Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

[media] media/rc: Send sync space information on the lirc device

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>

authored by

Austin Lund and committed by
Mauro Carvalho Chehab
a8f29e89 5eedd8d3

+9 -3
+9 -3
drivers/media/rc/ir-lirc-codec.c
··· 42 42 return -EINVAL; 43 43 44 44 /* 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"); 47 53 48 54 /* Carrier reports */ 49 - if (ev.carrier_report) { 55 + } else if (ev.carrier_report) { 50 56 sample = LIRC_FREQUENCY(ev.carrier); 51 57 IR_dprintk(2, "carrier report (freq: %d)\n", sample); 52 58