diff options
author | Jarod Wilson <jarod@redhat.com> | 2010-11-09 16:41:46 -0500 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2010-12-20 11:11:08 -0500 |
commit | 29b4494b1ff0157c1816ce8e2aea2abfdeb7f763 (patch) | |
tree | 287388322ddb0c05accb6faf1e9959110f3a29d4 /drivers/media | |
parent | 1cd50f25614226e99ac7a1518311e8474ea024e3 (diff) |
[media] mceusb: buffer parsing fixups for 1st-gen device
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>
Diffstat (limited to 'drivers/media')
-rw-r--r-- | 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 18110987597e..ed151c8290fe 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, | |||
446 | return; | 446 | return; |
447 | 447 | ||
448 | /* skip meaningless 0xb1 0x60 header bytes on orig receiver */ | 448 | /* skip meaningless 0xb1 0x60 header bytes on orig receiver */ |
449 | if (ir->flags.microsoft_gen1 && !out) | 449 | if (ir->flags.microsoft_gen1 && !out && !offset) |
450 | skip = 2; | 450 | skip = 2; |
451 | 451 | ||
452 | if (len <= skip) | 452 | if (len <= skip) |
@@ -807,6 +807,10 @@ static void mceusb_process_ir_data(struct mceusb_dev *ir, int buf_len) | |||
807 | if (ir->flags.microsoft_gen1) | 807 | if (ir->flags.microsoft_gen1) |
808 | i = 2; | 808 | i = 2; |
809 | 809 | ||
810 | /* if there's no data, just return now */ | ||
811 | if (buf_len <= i) | ||
812 | return; | ||
813 | |||
810 | for (; i < buf_len; i++) { | 814 | for (; i < buf_len; i++) { |
811 | switch (ir->parser_state) { | 815 | switch (ir->parser_state) { |
812 | case SUBCMD: | 816 | case SUBCMD: |