Files
Arch-R/packages/sysutils/remote/lirc/patches/lirc-0.8.7-uinput_key_fix.diff
Stephan Raue 2283017c2c lirc: remove unneeded patches, cleanup
Signed-off-by: Stephan Raue <stephan@openelec.tv>
2010-10-23 07:21:24 +02:00

70 lines
1.9 KiB
Diff

diff -Naur lirc-0.8.7-old/daemons/input_map.c lirc-0.8.7-new/daemons/input_map.c
--- lirc-0.8.7-old/daemons/input_map.c 2008-10-26 08:10:17.000000000 -0700
+++ lirc-0.8.7-new/daemons/input_map.c 2010-09-07 16:19:12.000000000 -0700
@@ -25,6 +25,21 @@
{NULL, 0}
};
+int get_input_code_by_index(int index, linux_input_code *code)
+{
+ int i;
+
+ for (i=0; input_map[i].name != NULL; i++)
+ {
+ if (i == index)
+ {
+ *code = input_map[i].code;
+ return i;
+ }
+ }
+ return -1;
+}
+
int get_input_code(const char *name, linux_input_code *code)
{
int i;
diff -Naur lirc-0.8.7-old/daemons/input_map.h lirc-0.8.7-new/daemons/input_map.h
--- lirc-0.8.7-old/daemons/input_map.h 2008-10-26 08:10:17.000000000 -0700
+++ lirc-0.8.7-new/daemons/input_map.h 2010-09-07 16:19:12.000000000 -0700
@@ -28,6 +28,7 @@
typedef unsigned short linux_input_code;
#endif
+int get_input_code_by_index(int index, linux_input_code *code);
int get_input_code(const char *name, linux_input_code *code);
void fprint_namespace(FILE *f);
int is_in_namespace(const char *name);
diff -Naur lirc-0.8.7-old/daemons/lircd.c lirc-0.8.7-new/daemons/lircd.c
--- lirc-0.8.7-old/daemons/lircd.c 2010-08-26 22:08:09.000000000 -0700
+++ lirc-0.8.7-new/daemons/lircd.c 2010-09-07 16:19:12.000000000 -0700
@@ -422,6 +422,8 @@
#if defined(__linux__)
int fd;
int key;
+ linux_input_code code;
+ int i;
struct uinput_user_dev dev;
fd = open("/dev/input/uinput", O_RDWR);
@@ -450,12 +452,16 @@
goto setup_error;
}
- for(key = KEY_RESERVED; key <= KEY_UNKNOWN; key++)
+ for(i = 0; get_input_code_by_index(i, &code) >= 0; i++)
{
- if(ioctl(fd, UI_SET_KEYBIT, key) != 0)
+ key = (int)code;
+ if ((key < BTN_MISC) || (key > BTN_GEAR_UP))
{
- goto setup_error;
- }
+ if(ioctl(fd, UI_SET_KEYBIT, key) != 0)
+ {
+ goto setup_error;
+ }
+ }
}
if(ioctl(fd, UI_DEV_CREATE) != 0)