Commit c421c62a authored by Sean Young's avatar Sean Young Committed by Mauro Carvalho Chehab

media: rc: mce_kbd decoder: low timeout values cause double keydowns

The mce keyboard repeats pressed keys every 100ms. If the IR timeout
is set to less than that, we send key up events before the repeat
arrives, so we have key up/key down for each IR repeat.

The keyboard ends any sequence with a 0 scancode, in which case all keys
are cleared so there is no need to run the timeout timer: it only exists
for the case that the final 0 was not received.
Signed-off-by: default avatarSean Young <sean@mess.org>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@s-opensource.com>
parent 28492256
...@@ -322,11 +322,13 @@ static int ir_mce_kbd_decode(struct rc_dev *dev, struct ir_raw_event ev) ...@@ -322,11 +322,13 @@ static int ir_mce_kbd_decode(struct rc_dev *dev, struct ir_raw_event ev)
scancode = data->body & 0xffff; scancode = data->body & 0xffff;
dev_dbg(&dev->dev, "keyboard data 0x%08x\n", dev_dbg(&dev->dev, "keyboard data 0x%08x\n",
data->body); data->body);
if (dev->timeout) if (scancode) {
delay = usecs_to_jiffies(dev->timeout / 1000); delay = nsecs_to_jiffies(dev->timeout) +
else msecs_to_jiffies(100);
delay = msecs_to_jiffies(100); mod_timer(&data->rx_timeout, jiffies + delay);
mod_timer(&data->rx_timeout, jiffies + delay); } else {
del_timer(&data->rx_timeout);
}
/* Pass data to keyboard buffer parser */ /* Pass data to keyboard buffer parser */
ir_mce_kbd_process_keyboard_data(dev, scancode); ir_mce_kbd_process_keyboard_data(dev, scancode);
lsc.rc_proto = RC_PROTO_MCIR2_KBD; lsc.rc_proto = RC_PROTO_MCIR2_KBD;
......
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