]> err.no Git - systemd/commitdiff
keymap: continue reading keymap after invalid scancodes
authorSeth Forshee <seth.forshee@canonical.com>
Thu, 24 Mar 2011 15:33:54 +0000 (16:33 +0100)
committerMartin Pitt <martin.pitt@ubuntu.com>
Thu, 24 Mar 2011 15:33:54 +0000 (16:33 +0100)
Reading of keymaps is aborted when EINVAL is returned from EVIOCGETKEYCODE.
Scan codes are not always continuous ranges of values starting at 0, so this
can result in not getting the full keymap for a device. Instead, continue
processing if EINVAL is returned.

extras/keymap/keymap.c

index 719c30e60085ad0886da1269d31db099d604616d..eabd1e44d823f768703cc74de0bb2a363b3c3280 100644 (file)
@@ -141,8 +141,9 @@ static int dump_table(int fd) {
                int keycode;
 
                if ((keycode = evdev_get_keycode(fd, scancode, 1)) < 0) {
-                       if (keycode != -2)
-                               r = -1;
+                       if (keycode == -2)
+                               continue;
+                       r = -1;
                        break;
                }