]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blob - releases/4.14.3/media-rc-nec-decoder-should-not-send-both-repeat-and-keycode.patch
Linux 4.14.107
[thirdparty/kernel/stable-queue.git] / releases / 4.14.3 / media-rc-nec-decoder-should-not-send-both-repeat-and-keycode.patch
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
5
6 From: Sean Young <sean@mess.org>
7
8 commit 829bbf268894d0866bb9dd2b1e430cfa5c5f0779 upstream.
9
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.
12
13 Fixes: 265a2988d202 ("media: rc-core: consistent use of rc_repeat()")
14
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>
18
19 ---
20 drivers/media/rc/ir-nec-decoder.c | 31 ++++++++++++++++++-------------
21 1 file changed, 18 insertions(+), 13 deletions(-)
22
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;
27 return 0;
28 } else if (eq_margin(ev.duration, NEC_REPEAT_SPACE, NEC_UNIT / 2)) {
29 - rc_repeat(dev);
30 - IR_dprintk(1, "Repeat last key\n");
31 data->state = STATE_TRAILER_PULSE;
32 return 0;
33 }
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))
36 break;
37
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);
42 -
43 - scancode = ir_nec_bytes_to_scancode(address, not_address,
44 - command, not_command,
45 - &rc_proto);
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);
51 +
52 + scancode = ir_nec_bytes_to_scancode(address,
53 + not_address,
54 + command,
55 + not_command,
56 + &rc_proto);
57 +
58 + if (data->is_nec_x)
59 + data->necx_repeat = true;
60
61 - if (data->is_nec_x)
62 - data->necx_repeat = true;
63 + rc_keydown(dev, rc_proto, scancode, 0);
64 + } else {
65 + rc_repeat(dev);
66 + }
67
68 - rc_keydown(dev, rc_proto, scancode, 0);
69 data->state = STATE_INACTIVE;
70 return 0;
71 }