From: Jarod Wilson <jarod@redhat.com>
To: linux-media@vger.kernel.org
Subject: [PATCH 3/3] mceusb: buffer parsing fixups for 1st-gen device
Date: Thu, 28 Oct 2010 23:08:42 -0400 [thread overview]
Message-ID: <20101029030842.GD17238@redhat.com> (raw)
In-Reply-To: <20101029030545.GA17238@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 a05dec7..09a62f1 100644
--- a/drivers/media/IR/mceusb.c
+++ b/drivers/media/IR/mceusb.c
@@ -445,7 +445,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)
@@ -806,6 +806,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
prev parent reply other threads:[~2010-10-29 3:08 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-10-29 3:05 [PATCH 0/3] mceusb cleanups and new device support Jarod Wilson
2010-10-29 3:07 ` [PATCH 1/3] mceusb: add support for Conexant Hybrid TV RDU253S Jarod Wilson
2010-10-29 3:08 ` [PATCH 2/3] mceusb: fix up reporting of trailing space Jarod Wilson
2010-10-29 19:21 ` David Härdeman
2010-10-29 19:36 ` Jarod Wilson
2010-11-02 21:12 ` Jarod Wilson
2010-11-03 12:15 ` David Härdeman
2010-11-03 19:48 ` Jarod Wilson
2010-10-29 3:08 ` Jarod Wilson [this message]
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=20101029030842.GD17238@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 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.