summaryrefslogtreecommitdiff
path: root/drivers/media
diff options
context:
space:
mode:
authorSean Young <sean@mess.org>2018-09-18 11:50:20 +0300
committerMauro Carvalho Chehab <mchehab+samsung@kernel.org>2018-10-05 13:54:26 +0300
commitfec225a04330d0f222d24feb5bea045526031675 (patch)
tree72a5c0ba7174160f0e7cf73041e4ce842d378082 /drivers/media
parentbe9c03e4120d42fcdb8debe3c6237629e51b8864 (diff)
downloadlinux-fec225a04330d0f222d24feb5bea045526031675.tar.xz
media: rc: some events are dropped by userspace
libevdev (which is used by libinput) gets a list of keycodes from the input device on creation. Any events with keycodes which are not in this list are silently dropped. So, set all keycodes on device creation since we do not know which will be used if the keymap changes. Signed-off-by: Sean Young <sean@mess.org> Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
Diffstat (limited to 'drivers/media')
-rw-r--r--drivers/media/rc/rc-main.c14
1 files changed, 2 insertions, 12 deletions
diff --git a/drivers/media/rc/rc-main.c b/drivers/media/rc/rc-main.c
index ca68e1d2b2f9..7e5a9bc9b81d 100644
--- a/drivers/media/rc/rc-main.c
+++ b/drivers/media/rc/rc-main.c
@@ -274,7 +274,6 @@ static unsigned int ir_update_mapping(struct rc_dev *dev,
unsigned int new_keycode)
{
int old_keycode = rc_map->scan[index].keycode;
- int i;
/* Did the user wish to remove the mapping? */
if (new_keycode == KEY_RESERVED || new_keycode == KEY_UNKNOWN) {
@@ -289,20 +288,9 @@ static unsigned int ir_update_mapping(struct rc_dev *dev,
old_keycode == KEY_RESERVED ? "New" : "Replacing",
rc_map->scan[index].scancode, new_keycode);
rc_map->scan[index].keycode = new_keycode;
- __set_bit(new_keycode, dev->input_dev->keybit);
}
if (old_keycode != KEY_RESERVED) {
- /* A previous mapping was updated... */
- __clear_bit(old_keycode, dev->input_dev->keybit);
- /* ... but another scancode might use the same keycode */
- for (i = 0; i < rc_map->len; i++) {
- if (rc_map->scan[i].keycode == old_keycode) {
- __set_bit(old_keycode, dev->input_dev->keybit);
- break;
- }
- }
-
/* Possibly shrink the keytable, failure is not a problem */
ir_resize_table(dev, rc_map, GFP_ATOMIC);
}
@@ -1759,6 +1747,8 @@ static int rc_prepare_rx_device(struct rc_dev *dev)
set_bit(EV_REP, dev->input_dev->evbit);
set_bit(EV_MSC, dev->input_dev->evbit);
set_bit(MSC_SCAN, dev->input_dev->mscbit);
+ bitmap_fill(dev->input_dev->keybit, KEY_CNT);
+
if (dev->open)
dev->input_dev->open = ir_open;
if (dev->close)