X-Git-Url: https://git.cweiske.de/enigma2.git/blobdiff_plain/22061f63b0ae2254d569b3c9f2d28f1add39ab1c..d706d603c012cfca54bd7cea6bfaa4473bcb1d33:/lib/driver/rcinput.cpp diff --git a/lib/driver/rcinput.cpp b/lib/driver/rcinput.cpp index 58cc9afc..107b337b 100644 --- a/lib/driver/rcinput.cpp +++ b/lib/driver/rcinput.cpp @@ -16,7 +16,46 @@ void eRCDeviceInputDev::handleCode(int rccode) struct input_event *ev = (struct input_event *)rccode; if (ev->type!=EV_KEY) return; - eDebug("%x %x %x", ev->value, ev->code, ev->type); + +// eDebug("%x %x %x", ev->value, ev->code, ev->type); + + if (ev->type!=EV_KEY) + return; + + int km = iskeyboard ? input->getKeyboardMode() : eRCInput::kmNone; + +// eDebug("keyboard mode %d", km); + + if (km == eRCInput::kmAll) + return; + + if (km == eRCInput::kmAscii) + { +// eDebug("filtering.. %d", ev->code); + bool filtered = ( ev->code > 0 && ev->code < 61 ); + switch (ev->code) + { + case KEY_RESERVED: + case KEY_ESC: + case KEY_TAB: + case KEY_BACKSPACE: + case KEY_ENTER: + case KEY_LEFTCTRL: + case KEY_RIGHTSHIFT: + case KEY_LEFTALT: + case KEY_CAPSLOCK: + case KEY_INSERT: + case KEY_DELETE: + case KEY_MUTE: + filtered=false; + default: + break; + } + if (filtered) + return; +// eDebug("passed!"); + } + switch (ev->value) { case 0: @@ -31,90 +70,28 @@ void eRCDeviceInputDev::handleCode(int rccode) } } -eRCDeviceInputDev::eRCDeviceInputDev(eRCInputEventDriver *driver): eRCDevice(driver->getDeviceName(), driver) +eRCDeviceInputDev::eRCDeviceInputDev(eRCInputEventDriver *driver) + :eRCDevice(driver->getDeviceName(), driver), iskeyboard(false) { -} - -const char *eRCDeviceInputDev::getDescription() const -{ - return id.c_str(); -} - -const char *eRCDeviceInputDev::getKeyDescription(const eRCKey &key) const -{ - switch (key.code) + int len=id.length(); + int idx=0; + while(idx <= len-8) { - case KEY_0: return "0"; - case KEY_1: return "1"; - case KEY_2: return "2"; - case KEY_3: return "3"; - case KEY_4: return "4"; - case KEY_5: return "5"; - case KEY_6: return "6"; - case KEY_7: return "7"; - case KEY_8: return "8"; - case KEY_9: return "9"; - case KEY_RIGHT: return "rechts"; - case KEY_LEFT: return "links"; - case KEY_UP: return "oben"; - case KEY_DOWN: return "unten"; - case KEY_OK: return "ok"; - case KEY_MUTE: return "mute"; - case KEY_POWER: return "power"; - case KEY_GREEN: return "gruen"; - case KEY_YELLOW: return "gelb"; - case KEY_RED: return "rot"; - case KEY_BLUE: return "blau"; - case KEY_VOLUMEUP: return "Lautstaerke plus"; - case KEY_VOLUMEDOWN: return "Lautstaerke minus"; - case KEY_HELP: return "?"; - case KEY_SETUP: return "d-Box"; -#if 0 - case KEY_TOPLEFT: return "oben links"; - case KEY_TOPRIGHT: return "oben rechts"; - case KEY_BOTTOMLEFT: return "unten links"; - case KEY_BOTTOMRIGHT: return "unten rechts"; -#endif - case KEY_HOME: return "home"; - default: return 0; + if (!strncasecmp(&id[idx++], "KEYBOARD", 8)) + { + iskeyboard=true; + break; + } } + eDebug("Input device \"%s\" is %sa keyboard.", id.c_str(), iskeyboard ? "" : "not "); + } -int eRCDeviceInputDev::getKeyCompatibleCode(const eRCKey &key) const +const char *eRCDeviceInputDev::getDescription() const { - switch (key.code) - { - case KEY_0: return eRCInput::RC_0; - case KEY_1: return eRCInput::RC_1; - case KEY_2: return eRCInput::RC_2; - case KEY_3: return eRCInput::RC_3; - case KEY_4: return eRCInput::RC_4; - case KEY_5: return eRCInput::RC_5; - case KEY_6: return eRCInput::RC_6; - case KEY_7: return eRCInput::RC_7; - case KEY_8: return eRCInput::RC_8; - case KEY_9: return eRCInput::RC_9; - case KEY_RIGHT: return eRCInput::RC_RIGHT; - case KEY_LEFT: return eRCInput::RC_LEFT; - case KEY_UP: return eRCInput::RC_UP; - case KEY_DOWN: return eRCInput::RC_DOWN; - case KEY_OK: return eRCInput::RC_OK; - case KEY_MUTE: return eRCInput::RC_MUTE; - case KEY_POWER: return eRCInput::RC_STANDBY; - case KEY_GREEN: return eRCInput::RC_GREEN; - case KEY_YELLOW: return eRCInput::RC_YELLOW; - case KEY_RED: return eRCInput::RC_RED; - case KEY_VOLUMEUP: return eRCInput::RC_PLUS; - case KEY_BLUE: return eRCInput::RC_BLUE; - case KEY_VOLUMEDOWN: return eRCInput::RC_MINUS; - case KEY_HELP: return eRCInput::RC_HELP; - case KEY_SETUP: return eRCInput::RC_DBOX; - case KEY_HOME: return eRCInput::RC_HOME; - } - return -1; + return id.c_str(); } - class eInputDeviceInit { ePtrList m_drivers;