From: Jarod Wilson <jarod@redhat.com>
To: linux-media@vger.kernel.org
Cc: "David Härdeman" <david@hardeman.nu>
Subject: [PATCH 2/3 v2] mceusb: buffer parsing fixups for 1st-gen device
Date: Tue, 9 Nov 2010 16:41:46 -0500 [thread overview]
Message-ID: <20101109214146.GF11073@redhat.com> (raw)
In-Reply-To: <20101109213921.GD11073@redhat.com>
If we pass in an offset, we shouldn't skip 2 bytes. And the first-gen
hardware generates a constant stream of interrupts, always with two
header bytes, and if there's been no IR, with nothing else. Bail from
ir processing without calling ir_handle_raw_event when we get such a
buffer delivered to us.
Signed-off-by: Jarod Wilson <jarod@redhat.com>
---
drivers/media/IR/mceusb.c | 6 +++++-
1 files changed, 5 insertions(+), 1 deletions(-)
diff --git a/drivers/media/IR/mceusb.c b/drivers/media/IR/mceusb.c
index 1811098..ed151c8 100644
--- a/drivers/media/IR/mceusb.c
+++ b/drivers/media/IR/mceusb.c
@@ -446,7 +446,7 @@ static void mceusb_dev_printdata(struct mceusb_dev *ir, char *buf,
return;
/* skip meaningless 0xb1 0x60 header bytes on orig receiver */
- if (ir->flags.microsoft_gen1 && !out)
+ if (ir->flags.microsoft_gen1 && !out && !offset)
skip = 2;
if (len <= skip)
@@ -807,6 +807,10 @@ static void mceusb_process_ir_data(struct mceusb_dev *ir, int buf_len)
if (ir->flags.microsoft_gen1)
i = 2;
+ /* if there's no data, just return now */
+ if (buf_len <= i)
+ return;
+
for (; i < buf_len; i++) {
switch (ir->parser_state) {
case SUBCMD:
--
1.7.1
--
Jarod Wilson
jarod@redhat.com
next prev parent reply other threads:[~2010-11-09 21:41 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-11-09 21:39 [PATCH 0/3 v2] mceusb: buffer parsing and keymap cleanups Jarod Wilson
2010-11-09 21:41 ` [PATCH 1/3 v2] mceusb: fix up reporting of trailing space Jarod Wilson
2010-11-09 21:41 ` Jarod Wilson [this message]
2010-11-09 21:42 ` [PATCH 3/3 v2] IR: add tv power scancode to rc6 mce keymap 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=20101109214146.GF11073@redhat.com \
--to=jarod@redhat.com \
--cc=david@hardeman.nu \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.