- add keyboard mode support (like in enigma1)
authorFelix Domke <tmbinc@elitedvb.net>
Fri, 20 May 2005 19:34:23 +0000 (19:34 +0000)
committerFelix Domke <tmbinc@elitedvb.net>
Fri, 20 May 2005 19:34:23 +0000 (19:34 +0000)
lib/driver/rc.cpp
lib/driver/rc.h
lib/driver/rcconsole.cpp

index f1df549..ca0d62b 100644 (file)
@@ -177,6 +177,7 @@ eRCInput::eRCInput()
        instance=this;
        handle = -1;
        locked = 0;
+       keyboardMode = kmNone;
 }
 
 eRCInput::~eRCInput()
index 7b73596..1ce13c7 100644 (file)
@@ -166,6 +166,7 @@ class eRCInput: public Object
        int locked;     
        int handle;
        static eRCInput *instance;
+       int keyboardMode;
 
 public:
        struct lstr
@@ -190,6 +191,30 @@ public:
 
        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);
index 98ebed4..eae3a7a 100644 (file)
@@ -42,30 +42,30 @@ void eRCConsoleDriver::keyPressed(int)
        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;
@@ -75,7 +75,7 @@ void eRCConsoleDriver::keyPressed(int)
                        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);
@@ -104,7 +104,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