Input: rc-keymap - return KEY_RESERVED for unknown mappings
commit 54e74b87e2a9941c6fa82189f270b47cceeba714 upstream. 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: Mauro Carvalho Chehab <mchehab@redhat.com> Tested-by: Mark Lord <kernel@teksavvy.com> Signed-off-by: Dmitry Torokhov <dtor@mail.ru> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
This commit is contained in:
parent
c0b18d3b95
commit
82e7d9f7c8
@ -374,21 +374,27 @@ static int ir_getkeycode(struct input_dev *dev,
|
||||
index = ir_lookup_by_scancode(rc_tab, scancode);
|
||||
}
|
||||
|
||||
if (index >= rc_tab->len) {
|
||||
if (!(ke->flags & INPUT_KEYMAP_BY_INDEX))
|
||||
IR_dprintk(1, "unknown key for scancode 0x%04x\n",
|
||||
scancode);
|
||||
if (index < rc_tab->len) {
|
||||
entry = &rc_tab->scan[index];
|
||||
|
||||
ke->index = index;
|
||||
ke->keycode = entry->keycode;
|
||||
ke->len = 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;
|
||||
}
|
||||
|
||||
entry = &rc_tab->scan[index];
|
||||
|
||||
ke->index = index;
|
||||
ke->keycode = entry->keycode;
|
||||
ke->len = sizeof(entry->scancode);
|
||||
memcpy(ke->scancode, &entry->scancode, sizeof(entry->scancode));
|
||||
|
||||
retval = 0;
|
||||
|
||||
out:
|
||||
|
Loading…
x
Reference in New Issue
Block a user