aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
Diffstat (limited to 'drivers')
-rw-r--r--drivers/media/IR/mceusb.c63
1 files changed, 14 insertions, 49 deletions
diff --git a/drivers/media/IR/mceusb.c b/drivers/media/IR/mceusb.c
index 756f7186edb8..708a71a38443 100644
--- a/drivers/media/IR/mceusb.c
+++ b/drivers/media/IR/mceusb.c
@@ -68,7 +68,7 @@
68#define MCE_PULSE_BIT 0x80 /* Pulse bit, MSB set == PULSE else SPACE */ 68#define MCE_PULSE_BIT 0x80 /* Pulse bit, MSB set == PULSE else SPACE */
69#define MCE_PULSE_MASK 0x7F /* Pulse mask */ 69#define MCE_PULSE_MASK 0x7F /* Pulse mask */
70#define MCE_MAX_PULSE_LENGTH 0x7F /* Longest transmittable pulse symbol */ 70#define MCE_MAX_PULSE_LENGTH 0x7F /* Longest transmittable pulse symbol */
71#define MCE_PACKET_LENGTH_MASK 0xF /* Packet length mask */ 71#define MCE_PACKET_LENGTH_MASK 0x1F /* Packet length mask */
72 72
73 73
74/* module parameters */ 74/* module parameters */
@@ -209,11 +209,6 @@ static struct usb_device_id gen3_list[] = {
209 {} 209 {}
210}; 210};
211 211
212static struct usb_device_id pinnacle_list[] = {
213 { USB_DEVICE(VENDOR_PINNACLE, 0x0225) },
214 {}
215};
216
217static struct usb_device_id microsoft_gen1_list[] = { 212static struct usb_device_id microsoft_gen1_list[] = {
218 { USB_DEVICE(VENDOR_MICROSOFT, 0x006d) }, 213 { USB_DEVICE(VENDOR_MICROSOFT, 0x006d) },
219 {} 214 {}
@@ -542,6 +537,7 @@ static void mceusb_process_ir_data(struct mceusb_dev *ir, int buf_len)
542{ 537{
543 struct ir_raw_event rawir = { .pulse = false, .duration = 0 }; 538 struct ir_raw_event rawir = { .pulse = false, .duration = 0 };
544 int i, start_index = 0; 539 int i, start_index = 0;
540 u8 hdr = MCE_CONTROL_HEADER;
545 541
546 /* skip meaningless 0xb1 0x60 header bytes on orig receiver */ 542 /* skip meaningless 0xb1 0x60 header bytes on orig receiver */
547 if (ir->flags.microsoft_gen1) 543 if (ir->flags.microsoft_gen1)
@@ -551,15 +547,16 @@ static void mceusb_process_ir_data(struct mceusb_dev *ir, int buf_len)
551 if (ir->rem == 0) { 547 if (ir->rem == 0) {
552 /* decode mce packets of the form (84),AA,BB,CC,DD */ 548 /* decode mce packets of the form (84),AA,BB,CC,DD */
553 /* IR data packets can span USB messages - rem */ 549 /* IR data packets can span USB messages - rem */
554 ir->rem = (ir->buf_in[i] & MCE_PACKET_LENGTH_MASK); 550 hdr = ir->buf_in[i];
555 ir->cmd = (ir->buf_in[i] & ~MCE_PACKET_LENGTH_MASK); 551 ir->rem = (hdr & MCE_PACKET_LENGTH_MASK);
552 ir->cmd = (hdr & ~MCE_PACKET_LENGTH_MASK);
556 dev_dbg(ir->dev, "New data. rem: 0x%02x, cmd: 0x%02x\n", 553 dev_dbg(ir->dev, "New data. rem: 0x%02x, cmd: 0x%02x\n",
557 ir->rem, ir->cmd); 554 ir->rem, ir->cmd);
558 i++; 555 i++;
559 } 556 }
560 557
561 /* Only cmd 0x8<bytes> is IR data, don't process MCE commands */ 558 /* don't process MCE commands */
562 if (ir->cmd != 0x80) { 559 if (hdr == MCE_CONTROL_HEADER || hdr == 0xff) {
563 ir->rem = 0; 560 ir->rem = 0;
564 return; 561 return;
565 } 562 }
@@ -841,12 +838,10 @@ static int __devinit mceusb_dev_probe(struct usb_interface *intf,
841 struct usb_endpoint_descriptor *ep_out = NULL; 838 struct usb_endpoint_descriptor *ep_out = NULL;
842 struct usb_host_config *config; 839 struct usb_host_config *config;
843 struct mceusb_dev *ir = NULL; 840 struct mceusb_dev *ir = NULL;
844 int pipe, maxp; 841 int pipe, maxp, i;
845 int i, ret;
846 char buf[63], name[128] = ""; 842 char buf[63], name[128] = "";
847 bool is_gen3; 843 bool is_gen3;
848 bool is_microsoft_gen1; 844 bool is_microsoft_gen1;
849 bool is_pinnacle;
850 bool tx_mask_inverted; 845 bool tx_mask_inverted;
851 846
852 dev_dbg(&intf->dev, ": %s called\n", __func__); 847 dev_dbg(&intf->dev, ": %s called\n", __func__);
@@ -858,7 +853,6 @@ static int __devinit mceusb_dev_probe(struct usb_interface *intf,
858 853
859 is_gen3 = usb_match_id(intf, gen3_list) ? 1 : 0; 854 is_gen3 = usb_match_id(intf, gen3_list) ? 1 : 0;
860 is_microsoft_gen1 = usb_match_id(intf, microsoft_gen1_list) ? 1 : 0; 855 is_microsoft_gen1 = usb_match_id(intf, microsoft_gen1_list) ? 1 : 0;
861 is_pinnacle = usb_match_id(intf, pinnacle_list) ? 1 : 0;
862 tx_mask_inverted = usb_match_id(intf, std_tx_mask_list) ? 0 : 1; 856 tx_mask_inverted = usb_match_id(intf, std_tx_mask_list) ? 0 : 1;
863 857
864 /* step through the endpoints to find first bulk in and out endpoint */ 858 /* step through the endpoints to find first bulk in and out endpoint */
@@ -873,19 +867,11 @@ static int __devinit mceusb_dev_probe(struct usb_interface *intf,
873 || ((ep->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) 867 || ((ep->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK)
874 == USB_ENDPOINT_XFER_INT))) { 868 == USB_ENDPOINT_XFER_INT))) {
875 869
876 dev_dbg(&intf->dev, ": acceptable inbound endpoint "
877 "found\n");
878 ep_in = ep; 870 ep_in = ep;
879 ep_in->bmAttributes = USB_ENDPOINT_XFER_INT; 871 ep_in->bmAttributes = USB_ENDPOINT_XFER_INT;
880 if (!is_pinnacle) 872 ep_in->bInterval = 1;
881 /* 873 dev_dbg(&intf->dev, ": acceptable inbound endpoint "
882 * Ideally, we'd use what the device offers up, 874 "found\n");
883 * but that leads to non-functioning first and
884 * second-gen devices, and many devices have an
885 * invalid bInterval of 0. Pinnacle devices
886 * don't work witha bInterval of 1 though.
887 */
888 ep_in->bInterval = 1;
889 } 875 }
890 876
891 if ((ep_out == NULL) 877 if ((ep_out == NULL)
@@ -896,19 +882,11 @@ static int __devinit mceusb_dev_probe(struct usb_interface *intf,
896 || ((ep->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) 882 || ((ep->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK)
897 == USB_ENDPOINT_XFER_INT))) { 883 == USB_ENDPOINT_XFER_INT))) {
898 884
899 dev_dbg(&intf->dev, ": acceptable outbound endpoint "
900 "found\n");
901 ep_out = ep; 885 ep_out = ep;
902 ep_out->bmAttributes = USB_ENDPOINT_XFER_INT; 886 ep_out->bmAttributes = USB_ENDPOINT_XFER_INT;
903 if (!is_pinnacle) 887 ep_out->bInterval = 1;
904 /* 888 dev_dbg(&intf->dev, ": acceptable outbound endpoint "
905 * Ideally, we'd use what the device offers up, 889 "found\n");
906 * but that leads to non-functioning first and
907 * second-gen devices, and many devices have an
908 * invalid bInterval of 0. Pinnacle devices
909 * don't work witha bInterval of 1 though.
910 */
911 ep_out->bInterval = 1;
912 } 890 }
913 } 891 }
914 if (ep_in == NULL) { 892 if (ep_in == NULL) {
@@ -962,19 +940,6 @@ static int __devinit mceusb_dev_probe(struct usb_interface *intf,
962 ir->urb_in->transfer_dma = ir->dma_in; 940 ir->urb_in->transfer_dma = ir->dma_in;
963 ir->urb_in->transfer_flags |= URB_NO_TRANSFER_DMA_MAP; 941 ir->urb_in->transfer_flags |= URB_NO_TRANSFER_DMA_MAP;
964 942
965 if (is_pinnacle) {
966 /*
967 * I have no idea why but this reset seems to be crucial to
968 * getting the device to do outbound IO correctly - without
969 * this the device seems to hang, ignoring all input - although
970 * IR signals are correctly sent from the device, no input is
971 * interpreted by the device and the host never does the
972 * completion routine
973 */
974 ret = usb_reset_configuration(dev);
975 dev_info(&intf->dev, "usb reset config ret %x\n", ret);
976 }
977
978 /* initialize device */ 943 /* initialize device */
979 if (ir->flags.gen3) 944 if (ir->flags.gen3)
980 mceusb_gen3_init(ir); 945 mceusb_gen3_init(ir);