summaryrefslogtreecommitdiff
path: root/remote.c
diff options
context:
space:
mode:
authorKlaus Schmidinger <vdr@tvdr.de>2002-12-15 10:58:00 +0100
committerKlaus Schmidinger <vdr@tvdr.de>2002-12-15 10:58:00 +0100
commitb90e708733789290c633e620f24bd6eb08dd0c2d (patch)
tree31c8fcab50cb1b54ff51c2220aa29adee5db5a34 /remote.c
parent0f01d921066d81d0c6a4ddaa521048566cc28c80 (diff)
downloadvdr-b90e708733789290c633e620f24bd6eb08dd0c2d.tar.gz
vdr-b90e708733789290c633e620f24bd6eb08dd0c2d.tar.bz2
Implemented raw keyboard input
Diffstat (limited to 'remote.c')
-rw-r--r--remote.c67
1 files changed, 64 insertions, 3 deletions
diff --git a/remote.c b/remote.c
index d4f1702b..da28f389 100644
--- a/remote.c
+++ b/remote.c
@@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
- * $Id: remote.c 1.34 2002/12/08 13:37:13 kls Exp $
+ * $Id: remote.c 1.35 2002/12/15 10:09:27 kls Exp $
*/
#include "remote.h"
@@ -149,6 +149,39 @@ cRemotes Remotes;
// --- cKbdRemote ------------------------------------------------------------
+struct tKbdMap {
+ eKbdFunc func;
+ uint64 code;
+ };
+
+static tKbdMap KbdMap[] = {
+ { kfF1, 0x0000001B5B31317EULL },
+ { kfF2, 0x0000001B5B31327EULL },
+ { kfF3, 0x0000001B5B31337EULL },
+ { kfF4, 0x0000001B5B31347EULL },
+ { kfF5, 0x0000001B5B31357EULL },
+ { kfF6, 0x0000001B5B31377EULL },
+ { kfF7, 0x0000001B5B31387EULL },
+ { kfF8, 0x0000001B5B31397EULL },
+ { kfF9, 0x0000001B5B32307EULL },
+ { kfF10, 0x0000001B5B32317EULL },
+ { kfF11, 0x0000001B5B32327EULL },
+ { kfF12, 0x0000001B5B32337EULL },
+ { kfUp, 0x00000000001B5B41ULL },
+ { kfDown, 0x00000000001B5B42ULL },
+ { kfLeft, 0x00000000001B5B44ULL },
+ { kfRight, 0x00000000001B5B43ULL },
+ { kfHome, 0x00000000001B5B48ULL },
+ { kfEnd, 0x00000000001B5B46ULL },
+ { kfPgUp, 0x000000001B5B357EULL },
+ { kfPgDown, 0x000000001B5B367EULL },
+ { kfIns, 0x000000001B5B327EULL },
+ { kfDel, 0x000000001B5B337EULL },
+ { kfNone, 0x0000000000000000ULL }
+ };
+
+bool cKbdRemote::rawMode = false;
+
cKbdRemote::cKbdRemote(void)
:cRemote("KBD")
{
@@ -172,6 +205,29 @@ cKbdRemote::~cKbdRemote()
tcsetattr(STDIN_FILENO, TCSANOW, &savedTm);
}
+void cKbdRemote::SetRawMode(bool RawMode)
+{
+ rawMode = RawMode;
+}
+
+uint64 cKbdRemote::MapFuncToCode(int Func)
+{
+ for (tKbdMap *p = KbdMap; p->func != kfNone; p++) {
+ if (p->func == Func)
+ return p->code;
+ }
+ return (Func <= 0xFF) ? Func : 0;
+}
+
+int cKbdRemote::MapCodeToFunc(uint64 Code)
+{
+ for (tKbdMap *p = KbdMap; p->func != kfNone; p++) {
+ if (p->code == Code)
+ return p->func;
+ }
+ return (Code <= 0xFF) ? Code : kfNone;
+}
+
void cKbdRemote::Action(void)
{
dsyslog("KBD remote control thread started (pid=%d)", getpid());
@@ -198,8 +254,13 @@ void cKbdRemote::Action(void)
// key (if somebody knows how to clean this up, please let me know):
if (Command == 0x1B && time_ms() - t0 < 100)
continue;
- if (Command)
- Put(Command);
+ if (Command) {
+ if (rawMode || !Put(Command)) {
+ int func = MapCodeToFunc(Command);
+ if (func)
+ Put(KBDKEY(func));
+ }
+ }
break;
}
else {