X-Git-Url: https://git.cweiske.de/enigma2.git/blobdiff_plain/54bd4123728628a6f77bad2584b70d1353a91666..8659b61d462dd64b6278f2d6470832f46821cfd5:/lib/driver/rcconsole.cpp diff --git a/lib/driver/rcconsole.cpp b/lib/driver/rcconsole.cpp index f662b2b1..bcce5601 100644 --- a/lib/driver/rcconsole.cpp +++ b/lib/driver/rcconsole.cpp @@ -14,7 +14,7 @@ eRCConsoleDriver::eRCConsoleDriver(const char *filename): eRCDriver(eRCInput::ge sn=0; } else { - sn=new eSocketNotifier(eApp, handle, eSocketNotifier::Read); + sn=eSocketNotifier::create(eApp, handle, eSocketNotifier::Read); CONNECT(sn->activated, eRCConsoleDriver::keyPressed); eRCInput::getInstance()->setFile(handle); } @@ -32,29 +32,25 @@ eRCConsoleDriver::~eRCConsoleDriver() tcsetattr(handle,TCSANOW, &ot); if (handle>=0) close(handle); - if (sn) - delete sn; } void eRCConsoleDriver::keyPressed(int) { - char data[16]; - char *d = data; + unsigned char data[16]; + unsigned char *d = data; int num = read(handle, data, 16); - int code; -#if 0 + int code=-1; + int km = input->getKeyboardMode(); if (km == eRCInput::kmNone) return; -#endif + while (num--) { -#if 0 +// eDebug("console code %08x\n", *d); if (km == eRCInput::kmAll) -#endif code = *d++; -#if 0 else { if (*d == 27) // escape code @@ -69,22 +65,31 @@ void eRCConsoleDriver::keyPressed(int) } else code = *d; ++d; - + if (code < 32) /* control characters */ code = -1; - if (code == 0x7F) /* delete */ - code = -1; + else switch(code) + { + case 0x7E: // mute, einfg, entf + case 0x7F: // backspace + code = -1; + default: + break; + } } -#endif + if (code != -1) for (std::list::iterator i(listeners.begin()); i!=listeners.end(); ++i) + { +// eDebug("ascii %08x", code); (*i)->handleCode(code); + } } } -void eRCConsole::handleCode(int code) +void eRCConsole::handleCode(long code) { - input->keyPressed(eRCKey(this, code, 0)); + input->keyPressed(eRCKey(this, code, eRCKey::flagAscii)); } eRCConsole::eRCConsole(eRCDriver *driver) @@ -104,7 +109,7 @@ const char *eRCConsole::getKeyDescription(const eRCKey &key) const int eRCConsole::getKeyCompatibleCode(const eRCKey &key) const { - return key.code; // | KEY_ASCII; + return key.code; } class eRCConsoleInit