Re: 2.6.36/2.6.37: broken compatibility with userspace input-utils ?
From: Mark Lord <hidden>
Date: 2011-01-26 15:06:02
Also in:
linux-media, lkml
On 11-01-25 09:00 PM, Dmitry Torokhov wrote:
On Tue, Jan 25, 2011 at 03:29:14PM -0800, Dmitry Torokhov wrote:quoted
On Tue, Jan 25, 2011 at 05:22:09PM -0500, Mark Lord wrote:quoted
On 11-01-25 05:00 PM, Mauro Carvalho Chehab wrote:quoted
Em 25-01-2011 18:54, Dmitry Torokhov escreveu:
..
quoted
quoted
quoted
quoted
That has been done as well; we have 2 new ioctls and kept 2 old ioctls.That's the problem: you did NOT keep the two old ioctls(). Those got changed too.. so now we have four NEW ioctls(), none of which backward compatible with userspace.Please calm down. This, in fact, is not new vs old ioctl problem but rather particular driver (or rather set of drivers) implementation issue. Even if we drop the new ioctls and convert the RC code to use the old ones you'd be observing the same breakage as RC code responds with -EINVAL to not-yet-established mappings. I'll see what can be done for these drivers; I guess we could supply a fake KEY_RESERVED entry for not mapped scancodes if there are mapped scancodes "above" current one. That should result in the same behavior for RCs as before.I wonder if the patch below is all that is needed...
Nope. Does not work here: $ lsinput protocol version mismatch (expected 65536, got 65537)
quoted hunk ↗ jump to hunk
Input: ir-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. Signed-off-by: Dmitry Torokhov <redacted> --- drivers/media/IR/ir-keytable.c | 28 +++++++++++++++++----------- 1 files changed, 17 insertions(+), 11 deletions(-)diff --git a/drivers/media/IR/ir-keytable.c b/drivers/media/IR/ir-keytable.c index f60107c..c4645d7 100644 --- a/drivers/media/IR/ir-keytable.c +++ b/drivers/media/IR/ir-keytable.c@@ -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: