summaryrefslogtreecommitdiffstats
path: root/drivers/media
diff options
context:
space:
mode:
authorMauro Carvalho Chehab <mchehab@redhat.com>2009-08-30 03:03:47 +0200
committerMauro Carvalho Chehab <mchehab@redhat.com>2009-09-12 17:19:49 +0200
commita4c1cbc7819e890d4c2bc2b79b6cbf0fd9cad699 (patch)
treea3ad52e6b36c7fd6c23bfe93c60e46eca1dd05dc /drivers/media
parentV4L/DVB (12599): dvb-usb-remote: Allow dynamically replacing the IR keycodes (diff)
downloadlinux-a4c1cbc7819e890d4c2bc2b79b6cbf0fd9cad699.tar.xz
linux-a4c1cbc7819e890d4c2bc2b79b6cbf0fd9cad699.zip
V4L/DVB (12600): dvb-usb-remote: return KEY_RESERVED if there's free space for new keys
The input subsystem checks if get_keycode works for a scan code. Due to that, we need to return a valid value when there's some space at the table that can be used by a scancode. Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media')
-rw-r--r--drivers/media/dvb/dvb-usb/dvb-usb-remote.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/drivers/media/dvb/dvb-usb/dvb-usb-remote.c b/drivers/media/dvb/dvb-usb/dvb-usb-remote.c
index b6dbc2b538d4..edde87c6aa3a 100644
--- a/drivers/media/dvb/dvb-usb/dvb-usb-remote.c
+++ b/drivers/media/dvb/dvb-usb/dvb-usb-remote.c
@@ -22,6 +22,19 @@ static int dvb_usb_getkeycode(struct input_dev *dev,
*keycode = keymap[i].event;
return 0;
}
+
+ /*
+ * If is there extra space, returns KEY_RESERVED,
+ * otherwise, input core won't let dvb_usb_setkeycode
+ * to work
+ */
+ for (i = 0; i < d->props.rc_key_map_size; i++)
+ if (keymap[i].event == KEY_RESERVED ||
+ keymap[i].event == KEY_UNKNOWN) {
+ *keycode = KEY_RESERVED;
+ return 0;
+ }
+
return -EINVAL;
}