aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOndrej Zary <linux@rainbow-software.org>2009-08-06 19:09:52 -0400
committerGreg Kroah-Hartman <gregkh@suse.de>2009-09-23 09:46:32 -0400
commit5128a66c6605d8178f69b7a8f2a70060933a26b4 (patch)
tree9f0c8b119d7fcbfe821af683bd808f75892b5099
parent7b4361f0848193ddc36dfb2c9a7391c56a9df2ad (diff)
USB: ark3116: add IrDA support for Gembird UIR-22
Add IrDA support to ark3116 driver. This makes Gembird UIR-22 USB to IrDA adapter work (vendor ID 0x18ec, device ID 0x3118). This adapter contains ARK3116T USB serial chip and an IrDA transceiver, thus a command like "irattach /dev/ttyUSB0 -s" is needed. All magic numbers were captured using usbsnoop from windows driver that came with the device. Signed-off-by: Ondrej Zary <linux@rainbow-software.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
-rw-r--r--drivers/usb/serial/ark3116.c24
1 files changed, 23 insertions, 1 deletions
diff --git a/drivers/usb/serial/ark3116.c b/drivers/usb/serial/ark3116.c
index 5d25d3e52bf6..131e61adaaf7 100644
--- a/drivers/usb/serial/ark3116.c
+++ b/drivers/usb/serial/ark3116.c
@@ -31,10 +31,20 @@ static int debug;
31 31
32static struct usb_device_id id_table [] = { 32static struct usb_device_id id_table [] = {
33 { USB_DEVICE(0x6547, 0x0232) }, 33 { USB_DEVICE(0x6547, 0x0232) },
34 { USB_DEVICE(0x18ec, 0x3118) }, /* USB to IrDA adapter */
34 { }, 35 { },
35}; 36};
36MODULE_DEVICE_TABLE(usb, id_table); 37MODULE_DEVICE_TABLE(usb, id_table);
37 38
39static int is_irda(struct usb_serial *serial)
40{
41 struct usb_device *dev = serial->dev;
42 if (le16_to_cpu(dev->descriptor.idVendor) == 0x18ec &&
43 le16_to_cpu(dev->descriptor.idProduct) == 0x3118)
44 return 1;
45 return 0;
46}
47
38static inline void ARK3116_SND(struct usb_serial *serial, int seq, 48static inline void ARK3116_SND(struct usb_serial *serial, int seq,
39 __u8 request, __u8 requesttype, 49 __u8 request, __u8 requesttype,
40 __u16 value, __u16 index) 50 __u16 value, __u16 index)
@@ -84,11 +94,21 @@ static int ark3116_attach(struct usb_serial *serial)
84 return -ENOMEM; 94 return -ENOMEM;
85 } 95 }
86 96
97 if (is_irda(serial))
98 dbg("IrDA mode");
99
87 /* 3 */ 100 /* 3 */
88 ARK3116_SND(serial, 3, 0xFE, 0x40, 0x0008, 0x0002); 101 ARK3116_SND(serial, 3, 0xFE, 0x40, 0x0008, 0x0002);
89 ARK3116_SND(serial, 4, 0xFE, 0x40, 0x0008, 0x0001); 102 ARK3116_SND(serial, 4, 0xFE, 0x40, 0x0008, 0x0001);
90 ARK3116_SND(serial, 5, 0xFE, 0x40, 0x0000, 0x0008); 103 ARK3116_SND(serial, 5, 0xFE, 0x40, 0x0000, 0x0008);
91 ARK3116_SND(serial, 6, 0xFE, 0x40, 0x0000, 0x000B); 104 ARK3116_SND(serial, 6, 0xFE, 0x40, is_irda(serial) ? 0x0001 : 0x0000,
105 0x000B);
106
107 if (is_irda(serial)) {
108 ARK3116_SND(serial, 1001, 0xFE, 0x40, 0x0000, 0x000C);
109 ARK3116_SND(serial, 1002, 0xFE, 0x40, 0x0041, 0x000D);
110 ARK3116_SND(serial, 1003, 0xFE, 0x40, 0x0001, 0x000A);
111 }
92 112
93 /* <-- seq7 */ 113 /* <-- seq7 */
94 ARK3116_RCV(serial, 7, 0xFE, 0xC0, 0x0000, 0x0003, 0x00, buf); 114 ARK3116_RCV(serial, 7, 0xFE, 0xC0, 0x0000, 0x0003, 0x00, buf);
@@ -125,6 +145,8 @@ static int ark3116_attach(struct usb_serial *serial)
125 ARK3116_SND(serial, 147, 0xFE, 0x40, 0x0083, 0x0003); 145 ARK3116_SND(serial, 147, 0xFE, 0x40, 0x0083, 0x0003);
126 ARK3116_SND(serial, 148, 0xFE, 0x40, 0x0038, 0x0000); 146 ARK3116_SND(serial, 148, 0xFE, 0x40, 0x0038, 0x0000);
127 ARK3116_SND(serial, 149, 0xFE, 0x40, 0x0001, 0x0001); 147 ARK3116_SND(serial, 149, 0xFE, 0x40, 0x0001, 0x0001);
148 if (is_irda(serial))
149 ARK3116_SND(serial, 1004, 0xFE, 0x40, 0x0000, 0x0009);
128 ARK3116_SND(serial, 150, 0xFE, 0x40, 0x0003, 0x0003); 150 ARK3116_SND(serial, 150, 0xFE, 0x40, 0x0003, 0x0003);
129 ARK3116_RCV(serial, 151, 0xFE, 0xC0, 0x0000, 0x0004, 0x03, buf); 151 ARK3116_RCV(serial, 151, 0xFE, 0xC0, 0x0000, 0x0004, 0x03, buf);
130 ARK3116_SND(serial, 152, 0xFE, 0x40, 0x0000, 0x0003); 152 ARK3116_SND(serial, 152, 0xFE, 0x40, 0x0000, 0x0003);