Skip to content

Commit

Permalink
[media] mceusb: buffer parsing fixups for 1st-gen device
Browse files Browse the repository at this point in the history
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>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
  • Loading branch information
Jarod Wilson authored and Mauro Carvalho Chehab committed Dec 20, 2010
1 parent 1cd50f2 commit 29b4494
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion drivers/media/IR/mceusb.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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:
Expand Down

0 comments on commit 29b4494

Please sign in to comment.