aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/dvb/dvb-usb
diff options
context:
space:
mode:
authorMauro Carvalho Chehab <mchehab@redhat.com>2009-09-26 12:29:35 -0400
committerMauro Carvalho Chehab <mchehab@redhat.com>2009-12-05 15:40:02 -0500
commitaa15c0a347be6d5d16c557ed5b6b72345be48bdd (patch)
treed352357ed8174161c5fdfe2d8b443b67090b6ea9 /drivers/media/dvb/dvb-usb
parent8d64827172ae680d34d0611a1e865b546e6a5f08 (diff)
V4L/DVB (13042): Add NEC protocol to firmware v1.2 handler
Currently, dvb_usb_dib0700_ir_proto is supported only with firmwares older than 1.2. Adds support for it also with the newer firmware. This is needed in order to support PixelView SBTVD IR. Cc: Patrick Boettcher <pb@linuxtv.org> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/dvb/dvb-usb')
-rw-r--r--drivers/media/dvb/dvb-usb/dib0700_devices.c61
1 files changed, 37 insertions, 24 deletions
diff --git a/drivers/media/dvb/dvb-usb/dib0700_devices.c b/drivers/media/dvb/dvb-usb/dib0700_devices.c
index 6bd8951ea02b..81569deaa192 100644
--- a/drivers/media/dvb/dvb-usb/dib0700_devices.c
+++ b/drivers/media/dvb/dvb-usb/dib0700_devices.c
@@ -558,8 +558,7 @@ static int dib0700_rc_query_legacy(struct dvb_usb_device *d, u32 *event,
558struct dib0700_rc_response { 558struct dib0700_rc_response {
559 u8 report_id; 559 u8 report_id;
560 u8 data_state; 560 u8 data_state;
561 u8 system_msb; 561 u16 system;
562 u8 system_lsb;
563 u8 data; 562 u8 data;
564 u8 not_data; 563 u8 not_data;
565}; 564};
@@ -589,37 +588,51 @@ static int dib0700_rc_query_v1_20(struct dvb_usb_device *d, u32 *event,
589 return 0; 588 return 0;
590 } 589 }
591 590
592 if (actlen != sizeof(buf)) { 591 printk("IR raw %2X %2X %2X %2X %2X %2X (len %d)\n", buf[0], buf[1], buf[2], buf[3], buf[4], buf[5], actlen);
593 /* We didn't get back the 6 byte message we expected */
594 err("Unexpected RC response size [%d]", actlen);
595 return -1;
596 }
597 592
598 poll_reply.report_id = buf[0]; 593 switch (dvb_usb_dib0700_ir_proto) {
599 poll_reply.data_state = buf[1]; 594 case 0:
600 poll_reply.system_msb = buf[2]; 595 poll_reply.report_id = 0;
601 poll_reply.system_lsb = buf[3]; 596 poll_reply.data_state = 1;
602 poll_reply.data = buf[4]; 597 poll_reply.system = buf[2];
603 poll_reply.not_data = buf[5]; 598 poll_reply.data = buf[4];
599 poll_reply.not_data = buf[5];
604 600
605 /* 601 /* NEC protocol sends repeat code as 0 0 0 FF */
606 info("rid=%02x ds=%02x sm=%02x sl=%02x d=%02x nd=%02x\n", 602 if ((poll_reply.system == 0x00) && (poll_reply.data == 0x00)
607 poll_reply.report_id, poll_reply.data_state, 603 && (poll_reply.not_data == 0xff)) {
608 poll_reply.system_msb, poll_reply.system_lsb, 604 poll_reply.data_state = 2;
609 poll_reply.data, poll_reply.not_data); 605 break;
610 */ 606 }
607 break;
608 default:
609 if (actlen != sizeof(buf)) {
610 /* We didn't get back the 6 byte message we expected */
611 err("Unexpected RC response size [%d]", actlen);
612 return -1;
613 }
614
615 poll_reply.report_id = buf[0];
616 poll_reply.data_state = buf[1];
617 poll_reply.system = (buf[2] << 8) | buf[3];
618 poll_reply.data = buf[4];
619 poll_reply.not_data = buf[5];
620
621 break;
622 }
611 623
612 if ((poll_reply.data + poll_reply.not_data) != 0xff) { 624 if ((poll_reply.data + poll_reply.not_data) != 0xff) {
613 /* Key failed integrity check */ 625 /* Key failed integrity check */
614 err("key failed integrity check: %02x %02x %02x %02x", 626 err("key failed integrity check: %04x %02x %02x",
615 poll_reply.system_msb, poll_reply.system_lsb, 627 poll_reply.system,
616 poll_reply.data, poll_reply.not_data); 628 poll_reply.data, poll_reply.not_data);
617 return -1; 629 return -1;
618 } 630 }
619 631
632
620 /* Find the key in the map */ 633 /* Find the key in the map */
621 for (i = 0; i < d->props.rc_key_map_size; i++) { 634 for (i = 0; i < d->props.rc_key_map_size; i++) {
622 if (rc5_custom(&keymap[i]) == poll_reply.system_lsb && 635 if (rc5_custom(&keymap[i]) == (poll_reply.system & 0xff) &&
623 rc5_data(&keymap[i]) == poll_reply.data) { 636 rc5_data(&keymap[i]) == poll_reply.data) {
624 *event = keymap[i].event; 637 *event = keymap[i].event;
625 found = 1; 638 found = 1;
@@ -628,8 +641,8 @@ static int dib0700_rc_query_v1_20(struct dvb_usb_device *d, u32 *event,
628 } 641 }
629 642
630 if (found == 0) { 643 if (found == 0) {
631 err("Unknown remote controller key: %02x %02x %02x %02x", 644 err("Unknown remote controller key: %04x %02x %02x",
632 poll_reply.system_msb, poll_reply.system_lsb, 645 poll_reply.system,
633 poll_reply.data, poll_reply.not_data); 646 poll_reply.data, poll_reply.not_data);
634 d->last_event = 0; 647 d->last_event = 0;
635 return 0; 648 return 0;