1 From 829bbf268894d0866bb9dd2b1e430cfa5c5f0779 Mon Sep 17 00:00:00 2001
2 From: Sean Young <sean@mess.org>
3 Date: Sun, 1 Oct 2017 16:38:29 -0400
4 Subject: media: rc: nec decoder should not send both repeat and keycode
6 From: Sean Young <sean@mess.org>
8 commit 829bbf268894d0866bb9dd2b1e430cfa5c5f0779 upstream.
10 When receiving an nec repeat, rc_repeat() is called and then rc_keydown()
11 with the last decoded scancode. That last call is redundant.
13 Fixes: 265a2988d202 ("media: rc-core: consistent use of rc_repeat()")
15 Signed-off-by: Sean Young <sean@mess.org>
16 Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
17 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
20 drivers/media/rc/ir-nec-decoder.c | 31 ++++++++++++++++++-------------
21 1 file changed, 18 insertions(+), 13 deletions(-)
23 --- a/drivers/media/rc/ir-nec-decoder.c
24 +++ b/drivers/media/rc/ir-nec-decoder.c
25 @@ -87,8 +87,6 @@ static int ir_nec_decode(struct rc_dev *
26 data->state = STATE_BIT_PULSE;
28 } else if (eq_margin(ev.duration, NEC_REPEAT_SPACE, NEC_UNIT / 2)) {
30 - IR_dprintk(1, "Repeat last key\n");
31 data->state = STATE_TRAILER_PULSE;
34 @@ -151,19 +149,26 @@ static int ir_nec_decode(struct rc_dev *
35 if (!geq_margin(ev.duration, NEC_TRAILER_SPACE, NEC_UNIT / 2))
38 - address = bitrev8((data->bits >> 24) & 0xff);
39 - not_address = bitrev8((data->bits >> 16) & 0xff);
40 - command = bitrev8((data->bits >> 8) & 0xff);
41 - not_command = bitrev8((data->bits >> 0) & 0xff);
43 - scancode = ir_nec_bytes_to_scancode(address, not_address,
44 - command, not_command,
46 + if (data->count == NEC_NBITS) {
47 + address = bitrev8((data->bits >> 24) & 0xff);
48 + not_address = bitrev8((data->bits >> 16) & 0xff);
49 + command = bitrev8((data->bits >> 8) & 0xff);
50 + not_command = bitrev8((data->bits >> 0) & 0xff);
52 + scancode = ir_nec_bytes_to_scancode(address,
59 + data->necx_repeat = true;
62 - data->necx_repeat = true;
63 + rc_keydown(dev, rc_proto, scancode, 0);
68 - rc_keydown(dev, rc_proto, scancode, 0);
69 data->state = STATE_INACTIVE;