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


Origin commit data
------------------
Branch: master
Commit: 123a1b75a8
Author: Stefan Seyfried <seife@tuxbox-git.slipkontur.de>
Date: 2012-03-25 (Sun, 25 Mar 2012)

Origin message was:
------------------
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


------------------
This commit was generated by Migit
This commit is contained in:
Stefan Seyfried
2012-03-25 20:42:26 +02:00
parent 31f614941e
commit f10ae4e7b0

View File

@@ -169,15 +169,8 @@ static void *input_thread(void *data)
return NULL; return NULL;
} }
memset(&u, 0, sizeof(u));
fcntl(uinput, F_SETFD, FD_CLOEXEC); 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 */ /* configure the device */
memset(&ud, 0, sizeof(ud)); memset(&ud, 0, sizeof(ud));
@@ -187,6 +180,11 @@ static void *input_thread(void *data)
ud.id.product = 0x5678; ud.id.product = 0x5678;
ud.id.bustype = BUS_I2C; /* ?? */ ud.id.bustype = BUS_I2C; /* ?? */
write(uinput, &ud, sizeof(ud)); 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)) if (ioctl(uinput, UI_DEV_CREATE))
{ {
@@ -318,15 +316,17 @@ static void *input_thread(void *data)
case 0xf057: u.code = KEY_EJECTCD; break; case 0xf057: u.code = KEY_EJECTCD; break;
case 0xf056: u.code = KEY_RECORD; break; case 0xf056: u.code = KEY_RECORD; break;
/* case 0xf05c: u.code = KEY_NEXT; 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: default:
continue; continue;
} }
switch (e.type) switch (e.type)
{ {
case 1: if (u.value < 2) /* 1 = key press */ case 1: u.value = 1; break; /* 1 = key press */
u.value++; /* 2 = key repeat */
break;
case 2: u.value = 0; break; /* 0 = key release */ case 2: u.value = 0; break; /* 0 = key release */
/* 2 = key repeat (not used) */
default: default:
continue; continue;
} }