aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/rc/ir-nec-decoder.c
diff options
context:
space:
mode:
authorMariusz Białończyk <manio@skyboo.net>2010-12-29 17:48:43 -0500
committerMauro Carvalho Chehab <mchehab@redhat.com>2010-12-31 10:46:01 -0500
commit21d33014108671cc6b02feda088f32bf26ce532d (patch)
tree6cf400b067ca0da5adb45c9ec1611ba417e2e8f7 /drivers/media/rc/ir-nec-decoder.c
parentef98a2c0f2856f6b2aa87fd32d5b192afaeae518 (diff)
[media] ir-nec-decoder: fix repeat key issue
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>
Diffstat (limited to 'drivers/media/rc/ir-nec-decoder.c')
-rw-r--r--drivers/media/rc/ir-nec-decoder.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/drivers/media/rc/ir-nec-decoder.c b/drivers/media/rc/ir-nec-decoder.c
index 5d15c31288b9..7b58b4a1729b 100644
--- a/drivers/media/rc/ir-nec-decoder.c
+++ b/drivers/media/rc/ir-nec-decoder.c
@@ -88,9 +88,13 @@ static int ir_nec_decode(struct rc_dev *dev, struct ir_raw_event ev)
88 data->state = STATE_BIT_PULSE; 88 data->state = STATE_BIT_PULSE;
89 return 0; 89 return 0;
90 } else if (eq_margin(ev.duration, NEC_REPEAT_SPACE, NEC_UNIT / 2)) { 90 } else if (eq_margin(ev.duration, NEC_REPEAT_SPACE, NEC_UNIT / 2)) {
91 rc_repeat(dev); 91 if (!dev->keypressed) {
92 IR_dprintk(1, "Repeat last key\n"); 92 IR_dprintk(1, "Discarding last key repeat: event after key up\n");
93 data->state = STATE_TRAILER_PULSE; 93 } else {
94 rc_repeat(dev);
95 IR_dprintk(1, "Repeat last key\n");
96 data->state = STATE_TRAILER_PULSE;
97 }
94 return 0; 98 return 0;
95 } 99 }
96 100