diff options
Diffstat (limited to 'drivers/media/IR/mceusb.c')
-rw-r--r-- | drivers/media/IR/mceusb.c | 174 |
1 files changed, 109 insertions, 65 deletions
diff --git a/drivers/media/IR/mceusb.c b/drivers/media/IR/mceusb.c index 9dce684fd231..392ca24132da 100644 --- a/drivers/media/IR/mceusb.c +++ b/drivers/media/IR/mceusb.c | |||
@@ -35,10 +35,10 @@ | |||
35 | #include <linux/device.h> | 35 | #include <linux/device.h> |
36 | #include <linux/module.h> | 36 | #include <linux/module.h> |
37 | #include <linux/slab.h> | 37 | #include <linux/slab.h> |
38 | #include <linux/usb.h> | ||
39 | #include <linux/input.h> | 38 | #include <linux/input.h> |
39 | #include <linux/usb.h> | ||
40 | #include <linux/usb/input.h> | ||
40 | #include <media/ir-core.h> | 41 | #include <media/ir-core.h> |
41 | #include <media/ir-common.h> | ||
42 | 42 | ||
43 | #define DRIVER_VERSION "1.91" | 43 | #define DRIVER_VERSION "1.91" |
44 | #define DRIVER_AUTHOR "Jarod Wilson <jarod@wilsonet.com>" | 44 | #define DRIVER_AUTHOR "Jarod Wilson <jarod@wilsonet.com>" |
@@ -49,6 +49,7 @@ | |||
49 | #define USB_BUFLEN 32 /* USB reception buffer length */ | 49 | #define USB_BUFLEN 32 /* USB reception buffer length */ |
50 | #define USB_CTRL_MSG_SZ 2 /* Size of usb ctrl msg on gen1 hw */ | 50 | #define USB_CTRL_MSG_SZ 2 /* Size of usb ctrl msg on gen1 hw */ |
51 | #define MCE_G1_INIT_MSGS 40 /* Init messages on gen1 hw to throw out */ | 51 | #define MCE_G1_INIT_MSGS 40 /* Init messages on gen1 hw to throw out */ |
52 | #define MS_TO_NS(msec) ((msec) * 1000) | ||
52 | 53 | ||
53 | /* MCE constants */ | 54 | /* MCE constants */ |
54 | #define MCE_CMDBUF_SIZE 384 /* MCE Command buffer length */ | 55 | #define MCE_CMDBUF_SIZE 384 /* MCE Command buffer length */ |
@@ -74,6 +75,7 @@ | |||
74 | #define MCE_PACKET_LENGTH_MASK 0x1f /* Packet length mask */ | 75 | #define MCE_PACKET_LENGTH_MASK 0x1f /* Packet length mask */ |
75 | 76 | ||
76 | /* Sub-commands, which follow MCE_COMMAND_HEADER or MCE_HW_CMD_HEADER */ | 77 | /* Sub-commands, which follow MCE_COMMAND_HEADER or MCE_HW_CMD_HEADER */ |
78 | #define MCE_CMD_SIG_END 0x01 /* End of signal */ | ||
77 | #define MCE_CMD_PING 0x03 /* Ping device */ | 79 | #define MCE_CMD_PING 0x03 /* Ping device */ |
78 | #define MCE_CMD_UNKNOWN 0x04 /* Unknown */ | 80 | #define MCE_CMD_UNKNOWN 0x04 /* Unknown */ |
79 | #define MCE_CMD_UNKNOWN2 0x05 /* Unknown */ | 81 | #define MCE_CMD_UNKNOWN2 0x05 /* Unknown */ |
@@ -91,6 +93,7 @@ | |||
91 | #define MCE_CMD_G_TXMASK 0x13 /* Set TX port bitmask */ | 93 | #define MCE_CMD_G_TXMASK 0x13 /* Set TX port bitmask */ |
92 | #define MCE_CMD_S_RXSENSOR 0x14 /* Set RX sensor (std/learning) */ | 94 | #define MCE_CMD_S_RXSENSOR 0x14 /* Set RX sensor (std/learning) */ |
93 | #define MCE_CMD_G_RXSENSOR 0x15 /* Get RX sensor (std/learning) */ | 95 | #define MCE_CMD_G_RXSENSOR 0x15 /* Get RX sensor (std/learning) */ |
96 | #define MCE_RSP_PULSE_COUNT 0x15 /* RX pulse count (only if learning) */ | ||
94 | #define MCE_CMD_TX_PORTS 0x16 /* Get number of TX ports */ | 97 | #define MCE_CMD_TX_PORTS 0x16 /* Get number of TX ports */ |
95 | #define MCE_CMD_G_WAKESRC 0x17 /* Get wake source */ | 98 | #define MCE_CMD_G_WAKESRC 0x17 /* Get wake source */ |
96 | #define MCE_CMD_UNKNOWN7 0x18 /* Unknown */ | 99 | #define MCE_CMD_UNKNOWN7 0x18 /* Unknown */ |
@@ -146,14 +149,16 @@ enum mceusb_model_type { | |||
146 | MCE_GEN3, | 149 | MCE_GEN3, |
147 | MCE_GEN2_TX_INV, | 150 | MCE_GEN2_TX_INV, |
148 | POLARIS_EVK, | 151 | POLARIS_EVK, |
152 | CX_HYBRID_TV, | ||
149 | }; | 153 | }; |
150 | 154 | ||
151 | struct mceusb_model { | 155 | struct mceusb_model { |
152 | u32 mce_gen1:1; | 156 | u32 mce_gen1:1; |
153 | u32 mce_gen2:1; | 157 | u32 mce_gen2:1; |
154 | u32 mce_gen3:1; | 158 | u32 mce_gen3:1; |
155 | u32 tx_mask_inverted:1; | 159 | u32 tx_mask_normal:1; |
156 | u32 is_polaris:1; | 160 | u32 is_polaris:1; |
161 | u32 no_tx:1; | ||
157 | 162 | ||
158 | const char *rc_map; /* Allow specify a per-board map */ | 163 | const char *rc_map; /* Allow specify a per-board map */ |
159 | const char *name; /* per-board name */ | 164 | const char *name; /* per-board name */ |
@@ -162,18 +167,18 @@ struct mceusb_model { | |||
162 | static const struct mceusb_model mceusb_model[] = { | 167 | static const struct mceusb_model mceusb_model[] = { |
163 | [MCE_GEN1] = { | 168 | [MCE_GEN1] = { |
164 | .mce_gen1 = 1, | 169 | .mce_gen1 = 1, |
165 | .tx_mask_inverted = 1, | 170 | .tx_mask_normal = 1, |
166 | }, | 171 | }, |
167 | [MCE_GEN2] = { | 172 | [MCE_GEN2] = { |
168 | .mce_gen2 = 1, | 173 | .mce_gen2 = 1, |
169 | }, | 174 | }, |
170 | [MCE_GEN2_TX_INV] = { | 175 | [MCE_GEN2_TX_INV] = { |
171 | .mce_gen2 = 1, | 176 | .mce_gen2 = 1, |
172 | .tx_mask_inverted = 1, | 177 | .tx_mask_normal = 1, |
173 | }, | 178 | }, |
174 | [MCE_GEN3] = { | 179 | [MCE_GEN3] = { |
175 | .mce_gen3 = 1, | 180 | .mce_gen3 = 1, |
176 | .tx_mask_inverted = 1, | 181 | .tx_mask_normal = 1, |
177 | }, | 182 | }, |
178 | [POLARIS_EVK] = { | 183 | [POLARIS_EVK] = { |
179 | .is_polaris = 1, | 184 | .is_polaris = 1, |
@@ -183,7 +188,12 @@ static const struct mceusb_model mceusb_model[] = { | |||
183 | * to allow testing it | 188 | * to allow testing it |
184 | */ | 189 | */ |
185 | .rc_map = RC_MAP_RC5_HAUPPAUGE_NEW, | 190 | .rc_map = RC_MAP_RC5_HAUPPAUGE_NEW, |
186 | .name = "cx231xx MCE IR", | 191 | .name = "Conexant Hybrid TV (cx231xx) MCE IR", |
192 | }, | ||
193 | [CX_HYBRID_TV] = { | ||
194 | .is_polaris = 1, | ||
195 | .no_tx = 1, /* tx isn't wired up at all */ | ||
196 | .name = "Conexant Hybrid TV (cx231xx) MCE IR", | ||
187 | }, | 197 | }, |
188 | }; | 198 | }; |
189 | 199 | ||
@@ -273,6 +283,8 @@ static struct usb_device_id mceusb_dev_table[] = { | |||
273 | { USB_DEVICE(VENDOR_FORMOSA, 0xe03c) }, | 283 | { USB_DEVICE(VENDOR_FORMOSA, 0xe03c) }, |
274 | /* Formosa Industrial Computing */ | 284 | /* Formosa Industrial Computing */ |
275 | { USB_DEVICE(VENDOR_FORMOSA, 0xe03e) }, | 285 | { USB_DEVICE(VENDOR_FORMOSA, 0xe03e) }, |
286 | /* Fintek eHome Infrared Transceiver (HP branded) */ | ||
287 | { USB_DEVICE(VENDOR_FINTEK, 0x5168) }, | ||
276 | /* Fintek eHome Infrared Transceiver */ | 288 | /* Fintek eHome Infrared Transceiver */ |
277 | { USB_DEVICE(VENDOR_FINTEK, 0x0602) }, | 289 | { USB_DEVICE(VENDOR_FINTEK, 0x0602) }, |
278 | /* Fintek eHome Infrared Transceiver (in the AOpen MP45) */ | 290 | /* Fintek eHome Infrared Transceiver (in the AOpen MP45) */ |
@@ -292,9 +304,12 @@ static struct usb_device_id mceusb_dev_table[] = { | |||
292 | { USB_DEVICE(VENDOR_NORTHSTAR, 0xe004) }, | 304 | { USB_DEVICE(VENDOR_NORTHSTAR, 0xe004) }, |
293 | /* TiVo PC IR Receiver */ | 305 | /* TiVo PC IR Receiver */ |
294 | { USB_DEVICE(VENDOR_TIVO, 0x2000) }, | 306 | { USB_DEVICE(VENDOR_TIVO, 0x2000) }, |
295 | /* Conexant SDK */ | 307 | /* Conexant Hybrid TV "Shelby" Polaris SDK */ |
296 | { USB_DEVICE(VENDOR_CONEXANT, 0x58a1), | 308 | { USB_DEVICE(VENDOR_CONEXANT, 0x58a1), |
297 | .driver_info = POLARIS_EVK }, | 309 | .driver_info = POLARIS_EVK }, |
310 | /* Conexant Hybrid TV RDU253S Polaris */ | ||
311 | { USB_DEVICE(VENDOR_CONEXANT, 0x58a5), | ||
312 | .driver_info = CX_HYBRID_TV }, | ||
298 | /* Terminating entry */ | 313 | /* Terminating entry */ |
299 | { } | 314 | { } |
300 | }; | 315 | }; |
@@ -303,7 +318,10 @@ static struct usb_device_id mceusb_dev_table[] = { | |||
303 | struct mceusb_dev { | 318 | struct mceusb_dev { |
304 | /* ir-core bits */ | 319 | /* ir-core bits */ |
305 | struct ir_dev_props *props; | 320 | struct ir_dev_props *props; |
306 | struct ir_raw_event rawir; | 321 | |
322 | /* optional features we can enable */ | ||
323 | bool carrier_report_enabled; | ||
324 | bool learning_enabled; | ||
307 | 325 | ||
308 | /* core device bits */ | 326 | /* core device bits */ |
309 | struct device *dev; | 327 | struct device *dev; |
@@ -318,6 +336,8 @@ struct mceusb_dev { | |||
318 | /* buffers and dma */ | 336 | /* buffers and dma */ |
319 | unsigned char *buf_in; | 337 | unsigned char *buf_in; |
320 | unsigned int len_in; | 338 | unsigned int len_in; |
339 | dma_addr_t dma_in; | ||
340 | dma_addr_t dma_out; | ||
321 | 341 | ||
322 | enum { | 342 | enum { |
323 | CMD_HEADER = 0, | 343 | CMD_HEADER = 0, |
@@ -325,15 +345,14 @@ struct mceusb_dev { | |||
325 | CMD_DATA, | 345 | CMD_DATA, |
326 | PARSE_IRDATA, | 346 | PARSE_IRDATA, |
327 | } parser_state; | 347 | } parser_state; |
328 | u8 cmd, rem; /* Remaining IR data bytes in packet */ | ||
329 | 348 | ||
330 | dma_addr_t dma_in; | 349 | u8 cmd, rem; /* Remaining IR data bytes in packet */ |
331 | dma_addr_t dma_out; | ||
332 | 350 | ||
333 | struct { | 351 | struct { |
334 | u32 connected:1; | 352 | u32 connected:1; |
335 | u32 tx_mask_inverted:1; | 353 | u32 tx_mask_normal:1; |
336 | u32 microsoft_gen1:1; | 354 | u32 microsoft_gen1:1; |
355 | u32 no_tx:1; | ||
337 | } flags; | 356 | } flags; |
338 | 357 | ||
339 | /* transmit support */ | 358 | /* transmit support */ |
@@ -408,9 +427,10 @@ static int mceusb_cmdsize(u8 cmd, u8 subcmd) | |||
408 | case MCE_CMD_UNKNOWN: | 427 | case MCE_CMD_UNKNOWN: |
409 | case MCE_CMD_S_CARRIER: | 428 | case MCE_CMD_S_CARRIER: |
410 | case MCE_CMD_S_TIMEOUT: | 429 | case MCE_CMD_S_TIMEOUT: |
411 | case MCE_CMD_G_RXSENSOR: | 430 | case MCE_RSP_PULSE_COUNT: |
412 | datasize = 2; | 431 | datasize = 2; |
413 | break; | 432 | break; |
433 | case MCE_CMD_SIG_END: | ||
414 | case MCE_CMD_S_TXMASK: | 434 | case MCE_CMD_S_TXMASK: |
415 | case MCE_CMD_S_RXSENSOR: | 435 | case MCE_CMD_S_RXSENSOR: |
416 | datasize = 1; | 436 | datasize = 1; |
@@ -433,7 +453,7 @@ static void mceusb_dev_printdata(struct mceusb_dev *ir, char *buf, | |||
433 | return; | 453 | return; |
434 | 454 | ||
435 | /* skip meaningless 0xb1 0x60 header bytes on orig receiver */ | 455 | /* skip meaningless 0xb1 0x60 header bytes on orig receiver */ |
436 | if (ir->flags.microsoft_gen1 && !out) | 456 | if (ir->flags.microsoft_gen1 && !out && !offset) |
437 | skip = 2; | 457 | skip = 2; |
438 | 458 | ||
439 | if (len <= skip) | 459 | if (len <= skip) |
@@ -491,6 +511,9 @@ static void mceusb_dev_printdata(struct mceusb_dev *ir, char *buf, | |||
491 | break; | 511 | break; |
492 | case MCE_COMMAND_HEADER: | 512 | case MCE_COMMAND_HEADER: |
493 | switch (subcmd) { | 513 | switch (subcmd) { |
514 | case MCE_CMD_SIG_END: | ||
515 | dev_info(dev, "End of signal\n"); | ||
516 | break; | ||
494 | case MCE_CMD_PING: | 517 | case MCE_CMD_PING: |
495 | dev_info(dev, "Ping\n"); | 518 | dev_info(dev, "Ping\n"); |
496 | break; | 519 | break; |
@@ -525,10 +548,11 @@ static void mceusb_dev_printdata(struct mceusb_dev *ir, char *buf, | |||
525 | inout, data1 == 0x02 ? "short" : "long"); | 548 | inout, data1 == 0x02 ? "short" : "long"); |
526 | break; | 549 | break; |
527 | case MCE_CMD_G_RXSENSOR: | 550 | case MCE_CMD_G_RXSENSOR: |
528 | if (len == 2) | 551 | /* aka MCE_RSP_PULSE_COUNT */ |
552 | if (out) | ||
529 | dev_info(dev, "Get receive sensor\n"); | 553 | dev_info(dev, "Get receive sensor\n"); |
530 | else | 554 | else if (ir->learning_enabled) |
531 | dev_info(dev, "Received pulse count is %d\n", | 555 | dev_info(dev, "RX pulse count: %d\n", |
532 | ((data1 << 8) | data2)); | 556 | ((data1 << 8) | data2)); |
533 | break; | 557 | break; |
534 | case MCE_RSP_CMD_INVALID: | 558 | case MCE_RSP_CMD_INVALID: |
@@ -724,16 +748,16 @@ out: | |||
724 | return ret ? ret : n; | 748 | return ret ? ret : n; |
725 | } | 749 | } |
726 | 750 | ||
727 | /* Sets active IR outputs -- mce devices typically (all?) have two */ | 751 | /* Sets active IR outputs -- mce devices typically have two */ |
728 | static int mceusb_set_tx_mask(void *priv, u32 mask) | 752 | static int mceusb_set_tx_mask(void *priv, u32 mask) |
729 | { | 753 | { |
730 | struct mceusb_dev *ir = priv; | 754 | struct mceusb_dev *ir = priv; |
731 | 755 | ||
732 | if (ir->flags.tx_mask_inverted) | 756 | if (ir->flags.tx_mask_normal) |
757 | ir->tx_mask = mask; | ||
758 | else | ||
733 | ir->tx_mask = (mask != MCE_DEFAULT_TX_MASK ? | 759 | ir->tx_mask = (mask != MCE_DEFAULT_TX_MASK ? |
734 | mask ^ MCE_DEFAULT_TX_MASK : mask) << 1; | 760 | mask ^ MCE_DEFAULT_TX_MASK : mask) << 1; |
735 | else | ||
736 | ir->tx_mask = mask; | ||
737 | 761 | ||
738 | return 0; | 762 | return 0; |
739 | } | 763 | } |
@@ -752,7 +776,7 @@ static int mceusb_set_tx_carrier(void *priv, u32 carrier) | |||
752 | 776 | ||
753 | if (carrier == 0) { | 777 | if (carrier == 0) { |
754 | ir->carrier = carrier; | 778 | ir->carrier = carrier; |
755 | cmdbuf[2] = 0x01; | 779 | cmdbuf[2] = MCE_CMD_SIG_END; |
756 | cmdbuf[3] = MCE_IRDATA_TRAILER; | 780 | cmdbuf[3] = MCE_IRDATA_TRAILER; |
757 | dev_dbg(ir->dev, "%s: disabling carrier " | 781 | dev_dbg(ir->dev, "%s: disabling carrier " |
758 | "modulation\n", __func__); | 782 | "modulation\n", __func__); |
@@ -782,6 +806,34 @@ static int mceusb_set_tx_carrier(void *priv, u32 carrier) | |||
782 | return carrier; | 806 | return carrier; |
783 | } | 807 | } |
784 | 808 | ||
809 | /* | ||
810 | * We don't do anything but print debug spew for many of the command bits | ||
811 | * we receive from the hardware, but some of them are useful information | ||
812 | * we want to store so that we can use them. | ||
813 | */ | ||
814 | static void mceusb_handle_command(struct mceusb_dev *ir, int index) | ||
815 | { | ||
816 | u8 hi = ir->buf_in[index + 1] & 0xff; | ||
817 | u8 lo = ir->buf_in[index + 2] & 0xff; | ||
818 | |||
819 | switch (ir->buf_in[index]) { | ||
820 | /* 2-byte return value commands */ | ||
821 | case MCE_CMD_S_TIMEOUT: | ||
822 | ir->props->timeout = MS_TO_NS((hi << 8 | lo) / 2); | ||
823 | break; | ||
824 | |||
825 | /* 1-byte return value commands */ | ||
826 | case MCE_CMD_S_TXMASK: | ||
827 | ir->tx_mask = hi; | ||
828 | break; | ||
829 | case MCE_CMD_S_RXSENSOR: | ||
830 | ir->learning_enabled = (hi == 0x02); | ||
831 | break; | ||
832 | default: | ||
833 | break; | ||
834 | } | ||
835 | } | ||
836 | |||
785 | static void mceusb_process_ir_data(struct mceusb_dev *ir, int buf_len) | 837 | static void mceusb_process_ir_data(struct mceusb_dev *ir, int buf_len) |
786 | { | 838 | { |
787 | DEFINE_IR_RAW_EVENT(rawir); | 839 | DEFINE_IR_RAW_EVENT(rawir); |
@@ -791,39 +843,30 @@ static void mceusb_process_ir_data(struct mceusb_dev *ir, int buf_len) | |||
791 | if (ir->flags.microsoft_gen1) | 843 | if (ir->flags.microsoft_gen1) |
792 | i = 2; | 844 | i = 2; |
793 | 845 | ||
846 | /* if there's no data, just return now */ | ||
847 | if (buf_len <= i) | ||
848 | return; | ||
849 | |||
794 | for (; i < buf_len; i++) { | 850 | for (; i < buf_len; i++) { |
795 | switch (ir->parser_state) { | 851 | switch (ir->parser_state) { |
796 | case SUBCMD: | 852 | case SUBCMD: |
797 | ir->rem = mceusb_cmdsize(ir->cmd, ir->buf_in[i]); | 853 | ir->rem = mceusb_cmdsize(ir->cmd, ir->buf_in[i]); |
798 | mceusb_dev_printdata(ir, ir->buf_in, i - 1, | 854 | mceusb_dev_printdata(ir, ir->buf_in, i - 1, |
799 | ir->rem + 2, false); | 855 | ir->rem + 2, false); |
856 | mceusb_handle_command(ir, i); | ||
800 | ir->parser_state = CMD_DATA; | 857 | ir->parser_state = CMD_DATA; |
801 | break; | 858 | break; |
802 | case PARSE_IRDATA: | 859 | case PARSE_IRDATA: |
803 | ir->rem--; | 860 | ir->rem--; |
804 | rawir.pulse = ((ir->buf_in[i] & MCE_PULSE_BIT) != 0); | 861 | rawir.pulse = ((ir->buf_in[i] & MCE_PULSE_BIT) != 0); |
805 | rawir.duration = (ir->buf_in[i] & MCE_PULSE_MASK) | 862 | rawir.duration = (ir->buf_in[i] & MCE_PULSE_MASK) |
806 | * MCE_TIME_UNIT * 1000; | 863 | * MS_TO_NS(MCE_TIME_UNIT); |
807 | |||
808 | if ((ir->buf_in[i] & MCE_PULSE_MASK) == 0x7f) { | ||
809 | if (ir->rawir.pulse == rawir.pulse) { | ||
810 | ir->rawir.duration += rawir.duration; | ||
811 | } else { | ||
812 | ir->rawir.duration = rawir.duration; | ||
813 | ir->rawir.pulse = rawir.pulse; | ||
814 | } | ||
815 | if (ir->rem) | ||
816 | break; | ||
817 | } | ||
818 | rawir.duration += ir->rawir.duration; | ||
819 | ir->rawir.duration = 0; | ||
820 | ir->rawir.pulse = rawir.pulse; | ||
821 | 864 | ||
822 | dev_dbg(ir->dev, "Storing %s with duration %d\n", | 865 | dev_dbg(ir->dev, "Storing %s with duration %d\n", |
823 | rawir.pulse ? "pulse" : "space", | 866 | rawir.pulse ? "pulse" : "space", |
824 | rawir.duration); | 867 | rawir.duration); |
825 | 868 | ||
826 | ir_raw_event_store(ir->idev, &rawir); | 869 | ir_raw_event_store_with_filter(ir->idev, &rawir); |
827 | break; | 870 | break; |
828 | case CMD_DATA: | 871 | case CMD_DATA: |
829 | ir->rem--; | 872 | ir->rem--; |
@@ -839,17 +882,10 @@ static void mceusb_process_ir_data(struct mceusb_dev *ir, int buf_len) | |||
839 | continue; | 882 | continue; |
840 | } | 883 | } |
841 | ir->rem = (ir->cmd & MCE_PACKET_LENGTH_MASK); | 884 | ir->rem = (ir->cmd & MCE_PACKET_LENGTH_MASK); |
842 | mceusb_dev_printdata(ir, ir->buf_in, i, ir->rem + 1, false); | 885 | mceusb_dev_printdata(ir, ir->buf_in, |
843 | if (ir->rem) { | 886 | i, ir->rem + 1, false); |
887 | if (ir->rem) | ||
844 | ir->parser_state = PARSE_IRDATA; | 888 | ir->parser_state = PARSE_IRDATA; |
845 | break; | ||
846 | } | ||
847 | /* | ||
848 | * a package with len=0 (e. g. 0x80) means end of | ||
849 | * data. We could use it to do the call to | ||
850 | * ir_raw_event_handle(). For now, we don't need to | ||
851 | * use it. | ||
852 | */ | ||
853 | break; | 889 | break; |
854 | } | 890 | } |
855 | 891 | ||
@@ -984,9 +1020,11 @@ static void mceusb_get_parameters(struct mceusb_dev *ir) | |||
984 | mce_async_out(ir, GET_CARRIER_FREQ, sizeof(GET_CARRIER_FREQ)); | 1020 | mce_async_out(ir, GET_CARRIER_FREQ, sizeof(GET_CARRIER_FREQ)); |
985 | mce_sync_in(ir, NULL, maxp); | 1021 | mce_sync_in(ir, NULL, maxp); |
986 | 1022 | ||
987 | /* get the transmitter bitmask */ | 1023 | if (!ir->flags.no_tx) { |
988 | mce_async_out(ir, GET_TX_BITMASK, sizeof(GET_TX_BITMASK)); | 1024 | /* get the transmitter bitmask */ |
989 | mce_sync_in(ir, NULL, maxp); | 1025 | mce_async_out(ir, GET_TX_BITMASK, sizeof(GET_TX_BITMASK)); |
1026 | mce_sync_in(ir, NULL, maxp); | ||
1027 | } | ||
990 | 1028 | ||
991 | /* get receiver timeout value */ | 1029 | /* get receiver timeout value */ |
992 | mce_async_out(ir, GET_RX_TIMEOUT, sizeof(GET_RX_TIMEOUT)); | 1030 | mce_async_out(ir, GET_RX_TIMEOUT, sizeof(GET_RX_TIMEOUT)); |
@@ -1035,12 +1073,18 @@ static struct input_dev *mceusb_init_input_dev(struct mceusb_dev *ir) | |||
1035 | props->priv = ir; | 1073 | props->priv = ir; |
1036 | props->driver_type = RC_DRIVER_IR_RAW; | 1074 | props->driver_type = RC_DRIVER_IR_RAW; |
1037 | props->allowed_protos = IR_TYPE_ALL; | 1075 | props->allowed_protos = IR_TYPE_ALL; |
1038 | props->s_tx_mask = mceusb_set_tx_mask; | 1076 | props->timeout = MS_TO_NS(1000); |
1039 | props->s_tx_carrier = mceusb_set_tx_carrier; | 1077 | if (!ir->flags.no_tx) { |
1040 | props->tx_ir = mceusb_tx_ir; | 1078 | props->s_tx_mask = mceusb_set_tx_mask; |
1079 | props->s_tx_carrier = mceusb_set_tx_carrier; | ||
1080 | props->tx_ir = mceusb_tx_ir; | ||
1081 | } | ||
1041 | 1082 | ||
1042 | ir->props = props; | 1083 | ir->props = props; |
1043 | 1084 | ||
1085 | usb_to_input_id(ir->usbdev, &idev->id); | ||
1086 | idev->dev.parent = ir->dev; | ||
1087 | |||
1044 | if (mceusb_model[ir->model].rc_map) | 1088 | if (mceusb_model[ir->model].rc_map) |
1045 | rc_map = mceusb_model[ir->model].rc_map; | 1089 | rc_map = mceusb_model[ir->model].rc_map; |
1046 | 1090 | ||
@@ -1074,16 +1118,16 @@ static int __devinit mceusb_dev_probe(struct usb_interface *intf, | |||
1074 | enum mceusb_model_type model = id->driver_info; | 1118 | enum mceusb_model_type model = id->driver_info; |
1075 | bool is_gen3; | 1119 | bool is_gen3; |
1076 | bool is_microsoft_gen1; | 1120 | bool is_microsoft_gen1; |
1077 | bool tx_mask_inverted; | 1121 | bool tx_mask_normal; |
1078 | bool is_polaris; | 1122 | bool is_polaris; |
1079 | 1123 | ||
1080 | dev_dbg(&intf->dev, ": %s called\n", __func__); | 1124 | dev_dbg(&intf->dev, "%s called\n", __func__); |
1081 | 1125 | ||
1082 | idesc = intf->cur_altsetting; | 1126 | idesc = intf->cur_altsetting; |
1083 | 1127 | ||
1084 | is_gen3 = mceusb_model[model].mce_gen3; | 1128 | is_gen3 = mceusb_model[model].mce_gen3; |
1085 | is_microsoft_gen1 = mceusb_model[model].mce_gen1; | 1129 | is_microsoft_gen1 = mceusb_model[model].mce_gen1; |
1086 | tx_mask_inverted = mceusb_model[model].tx_mask_inverted; | 1130 | tx_mask_normal = mceusb_model[model].tx_mask_normal; |
1087 | is_polaris = mceusb_model[model].is_polaris; | 1131 | is_polaris = mceusb_model[model].is_polaris; |
1088 | 1132 | ||
1089 | if (is_polaris) { | 1133 | if (is_polaris) { |
@@ -1107,7 +1151,7 @@ static int __devinit mceusb_dev_probe(struct usb_interface *intf, | |||
1107 | ep_in = ep; | 1151 | ep_in = ep; |
1108 | ep_in->bmAttributes = USB_ENDPOINT_XFER_INT; | 1152 | ep_in->bmAttributes = USB_ENDPOINT_XFER_INT; |
1109 | ep_in->bInterval = 1; | 1153 | ep_in->bInterval = 1; |
1110 | dev_dbg(&intf->dev, ": acceptable inbound endpoint " | 1154 | dev_dbg(&intf->dev, "acceptable inbound endpoint " |
1111 | "found\n"); | 1155 | "found\n"); |
1112 | } | 1156 | } |
1113 | 1157 | ||
@@ -1122,12 +1166,12 @@ static int __devinit mceusb_dev_probe(struct usb_interface *intf, | |||
1122 | ep_out = ep; | 1166 | ep_out = ep; |
1123 | ep_out->bmAttributes = USB_ENDPOINT_XFER_INT; | 1167 | ep_out->bmAttributes = USB_ENDPOINT_XFER_INT; |
1124 | ep_out->bInterval = 1; | 1168 | ep_out->bInterval = 1; |
1125 | dev_dbg(&intf->dev, ": acceptable outbound endpoint " | 1169 | dev_dbg(&intf->dev, "acceptable outbound endpoint " |
1126 | "found\n"); | 1170 | "found\n"); |
1127 | } | 1171 | } |
1128 | } | 1172 | } |
1129 | if (ep_in == NULL) { | 1173 | if (ep_in == NULL) { |
1130 | dev_dbg(&intf->dev, ": inbound and/or endpoint not found\n"); | 1174 | dev_dbg(&intf->dev, "inbound and/or endpoint not found\n"); |
1131 | return -ENODEV; | 1175 | return -ENODEV; |
1132 | } | 1176 | } |
1133 | 1177 | ||
@@ -1150,11 +1194,10 @@ static int __devinit mceusb_dev_probe(struct usb_interface *intf, | |||
1150 | ir->dev = &intf->dev; | 1194 | ir->dev = &intf->dev; |
1151 | ir->len_in = maxp; | 1195 | ir->len_in = maxp; |
1152 | ir->flags.microsoft_gen1 = is_microsoft_gen1; | 1196 | ir->flags.microsoft_gen1 = is_microsoft_gen1; |
1153 | ir->flags.tx_mask_inverted = tx_mask_inverted; | 1197 | ir->flags.tx_mask_normal = tx_mask_normal; |
1198 | ir->flags.no_tx = mceusb_model[model].no_tx; | ||
1154 | ir->model = model; | 1199 | ir->model = model; |
1155 | 1200 | ||
1156 | init_ir_raw_event(&ir->rawir); | ||
1157 | |||
1158 | /* Saving usb interface data for use by the transmitter routine */ | 1201 | /* Saving usb interface data for use by the transmitter routine */ |
1159 | ir->usb_ep_in = ep_in; | 1202 | ir->usb_ep_in = ep_in; |
1160 | ir->usb_ep_out = ep_out; | 1203 | ir->usb_ep_out = ep_out; |
@@ -1191,7 +1234,8 @@ static int __devinit mceusb_dev_probe(struct usb_interface *intf, | |||
1191 | 1234 | ||
1192 | mceusb_get_parameters(ir); | 1235 | mceusb_get_parameters(ir); |
1193 | 1236 | ||
1194 | mceusb_set_tx_mask(ir, MCE_DEFAULT_TX_MASK); | 1237 | if (!ir->flags.no_tx) |
1238 | mceusb_set_tx_mask(ir, MCE_DEFAULT_TX_MASK); | ||
1195 | 1239 | ||
1196 | usb_set_intfdata(intf, ir); | 1240 | usb_set_intfdata(intf, ir); |
1197 | 1241 | ||