diff --git a/src/driver/fade.cpp b/src/driver/fade.cpp index 3af188521..daefa3696 100644 --- a/src/driver/fade.cpp +++ b/src/driver/fade.cpp @@ -55,11 +55,7 @@ void COSDFader::StartFadeIn() fadeIn = true; fadeOut = false; fadeValue = 100; -#ifdef BOXMODEL_CS_HD2 - frameBuffer->setBlendMode(CNXTFB_BLEND_MODE_UNIFORM_ALPHA); // Global alpha multiplied with pixel alpha -#else frameBuffer->setBlendMode(2); // Global alpha multiplied with pixel alpha -#endif frameBuffer->setBlendLevel(fadeValue); #if HAVE_SPARK_HARDWARE || HAVE_DUCKBOX_HARDWARE || (HAVE_COOL_HARDWARE && defined(BOXMODEL_CS_HD2)) @@ -79,11 +75,7 @@ bool COSDFader::StartFadeOut() if ((!fadeOut) && g_settings.widget_fade) { fadeOut = true; fadeTimer = g_RCInput->addTimer( FADE_TIME, false ); -#ifdef BOXMODEL_CS_HD2 - frameBuffer->setBlendMode(CNXTFB_BLEND_MODE_UNIFORM_ALPHA); // Global alpha multiplied with pixel alpha -#else frameBuffer->setBlendMode(2); // Global alpha multiplied with pixel alpha -#endif ret = true; } return ret; @@ -93,11 +85,7 @@ void COSDFader::StopFade() { if ( fadeIn || fadeOut ) { g_RCInput->killTimer(fadeTimer); -#ifdef BOXMODEL_CS_HD2 - frameBuffer->setBlendMode(CNXTFB_BLEND_MODE_PER_PIXEL); // Global alpha multiplied with pixel alpha -#else frameBuffer->setBlendMode(1); // Global alpha multiplied with pixel alpha -#endif #if HAVE_SPARK_HARDWARE || HAVE_DUCKBOX_HARDWARE || (HAVE_COOL_HARDWARE && defined(BOXMODEL_CS_HD2)) usleep(60000); #endif @@ -124,11 +112,7 @@ bool COSDFader::FadeDone() fadeValue = max_alpha; g_RCInput->killTimer (fadeTimer); fadeIn = false; -#ifdef BOXMODEL_CS_HD2 - frameBuffer->setBlendMode(CNXTFB_BLEND_MODE_PER_PIXEL); // Global alpha multiplied with pixel alpha -#else frameBuffer->setBlendMode(1); // Global alpha multiplied with pixel alpha -#endif #if HAVE_SPARK_HARDWARE || HAVE_DUCKBOX_HARDWARE || (HAVE_COOL_HARDWARE && defined(BOXMODEL_CS_HD2)) usleep(60000); #endif diff --git a/src/driver/fb_accel_cs_hd2.cpp b/src/driver/fb_accel_cs_hd2.cpp index e66770c8f..8a6b42767 100644 --- a/src/driver/fb_accel_cs_hd2.cpp +++ b/src/driver/fb_accel_cs_hd2.cpp @@ -297,7 +297,10 @@ fb_pixel_t * CFbAccelCSHD2::getBackBufferPointer() const void CFbAccelCSHD2::setBlendMode(uint8_t mode) { - if (ioctl(fd, FBIO_SETBLENDMODE, mode)) + uint8_t arg = CNXTFB_BLEND_MODE_PER_PIXEL; + if (mode == 2) + arg = CNXTFB_BLEND_MODE_UNIFORM_ALPHA; + if (ioctl(fd, FBIO_SETBLENDMODE, arg)) printf("FBIO_SETBLENDMODE failed.\n"); } diff --git a/src/driver/rcinput.cpp b/src/driver/rcinput.cpp index 1678addeb..35c0a5542 100644 --- a/src/driver/rcinput.cpp +++ b/src/driver/rcinput.cpp @@ -174,49 +174,9 @@ bool CRCInput::checkdev() return true; /* need to check anyway... */ } -#ifdef BOXMODEL_CS_HD2 -bool CRCInput::checkdev_lnk(std::string lnk) -{ - static struct stat info; - if (lstat(lnk.c_str(), &info) != -1) { - if (S_ISLNK(info.st_mode)) { - std::string tmp = readLink(lnk); - if (!tmp.empty()) { - if (lstat(tmp.c_str(), &info) != -1) { - if (S_ISCHR(info.st_mode)) - return true; - } - } - } - } - return false; -} -#endif - bool CRCInput::checkpath(in_dev id) { for (std::vector::iterator it = indev.begin(); it != indev.end(); ++it) { -#ifdef BOXMODEL_CS_HD2 - if ((id.type == DT_LNK) || ((*it).type == DT_LNK)) { - std::string check1, check2; - if (id.type == DT_LNK) - check1 = readLink(id.path); - else - check1 = id.path; - - if ((*it).type == DT_LNK) - check2 = readLink((*it).path); - else - check2 = (*it).path; - - if ((!check1.empty()) && (!check2.empty()) && (check1 == check2)) { - printf("[rcinput:%s] skipping already opened %s => %s\n", __func__, id.path.c_str(), check1.c_str()); - return true; - } - else - return false; - } -#endif if ((*it).path == id.path) { printf("[rcinput:%s] skipping already opened %s\n", __func__, id.path.c_str()); return true; @@ -245,23 +205,24 @@ void CRCInput::open(bool recheck) while ((dentry = readdir(dir)) != NULL) { - if ((dentry->d_type != DT_CHR) -#ifdef BOXMODEL_CS_HD2 - && (dentry->d_type != DT_LNK) -#endif - ) { - d_printf("[rcinput:%s] skipping '%s'\n", __func__, dentry->d_name); - continue; - } -#ifdef BOXMODEL_CS_HD2 - if ((dentry->d_type == DT_LNK) && (!checkdev_lnk("/dev/input/" + std::string(dentry->d_name)))) { - d_printf("[rcinput:%s] skipping '%s'\n", __func__, dentry->d_name); - continue; - } - id.type = dentry->d_type; -#endif - d_printf("[rcinput:%s] considering '%s'\n", __func__, dentry->d_name); id.path = "/dev/input/" + std::string(dentry->d_name); + /* hack: on hd2, the device is called "/dev/cs_ir", + there are links in /dev/input: pointing to it nevis_ir and event0 (WTF???) + so if nevis_ir points to cs_ir, accept it, even though it is a symlink... + a better solution would be to simply mknod /dev/input/nevis_ir c 240 0, creating + a second instance of /dev/cs_ir named /dev/input/nevis_ir (or to fix the driver + to actually create a real event0 device via udev) + Note: i'm deliberately not using event0, because this might be replaced by a "real" + event0 device if e.g. an USB keyboard is plugged in*/ + if (dentry->d_type == DT_LNK && + id.path == "/dev/input/nevis_ir") { + if (readLink(id.path) != "/dev/cs_ir") + continue; + } else if (dentry->d_type != DT_CHR) { + d_printf("[rcinput:%s] skipping '%s'\n", __func__, dentry->d_name); + continue; + } + d_printf("[rcinput:%s] considering '%s'\n", __func__, dentry->d_name); if (checkpath(id)) continue; id.fd = ::open(id.path.c_str(), O_RDWR|O_NONBLOCK|O_CLOEXEC); @@ -1382,7 +1343,7 @@ void CRCInput::getMsg_us(neutrino_msg_t * msg, neutrino_msg_data_t * data, uint6 } uint32_t trkey = translate(ev.code); - d_printf("key: %04x value %d, translate: %04x -%s-\n", ev.code, ev.value, trkey, getKeyName(trkey).c_str()); + printf("key: %04x value %d, translate: %04x -%s-\n", ev.code, ev.value, trkey, getKeyName(trkey).c_str()); if (trkey == RC_nokey) continue; @@ -1815,11 +1776,7 @@ void CRCInput::set_rc_hw(ir_protocol_t ir_protocol, unsigned int ir_address) } int fd = -1; for (std::vector::iterator it = indev.begin(); it != indev.end(); ++it) { - if (((*it).path == "/dev/input/nevis_ir") -#ifdef BOXMODEL_CS_HD2 - || ((*it).path == "/dev/input/input0") -#endif - ){ + if ((*it).path == "/dev/input/nevis_ir") { fd = (*it).fd; break; } diff --git a/src/driver/rcinput.h b/src/driver/rcinput.h index 450dd4dd7..d2c29e50f 100644 --- a/src/driver/rcinput.h +++ b/src/driver/rcinput.h @@ -145,9 +145,6 @@ class CRCInput { int fd; std::string path; -#ifdef BOXMODEL_CS_HD2 - int type; -#endif }; uint32_t timerid; @@ -170,9 +167,6 @@ class CRCInput void open(bool recheck = false); bool checkpath(in_dev id); bool checkdev(); -#ifdef BOXMODEL_CS_HD2 - bool checkdev_lnk(std::string lnk); -#endif void close(); int translate(int code); void calculateMaxFd(void); diff --git a/src/gui/keybind_setup.cpp b/src/gui/keybind_setup.cpp index 1e835cc30..bd6af76e7 100644 --- a/src/gui/keybind_setup.cpp +++ b/src/gui/keybind_setup.cpp @@ -305,7 +305,7 @@ int CKeybindSetup::showKeySetup() #endif cc = new CMenuOptionNumberChooser(LOCALE_KEYBINDINGMENU_REPEATBLOCK, - &g_settings.repeat_blocker, true, 0, 999, NULL, + &g_settings.repeat_blocker, true, 0, 999, this, CRCInput::convertDigitToKey(shortcut++), NULL, 0, 0, LOCALE_OPTIONS_OFF); cc->setNumberFormat(ms_number_format); cc->setNumericInput(true); @@ -313,7 +313,7 @@ int CKeybindSetup::showKeySetup() keySettings->addItem(cc); cc = new CMenuOptionNumberChooser(LOCALE_KEYBINDINGMENU_REPEATBLOCKGENERIC, - &g_settings.repeat_genericblocker, true, 0, 999, NULL, + &g_settings.repeat_genericblocker, true, 0, 999, this, CRCInput::convertDigitToKey(shortcut++), NULL, 0, 0, LOCALE_OPTIONS_OFF); cc->setNumberFormat(ms_number_format); cc->setNumericInput(true); diff --git a/src/neutrino.cpp b/src/neutrino.cpp index a051e97b0..1b28470df 100644 --- a/src/neutrino.cpp +++ b/src/neutrino.cpp @@ -3608,7 +3608,7 @@ int CNeutrinoApp::handleMsg(const neutrino_msg_t _msg, neutrino_msg_data_t data) return messages_return::handled; } if ((msg >= CRCInput::RC_WithData) && (msg < CRCInput::RC_WithData + 0x10000000)) { - INFO("###################################### DELETED msg %x data %x\n", msg, data); + INFO("###################################### DELETED msg %lX data %lX\n", msg, data); delete [] (unsigned char*) data; return messages_return::handled; } diff --git a/src/nhttpd/tuxboxapi/controlapi.cpp b/src/nhttpd/tuxboxapi/controlapi.cpp index a228f09b9..49f9bee1f 100644 --- a/src/nhttpd/tuxboxapi/controlapi.cpp +++ b/src/nhttpd/tuxboxapi/controlapi.cpp @@ -882,8 +882,8 @@ void CControlAPI::RCEmCGI(CyhookHandler *hh) #endif int evd = open(EVENTDEV, O_RDWR); if (evd < 0) { + perror("opening " EVENTDEV " failed"); hh->SendError(); - perror("opening event0 failed"); return; } if (rc_send(evd, sendcode, KEY_PRESSED) < 0) { @@ -894,8 +894,8 @@ void CControlAPI::RCEmCGI(CyhookHandler *hh) } if (rc_send(evd, sendcode, KEY_RELEASED) < 0) { perror("writing 'KEY_RELEASED' event failed"); - close(evd); hh->SendError(); + close(evd); return; } close(evd); diff --git a/src/rcsim.c b/src/rcsim.c index 2ae56a39c..ccfdb6c59 100644 --- a/src/rcsim.c +++ b/src/rcsim.c @@ -219,7 +219,7 @@ int main (int argc, char **argv){ #if defined (EVENTDEV) evd=open (EVENTDEV,O_RDWR); if (evd<0){ - perror ("opening event0 failed"); + perror ("opening " EVENTDEV " failed"); return 1; } #else