From 123a1b75a8560f90cbdcb36c3ae4382fb529e69a Mon Sep 17 00:00:00 2001 From: Stefan Seyfried Date: Sun, 25 Mar 2012 20:42:26 +0200 Subject: [PATCH] triple: improve DFB->uinput routines * use kernel input device repeat instead of generating selfmade repeat events, this allows using input device rate settings * add frontpanel left/right buttons, their keycodes differ from the rc buttons --- libtriple/lt_dfbinput.cpp | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/libtriple/lt_dfbinput.cpp b/libtriple/lt_dfbinput.cpp index 252d14f..6000ff8 100644 --- a/libtriple/lt_dfbinput.cpp +++ b/libtriple/lt_dfbinput.cpp @@ -169,15 +169,8 @@ static void *input_thread(void *data) return NULL; } + memset(&u, 0, sizeof(u)); fcntl(uinput, F_SETFD, FD_CLOEXEC); - ioctl(uinput, UI_SET_EVBIT, EV_KEY); - /* do not use kernel repeat EV_REP since neutrino will be confused by the - * generated SYN_REPORT events... - ioctl(uinput, UI_SET_EVBIT, EV_REP); - */ - /* register keys */ - for (i = 0; key_list[i] != -1; i++) - ioctl(uinput, UI_SET_KEYBIT, key_list[i]); /* configure the device */ memset(&ud, 0, sizeof(ud)); @@ -187,6 +180,11 @@ static void *input_thread(void *data) ud.id.product = 0x5678; ud.id.bustype = BUS_I2C; /* ?? */ write(uinput, &ud, sizeof(ud)); + ioctl(uinput, UI_SET_EVBIT, EV_KEY); + ioctl(uinput, UI_SET_EVBIT, EV_REP); + /* register keys */ + for (i = 0; key_list[i] != -1; i++) + ioctl(uinput, UI_SET_KEYBIT, key_list[i]); if (ioctl(uinput, UI_DEV_CREATE)) { @@ -318,15 +316,17 @@ static void *input_thread(void *data) case 0xf057: u.code = KEY_EJECTCD; break; case 0xf056: u.code = KEY_RECORD; break; /* case 0xf05c: u.code = KEY_NEXT; break; */ + /* front panel left / right */ + case 0xf506: u.code = KEY_LEFT; break; + case 0xf507: u.code = KEY_RIGHT; break; default: continue; } switch (e.type) { - case 1: if (u.value < 2) /* 1 = key press */ - u.value++; /* 2 = key repeat */ - break; + case 1: u.value = 1; break; /* 1 = key press */ case 2: u.value = 0; break; /* 0 = key release */ + /* 2 = key repeat (not used) */ default: continue; }