summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Pitt <martinpitt@gnome.org>2012-10-19 08:03:09 +0200
committerMartin Pitt <martinpitt@gnome.org>2012-10-19 08:05:58 +0200
commitaccfdb7abfe0dad7c8e7e5364d93ad962895acfc (patch)
treed3584ac4848cbda8f9a13ce6271b5ef1a9d80b89
parent3bb9434b69b8562117b8ec34b4498aa208907316 (diff)
keymap: Tolerate invalid entries in keymaps
Some keymaps apply to a large range of computer models, not all of which have all of the scan codes in the maps. If a single scan code is invalid, do not abort but continue with the next entry in the map. Instead just show the error message for that particular scan code, to help with debugging.
-rw-r--r--src/udev/keymap/keymap.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/udev/keymap/keymap.c b/src/udev/keymap/keymap.c
index a6f97ddcef..0db56d26ad 100644
--- a/src/udev/keymap/keymap.c
+++ b/src/udev/keymap/keymap.c
@@ -71,7 +71,7 @@ static int evdev_get_keycode(int fd, unsigned scancode, int e)
if (e && errno == EINVAL) {
return -2;
} else {
- fprintf(stderr, "EVIOCGKEYCODE: %m\n");
+ fprintf(stderr, "EVIOCGKEYCODE for scan code 0x%x: %m\n", scancode);
return -1;
}
}
@@ -226,19 +226,19 @@ static int merge_table(int fd, FILE *f) {
if ((old_keycode = evdev_get_keycode(fd, scancode, 0)) < 0) {
r = -1;
- goto fail;
+ continue;
}
if (evdev_set_keycode(fd, scancode, new_keycode) < 0) {
r = -1;
- goto fail;
+ continue;
}
if (new_keycode != old_keycode)
fprintf(stderr, "Remapped scancode 0x%02x to 0x%02x (prior: 0x%02x)\n",
scancode, new_keycode, old_keycode);
}
-fail:
+
fclose(f);
return r;
}