Commit 54e74b87 authored by Dmitry Torokhov's avatar Dmitry Torokhov Committed by Linus Torvalds

Input: rc-keymap - return KEY_RESERVED for unknown mappings

Do not respond with -EINVAL to EVIOCGKEYCODE for not-yet-mapped
scancodes, but rather return KEY_RESERVED.

This fixes breakage with Ubuntu's input-kbd utility that stopped
returning full keymaps for remote controls.
Tested-by: default avatarMauro Carvalho Chehab <mchehab@redhat.com>
Tested-by: default avatarMark Lord <kernel@teksavvy.com>
Signed-off-by: default avatarDmitry Torokhov <dtor@mail.ru>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 1ca05b7f
...@@ -458,14 +458,7 @@ static int ir_getkeycode(struct input_dev *idev, ...@@ -458,14 +458,7 @@ static int ir_getkeycode(struct input_dev *idev,
index = ir_lookup_by_scancode(rc_map, scancode); index = ir_lookup_by_scancode(rc_map, scancode);
} }
if (index >= rc_map->len) { if (index < rc_map->len) {
if (!(ke->flags & INPUT_KEYMAP_BY_INDEX))
IR_dprintk(1, "unknown key for scancode 0x%04x\n",
scancode);
retval = -EINVAL;
goto out;
}
entry = &rc_map->scan[index]; entry = &rc_map->scan[index];
ke->index = index; ke->index = index;
...@@ -473,6 +466,19 @@ static int ir_getkeycode(struct input_dev *idev, ...@@ -473,6 +466,19 @@ static int ir_getkeycode(struct input_dev *idev,
ke->len = sizeof(entry->scancode); ke->len = sizeof(entry->scancode);
memcpy(ke->scancode, &entry->scancode, sizeof(entry->scancode)); memcpy(ke->scancode, &entry->scancode, sizeof(entry->scancode));
} else if (!(ke->flags & INPUT_KEYMAP_BY_INDEX)) {
/*
* We do not really know the valid range of scancodes
* so let's respond with KEY_RESERVED to anything we
* do not have mapping for [yet].
*/
ke->index = index;
ke->keycode = KEY_RESERVED;
} else {
retval = -EINVAL;
goto out;
}
retval = 0; retval = 0;
out: out:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment