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

Configure Feed

Select the types of activity you want to include in your feed.

media: lirc: report ir receiver overflow

If the driver reports that the hardware had an overflow, report this to
userspace. It would be nice to know when this happens, and not just get
a long space.

This change has been tested with lircd, ir-ctl, and ir-keytable.

Signed-off-by: Sean Young <sean@mess.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>

authored by

Sean Young and committed by
Mauro Carvalho Chehab
68a99f6a 950170d6

+30 -14
+3
Documentation/userspace-api/media/lirc.h.rst.exceptions
··· 11 11 ignore define LIRC_PULSE 12 12 ignore define LIRC_FREQUENCY 13 13 ignore define LIRC_TIMEOUT 14 + ignore define LIRC_OVERFLOW 14 15 ignore define LIRC_VALUE 15 16 ignore define LIRC_MODE2 16 17 ignore define LIRC_IS_SPACE 17 18 ignore define LIRC_IS_PULSE 18 19 ignore define LIRC_IS_FREQUENCY 19 20 ignore define LIRC_IS_TIMEOUT 21 + ignore define LIRC_IS_OVERFLOW 20 22 21 23 ignore define LIRC_MODE2SEND 22 24 ignore define LIRC_SEND2MODE ··· 77 75 ignore define LIRC_MODE2_SPACE 78 76 ignore define LIRC_MODE2_PULSE 79 77 ignore define LIRC_MODE2_TIMEOUT 78 + ignore define LIRC_MODE2_OVERFLOW 80 79 81 80 ignore define LIRC_VALUE_MASK 82 81 ignore define LIRC_MODE2_MASK
+9 -2
Documentation/userspace-api/media/rc/lirc-dev-intro.rst
··· 103 103 104 104 ``LIRC_MODE2_PULSE`` 105 105 106 - Signifies the presence of IR in microseconds. 106 + Signifies the presence of IR in microseconds, also known as *flash*. 107 107 108 108 ``LIRC_MODE2_SPACE`` 109 109 110 - Signifies absence of IR in microseconds. 110 + Signifies absence of IR in microseconds, also known as *gap*. 111 111 112 112 ``LIRC_MODE2_FREQUENCY`` 113 113 ··· 120 120 When the timeout set with :ref:`lirc_set_rec_timeout` expires due 121 121 to no IR being detected, this packet will be sent, with the number 122 122 of microseconds with no IR. 123 + 124 + ``LIRC_MODE2_OVERFLOW`` 125 + 126 + Signifies that the IR receiver encounter an overflow, and some IR 127 + is missing. The IR data after this should be correct again. The 128 + actual value is not important, but this is set to 0xffffff by the 129 + kernel for compatibility with lircd. 123 130 124 131 .. _lirc-mode-pulse: 125 132
+6 -7
drivers/media/rc/lirc_dev.c
··· 44 44 /* Receiver overflow, data missing */ 45 45 if (ev.overflow) { 46 46 /* 47 - * Userspace expects a long space event before the start of 48 - * the signal to use as a sync. This may be done with repeat 49 - * packets and normal samples. But if an overflow has been sent 50 - * then we assume that a long time has passed, so we send a 51 - * space with the maximum time value. 47 + * Send lirc overflow message. This message is unknown to 48 + * lircd, but it will interpret this as a long space as 49 + * long as the value is set to high value. This resets its 50 + * decoder state. 52 51 */ 53 - sample = LIRC_SPACE(LIRC_VALUE_MASK); 54 - dev_dbg(&dev->dev, "delivering overflow space to lirc_dev\n"); 52 + sample = LIRC_OVERFLOW(LIRC_VALUE_MASK); 53 + dev_dbg(&dev->dev, "delivering overflow to lirc_dev\n"); 55 54 56 55 /* Carrier reports */ 57 56 } else if (ev.carrier_report) {
+5 -1
drivers/media/rc/rc-loopback.c
··· 112 112 rawir.pulse = i % 2 ? false : true; 113 113 rawir.duration = txbuf[i]; 114 114 115 - ir_raw_event_store_with_filter(dev, &rawir); 115 + /* simulate overflow if ridiculously long pulse was sent */ 116 + if (rawir.pulse && rawir.duration > MS_TO_US(50)) 117 + ir_raw_event_overflow(dev); 118 + else 119 + ir_raw_event_store_with_filter(dev, &rawir); 116 120 } 117 121 118 122 if (lodev->carrierreport) {
+7 -4
include/uapi/linux/lirc.h
··· 16 16 #define LIRC_MODE2_PULSE 0x01000000 17 17 #define LIRC_MODE2_FREQUENCY 0x02000000 18 18 #define LIRC_MODE2_TIMEOUT 0x03000000 19 + #define LIRC_MODE2_OVERFLOW 0x04000000 19 20 20 21 #define LIRC_VALUE_MASK 0x00FFFFFF 21 22 #define LIRC_MODE2_MASK 0xFF000000 22 23 23 - #define LIRC_SPACE(val) (((val)&LIRC_VALUE_MASK) | LIRC_MODE2_SPACE) 24 - #define LIRC_PULSE(val) (((val)&LIRC_VALUE_MASK) | LIRC_MODE2_PULSE) 25 - #define LIRC_FREQUENCY(val) (((val)&LIRC_VALUE_MASK) | LIRC_MODE2_FREQUENCY) 26 - #define LIRC_TIMEOUT(val) (((val)&LIRC_VALUE_MASK) | LIRC_MODE2_TIMEOUT) 24 + #define LIRC_SPACE(val) (((val) & LIRC_VALUE_MASK) | LIRC_MODE2_SPACE) 25 + #define LIRC_PULSE(val) (((val) & LIRC_VALUE_MASK) | LIRC_MODE2_PULSE) 26 + #define LIRC_FREQUENCY(val) (((val) & LIRC_VALUE_MASK) | LIRC_MODE2_FREQUENCY) 27 + #define LIRC_TIMEOUT(val) (((val) & LIRC_VALUE_MASK) | LIRC_MODE2_TIMEOUT) 28 + #define LIRC_OVERFLOW(val) (((val) & LIRC_VALUE_MASK) | LIRC_MODE2_OVERFLOW) 27 29 28 30 #define LIRC_VALUE(val) ((val)&LIRC_VALUE_MASK) 29 31 #define LIRC_MODE2(val) ((val)&LIRC_MODE2_MASK) ··· 34 32 #define LIRC_IS_PULSE(val) (LIRC_MODE2(val) == LIRC_MODE2_PULSE) 35 33 #define LIRC_IS_FREQUENCY(val) (LIRC_MODE2(val) == LIRC_MODE2_FREQUENCY) 36 34 #define LIRC_IS_TIMEOUT(val) (LIRC_MODE2(val) == LIRC_MODE2_TIMEOUT) 35 + #define LIRC_IS_OVERFLOW(val) (LIRC_MODE2(val) == LIRC_MODE2_OVERFLOW) 37 36 38 37 /* used heavily by lirc userspace */ 39 38 #define lirc_t int