From: Seth Forshee Date: Thu, 24 Mar 2011 15:33:54 +0000 (+0100) Subject: keymap: continue reading keymap after invalid scancodes X-Git-Tag: 174~215 X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?p=elogind.git;a=commitdiff_plain;h=641842bce295ec17cca52d34cfaa6765e097bb18 keymap: continue reading keymap after invalid scancodes 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. --- diff --git a/extras/keymap/keymap.c b/extras/keymap/keymap.c index 719c30e60..eabd1e44d 100644 --- a/extras/keymap/keymap.c +++ b/extras/keymap/keymap.c @@ -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; }