From: Jarod Wilson <jarod@redhat.com>
To: linux-media@vger.kernel.org
Subject: [PATCH] IR: let all protocol decoders have a go at raw data
Date: Fri, 28 May 2010 15:59:45 -0400 [thread overview]
Message-ID: <20100528195945.GA7305@redhat.com> (raw)
The mceusb driver I'm about to submit handles just about any raw IR you
can throw at it. The ir-core loads up all protocol decoders, starting
with NEC, then RC5, then RC6. RUN_DECODER() was trying them in the same
order, and exiting if any of the decoders didn't like the data. The
default mceusb remote talks RC6(6A). Well, the RC6 decoder never gets a
chance to run unless you move the RC6 decoder to the front of the list.
What I believe to be correct is to have RUN_DECODER keep trying all of
the decoders, even when one triggers an error. I don't think the errors
matter so much as it matters that at least one was successful -- i.e.,
that _sumrc is > 0. The following works for me w/my mceusb driver and
the default decoder ordering -- NEC and RC5 still fail, but RC6 still
gets a crack at it, and successfully does its job.
Signed-off-by: Jarod Wilson <jarod@redhat.com>
---
drivers/media/IR/ir-raw-event.c | 7 ++++---
1 files changed, 4 insertions(+), 3 deletions(-)
diff --git a/drivers/media/IR/ir-raw-event.c b/drivers/media/IR/ir-raw-event.c
index ea68a3f..44162db 100644
--- a/drivers/media/IR/ir-raw-event.c
+++ b/drivers/media/IR/ir-raw-event.c
@@ -36,14 +36,15 @@ static DEFINE_SPINLOCK(ir_raw_handler_lock);
*/
#define RUN_DECODER(ops, ...) ({ \
struct ir_raw_handler *_ir_raw_handler; \
- int _sumrc = 0, _rc; \
+ int _sumrc = 0, _rc, _fail; \
spin_lock(&ir_raw_handler_lock); \
list_for_each_entry(_ir_raw_handler, &ir_raw_handler_list, list) { \
if (_ir_raw_handler->ops) { \
_rc = _ir_raw_handler->ops(__VA_ARGS__); \
if (_rc < 0) \
- break; \
- _sumrc += _rc; \
+ _fail++; \
+ else \
+ _sumrc += _rc; \
} \
} \
spin_unlock(&ir_raw_handler_lock); \
--
Jarod Wilson
jarod@redhat.com
next reply other threads:[~2010-05-28 19:59 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-05-28 19:59 Jarod Wilson [this message]
2010-05-29 17:17 ` [PATCH v2] IR: let all protocol decoders have a go at raw data Jarod Wilson
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20100528195945.GA7305@redhat.com \
--to=jarod@redhat.com \
--cc=linux-media@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox