linux-media.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/3] media: rc: drivers should produce alternate pulse and space timing events
@ 2018-05-12 10:55 Sean Young
  2018-05-12 10:55 ` [PATCH 2/3] media: rc: decoders do not need to check for transitions Sean Young
                   ` (2 more replies)
  0 siblings, 3 replies; 10+ messages in thread
From: Sean Young @ 2018-05-12 10:55 UTC (permalink / raw)
  To: linux-media

Report an error if this is not the case or any problem with the generated
raw events.

Signed-off-by: Sean Young <sean@mess.org>
---
 drivers/media/rc/rc-ir-raw.c | 19 +++++++++++++++----
 1 file changed, 15 insertions(+), 4 deletions(-)

diff --git a/drivers/media/rc/rc-ir-raw.c b/drivers/media/rc/rc-ir-raw.c
index 2e50104ae138..49c56da9bc67 100644
--- a/drivers/media/rc/rc-ir-raw.c
+++ b/drivers/media/rc/rc-ir-raw.c
@@ -22,16 +22,27 @@ static int ir_raw_event_thread(void *data)
 {
 	struct ir_raw_event ev;
 	struct ir_raw_handler *handler;
-	struct ir_raw_event_ctrl *raw = (struct ir_raw_event_ctrl *)data;
+	struct ir_raw_event_ctrl *raw = data;
+	struct rc_dev *dev = raw->dev;
 
 	while (1) {
 		mutex_lock(&ir_raw_handler_lock);
 		while (kfifo_out(&raw->kfifo, &ev, 1)) {
+			if (is_timing_event(ev)) {
+				if (ev.duration == 0)
+					dev_err(&dev->dev, "nonsensical timing event of duration 0");
+				if (is_timing_event(raw->prev_ev) &&
+				    !is_transition(&ev, &raw->prev_ev))
+					dev_err(&dev->dev, "two consecutive events of type %s",
+						TO_STR(ev.pulse));
+				if (raw->prev_ev.reset && ev.pulse == 0)
+					dev_err(&dev->dev, "timing event after reset should be pulse");
+			}
 			list_for_each_entry(handler, &ir_raw_handler_list, list)
-				if (raw->dev->enabled_protocols &
+				if (dev->enabled_protocols &
 				    handler->protocols || !handler->protocols)
-					handler->decode(raw->dev, ev);
-			ir_lirc_raw_event(raw->dev, ev);
+					handler->decode(dev, ev);
+			ir_lirc_raw_event(dev, ev);
 			raw->prev_ev = ev;
 		}
 		mutex_unlock(&ir_raw_handler_lock);
-- 
2.17.0

^ permalink raw reply related	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2018-06-26 16:46 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-05-12 10:55 [PATCH 1/3] media: rc: drivers should produce alternate pulse and space timing events Sean Young
2018-05-12 10:55 ` [PATCH 2/3] media: rc: decoders do not need to check for transitions Sean Young
2018-05-12 10:55 ` [PATCH 3/3] media: rc: winbond: do not send reset and timeout raw events on startup Sean Young
2018-06-19 12:08 ` [1/3] media: rc: drivers should produce alternate pulse and space timing events Jerome Brunet
2018-06-19 12:57   ` Sean Young
2018-06-19 14:09     ` Jerome Brunet
2018-06-26 14:37       ` Sean Young
2018-06-26 14:39         ` Jerome Brunet
2018-06-26 16:33           ` Sean Young
2018-06-26 16:46             ` Jerome Brunet

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).