From 056b47c09b8794bbca1f00d62dc25d33808ade26 Mon Sep 17 00:00:00 2001 From: svenhoefer Date: Wed, 22 Feb 2017 14:53:25 +0100 Subject: [PATCH 01/10] - rc_input: do always show key-presses in console; ... by mistake removed in 1eec78ccfd7d672ef2cc814ee8ff245696fe3a78 --- src/driver/rcinput.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/driver/rcinput.cpp b/src/driver/rcinput.cpp index 1678addeb..8357f2355 100644 --- a/src/driver/rcinput.cpp +++ b/src/driver/rcinput.cpp @@ -1382,7 +1382,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; From 7c2e25103f77d9480a2501612c498e7e8466be0d Mon Sep 17 00:00:00 2001 From: svenhoefer Date: Wed, 22 Feb 2017 15:25:04 +0100 Subject: [PATCH 02/10] - controlapi: fix perror message --- src/nhttpd/tuxboxapi/controlapi.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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); From f0f7aec577044d9c8ac02c58ffe3a03ff666b2e9 Mon Sep 17 00:00:00 2001 From: svenhoefer Date: Wed, 22 Feb 2017 15:25:04 +0100 Subject: [PATCH 03/10] - rcsim: fix perror message --- src/rcsim.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 From c4aaf7678cf6a02c24524f71fba7663602466f07 Mon Sep 17 00:00:00 2001 From: svenhoefer Date: Thu, 23 Feb 2017 12:13:49 +0100 Subject: [PATCH 04/10] - neutrino.cpp: fix compiler warning; ... msg and data is type long unsigned int, so %lu seems the right format, but above %lX is used too and it works fine. So, what's the right one? --- src/neutrino.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/neutrino.cpp b/src/neutrino.cpp index 1844b0276..57a0ca62c 100644 --- a/src/neutrino.cpp +++ b/src/neutrino.cpp @@ -3520,7 +3520,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; } From ee9138f065391914dddf158ca9676fb9d87b9667 Mon Sep 17 00:00:00 2001 From: Stefan Seyfried Date: Wed, 22 Feb 2017 08:45:37 +0100 Subject: [PATCH 05/10] Revert "rcinput: Add exception handling for cs hd2" This reverts commit 1b79faff780befa63a04be86560e7183d7a663aa. Wrong in so many ways :-) - The code worked perfectly. But ok, it's easier possible. ;) Signed-off-by: M. Liebmann --- src/driver/rcinput.cpp | 53 +----------------------------------------- src/driver/rcinput.h | 6 ----- 2 files changed, 1 insertion(+), 58 deletions(-) diff --git a/src/driver/rcinput.cpp b/src/driver/rcinput.cpp index 8357f2355..ddba969d2 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,21 +205,10 @@ 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 - ) { + if (dentry->d_type != DT_CHR) { 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); if (checkpath(id)) 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); From f0ab22d8b0144260d34160347392472550044e9f Mon Sep 17 00:00:00 2001 From: Stefan Seyfried Date: Wed, 22 Feb 2017 08:46:05 +0100 Subject: [PATCH 06/10] Revert "CRCInput::set_rc_hw: Fix device check for cs hd2" This reverts commit 5cac45ccb837955bd03b9b2cc41e415c983139d7. --- src/driver/rcinput.cpp | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/src/driver/rcinput.cpp b/src/driver/rcinput.cpp index ddba969d2..76090ef0e 100644 --- a/src/driver/rcinput.cpp +++ b/src/driver/rcinput.cpp @@ -1764,11 +1764,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; } From d02b29650e376c3de136e65ecf76bda290f00092 Mon Sep 17 00:00:00 2001 From: Stefan Seyfried Date: Wed, 22 Feb 2017 11:43:37 +0100 Subject: [PATCH 07/10] rcinput: add less ugly hack for crappy hd2 driver --- src/driver/rcinput.cpp | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/src/driver/rcinput.cpp b/src/driver/rcinput.cpp index 76090ef0e..f54f7bcaf 100644 --- a/src/driver/rcinput.cpp +++ b/src/driver/rcinput.cpp @@ -205,12 +205,23 @@ void CRCInput::open(bool recheck) while ((dentry = readdir(dir)) != NULL) { - if (dentry->d_type != DT_CHR) { + 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... + the rest of the code then uses coolstream specific parts if path == "nevis_ir" + a better solution would be to simply mknod /dev/input/nevis_ir c 240 0, creating + a second instance of /dev/cs_ir named /dv/input/nevis_ir (or to fix the driver + to actually create a real input device */ + 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); - id.path = "/dev/input/" + std::string(dentry->d_name); if (checkpath(id)) continue; id.fd = ::open(id.path.c_str(), O_RDWR|O_NONBLOCK|O_CLOEXEC); From 25165a1eaf106e5d5f74b5645ca33b42c1cda527 Mon Sep 17 00:00:00 2001 From: Stefan Seyfried Date: Wed, 22 Feb 2017 20:29:51 +0100 Subject: [PATCH 08/10] rcinput: clarify comment regarding hd2 device --- src/driver/rcinput.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/driver/rcinput.cpp b/src/driver/rcinput.cpp index f54f7bcaf..35c0a5542 100644 --- a/src/driver/rcinput.cpp +++ b/src/driver/rcinput.cpp @@ -209,10 +209,11 @@ void CRCInput::open(bool recheck) /* 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... - the rest of the code then uses coolstream specific parts if path == "nevis_ir" a better solution would be to simply mknod /dev/input/nevis_ir c 240 0, creating - a second instance of /dev/cs_ir named /dv/input/nevis_ir (or to fix the driver - to actually create a real input device */ + 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") From 41e420d35dfbadd53d6f3571536820ac3e79b989 Mon Sep 17 00:00:00 2001 From: Stefan Seyfried Date: Wed, 22 Feb 2017 21:23:11 +0100 Subject: [PATCH 09/10] fb_accel: move hd2 specific parts from fader to fb_accel --- src/driver/fade.cpp | 16 ---------------- src/driver/fb_accel_cs_hd2.cpp | 5 ++++- 2 files changed, 4 insertions(+), 17 deletions(-) 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 b801a37ff..ce20ce051 100644 --- a/src/driver/fb_accel_cs_hd2.cpp +++ b/src/driver/fb_accel_cs_hd2.cpp @@ -241,7 +241,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"); } From 6b8a7eb5f32f7249a260ee368b8afe1727bd9c2d Mon Sep 17 00:00:00 2001 From: "M. Liebmann" Date: Thu, 23 Feb 2017 08:54:01 +0100 Subject: [PATCH 10/10] CKeybindSetup: Fix changeNotify call for change repeat_block... --- src/gui/keybind_setup.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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);