Skip to content

Commit bdb39cc

Browse files
aplundgregkh
authored andcommitted
media/rc: Send sync space information on the lirc device
commit a8f29e8 upstream. Userspace expects to see a long space before the first pulse is sent on the lirc device. Currently, if a long time has passed and a new packet is started, the lirc codec just returns and doesn't send anything. This makes lircd ignore many perfectly valid signals unless they are sent in quick sucession. When a reset event is delivered, we cannot know anything about the duration of the space. But it should be safe to assume it has been a long time and we just set the duration to maximum. Signed-off-by: Austin Lund <austin.lund@gmail.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 4e55dad commit bdb39cc

1 file changed

Lines changed: 9 additions & 3 deletions

File tree

‎drivers/media/rc/ir-lirc-codec.c‎

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,11 +42,17 @@ static int ir_lirc_decode(struct rc_dev *dev, struct ir_raw_event ev)
4242
return -EINVAL;
4343

4444
/* Packet start */
45-
if (ev.reset)
46-
return 0;
45+
if (ev.reset) {
46+
/* Userspace expects a long space event before the start of
47+
* the signal to use as a sync. This may be done with repeat
48+
* packets and normal samples. But if a reset has been sent
49+
* then we assume that a long time has passed, so we send a
50+
* space with the maximum time value. */
51+
sample = LIRC_SPACE(LIRC_VALUE_MASK);
52+
IR_dprintk(2, "delivering reset sync space to lirc_dev\n");
4753

4854
/* Carrier reports */
49-
if (ev.carrier_report) {
55+
} else if (ev.carrier_report) {
5056
sample = LIRC_FREQUENCY(ev.carrier);
5157
IR_dprintk(2, "carrier report (freq: %d)\n", sample);
5258

0 commit comments

Comments
 (0)