From: kos Date: Thu, 24 Nov 2011 03:53:50 +0000 (+0900) Subject: use rc-keyboard on ultimo X-Git-Url: http://code.vuplus.com/gitweb/?p=vuplus_dvbapp;a=commitdiff_plain;h=c14566d43a80034aa5001c1a1c1001ae9e6191b5 use rc-keyboard on ultimo --- diff --git a/configure.ac b/configure.ac index 01b21de..1b95bea 100644 --- a/configure.ac +++ b/configure.ac @@ -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]], diff --git a/lib/driver/rcconsole.cpp b/lib/driver/rcconsole.cpp index 77f4322..cdd93d4 100644 --- a/lib/driver/rcconsole.cpp +++ b/lib/driver/rcconsole.cpp @@ -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*/ } }; diff --git a/lib/driver/rcinput.cpp b/lib/driver/rcinput.cpp index f30ba8c..2659ddc 100644 --- a/lib/driver/rcinput.cpp +++ b/lib/driver/rcinput.cpp @@ -11,6 +11,32 @@ #include #include +#ifdef VUPLUS_USE_RCKBD +// / / / / / / +static char g_SmallAlphaMap[] = " -= qwertyuiop asdfghjkl;\' zxcvbnm,./"; +static char g_LargeAlphaMap[] = " !@# % &*()_+ QWERTYUIOP ASDFGHJKL:\" ZXCVBNM<>?"; + +#include +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: