int locked;
int handle;
static eRCInput *instance;
+ int keyboardMode;
public:
struct lstr
void setFile(int handle);
+ /* This is only relevant for "keyboard"-styled input devices,
+ i.e. not plain remote controls. It's up to the input device
+ driver to decide wheter an input device is a keyboard or
+ not.
+
+ kmNone will ignore all Ascii Characters sent from the
+ keyboard/console driver, only give normal keycodes to the
+ application.
+
+ kmAscii will filter out all keys which produce ascii characters,
+ and send them instead. Note that Modifiers like shift will still
+ be send. Control keys which produce escape codes are send using
+ normal keycodes.
+
+ kmAll will ignore all keycodes, and send everything as ascii,
+ including escape codes. Pretty much useless, since you should
+ lock the console and pass this as the console fd for making the
+ tc* stuff working.
+ */
+
+ enum { kmNone, kmAscii, kmAll };
+ void setKeyboardMode(int mode) { keyboardMode = mode; }
+ int getKeyboardMode() { return keyboardMode; }
+
void keyPressed(const eRCKey &key)
{
/*emit*/ keyEvent(key);
char *d = data;
int num = read(handle, data, 16);
int code;
-#if 0
+
int km = input->getKeyboardMode();
if (km == eRCInput::kmNone)
return;
-#endif
+
while (num--)
{
-#if 0
if (km == eRCInput::kmAll)
-#endif
code = *d++;
-#if 0
else
{
if (*d == 27) // escape code
{
- while (num)
+ /* skip all this stuff */
+ return;
+
+/* while (num)
{
num--;
if (*++d != '[')
break;
}
- code = -1;
+ code = -1; */
} else
code = *d;
++d;
if (code == 0x7F) /* delete */
code = -1;
}
-#endif
+
if (code != -1)
for (std::list<eRCDevice*>::iterator i(listeners.begin()); i!=listeners.end(); ++i)
(*i)->handleCode(code | 0x8000);
int eRCConsole::getKeyCompatibleCode(const eRCKey &key) const
{
- return key.code; // | KEY_ASCII;
+ return key.code;
}
class eRCConsoleInit