Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 29b4494b authored by Jarod Wilson's avatar Jarod Wilson Committed by Mauro Carvalho Chehab
Browse files

[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: default avatarJarod Wilson <jarod@redhat.com>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@redhat.com>
parent 1cd50f25
Loading
Loading
Loading
Loading
+5 −1
Original line number Original line Diff line number Diff line
@@ -446,7 +446,7 @@ static void mceusb_dev_printdata(struct mceusb_dev *ir, char *buf,
		return;
		return;


	/* skip meaningless 0xb1 0x60 header bytes on orig receiver */
	/* skip meaningless 0xb1 0x60 header bytes on orig receiver */
	if (ir->flags.microsoft_gen1 && !out)
	if (ir->flags.microsoft_gen1 && !out && !offset)
		skip = 2;
		skip = 2;


	if (len <= skip)
	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)
	if (ir->flags.microsoft_gen1)
		i = 2;
		i = 2;


	/* if there's no data, just return now */
	if (buf_len <= i)
		return;

	for (; i < buf_len; i++) {
	for (; i < buf_len; i++) {
		switch (ir->parser_state) {
		switch (ir->parser_state) {
		case SUBCMD:
		case SUBCMD: