ir-keytable: Be a little more pedantic with EVIOGKEYCODE
authorMauro Carvalho Chehab <mchehab@redhat.com>
Tue, 25 Jan 2011 14:07:53 +0000 (12:07 -0200)
committerMauro Carvalho Chehab <mchehab@redhat.com>
Tue, 25 Jan 2011 14:07:53 +0000 (12:07 -0200)
V1 always use u_int32_t. V2 can use different lengths, but,
currently, the tool is not ready for bigger code sizes.

Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
utils/keytable/keytable.c

index 92ad7ee355fac10d026381179432916ef3ee0244..e36a72be53d7ebed9f985b65e356682fc789e0dd 100644 (file)
@@ -45,7 +45,7 @@ struct input_keymap_entry_v2 {
 #endif
 
 struct keytable {
-       int codes[2];
+       u_int32_t codes[2];
        struct input_keymap_entry_v2 keymap;
        struct keytable *next;
 };
@@ -1126,7 +1126,7 @@ static int get_input_protocol_version(int fd)
 static void clear_table(int fd)
 {
        int i, j;
-       int codes[2];
+       u_int32_t codes[2];
        struct input_keymap_entry_v2 entry;
 
        /* Clears old table */
@@ -1280,6 +1280,7 @@ static void display_table_v2(struct rc_device *rc_dev, int fd)
        do {
                entry.flags = KEYMAP_BY_INDEX;
                entry.index = i;
+               entry.len = sizeof(u_int32_t);
 
                if (ioctl(fd, EVIOCGKEYCODE_V2, &entry) == -1)
                        break;