Skip to content

Commit

Permalink
[media] ir-nec-decoder: fix repeat key issue
Browse files Browse the repository at this point in the history
Fixing the problem with NEC protocol and repeating keys under the following
circumstances. The problem occurs when there is a repeat code without
properly decoded scancode. This leads to repeat the wrong (last decoded)
scancode.

An example from real life:
I am pressing volume down, then several minutes later i am pressing
volume up, but the real scancode is wrongly decoded and only a repeat
event is emitted, so as a result volume is going down while i am holding
volume up button.

The patch fixes above problem using rc_keyup timeout (as pointed by Mauro).
It just prevents key repeats if they appear after rc_keyup.

Signed-off-by: Mariusz Białończyk <manio@skyboo.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
  • Loading branch information
Mariusz Białończyk authored and Mauro Carvalho Chehab committed Dec 31, 2010
1 parent ef98a2c commit 21d3301
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions drivers/media/rc/ir-nec-decoder.c
Original file line number Diff line number Diff line change
Expand Up @@ -88,9 +88,13 @@ static int ir_nec_decode(struct rc_dev *dev, struct ir_raw_event ev)
data->state = STATE_BIT_PULSE;
return 0;
} else if (eq_margin(ev.duration, NEC_REPEAT_SPACE, NEC_UNIT / 2)) {
rc_repeat(dev);
IR_dprintk(1, "Repeat last key\n");
data->state = STATE_TRAILER_PULSE;
if (!dev->keypressed) {
IR_dprintk(1, "Discarding last key repeat: event after key up\n");
} else {
rc_repeat(dev);
IR_dprintk(1, "Repeat last key\n");
data->state = STATE_TRAILER_PULSE;
}
return 0;
}

Expand Down

0 comments on commit 21d3301

Please sign in to comment.