use rc-keyboard on ultimo
authorkos <kos@dev3>
Thu, 24 Nov 2011 03:53:50 +0000 (12:53 +0900)
committerkos <kos@dev3>
Thu, 24 Nov 2011 03:53:50 +0000 (12:53 +0900)
configure.ac
lib/driver/rcconsole.cpp
lib/driver/rcinput.cpp

index 01b21de..1b95bea 100644 (file)
@@ -46,6 +46,15 @@ AC_CHECK_LIB([xmlccwrap], [exit], [LIBXMLCCWRAP_LIBS="-lxmlccwrap"], [AC_MSG_ERR
 AC_SUBST(LIBXMLCCWRAP_LIBS)
 AC_LANG_POP
 
+AC_ARG_WITH(remote-keyboard,
+        AC_HELP_STRING([--with-remote-keyboard], [use remote keyboard on dvbapp, yes or no]),
+        [[withrckbd=$withval]],
+        [[withrckbd=no]]
+)
+if test x"$withrckbd" != xno ; then
+        AC_DEFINE(VUPLUS_USE_RCKBD, 1,[Define when using a rc-keyboard on dvbapp])
+fi
+
 AC_ARG_WITH(set-right-half-vfd-skin,
         AC_HELP_STRING([--with-set-right-half-vfd-skin], [display right_half_vfd_icons from skin(for ultimo), yes or no]),
         [[setrighthalfvfdskin=$withval]],
index 77f4322..cdd93d4 100644 (file)
@@ -98,6 +98,10 @@ int eRCConsole::getKeyCompatibleCode(const eRCKey &key) const
        return key.code;
 }
 
+#ifdef VUPLUS_USE_RCKBD        
+eRCConsole* g_ConsoleDevice;
+#endif /*VUPLUS_USE_RCKBD*/
+
 class eRCConsoleInit
 {
        eRCConsoleDriver driver;
@@ -105,6 +109,9 @@ class eRCConsoleInit
 public:
        eRCConsoleInit(): driver("/dev/tty0"), device(&driver)
        {
+#ifdef VUPLUS_USE_RCKBD        
+               g_ConsoleDevice = &device;
+#endif /*VUPLUS_USE_RCKBD*/
        }
 };
 
index f30ba8c..2659ddc 100644 (file)
 #include <lib/base/init_num.h>
 #include <lib/driver/input_fake.h>
 
+#ifdef VUPLUS_USE_RCKBD        
+//                                /         /         /         /          /         /
+static char g_SmallAlphaMap[] = "            -=  qwertyuiop    asdfghjkl;\'   zxcvbnm,./";
+static char g_LargeAlphaMap[] = "  !@# % &*()_+  QWERTYUIOP    ASDFGHJKL:\"   ZXCVBNM<>?";
+
+#include <lib/driver/rcconsole.h>
+extern eRCConsole* g_ConsoleDevice;
+static char* g_pMap = g_SmallAlphaMap;
+inline char getAsciiCode(unsigned int code)
+{
+       switch(code)
+       {
+       case 57: return ' ';
+       case 43: return '\\';
+       }
+       
+       if(code<54)
+       {
+               if(g_pMap[code] == ' ')
+                       return 0;
+               return g_pMap[code];
+       }
+       return 0;
+}
+#endif /*VUPLUS_USE_RCKBD*/
+
 void eRCDeviceInputDev::handleCode(long rccode)
 {
        struct input_event *ev = (struct input_event *)rccode;
@@ -56,6 +82,30 @@ void eRCDeviceInputDev::handleCode(long rccode)
 //             eDebug("passed!");
        }
 
+#ifdef VUPLUS_USE_RCKBD
+       if(g_ConsoleDevice)
+       {
+               char code = getAsciiCode(ev->code);
+               //eDebug("getAsciiCode : [%d] [%c]", code, code);
+               switch(ev->value)
+               {
+               case 0:
+                       if(ev->code == 42) { g_pMap = g_SmallAlphaMap; return; }
+                       if(code) return;
+               case 1:
+                       {
+                               if(ev->code == 42) { g_pMap = g_LargeAlphaMap; return; }
+                               if(code)
+                               {
+                                       g_ConsoleDevice->handleCode(code);
+                                       return;
+                               }
+                       }
+                       break;
+               }
+       }
+#endif /*VUPLUS_USE_RCKBD*/
+
        switch (ev->value)
        {
        case 0: