| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | /* | 
 | 2 |  * USB Compaq iPAQ driver | 
 | 3 |  * | 
 | 4 |  *	Copyright (C) 2001 - 2002 | 
 | 5 |  *	    Ganesh Varadarajan <ganesh@veritas.com> | 
 | 6 |  * | 
 | 7 |  *	This program is free software; you can redistribute it and/or modify | 
 | 8 |  *	it under the terms of the GNU General Public License as published by | 
 | 9 |  *	the Free Software Foundation; either version 2 of the License, or | 
 | 10 |  *	(at your option) any later version. | 
 | 11 |  * | 
 | 12 |  * (12/12/2002) ganesh | 
 | 13 |  * 	Added support for practically all devices supported by ActiveSync | 
 | 14 |  * 	on Windows. Thanks to Wes Cilldhaire <billybobjoehenrybob@hotmail.com>. | 
 | 15 |  * | 
 | 16 |  * (26/11/2002) ganesh | 
 | 17 |  * 	Added insmod options to specify product and vendor id. | 
 | 18 |  * 	Use modprobe ipaq vendor=0xfoo product=0xbar | 
 | 19 |  * | 
 | 20 |  * (26/7/2002) ganesh | 
 | 21 |  * 	Fixed up broken error handling in ipaq_open. Retry the "kickstart" | 
 | 22 |  * 	packet much harder - this drastically reduces connection failures. | 
 | 23 |  * | 
 | 24 |  * (30/4/2002) ganesh | 
 | 25 |  * 	Added support for the Casio EM500. Completely untested. Thanks | 
 | 26 |  * 	to info from Nathan <wfilardo@fuse.net> | 
 | 27 |  * | 
 | 28 |  * (19/3/2002) ganesh | 
 | 29 |  *	Don't submit urbs while holding spinlocks. Not strictly necessary | 
 | 30 |  *	in 2.5.x. | 
 | 31 |  * | 
 | 32 |  * (8/3/2002) ganesh | 
 | 33 |  * 	The ipaq sometimes emits a '\0' before the CLIENT string. At this | 
 | 34 |  * 	point of time, the ppp ldisc is not yet attached to the tty, so | 
 | 35 |  * 	n_tty echoes "^ " to the ipaq, which messes up the chat. In 2.5.6-pre2 | 
 | 36 |  * 	this causes a panic because echo_char() tries to sleep in interrupt | 
 | 37 |  * 	context. | 
 | 38 |  * 	The fix is to tell the upper layers that this is a raw device so that | 
 | 39 |  * 	echoing is suppressed. Thanks to Lyle Lindholm for a detailed bug | 
 | 40 |  * 	report. | 
 | 41 |  * | 
 | 42 |  * (25/2/2002) ganesh | 
 | 43 |  * 	Added support for the HP Jornada 548 and 568. Completely untested. | 
 | 44 |  * 	Thanks to info from Heath Robinson and Arieh Davidoff. | 
 | 45 |  */ | 
 | 46 |  | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 47 | #include <linux/kernel.h> | 
 | 48 | #include <linux/errno.h> | 
 | 49 | #include <linux/init.h> | 
 | 50 | #include <linux/slab.h> | 
 | 51 | #include <linux/tty.h> | 
 | 52 | #include <linux/tty_driver.h> | 
 | 53 | #include <linux/tty_flip.h> | 
 | 54 | #include <linux/module.h> | 
 | 55 | #include <linux/spinlock.h> | 
| Alan Cox | eb6215c | 2008-07-22 11:12:41 +0100 | [diff] [blame] | 56 | #include <linux/uaccess.h> | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 57 | #include <linux/usb.h> | 
| Greg Kroah-Hartman | a969888 | 2006-07-11 21:22:58 -0700 | [diff] [blame] | 58 | #include <linux/usb/serial.h> | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 59 | #include "ipaq.h" | 
 | 60 |  | 
 | 61 | #define KP_RETRIES	100 | 
 | 62 |  | 
 | 63 | /* | 
 | 64 |  * Version Information | 
 | 65 |  */ | 
 | 66 |  | 
 | 67 | #define DRIVER_VERSION "v0.5" | 
 | 68 | #define DRIVER_AUTHOR "Ganesh Varadarajan <ganesh@veritas.com>" | 
 | 69 | #define DRIVER_DESC "USB PocketPC PDA driver" | 
 | 70 |  | 
 | 71 | static __u16 product, vendor; | 
 | 72 | static int debug; | 
| Frank Gevaerts | b33488e | 2006-06-30 02:34:45 -0700 | [diff] [blame] | 73 | static int connect_retries = KP_RETRIES; | 
 | 74 | static int initial_wait; | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 75 |  | 
 | 76 | /* Function prototypes for an ipaq */ | 
| Alan Cox | 95da310 | 2008-07-22 11:09:07 +0100 | [diff] [blame] | 77 | static int  ipaq_open(struct tty_struct *tty, | 
| Alan Cox | a509a7e | 2009-09-19 13:13:26 -0700 | [diff] [blame] | 78 | 			struct usb_serial_port *port); | 
| Alan Cox | 335f851 | 2009-06-11 12:26:29 +0100 | [diff] [blame] | 79 | static void ipaq_close(struct usb_serial_port *port); | 
| Mark Ellis | 1b8fb41 | 2009-03-09 22:24:29 +0000 | [diff] [blame] | 80 | static int  ipaq_calc_num_ports(struct usb_serial *serial); | 
| Alan Cox | 95da310 | 2008-07-22 11:09:07 +0100 | [diff] [blame] | 81 | static int  ipaq_startup(struct usb_serial *serial); | 
| Alan Cox | 95da310 | 2008-07-22 11:09:07 +0100 | [diff] [blame] | 82 | static int ipaq_write(struct tty_struct *tty, struct usb_serial_port *port, | 
 | 83 | 			const unsigned char *buf, int count); | 
| Alan Cox | eb6215c | 2008-07-22 11:12:41 +0100 | [diff] [blame] | 84 | static int ipaq_write_bulk(struct usb_serial_port *port, | 
 | 85 | 				const unsigned char *buf, int count); | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 86 | static void ipaq_write_gather(struct usb_serial_port *port); | 
| Alan Cox | eb6215c | 2008-07-22 11:12:41 +0100 | [diff] [blame] | 87 | static void ipaq_read_bulk_callback(struct urb *urb); | 
| David Howells | 7d12e78 | 2006-10-05 14:55:46 +0100 | [diff] [blame] | 88 | static void ipaq_write_bulk_callback(struct urb *urb); | 
| Alan Cox | 95da310 | 2008-07-22 11:09:07 +0100 | [diff] [blame] | 89 | static int ipaq_write_room(struct tty_struct *tty); | 
 | 90 | static int ipaq_chars_in_buffer(struct tty_struct *tty); | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 91 | static void ipaq_destroy_lists(struct usb_serial_port *port); | 
 | 92 |  | 
 | 93 |  | 
 | 94 | static struct usb_device_id ipaq_id_table [] = { | 
 | 95 | 	/* The first entry is a placeholder for the insmod-specified device */ | 
 | 96 | 	{ USB_DEVICE(0x049F, 0x0003) }, | 
| David Eriksson | eb3c5ed | 2005-10-18 20:12:24 +0200 | [diff] [blame] | 97 | 	{ USB_DEVICE(0x0104, 0x00BE) }, /* Socket USB Sync */ | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 98 | 	{ USB_DEVICE(0x03F0, 0x1016) }, /* HP USB Sync */ | 
 | 99 | 	{ USB_DEVICE(0x03F0, 0x1116) }, /* HP USB Sync 1611 */ | 
 | 100 | 	{ USB_DEVICE(0x03F0, 0x1216) }, /* HP USB Sync 1612 */ | 
 | 101 | 	{ USB_DEVICE(0x03F0, 0x2016) }, /* HP USB Sync 1620 */ | 
 | 102 | 	{ USB_DEVICE(0x03F0, 0x2116) }, /* HP USB Sync 1621 */ | 
 | 103 | 	{ USB_DEVICE(0x03F0, 0x2216) }, /* HP USB Sync 1622 */ | 
 | 104 | 	{ USB_DEVICE(0x03F0, 0x3016) }, /* HP USB Sync 1630 */ | 
 | 105 | 	{ USB_DEVICE(0x03F0, 0x3116) }, /* HP USB Sync 1631 */ | 
 | 106 | 	{ USB_DEVICE(0x03F0, 0x3216) }, /* HP USB Sync 1632 */ | 
 | 107 | 	{ USB_DEVICE(0x03F0, 0x4016) }, /* HP USB Sync 1640 */ | 
 | 108 | 	{ USB_DEVICE(0x03F0, 0x4116) }, /* HP USB Sync 1641 */ | 
 | 109 | 	{ USB_DEVICE(0x03F0, 0x4216) }, /* HP USB Sync 1642 */ | 
 | 110 | 	{ USB_DEVICE(0x03F0, 0x5016) }, /* HP USB Sync 1650 */ | 
 | 111 | 	{ USB_DEVICE(0x03F0, 0x5116) }, /* HP USB Sync 1651 */ | 
 | 112 | 	{ USB_DEVICE(0x03F0, 0x5216) }, /* HP USB Sync 1652 */ | 
| David Eriksson | eb3c5ed | 2005-10-18 20:12:24 +0200 | [diff] [blame] | 113 | 	{ USB_DEVICE(0x0409, 0x00D5) }, /* NEC USB Sync */ | 
 | 114 | 	{ USB_DEVICE(0x0409, 0x00D6) }, /* NEC USB Sync */ | 
 | 115 | 	{ USB_DEVICE(0x0409, 0x00D7) }, /* NEC USB Sync */ | 
 | 116 | 	{ USB_DEVICE(0x0409, 0x8024) }, /* NEC USB Sync */ | 
 | 117 | 	{ USB_DEVICE(0x0409, 0x8025) }, /* NEC USB Sync */ | 
 | 118 | 	{ USB_DEVICE(0x043E, 0x9C01) }, /* LGE USB Sync */ | 
 | 119 | 	{ USB_DEVICE(0x045E, 0x00CE) }, /* Microsoft USB Sync */ | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 120 | 	{ USB_DEVICE(0x045E, 0x0400) }, /* Windows Powered Pocket PC 2002 */ | 
 | 121 | 	{ USB_DEVICE(0x045E, 0x0401) }, /* Windows Powered Pocket PC 2002 */ | 
 | 122 | 	{ USB_DEVICE(0x045E, 0x0402) }, /* Windows Powered Pocket PC 2002 */ | 
 | 123 | 	{ USB_DEVICE(0x045E, 0x0403) }, /* Windows Powered Pocket PC 2002 */ | 
 | 124 | 	{ USB_DEVICE(0x045E, 0x0404) }, /* Windows Powered Pocket PC 2002 */ | 
 | 125 | 	{ USB_DEVICE(0x045E, 0x0405) }, /* Windows Powered Pocket PC 2002 */ | 
 | 126 | 	{ USB_DEVICE(0x045E, 0x0406) }, /* Windows Powered Pocket PC 2002 */ | 
 | 127 | 	{ USB_DEVICE(0x045E, 0x0407) }, /* Windows Powered Pocket PC 2002 */ | 
 | 128 | 	{ USB_DEVICE(0x045E, 0x0408) }, /* Windows Powered Pocket PC 2002 */ | 
 | 129 | 	{ USB_DEVICE(0x045E, 0x0409) }, /* Windows Powered Pocket PC 2002 */ | 
 | 130 | 	{ USB_DEVICE(0x045E, 0x040A) }, /* Windows Powered Pocket PC 2002 */ | 
 | 131 | 	{ USB_DEVICE(0x045E, 0x040B) }, /* Windows Powered Pocket PC 2002 */ | 
 | 132 | 	{ USB_DEVICE(0x045E, 0x040C) }, /* Windows Powered Pocket PC 2002 */ | 
 | 133 | 	{ USB_DEVICE(0x045E, 0x040D) }, /* Windows Powered Pocket PC 2002 */ | 
 | 134 | 	{ USB_DEVICE(0x045E, 0x040E) }, /* Windows Powered Pocket PC 2002 */ | 
 | 135 | 	{ USB_DEVICE(0x045E, 0x040F) }, /* Windows Powered Pocket PC 2002 */ | 
 | 136 | 	{ USB_DEVICE(0x045E, 0x0410) }, /* Windows Powered Pocket PC 2002 */ | 
 | 137 | 	{ USB_DEVICE(0x045E, 0x0411) }, /* Windows Powered Pocket PC 2002 */ | 
 | 138 | 	{ USB_DEVICE(0x045E, 0x0412) }, /* Windows Powered Pocket PC 2002 */ | 
 | 139 | 	{ USB_DEVICE(0x045E, 0x0413) }, /* Windows Powered Pocket PC 2002 */ | 
 | 140 | 	{ USB_DEVICE(0x045E, 0x0414) }, /* Windows Powered Pocket PC 2002 */ | 
 | 141 | 	{ USB_DEVICE(0x045E, 0x0415) }, /* Windows Powered Pocket PC 2002 */ | 
 | 142 | 	{ USB_DEVICE(0x045E, 0x0416) }, /* Windows Powered Pocket PC 2002 */ | 
 | 143 | 	{ USB_DEVICE(0x045E, 0x0417) }, /* Windows Powered Pocket PC 2002 */ | 
 | 144 | 	{ USB_DEVICE(0x045E, 0x0432) }, /* Windows Powered Pocket PC 2003 */ | 
 | 145 | 	{ USB_DEVICE(0x045E, 0x0433) }, /* Windows Powered Pocket PC 2003 */ | 
 | 146 | 	{ USB_DEVICE(0x045E, 0x0434) }, /* Windows Powered Pocket PC 2003 */ | 
 | 147 | 	{ USB_DEVICE(0x045E, 0x0435) }, /* Windows Powered Pocket PC 2003 */ | 
 | 148 | 	{ USB_DEVICE(0x045E, 0x0436) }, /* Windows Powered Pocket PC 2003 */ | 
 | 149 | 	{ USB_DEVICE(0x045E, 0x0437) }, /* Windows Powered Pocket PC 2003 */ | 
 | 150 | 	{ USB_DEVICE(0x045E, 0x0438) }, /* Windows Powered Pocket PC 2003 */ | 
 | 151 | 	{ USB_DEVICE(0x045E, 0x0439) }, /* Windows Powered Pocket PC 2003 */ | 
 | 152 | 	{ USB_DEVICE(0x045E, 0x043A) }, /* Windows Powered Pocket PC 2003 */ | 
 | 153 | 	{ USB_DEVICE(0x045E, 0x043B) }, /* Windows Powered Pocket PC 2003 */ | 
 | 154 | 	{ USB_DEVICE(0x045E, 0x043C) }, /* Windows Powered Pocket PC 2003 */ | 
 | 155 | 	{ USB_DEVICE(0x045E, 0x043D) }, /* Windows Powered Pocket PC 2003 */ | 
 | 156 | 	{ USB_DEVICE(0x045E, 0x043E) }, /* Windows Powered Pocket PC 2003 */ | 
 | 157 | 	{ USB_DEVICE(0x045E, 0x043F) }, /* Windows Powered Pocket PC 2003 */ | 
 | 158 | 	{ USB_DEVICE(0x045E, 0x0440) }, /* Windows Powered Pocket PC 2003 */ | 
 | 159 | 	{ USB_DEVICE(0x045E, 0x0441) }, /* Windows Powered Pocket PC 2003 */ | 
 | 160 | 	{ USB_DEVICE(0x045E, 0x0442) }, /* Windows Powered Pocket PC 2003 */ | 
 | 161 | 	{ USB_DEVICE(0x045E, 0x0443) }, /* Windows Powered Pocket PC 2003 */ | 
 | 162 | 	{ USB_DEVICE(0x045E, 0x0444) }, /* Windows Powered Pocket PC 2003 */ | 
 | 163 | 	{ USB_DEVICE(0x045E, 0x0445) }, /* Windows Powered Pocket PC 2003 */ | 
 | 164 | 	{ USB_DEVICE(0x045E, 0x0446) }, /* Windows Powered Pocket PC 2003 */ | 
 | 165 | 	{ USB_DEVICE(0x045E, 0x0447) }, /* Windows Powered Pocket PC 2003 */ | 
 | 166 | 	{ USB_DEVICE(0x045E, 0x0448) }, /* Windows Powered Pocket PC 2003 */ | 
 | 167 | 	{ USB_DEVICE(0x045E, 0x0449) }, /* Windows Powered Pocket PC 2003 */ | 
 | 168 | 	{ USB_DEVICE(0x045E, 0x044A) }, /* Windows Powered Pocket PC 2003 */ | 
 | 169 | 	{ USB_DEVICE(0x045E, 0x044B) }, /* Windows Powered Pocket PC 2003 */ | 
 | 170 | 	{ USB_DEVICE(0x045E, 0x044C) }, /* Windows Powered Pocket PC 2003 */ | 
 | 171 | 	{ USB_DEVICE(0x045E, 0x044D) }, /* Windows Powered Pocket PC 2003 */ | 
 | 172 | 	{ USB_DEVICE(0x045E, 0x044E) }, /* Windows Powered Pocket PC 2003 */ | 
 | 173 | 	{ USB_DEVICE(0x045E, 0x044F) }, /* Windows Powered Pocket PC 2003 */ | 
 | 174 | 	{ USB_DEVICE(0x045E, 0x0450) }, /* Windows Powered Pocket PC 2003 */ | 
 | 175 | 	{ USB_DEVICE(0x045E, 0x0451) }, /* Windows Powered Pocket PC 2003 */ | 
 | 176 | 	{ USB_DEVICE(0x045E, 0x0452) }, /* Windows Powered Pocket PC 2003 */ | 
 | 177 | 	{ USB_DEVICE(0x045E, 0x0453) }, /* Windows Powered Pocket PC 2003 */ | 
 | 178 | 	{ USB_DEVICE(0x045E, 0x0454) }, /* Windows Powered Pocket PC 2003 */ | 
 | 179 | 	{ USB_DEVICE(0x045E, 0x0455) }, /* Windows Powered Pocket PC 2003 */ | 
 | 180 | 	{ USB_DEVICE(0x045E, 0x0456) }, /* Windows Powered Pocket PC 2003 */ | 
 | 181 | 	{ USB_DEVICE(0x045E, 0x0457) }, /* Windows Powered Pocket PC 2003 */ | 
 | 182 | 	{ USB_DEVICE(0x045E, 0x0458) }, /* Windows Powered Pocket PC 2003 */ | 
 | 183 | 	{ USB_DEVICE(0x045E, 0x0459) }, /* Windows Powered Pocket PC 2003 */ | 
 | 184 | 	{ USB_DEVICE(0x045E, 0x045A) }, /* Windows Powered Pocket PC 2003 */ | 
 | 185 | 	{ USB_DEVICE(0x045E, 0x045B) }, /* Windows Powered Pocket PC 2003 */ | 
 | 186 | 	{ USB_DEVICE(0x045E, 0x045C) }, /* Windows Powered Pocket PC 2003 */ | 
 | 187 | 	{ USB_DEVICE(0x045E, 0x045D) }, /* Windows Powered Pocket PC 2003 */ | 
 | 188 | 	{ USB_DEVICE(0x045E, 0x045E) }, /* Windows Powered Pocket PC 2003 */ | 
 | 189 | 	{ USB_DEVICE(0x045E, 0x045F) }, /* Windows Powered Pocket PC 2003 */ | 
 | 190 | 	{ USB_DEVICE(0x045E, 0x0460) }, /* Windows Powered Pocket PC 2003 */ | 
 | 191 | 	{ USB_DEVICE(0x045E, 0x0461) }, /* Windows Powered Pocket PC 2003 */ | 
 | 192 | 	{ USB_DEVICE(0x045E, 0x0462) }, /* Windows Powered Pocket PC 2003 */ | 
 | 193 | 	{ USB_DEVICE(0x045E, 0x0463) }, /* Windows Powered Pocket PC 2003 */ | 
 | 194 | 	{ USB_DEVICE(0x045E, 0x0464) }, /* Windows Powered Pocket PC 2003 */ | 
 | 195 | 	{ USB_DEVICE(0x045E, 0x0465) }, /* Windows Powered Pocket PC 2003 */ | 
 | 196 | 	{ USB_DEVICE(0x045E, 0x0466) }, /* Windows Powered Pocket PC 2003 */ | 
 | 197 | 	{ USB_DEVICE(0x045E, 0x0467) }, /* Windows Powered Pocket PC 2003 */ | 
 | 198 | 	{ USB_DEVICE(0x045E, 0x0468) }, /* Windows Powered Pocket PC 2003 */ | 
 | 199 | 	{ USB_DEVICE(0x045E, 0x0469) }, /* Windows Powered Pocket PC 2003 */ | 
 | 200 | 	{ USB_DEVICE(0x045E, 0x046A) }, /* Windows Powered Pocket PC 2003 */ | 
 | 201 | 	{ USB_DEVICE(0x045E, 0x046B) }, /* Windows Powered Pocket PC 2003 */ | 
 | 202 | 	{ USB_DEVICE(0x045E, 0x046C) }, /* Windows Powered Pocket PC 2003 */ | 
 | 203 | 	{ USB_DEVICE(0x045E, 0x046D) }, /* Windows Powered Pocket PC 2003 */ | 
 | 204 | 	{ USB_DEVICE(0x045E, 0x046E) }, /* Windows Powered Pocket PC 2003 */ | 
 | 205 | 	{ USB_DEVICE(0x045E, 0x046F) }, /* Windows Powered Pocket PC 2003 */ | 
 | 206 | 	{ USB_DEVICE(0x045E, 0x0470) }, /* Windows Powered Pocket PC 2003 */ | 
 | 207 | 	{ USB_DEVICE(0x045E, 0x0471) }, /* Windows Powered Pocket PC 2003 */ | 
 | 208 | 	{ USB_DEVICE(0x045E, 0x0472) }, /* Windows Powered Pocket PC 2003 */ | 
 | 209 | 	{ USB_DEVICE(0x045E, 0x0473) }, /* Windows Powered Pocket PC 2003 */ | 
 | 210 | 	{ USB_DEVICE(0x045E, 0x0474) }, /* Windows Powered Pocket PC 2003 */ | 
 | 211 | 	{ USB_DEVICE(0x045E, 0x0475) }, /* Windows Powered Pocket PC 2003 */ | 
 | 212 | 	{ USB_DEVICE(0x045E, 0x0476) }, /* Windows Powered Pocket PC 2003 */ | 
 | 213 | 	{ USB_DEVICE(0x045E, 0x0477) }, /* Windows Powered Pocket PC 2003 */ | 
 | 214 | 	{ USB_DEVICE(0x045E, 0x0478) }, /* Windows Powered Pocket PC 2003 */ | 
 | 215 | 	{ USB_DEVICE(0x045E, 0x0479) }, /* Windows Powered Pocket PC 2003 */ | 
 | 216 | 	{ USB_DEVICE(0x045E, 0x047A) }, /* Windows Powered Pocket PC 2003 */ | 
 | 217 | 	{ USB_DEVICE(0x045E, 0x047B) }, /* Windows Powered Pocket PC 2003 */ | 
 | 218 | 	{ USB_DEVICE(0x045E, 0x04C8) }, /* Windows Powered Smartphone 2002 */ | 
 | 219 | 	{ USB_DEVICE(0x045E, 0x04C9) }, /* Windows Powered Smartphone 2002 */ | 
 | 220 | 	{ USB_DEVICE(0x045E, 0x04CA) }, /* Windows Powered Smartphone 2002 */ | 
 | 221 | 	{ USB_DEVICE(0x045E, 0x04CB) }, /* Windows Powered Smartphone 2002 */ | 
 | 222 | 	{ USB_DEVICE(0x045E, 0x04CC) }, /* Windows Powered Smartphone 2002 */ | 
 | 223 | 	{ USB_DEVICE(0x045E, 0x04CD) }, /* Windows Powered Smartphone 2002 */ | 
 | 224 | 	{ USB_DEVICE(0x045E, 0x04CE) }, /* Windows Powered Smartphone 2002 */ | 
 | 225 | 	{ USB_DEVICE(0x045E, 0x04D7) }, /* Windows Powered Smartphone 2003 */ | 
 | 226 | 	{ USB_DEVICE(0x045E, 0x04D8) }, /* Windows Powered Smartphone 2003 */ | 
 | 227 | 	{ USB_DEVICE(0x045E, 0x04D9) }, /* Windows Powered Smartphone 2003 */ | 
 | 228 | 	{ USB_DEVICE(0x045E, 0x04DA) }, /* Windows Powered Smartphone 2003 */ | 
 | 229 | 	{ USB_DEVICE(0x045E, 0x04DB) }, /* Windows Powered Smartphone 2003 */ | 
 | 230 | 	{ USB_DEVICE(0x045E, 0x04DC) }, /* Windows Powered Smartphone 2003 */ | 
 | 231 | 	{ USB_DEVICE(0x045E, 0x04DD) }, /* Windows Powered Smartphone 2003 */ | 
 | 232 | 	{ USB_DEVICE(0x045E, 0x04DE) }, /* Windows Powered Smartphone 2003 */ | 
 | 233 | 	{ USB_DEVICE(0x045E, 0x04DF) }, /* Windows Powered Smartphone 2003 */ | 
 | 234 | 	{ USB_DEVICE(0x045E, 0x04E0) }, /* Windows Powered Smartphone 2003 */ | 
 | 235 | 	{ USB_DEVICE(0x045E, 0x04E1) }, /* Windows Powered Smartphone 2003 */ | 
 | 236 | 	{ USB_DEVICE(0x045E, 0x04E2) }, /* Windows Powered Smartphone 2003 */ | 
 | 237 | 	{ USB_DEVICE(0x045E, 0x04E3) }, /* Windows Powered Smartphone 2003 */ | 
 | 238 | 	{ USB_DEVICE(0x045E, 0x04E4) }, /* Windows Powered Smartphone 2003 */ | 
 | 239 | 	{ USB_DEVICE(0x045E, 0x04E5) }, /* Windows Powered Smartphone 2003 */ | 
 | 240 | 	{ USB_DEVICE(0x045E, 0x04E6) }, /* Windows Powered Smartphone 2003 */ | 
 | 241 | 	{ USB_DEVICE(0x045E, 0x04E7) }, /* Windows Powered Smartphone 2003 */ | 
 | 242 | 	{ USB_DEVICE(0x045E, 0x04E8) }, /* Windows Powered Smartphone 2003 */ | 
 | 243 | 	{ USB_DEVICE(0x045E, 0x04E9) }, /* Windows Powered Smartphone 2003 */ | 
 | 244 | 	{ USB_DEVICE(0x045E, 0x04EA) }, /* Windows Powered Smartphone 2003 */ | 
| David Eriksson | eb3c5ed | 2005-10-18 20:12:24 +0200 | [diff] [blame] | 245 | 	{ USB_DEVICE(0x049F, 0x0003) }, /* Compaq iPAQ USB Sync */ | 
 | 246 | 	{ USB_DEVICE(0x049F, 0x0032) }, /* Compaq iPAQ USB Sync */ | 
 | 247 | 	{ USB_DEVICE(0x04A4, 0x0014) }, /* Hitachi USB Sync */ | 
 | 248 | 	{ USB_DEVICE(0x04AD, 0x0301) }, /* USB Sync 0301 */ | 
 | 249 | 	{ USB_DEVICE(0x04AD, 0x0302) }, /* USB Sync 0302 */ | 
 | 250 | 	{ USB_DEVICE(0x04AD, 0x0303) }, /* USB Sync 0303 */ | 
| Andre Spahlinger | 62d909c | 2007-03-05 19:09:35 +0100 | [diff] [blame] | 251 | 	{ USB_DEVICE(0x04AD, 0x0306) }, /* GPS Pocket PC USB Sync */ | 
 | 252 | 	{ USB_DEVICE(0x04B7, 0x0531) }, /* MyGuide 7000 XL USB Sync */ | 
| David Eriksson | eb3c5ed | 2005-10-18 20:12:24 +0200 | [diff] [blame] | 253 | 	{ USB_DEVICE(0x04C5, 0x1058) }, /* FUJITSU USB Sync */ | 
 | 254 | 	{ USB_DEVICE(0x04C5, 0x1079) }, /* FUJITSU USB Sync */ | 
 | 255 | 	{ USB_DEVICE(0x04DA, 0x2500) }, /* Panasonic USB Sync */ | 
| Norihiko Tomiyama | aec0d50 | 2006-07-13 09:43:02 +0900 | [diff] [blame] | 256 | 	{ USB_DEVICE(0x04DD, 0x9102) }, /* SHARP WS003SH USB Modem */ | 
| Norihiko Tomiyama | 922fdaa | 2006-08-08 14:31:25 +0900 | [diff] [blame] | 257 | 	{ USB_DEVICE(0x04DD, 0x9121) }, /* SHARP WS004SH USB Modem */ | 
 | 258 | 	{ USB_DEVICE(0x04DD, 0x9123) }, /* SHARP WS007SH USB Modem */ | 
| Norihiko Tomiyama | c51e974 | 2007-04-05 10:05:40 +0900 | [diff] [blame] | 259 | 	{ USB_DEVICE(0x04DD, 0x9151) }, /* SHARP S01SH USB Modem */ | 
| Nobuhiro Iwamatsu | eecfb91 | 2007-10-11 00:37:50 +0900 | [diff] [blame] | 260 | 	{ USB_DEVICE(0x04DD, 0x91AC) }, /* SHARP WS011SH USB Modem */ | 
| David Eriksson | eb3c5ed | 2005-10-18 20:12:24 +0200 | [diff] [blame] | 261 | 	{ USB_DEVICE(0x04E8, 0x5F00) }, /* Samsung NEXiO USB Sync */ | 
 | 262 | 	{ USB_DEVICE(0x04E8, 0x5F01) }, /* Samsung NEXiO USB Sync */ | 
 | 263 | 	{ USB_DEVICE(0x04E8, 0x5F02) }, /* Samsung NEXiO USB Sync */ | 
 | 264 | 	{ USB_DEVICE(0x04E8, 0x5F03) }, /* Samsung NEXiO USB Sync */ | 
 | 265 | 	{ USB_DEVICE(0x04E8, 0x5F04) }, /* Samsung NEXiO USB Sync */ | 
 | 266 | 	{ USB_DEVICE(0x04E8, 0x6611) }, /* Samsung MITs USB Sync */ | 
 | 267 | 	{ USB_DEVICE(0x04E8, 0x6613) }, /* Samsung MITs USB Sync */ | 
 | 268 | 	{ USB_DEVICE(0x04E8, 0x6615) }, /* Samsung MITs USB Sync */ | 
 | 269 | 	{ USB_DEVICE(0x04E8, 0x6617) }, /* Samsung MITs USB Sync */ | 
 | 270 | 	{ USB_DEVICE(0x04E8, 0x6619) }, /* Samsung MITs USB Sync */ | 
 | 271 | 	{ USB_DEVICE(0x04E8, 0x661B) }, /* Samsung MITs USB Sync */ | 
 | 272 | 	{ USB_DEVICE(0x04E8, 0x662E) }, /* Samsung MITs USB Sync */ | 
 | 273 | 	{ USB_DEVICE(0x04E8, 0x6630) }, /* Samsung MITs USB Sync */ | 
 | 274 | 	{ USB_DEVICE(0x04E8, 0x6632) }, /* Samsung MITs USB Sync */ | 
 | 275 | 	{ USB_DEVICE(0x04f1, 0x3011) }, /* JVC USB Sync */ | 
 | 276 | 	{ USB_DEVICE(0x04F1, 0x3012) }, /* JVC USB Sync */ | 
 | 277 | 	{ USB_DEVICE(0x0502, 0x1631) }, /* c10 Series */ | 
 | 278 | 	{ USB_DEVICE(0x0502, 0x1632) }, /* c20 Series */ | 
 | 279 | 	{ USB_DEVICE(0x0502, 0x16E1) }, /* Acer n10 Handheld USB Sync */ | 
 | 280 | 	{ USB_DEVICE(0x0502, 0x16E2) }, /* Acer n20 Handheld USB Sync */ | 
 | 281 | 	{ USB_DEVICE(0x0502, 0x16E3) }, /* Acer n30 Handheld USB Sync */ | 
 | 282 | 	{ USB_DEVICE(0x0536, 0x01A0) }, /* HHP PDT */ | 
 | 283 | 	{ USB_DEVICE(0x0543, 0x0ED9) }, /* ViewSonic Color Pocket PC V35 */ | 
 | 284 | 	{ USB_DEVICE(0x0543, 0x1527) }, /* ViewSonic Color Pocket PC V36 */ | 
 | 285 | 	{ USB_DEVICE(0x0543, 0x1529) }, /* ViewSonic Color Pocket PC V37 */ | 
 | 286 | 	{ USB_DEVICE(0x0543, 0x152B) }, /* ViewSonic Color Pocket PC V38 */ | 
 | 287 | 	{ USB_DEVICE(0x0543, 0x152E) }, /* ViewSonic Pocket PC */ | 
 | 288 | 	{ USB_DEVICE(0x0543, 0x1921) }, /* ViewSonic Communicator Pocket PC */ | 
 | 289 | 	{ USB_DEVICE(0x0543, 0x1922) }, /* ViewSonic Smartphone */ | 
 | 290 | 	{ USB_DEVICE(0x0543, 0x1923) }, /* ViewSonic Pocket PC V30 */ | 
 | 291 | 	{ USB_DEVICE(0x05E0, 0x2000) }, /* Symbol USB Sync */ | 
 | 292 | 	{ USB_DEVICE(0x05E0, 0x2001) }, /* Symbol USB Sync 0x2001 */ | 
 | 293 | 	{ USB_DEVICE(0x05E0, 0x2002) }, /* Symbol USB Sync 0x2002 */ | 
 | 294 | 	{ USB_DEVICE(0x05E0, 0x2003) }, /* Symbol USB Sync 0x2003 */ | 
 | 295 | 	{ USB_DEVICE(0x05E0, 0x2004) }, /* Symbol USB Sync 0x2004 */ | 
 | 296 | 	{ USB_DEVICE(0x05E0, 0x2005) }, /* Symbol USB Sync 0x2005 */ | 
 | 297 | 	{ USB_DEVICE(0x05E0, 0x2006) }, /* Symbol USB Sync 0x2006 */ | 
 | 298 | 	{ USB_DEVICE(0x05E0, 0x2007) }, /* Symbol USB Sync 0x2007 */ | 
 | 299 | 	{ USB_DEVICE(0x05E0, 0x2008) }, /* Symbol USB Sync 0x2008 */ | 
 | 300 | 	{ USB_DEVICE(0x05E0, 0x2009) }, /* Symbol USB Sync 0x2009 */ | 
 | 301 | 	{ USB_DEVICE(0x05E0, 0x200A) }, /* Symbol USB Sync 0x200A */ | 
 | 302 | 	{ USB_DEVICE(0x067E, 0x1001) }, /* Intermec Mobile Computer */ | 
 | 303 | 	{ USB_DEVICE(0x07CF, 0x2001) }, /* CASIO USB Sync 2001 */ | 
 | 304 | 	{ USB_DEVICE(0x07CF, 0x2002) }, /* CASIO USB Sync 2002 */ | 
 | 305 | 	{ USB_DEVICE(0x07CF, 0x2003) }, /* CASIO USB Sync 2003 */ | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 306 | 	{ USB_DEVICE(0x0930, 0x0700) }, /* TOSHIBA USB Sync 0700 */ | 
 | 307 | 	{ USB_DEVICE(0x0930, 0x0705) }, /* TOSHIBA Pocket PC e310 */ | 
| David Eriksson | eb3c5ed | 2005-10-18 20:12:24 +0200 | [diff] [blame] | 308 | 	{ USB_DEVICE(0x0930, 0x0706) }, /* TOSHIBA Pocket PC e740 */ | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 309 | 	{ USB_DEVICE(0x0930, 0x0707) }, /* TOSHIBA Pocket PC e330 Series */ | 
| Jan Engelhardt | 96de0e2 | 2007-10-19 23:21:04 +0200 | [diff] [blame] | 310 | 	{ USB_DEVICE(0x0930, 0x0708) }, /* TOSHIBA Pocket PC e350 Series */ | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 311 | 	{ USB_DEVICE(0x0930, 0x0709) }, /* TOSHIBA Pocket PC e750 Series */ | 
 | 312 | 	{ USB_DEVICE(0x0930, 0x070A) }, /* TOSHIBA Pocket PC e400 Series */ | 
 | 313 | 	{ USB_DEVICE(0x0930, 0x070B) }, /* TOSHIBA Pocket PC e800 Series */ | 
| David Eriksson | eb3c5ed | 2005-10-18 20:12:24 +0200 | [diff] [blame] | 314 | 	{ USB_DEVICE(0x094B, 0x0001) }, /* Linkup Systems USB Sync */ | 
 | 315 | 	{ USB_DEVICE(0x0960, 0x0065) }, /* BCOM USB Sync 0065 */ | 
 | 316 | 	{ USB_DEVICE(0x0960, 0x0066) }, /* BCOM USB Sync 0066 */ | 
 | 317 | 	{ USB_DEVICE(0x0960, 0x0067) }, /* BCOM USB Sync 0067 */ | 
 | 318 | 	{ USB_DEVICE(0x0961, 0x0010) }, /* Portatec USB Sync */ | 
 | 319 | 	{ USB_DEVICE(0x099E, 0x0052) }, /* Trimble GeoExplorer */ | 
 | 320 | 	{ USB_DEVICE(0x099E, 0x4000) }, /* TDS Data Collector */ | 
 | 321 | 	{ USB_DEVICE(0x0B05, 0x4200) }, /* ASUS USB Sync */ | 
 | 322 | 	{ USB_DEVICE(0x0B05, 0x4201) }, /* ASUS USB Sync */ | 
 | 323 | 	{ USB_DEVICE(0x0B05, 0x4202) }, /* ASUS USB Sync */ | 
 | 324 | 	{ USB_DEVICE(0x0B05, 0x420F) }, /* ASUS USB Sync */ | 
 | 325 | 	{ USB_DEVICE(0x0B05, 0x9200) }, /* ASUS USB Sync */ | 
 | 326 | 	{ USB_DEVICE(0x0B05, 0x9202) }, /* ASUS USB Sync */ | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 327 | 	{ USB_DEVICE(0x0BB4, 0x00CE) }, /* HTC USB Sync */ | 
| Alex Sanks | 0029908 | 2006-10-29 16:38:31 -0800 | [diff] [blame] | 328 | 	{ USB_DEVICE(0x0BB4, 0x00CF) }, /* HTC USB Modem */ | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 329 | 	{ USB_DEVICE(0x0BB4, 0x0A01) }, /* PocketPC USB Sync */ | 
 | 330 | 	{ USB_DEVICE(0x0BB4, 0x0A02) }, /* PocketPC USB Sync */ | 
 | 331 | 	{ USB_DEVICE(0x0BB4, 0x0A03) }, /* PocketPC USB Sync */ | 
 | 332 | 	{ USB_DEVICE(0x0BB4, 0x0A04) }, /* PocketPC USB Sync */ | 
 | 333 | 	{ USB_DEVICE(0x0BB4, 0x0A05) }, /* PocketPC USB Sync */ | 
 | 334 | 	{ USB_DEVICE(0x0BB4, 0x0A06) }, /* PocketPC USB Sync */ | 
 | 335 | 	{ USB_DEVICE(0x0BB4, 0x0A07) }, /* PocketPC USB Sync */ | 
 | 336 | 	{ USB_DEVICE(0x0BB4, 0x0A08) }, /* PocketPC USB Sync */ | 
 | 337 | 	{ USB_DEVICE(0x0BB4, 0x0A09) }, /* PocketPC USB Sync */ | 
 | 338 | 	{ USB_DEVICE(0x0BB4, 0x0A0A) }, /* PocketPC USB Sync */ | 
 | 339 | 	{ USB_DEVICE(0x0BB4, 0x0A0B) }, /* PocketPC USB Sync */ | 
 | 340 | 	{ USB_DEVICE(0x0BB4, 0x0A0C) }, /* PocketPC USB Sync */ | 
 | 341 | 	{ USB_DEVICE(0x0BB4, 0x0A0D) }, /* PocketPC USB Sync */ | 
 | 342 | 	{ USB_DEVICE(0x0BB4, 0x0A0E) }, /* PocketPC USB Sync */ | 
 | 343 | 	{ USB_DEVICE(0x0BB4, 0x0A0F) }, /* PocketPC USB Sync */ | 
 | 344 | 	{ USB_DEVICE(0x0BB4, 0x0A10) }, /* PocketPC USB Sync */ | 
 | 345 | 	{ USB_DEVICE(0x0BB4, 0x0A11) }, /* PocketPC USB Sync */ | 
 | 346 | 	{ USB_DEVICE(0x0BB4, 0x0A12) }, /* PocketPC USB Sync */ | 
 | 347 | 	{ USB_DEVICE(0x0BB4, 0x0A13) }, /* PocketPC USB Sync */ | 
 | 348 | 	{ USB_DEVICE(0x0BB4, 0x0A14) }, /* PocketPC USB Sync */ | 
 | 349 | 	{ USB_DEVICE(0x0BB4, 0x0A15) }, /* PocketPC USB Sync */ | 
 | 350 | 	{ USB_DEVICE(0x0BB4, 0x0A16) }, /* PocketPC USB Sync */ | 
 | 351 | 	{ USB_DEVICE(0x0BB4, 0x0A17) }, /* PocketPC USB Sync */ | 
 | 352 | 	{ USB_DEVICE(0x0BB4, 0x0A18) }, /* PocketPC USB Sync */ | 
 | 353 | 	{ USB_DEVICE(0x0BB4, 0x0A19) }, /* PocketPC USB Sync */ | 
 | 354 | 	{ USB_DEVICE(0x0BB4, 0x0A1A) }, /* PocketPC USB Sync */ | 
 | 355 | 	{ USB_DEVICE(0x0BB4, 0x0A1B) }, /* PocketPC USB Sync */ | 
 | 356 | 	{ USB_DEVICE(0x0BB4, 0x0A1C) }, /* PocketPC USB Sync */ | 
 | 357 | 	{ USB_DEVICE(0x0BB4, 0x0A1D) }, /* PocketPC USB Sync */ | 
 | 358 | 	{ USB_DEVICE(0x0BB4, 0x0A1E) }, /* PocketPC USB Sync */ | 
 | 359 | 	{ USB_DEVICE(0x0BB4, 0x0A1F) }, /* PocketPC USB Sync */ | 
 | 360 | 	{ USB_DEVICE(0x0BB4, 0x0A20) }, /* PocketPC USB Sync */ | 
 | 361 | 	{ USB_DEVICE(0x0BB4, 0x0A21) }, /* PocketPC USB Sync */ | 
 | 362 | 	{ USB_DEVICE(0x0BB4, 0x0A22) }, /* PocketPC USB Sync */ | 
 | 363 | 	{ USB_DEVICE(0x0BB4, 0x0A23) }, /* PocketPC USB Sync */ | 
 | 364 | 	{ USB_DEVICE(0x0BB4, 0x0A24) }, /* PocketPC USB Sync */ | 
 | 365 | 	{ USB_DEVICE(0x0BB4, 0x0A25) }, /* PocketPC USB Sync */ | 
 | 366 | 	{ USB_DEVICE(0x0BB4, 0x0A26) }, /* PocketPC USB Sync */ | 
 | 367 | 	{ USB_DEVICE(0x0BB4, 0x0A27) }, /* PocketPC USB Sync */ | 
 | 368 | 	{ USB_DEVICE(0x0BB4, 0x0A28) }, /* PocketPC USB Sync */ | 
 | 369 | 	{ USB_DEVICE(0x0BB4, 0x0A29) }, /* PocketPC USB Sync */ | 
 | 370 | 	{ USB_DEVICE(0x0BB4, 0x0A2A) }, /* PocketPC USB Sync */ | 
 | 371 | 	{ USB_DEVICE(0x0BB4, 0x0A2B) }, /* PocketPC USB Sync */ | 
 | 372 | 	{ USB_DEVICE(0x0BB4, 0x0A2C) }, /* PocketPC USB Sync */ | 
 | 373 | 	{ USB_DEVICE(0x0BB4, 0x0A2D) }, /* PocketPC USB Sync */ | 
 | 374 | 	{ USB_DEVICE(0x0BB4, 0x0A2E) }, /* PocketPC USB Sync */ | 
 | 375 | 	{ USB_DEVICE(0x0BB4, 0x0A2F) }, /* PocketPC USB Sync */ | 
 | 376 | 	{ USB_DEVICE(0x0BB4, 0x0A30) }, /* PocketPC USB Sync */ | 
 | 377 | 	{ USB_DEVICE(0x0BB4, 0x0A31) }, /* PocketPC USB Sync */ | 
 | 378 | 	{ USB_DEVICE(0x0BB4, 0x0A32) }, /* PocketPC USB Sync */ | 
 | 379 | 	{ USB_DEVICE(0x0BB4, 0x0A33) }, /* PocketPC USB Sync */ | 
 | 380 | 	{ USB_DEVICE(0x0BB4, 0x0A34) }, /* PocketPC USB Sync */ | 
 | 381 | 	{ USB_DEVICE(0x0BB4, 0x0A35) }, /* PocketPC USB Sync */ | 
 | 382 | 	{ USB_DEVICE(0x0BB4, 0x0A36) }, /* PocketPC USB Sync */ | 
 | 383 | 	{ USB_DEVICE(0x0BB4, 0x0A37) }, /* PocketPC USB Sync */ | 
 | 384 | 	{ USB_DEVICE(0x0BB4, 0x0A38) }, /* PocketPC USB Sync */ | 
 | 385 | 	{ USB_DEVICE(0x0BB4, 0x0A39) }, /* PocketPC USB Sync */ | 
 | 386 | 	{ USB_DEVICE(0x0BB4, 0x0A3A) }, /* PocketPC USB Sync */ | 
 | 387 | 	{ USB_DEVICE(0x0BB4, 0x0A3B) }, /* PocketPC USB Sync */ | 
 | 388 | 	{ USB_DEVICE(0x0BB4, 0x0A3C) }, /* PocketPC USB Sync */ | 
 | 389 | 	{ USB_DEVICE(0x0BB4, 0x0A3D) }, /* PocketPC USB Sync */ | 
 | 390 | 	{ USB_DEVICE(0x0BB4, 0x0A3E) }, /* PocketPC USB Sync */ | 
 | 391 | 	{ USB_DEVICE(0x0BB4, 0x0A3F) }, /* PocketPC USB Sync */ | 
 | 392 | 	{ USB_DEVICE(0x0BB4, 0x0A40) }, /* PocketPC USB Sync */ | 
 | 393 | 	{ USB_DEVICE(0x0BB4, 0x0A41) }, /* PocketPC USB Sync */ | 
 | 394 | 	{ USB_DEVICE(0x0BB4, 0x0A42) }, /* PocketPC USB Sync */ | 
 | 395 | 	{ USB_DEVICE(0x0BB4, 0x0A43) }, /* PocketPC USB Sync */ | 
 | 396 | 	{ USB_DEVICE(0x0BB4, 0x0A44) }, /* PocketPC USB Sync */ | 
 | 397 | 	{ USB_DEVICE(0x0BB4, 0x0A45) }, /* PocketPC USB Sync */ | 
 | 398 | 	{ USB_DEVICE(0x0BB4, 0x0A46) }, /* PocketPC USB Sync */ | 
 | 399 | 	{ USB_DEVICE(0x0BB4, 0x0A47) }, /* PocketPC USB Sync */ | 
 | 400 | 	{ USB_DEVICE(0x0BB4, 0x0A48) }, /* PocketPC USB Sync */ | 
 | 401 | 	{ USB_DEVICE(0x0BB4, 0x0A49) }, /* PocketPC USB Sync */ | 
 | 402 | 	{ USB_DEVICE(0x0BB4, 0x0A4A) }, /* PocketPC USB Sync */ | 
 | 403 | 	{ USB_DEVICE(0x0BB4, 0x0A4B) }, /* PocketPC USB Sync */ | 
 | 404 | 	{ USB_DEVICE(0x0BB4, 0x0A4C) }, /* PocketPC USB Sync */ | 
 | 405 | 	{ USB_DEVICE(0x0BB4, 0x0A4D) }, /* PocketPC USB Sync */ | 
 | 406 | 	{ USB_DEVICE(0x0BB4, 0x0A4E) }, /* PocketPC USB Sync */ | 
 | 407 | 	{ USB_DEVICE(0x0BB4, 0x0A4F) }, /* PocketPC USB Sync */ | 
 | 408 | 	{ USB_DEVICE(0x0BB4, 0x0A50) }, /* HTC SmartPhone USB Sync */ | 
 | 409 | 	{ USB_DEVICE(0x0BB4, 0x0A51) }, /* SmartPhone USB Sync */ | 
 | 410 | 	{ USB_DEVICE(0x0BB4, 0x0A52) }, /* SmartPhone USB Sync */ | 
 | 411 | 	{ USB_DEVICE(0x0BB4, 0x0A53) }, /* SmartPhone USB Sync */ | 
 | 412 | 	{ USB_DEVICE(0x0BB4, 0x0A54) }, /* SmartPhone USB Sync */ | 
 | 413 | 	{ USB_DEVICE(0x0BB4, 0x0A55) }, /* SmartPhone USB Sync */ | 
 | 414 | 	{ USB_DEVICE(0x0BB4, 0x0A56) }, /* SmartPhone USB Sync */ | 
 | 415 | 	{ USB_DEVICE(0x0BB4, 0x0A57) }, /* SmartPhone USB Sync */ | 
 | 416 | 	{ USB_DEVICE(0x0BB4, 0x0A58) }, /* SmartPhone USB Sync */ | 
 | 417 | 	{ USB_DEVICE(0x0BB4, 0x0A59) }, /* SmartPhone USB Sync */ | 
 | 418 | 	{ USB_DEVICE(0x0BB4, 0x0A5A) }, /* SmartPhone USB Sync */ | 
 | 419 | 	{ USB_DEVICE(0x0BB4, 0x0A5B) }, /* SmartPhone USB Sync */ | 
 | 420 | 	{ USB_DEVICE(0x0BB4, 0x0A5C) }, /* SmartPhone USB Sync */ | 
 | 421 | 	{ USB_DEVICE(0x0BB4, 0x0A5D) }, /* SmartPhone USB Sync */ | 
 | 422 | 	{ USB_DEVICE(0x0BB4, 0x0A5E) }, /* SmartPhone USB Sync */ | 
 | 423 | 	{ USB_DEVICE(0x0BB4, 0x0A5F) }, /* SmartPhone USB Sync */ | 
 | 424 | 	{ USB_DEVICE(0x0BB4, 0x0A60) }, /* SmartPhone USB Sync */ | 
 | 425 | 	{ USB_DEVICE(0x0BB4, 0x0A61) }, /* SmartPhone USB Sync */ | 
 | 426 | 	{ USB_DEVICE(0x0BB4, 0x0A62) }, /* SmartPhone USB Sync */ | 
 | 427 | 	{ USB_DEVICE(0x0BB4, 0x0A63) }, /* SmartPhone USB Sync */ | 
 | 428 | 	{ USB_DEVICE(0x0BB4, 0x0A64) }, /* SmartPhone USB Sync */ | 
 | 429 | 	{ USB_DEVICE(0x0BB4, 0x0A65) }, /* SmartPhone USB Sync */ | 
 | 430 | 	{ USB_DEVICE(0x0BB4, 0x0A66) }, /* SmartPhone USB Sync */ | 
 | 431 | 	{ USB_DEVICE(0x0BB4, 0x0A67) }, /* SmartPhone USB Sync */ | 
 | 432 | 	{ USB_DEVICE(0x0BB4, 0x0A68) }, /* SmartPhone USB Sync */ | 
 | 433 | 	{ USB_DEVICE(0x0BB4, 0x0A69) }, /* SmartPhone USB Sync */ | 
 | 434 | 	{ USB_DEVICE(0x0BB4, 0x0A6A) }, /* SmartPhone USB Sync */ | 
 | 435 | 	{ USB_DEVICE(0x0BB4, 0x0A6B) }, /* SmartPhone USB Sync */ | 
 | 436 | 	{ USB_DEVICE(0x0BB4, 0x0A6C) }, /* SmartPhone USB Sync */ | 
 | 437 | 	{ USB_DEVICE(0x0BB4, 0x0A6D) }, /* SmartPhone USB Sync */ | 
 | 438 | 	{ USB_DEVICE(0x0BB4, 0x0A6E) }, /* SmartPhone USB Sync */ | 
 | 439 | 	{ USB_DEVICE(0x0BB4, 0x0A6F) }, /* SmartPhone USB Sync */ | 
 | 440 | 	{ USB_DEVICE(0x0BB4, 0x0A70) }, /* SmartPhone USB Sync */ | 
 | 441 | 	{ USB_DEVICE(0x0BB4, 0x0A71) }, /* SmartPhone USB Sync */ | 
 | 442 | 	{ USB_DEVICE(0x0BB4, 0x0A72) }, /* SmartPhone USB Sync */ | 
 | 443 | 	{ USB_DEVICE(0x0BB4, 0x0A73) }, /* SmartPhone USB Sync */ | 
 | 444 | 	{ USB_DEVICE(0x0BB4, 0x0A74) }, /* SmartPhone USB Sync */ | 
 | 445 | 	{ USB_DEVICE(0x0BB4, 0x0A75) }, /* SmartPhone USB Sync */ | 
 | 446 | 	{ USB_DEVICE(0x0BB4, 0x0A76) }, /* SmartPhone USB Sync */ | 
 | 447 | 	{ USB_DEVICE(0x0BB4, 0x0A77) }, /* SmartPhone USB Sync */ | 
 | 448 | 	{ USB_DEVICE(0x0BB4, 0x0A78) }, /* SmartPhone USB Sync */ | 
 | 449 | 	{ USB_DEVICE(0x0BB4, 0x0A79) }, /* SmartPhone USB Sync */ | 
 | 450 | 	{ USB_DEVICE(0x0BB4, 0x0A7A) }, /* SmartPhone USB Sync */ | 
 | 451 | 	{ USB_DEVICE(0x0BB4, 0x0A7B) }, /* SmartPhone USB Sync */ | 
 | 452 | 	{ USB_DEVICE(0x0BB4, 0x0A7C) }, /* SmartPhone USB Sync */ | 
 | 453 | 	{ USB_DEVICE(0x0BB4, 0x0A7D) }, /* SmartPhone USB Sync */ | 
 | 454 | 	{ USB_DEVICE(0x0BB4, 0x0A7E) }, /* SmartPhone USB Sync */ | 
 | 455 | 	{ USB_DEVICE(0x0BB4, 0x0A7F) }, /* SmartPhone USB Sync */ | 
 | 456 | 	{ USB_DEVICE(0x0BB4, 0x0A80) }, /* SmartPhone USB Sync */ | 
 | 457 | 	{ USB_DEVICE(0x0BB4, 0x0A81) }, /* SmartPhone USB Sync */ | 
 | 458 | 	{ USB_DEVICE(0x0BB4, 0x0A82) }, /* SmartPhone USB Sync */ | 
 | 459 | 	{ USB_DEVICE(0x0BB4, 0x0A83) }, /* SmartPhone USB Sync */ | 
 | 460 | 	{ USB_DEVICE(0x0BB4, 0x0A84) }, /* SmartPhone USB Sync */ | 
 | 461 | 	{ USB_DEVICE(0x0BB4, 0x0A85) }, /* SmartPhone USB Sync */ | 
 | 462 | 	{ USB_DEVICE(0x0BB4, 0x0A86) }, /* SmartPhone USB Sync */ | 
 | 463 | 	{ USB_DEVICE(0x0BB4, 0x0A87) }, /* SmartPhone USB Sync */ | 
 | 464 | 	{ USB_DEVICE(0x0BB4, 0x0A88) }, /* SmartPhone USB Sync */ | 
 | 465 | 	{ USB_DEVICE(0x0BB4, 0x0A89) }, /* SmartPhone USB Sync */ | 
 | 466 | 	{ USB_DEVICE(0x0BB4, 0x0A8A) }, /* SmartPhone USB Sync */ | 
 | 467 | 	{ USB_DEVICE(0x0BB4, 0x0A8B) }, /* SmartPhone USB Sync */ | 
 | 468 | 	{ USB_DEVICE(0x0BB4, 0x0A8C) }, /* SmartPhone USB Sync */ | 
 | 469 | 	{ USB_DEVICE(0x0BB4, 0x0A8D) }, /* SmartPhone USB Sync */ | 
 | 470 | 	{ USB_DEVICE(0x0BB4, 0x0A8E) }, /* SmartPhone USB Sync */ | 
 | 471 | 	{ USB_DEVICE(0x0BB4, 0x0A8F) }, /* SmartPhone USB Sync */ | 
 | 472 | 	{ USB_DEVICE(0x0BB4, 0x0A90) }, /* SmartPhone USB Sync */ | 
 | 473 | 	{ USB_DEVICE(0x0BB4, 0x0A91) }, /* SmartPhone USB Sync */ | 
 | 474 | 	{ USB_DEVICE(0x0BB4, 0x0A92) }, /* SmartPhone USB Sync */ | 
 | 475 | 	{ USB_DEVICE(0x0BB4, 0x0A93) }, /* SmartPhone USB Sync */ | 
 | 476 | 	{ USB_DEVICE(0x0BB4, 0x0A94) }, /* SmartPhone USB Sync */ | 
 | 477 | 	{ USB_DEVICE(0x0BB4, 0x0A95) }, /* SmartPhone USB Sync */ | 
 | 478 | 	{ USB_DEVICE(0x0BB4, 0x0A96) }, /* SmartPhone USB Sync */ | 
 | 479 | 	{ USB_DEVICE(0x0BB4, 0x0A97) }, /* SmartPhone USB Sync */ | 
 | 480 | 	{ USB_DEVICE(0x0BB4, 0x0A98) }, /* SmartPhone USB Sync */ | 
 | 481 | 	{ USB_DEVICE(0x0BB4, 0x0A99) }, /* SmartPhone USB Sync */ | 
 | 482 | 	{ USB_DEVICE(0x0BB4, 0x0A9A) }, /* SmartPhone USB Sync */ | 
 | 483 | 	{ USB_DEVICE(0x0BB4, 0x0A9B) }, /* SmartPhone USB Sync */ | 
 | 484 | 	{ USB_DEVICE(0x0BB4, 0x0A9C) }, /* SmartPhone USB Sync */ | 
 | 485 | 	{ USB_DEVICE(0x0BB4, 0x0A9D) }, /* SmartPhone USB Sync */ | 
 | 486 | 	{ USB_DEVICE(0x0BB4, 0x0A9E) }, /* SmartPhone USB Sync */ | 
 | 487 | 	{ USB_DEVICE(0x0BB4, 0x0A9F) }, /* SmartPhone USB Sync */ | 
| Matthias Urlichs | 1b495f7 | 2006-09-24 21:38:47 +0200 | [diff] [blame] | 488 | 	{ USB_DEVICE(0x0BB4, 0x0BCE) }, /* "High Tech Computer Corp" */ | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 489 | 	{ USB_DEVICE(0x0BF8, 0x1001) }, /* Fujitsu Siemens Computers USB Sync */ | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 490 | 	{ USB_DEVICE(0x0C44, 0x03A2) }, /* Motorola iDEN Smartphone */ | 
| David Eriksson | eb3c5ed | 2005-10-18 20:12:24 +0200 | [diff] [blame] | 491 | 	{ USB_DEVICE(0x0C8E, 0x6000) }, /* Cesscom Luxian Series */ | 
| Jan Engelhardt | 96de0e2 | 2007-10-19 23:21:04 +0200 | [diff] [blame] | 492 | 	{ USB_DEVICE(0x0CAD, 0x9001) }, /* Motorola PowerPad Pocket PC Device */ | 
| David Eriksson | eb3c5ed | 2005-10-18 20:12:24 +0200 | [diff] [blame] | 493 | 	{ USB_DEVICE(0x0F4E, 0x0200) }, /* Freedom Scientific USB Sync */ | 
 | 494 | 	{ USB_DEVICE(0x0F98, 0x0201) }, /* Cyberbank USB Sync */ | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 495 | 	{ USB_DEVICE(0x0FB8, 0x3001) }, /* Wistron USB Sync */ | 
 | 496 | 	{ USB_DEVICE(0x0FB8, 0x3002) }, /* Wistron USB Sync */ | 
 | 497 | 	{ USB_DEVICE(0x0FB8, 0x3003) }, /* Wistron USB Sync */ | 
 | 498 | 	{ USB_DEVICE(0x0FB8, 0x4001) }, /* Wistron USB Sync */ | 
| David Eriksson | eb3c5ed | 2005-10-18 20:12:24 +0200 | [diff] [blame] | 499 | 	{ USB_DEVICE(0x1066, 0x00CE) }, /* E-TEN USB Sync */ | 
 | 500 | 	{ USB_DEVICE(0x1066, 0x0300) }, /* E-TEN P3XX Pocket PC */ | 
 | 501 | 	{ USB_DEVICE(0x1066, 0x0500) }, /* E-TEN P5XX Pocket PC */ | 
 | 502 | 	{ USB_DEVICE(0x1066, 0x0600) }, /* E-TEN P6XX Pocket PC */ | 
 | 503 | 	{ USB_DEVICE(0x1066, 0x0700) }, /* E-TEN P7XX Pocket PC */ | 
 | 504 | 	{ USB_DEVICE(0x1114, 0x0001) }, /* Psion Teklogix Sync 753x */ | 
 | 505 | 	{ USB_DEVICE(0x1114, 0x0004) }, /* Psion Teklogix Sync netBookPro */ | 
 | 506 | 	{ USB_DEVICE(0x1114, 0x0006) }, /* Psion Teklogix Sync 7525 */ | 
 | 507 | 	{ USB_DEVICE(0x1182, 0x1388) }, /* VES USB Sync */ | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 508 | 	{ USB_DEVICE(0x11D9, 0x1002) }, /* Rugged Pocket PC 2003 */ | 
| David Eriksson | eb3c5ed | 2005-10-18 20:12:24 +0200 | [diff] [blame] | 509 | 	{ USB_DEVICE(0x11D9, 0x1003) }, /* Rugged Pocket PC 2003 */ | 
 | 510 | 	{ USB_DEVICE(0x1231, 0xCE01) }, /* USB Sync 03 */ | 
 | 511 | 	{ USB_DEVICE(0x1231, 0xCE02) }, /* USB Sync 03 */ | 
 | 512 | 	{ USB_DEVICE(0x1690, 0x0601) }, /* Askey USB Sync */ | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 513 | 	{ USB_DEVICE(0x22B8, 0x4204) }, /* Motorola MPx200 Smartphone */ | 
 | 514 | 	{ USB_DEVICE(0x22B8, 0x4214) }, /* Motorola MPc GSM */ | 
 | 515 | 	{ USB_DEVICE(0x22B8, 0x4224) }, /* Motorola MPx220 Smartphone */ | 
 | 516 | 	{ USB_DEVICE(0x22B8, 0x4234) }, /* Motorola MPc CDMA */ | 
 | 517 | 	{ USB_DEVICE(0x22B8, 0x4244) }, /* Motorola MPx100 Smartphone */ | 
| David Eriksson | eb3c5ed | 2005-10-18 20:12:24 +0200 | [diff] [blame] | 518 | 	{ USB_DEVICE(0x3340, 0x011C) }, /* Mio DigiWalker PPC StrongARM */ | 
 | 519 | 	{ USB_DEVICE(0x3340, 0x0326) }, /* Mio DigiWalker 338 */ | 
 | 520 | 	{ USB_DEVICE(0x3340, 0x0426) }, /* Mio DigiWalker 338 */ | 
 | 521 | 	{ USB_DEVICE(0x3340, 0x043A) }, /* Mio DigiWalker USB Sync */ | 
 | 522 | 	{ USB_DEVICE(0x3340, 0x051C) }, /* MiTAC USB Sync 528 */ | 
 | 523 | 	{ USB_DEVICE(0x3340, 0x053A) }, /* Mio DigiWalker SmartPhone USB Sync */ | 
 | 524 | 	{ USB_DEVICE(0x3340, 0x071C) }, /* MiTAC USB Sync */ | 
 | 525 | 	{ USB_DEVICE(0x3340, 0x0B1C) }, /* Generic PPC StrongARM */ | 
 | 526 | 	{ USB_DEVICE(0x3340, 0x0E3A) }, /* Generic PPC USB Sync */ | 
 | 527 | 	{ USB_DEVICE(0x3340, 0x0F1C) }, /* Itautec USB Sync */ | 
 | 528 | 	{ USB_DEVICE(0x3340, 0x0F3A) }, /* Generic SmartPhone USB Sync */ | 
 | 529 | 	{ USB_DEVICE(0x3340, 0x1326) }, /* Itautec USB Sync */ | 
 | 530 | 	{ USB_DEVICE(0x3340, 0x191C) }, /* YAKUMO USB Sync */ | 
 | 531 | 	{ USB_DEVICE(0x3340, 0x2326) }, /* Vobis USB Sync */ | 
 | 532 | 	{ USB_DEVICE(0x3340, 0x3326) }, /* MEDION Winodws Moble USB Sync */ | 
 | 533 | 	{ USB_DEVICE(0x3708, 0x20CE) }, /* Legend USB Sync */ | 
 | 534 | 	{ USB_DEVICE(0x3708, 0x21CE) }, /* Lenovo USB Sync */ | 
 | 535 | 	{ USB_DEVICE(0x4113, 0x0210) }, /* Mobile Media Technology USB Sync */ | 
 | 536 | 	{ USB_DEVICE(0x4113, 0x0211) }, /* Mobile Media Technology USB Sync */ | 
 | 537 | 	{ USB_DEVICE(0x4113, 0x0400) }, /* Mobile Media Technology USB Sync */ | 
 | 538 | 	{ USB_DEVICE(0x4113, 0x0410) }, /* Mobile Media Technology USB Sync */ | 
 | 539 | 	{ USB_DEVICE(0x413C, 0x4001) }, /* Dell Axim USB Sync */ | 
 | 540 | 	{ USB_DEVICE(0x413C, 0x4002) }, /* Dell Axim USB Sync */ | 
 | 541 | 	{ USB_DEVICE(0x413C, 0x4003) }, /* Dell Axim USB Sync */ | 
 | 542 | 	{ USB_DEVICE(0x413C, 0x4004) }, /* Dell Axim USB Sync */ | 
 | 543 | 	{ USB_DEVICE(0x413C, 0x4005) }, /* Dell Axim USB Sync */ | 
 | 544 | 	{ USB_DEVICE(0x413C, 0x4006) }, /* Dell Axim USB Sync */ | 
 | 545 | 	{ USB_DEVICE(0x413C, 0x4007) }, /* Dell Axim USB Sync */ | 
 | 546 | 	{ USB_DEVICE(0x413C, 0x4008) }, /* Dell Axim USB Sync */ | 
 | 547 | 	{ USB_DEVICE(0x413C, 0x4009) }, /* Dell Axim USB Sync */ | 
 | 548 | 	{ USB_DEVICE(0x4505, 0x0010) }, /* Smartphone */ | 
 | 549 | 	{ USB_DEVICE(0x5E04, 0xCE00) }, /* SAGEM Wireless Assistant */ | 
| Christian Heim | 04cab132 | 2007-08-19 13:29:15 +0200 | [diff] [blame] | 550 | 	{ USB_DEVICE(0x0BB4, 0x00CF) }, /* HTC smartphone modems */ | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 551 | 	{ }                             /* Terminating entry */ | 
 | 552 | }; | 
 | 553 |  | 
| Alan Cox | eb6215c | 2008-07-22 11:12:41 +0100 | [diff] [blame] | 554 | MODULE_DEVICE_TABLE(usb, ipaq_id_table); | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 555 |  | 
 | 556 | static struct usb_driver ipaq_driver = { | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 557 | 	.name =		"ipaq", | 
 | 558 | 	.probe =	usb_serial_probe, | 
 | 559 | 	.disconnect =	usb_serial_disconnect, | 
 | 560 | 	.id_table =	ipaq_id_table, | 
| Greg Kroah-Hartman | ba9dc65 | 2005-11-16 13:41:28 -0800 | [diff] [blame] | 561 | 	.no_dynamic_id = 	1, | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 562 | }; | 
 | 563 |  | 
 | 564 |  | 
 | 565 | /* All of the device info needed for the Compaq iPAQ */ | 
| Greg Kroah-Hartman | ea65370 | 2005-06-20 21:15:16 -0700 | [diff] [blame] | 566 | static struct usb_serial_driver ipaq_device = { | 
| Greg Kroah-Hartman | 18fcac3 | 2005-06-20 21:15:16 -0700 | [diff] [blame] | 567 | 	.driver = { | 
 | 568 | 		.owner =	THIS_MODULE, | 
| Greg Kroah-Hartman | 269bda1 | 2005-06-20 21:15:16 -0700 | [diff] [blame] | 569 | 		.name =		"ipaq", | 
| Greg Kroah-Hartman | 18fcac3 | 2005-06-20 21:15:16 -0700 | [diff] [blame] | 570 | 	}, | 
| Greg Kroah-Hartman | 269bda1 | 2005-06-20 21:15:16 -0700 | [diff] [blame] | 571 | 	.description =		"PocketPC PDA", | 
| Johannes Hölzl | d9b1b78 | 2006-12-17 21:50:24 +0100 | [diff] [blame] | 572 | 	.usb_driver = 		&ipaq_driver, | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 573 | 	.id_table =		ipaq_id_table, | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 574 | 	.open =			ipaq_open, | 
 | 575 | 	.close =		ipaq_close, | 
 | 576 | 	.attach =		ipaq_startup, | 
| Mark Ellis | 1b8fb41 | 2009-03-09 22:24:29 +0000 | [diff] [blame] | 577 | 	.calc_num_ports =	ipaq_calc_num_ports, | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 578 | 	.write =		ipaq_write, | 
 | 579 | 	.write_room =		ipaq_write_room, | 
 | 580 | 	.chars_in_buffer =	ipaq_chars_in_buffer, | 
 | 581 | 	.read_bulk_callback =	ipaq_read_bulk_callback, | 
 | 582 | 	.write_bulk_callback =	ipaq_write_bulk_callback, | 
 | 583 | }; | 
 | 584 |  | 
 | 585 | static spinlock_t	write_list_lock; | 
 | 586 | static int		bytes_in; | 
 | 587 | static int		bytes_out; | 
 | 588 |  | 
| Alan Cox | 95da310 | 2008-07-22 11:09:07 +0100 | [diff] [blame] | 589 | static int ipaq_open(struct tty_struct *tty, | 
| Alan Cox | a509a7e | 2009-09-19 13:13:26 -0700 | [diff] [blame] | 590 | 			struct usb_serial_port *port) | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 591 | { | 
 | 592 | 	struct usb_serial	*serial = port->serial; | 
 | 593 | 	struct ipaq_private	*priv; | 
 | 594 | 	struct ipaq_packet	*pkt; | 
 | 595 | 	int			i, result = 0; | 
| Frank Gevaerts | b33488e | 2006-06-30 02:34:45 -0700 | [diff] [blame] | 596 | 	int			retries = connect_retries; | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 597 |  | 
| Harvey Harrison | 441b62c | 2008-03-03 16:08:34 -0800 | [diff] [blame] | 598 | 	dbg("%s - port %d", __func__, port->number); | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 599 |  | 
 | 600 | 	bytes_in = 0; | 
 | 601 | 	bytes_out = 0; | 
| Robert P. J. Day | 5cbded5 | 2006-12-13 00:35:56 -0800 | [diff] [blame] | 602 | 	priv = kmalloc(sizeof(struct ipaq_private), GFP_KERNEL); | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 603 | 	if (priv == NULL) { | 
| Greg Kroah-Hartman | 194343d | 2008-08-20 16:56:34 -0700 | [diff] [blame] | 604 | 		dev_err(&port->dev, "%s - Out of memory\n", __func__); | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 605 | 		return -ENOMEM; | 
 | 606 | 	} | 
 | 607 | 	usb_set_serial_port_data(port, priv); | 
 | 608 | 	priv->active = 0; | 
 | 609 | 	priv->queue_len = 0; | 
 | 610 | 	priv->free_len = 0; | 
 | 611 | 	INIT_LIST_HEAD(&priv->queue); | 
 | 612 | 	INIT_LIST_HEAD(&priv->freelist); | 
 | 613 |  | 
 | 614 | 	for (i = 0; i < URBDATA_QUEUE_MAX / PACKET_SIZE; i++) { | 
 | 615 | 		pkt = kmalloc(sizeof(struct ipaq_packet), GFP_KERNEL); | 
| Alan Cox | eb6215c | 2008-07-22 11:12:41 +0100 | [diff] [blame] | 616 | 		if (pkt == NULL) | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 617 | 			goto enomem; | 
| Alan Cox | eb6215c | 2008-07-22 11:12:41 +0100 | [diff] [blame] | 618 |  | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 619 | 		pkt->data = kmalloc(PACKET_SIZE, GFP_KERNEL); | 
 | 620 | 		if (pkt->data == NULL) { | 
 | 621 | 			kfree(pkt); | 
 | 622 | 			goto enomem; | 
 | 623 | 		} | 
 | 624 | 		pkt->len = 0; | 
 | 625 | 		pkt->written = 0; | 
 | 626 | 		INIT_LIST_HEAD(&pkt->list); | 
 | 627 | 		list_add(&pkt->list, &priv->freelist); | 
 | 628 | 		priv->free_len += PACKET_SIZE; | 
 | 629 | 	} | 
 | 630 |  | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 631 | 	/* | 
 | 632 | 	 * Lose the small buffers usbserial provides. Make larger ones. | 
 | 633 | 	 */ | 
 | 634 |  | 
 | 635 | 	kfree(port->bulk_in_buffer); | 
| Oliver Neukum | df3e1ab | 2008-06-30 14:33:57 +0200 | [diff] [blame] | 636 | 	kfree(port->bulk_out_buffer); | 
| Oliver Neukum | 852fef6 | 2008-07-26 22:42:42 +0200 | [diff] [blame] | 637 | 	/* make sure the generic serial code knows */ | 
 | 638 | 	port->bulk_out_buffer = NULL; | 
 | 639 |  | 
 | 640 | 	port->bulk_in_buffer = kmalloc(URBDATA_SIZE, GFP_KERNEL); | 
 | 641 | 	if (port->bulk_in_buffer == NULL) | 
 | 642 | 		goto enomem; | 
 | 643 |  | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 644 | 	port->bulk_out_buffer = kmalloc(URBDATA_SIZE, GFP_KERNEL); | 
 | 645 | 	if (port->bulk_out_buffer == NULL) { | 
| Oliver Neukum | 852fef6 | 2008-07-26 22:42:42 +0200 | [diff] [blame] | 646 | 		/* the buffer is useless, free it */ | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 647 | 		kfree(port->bulk_in_buffer); | 
| Oliver Neukum | ed6590a | 2007-09-17 20:15:53 +0200 | [diff] [blame] | 648 | 		port->bulk_in_buffer = NULL; | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 649 | 		goto enomem; | 
 | 650 | 	} | 
 | 651 | 	port->read_urb->transfer_buffer = port->bulk_in_buffer; | 
 | 652 | 	port->write_urb->transfer_buffer = port->bulk_out_buffer; | 
 | 653 | 	port->read_urb->transfer_buffer_length = URBDATA_SIZE; | 
| Alan Cox | eb6215c | 2008-07-22 11:12:41 +0100 | [diff] [blame] | 654 | 	port->bulk_out_size = port->write_urb->transfer_buffer_length | 
 | 655 | 							= URBDATA_SIZE; | 
 | 656 |  | 
| Frank Gevaerts | b33488e | 2006-06-30 02:34:45 -0700 | [diff] [blame] | 657 | 	msleep(1000*initial_wait); | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 658 |  | 
 | 659 | 	/* | 
 | 660 | 	 * Send out control message observed in win98 sniffs. Not sure what | 
 | 661 | 	 * it does, but from empirical observations, it seems that the device | 
 | 662 | 	 * will start the chat sequence once one of these messages gets | 
 | 663 | 	 * through. Since this has a reasonably high failure rate, we retry | 
 | 664 | 	 * several times. | 
 | 665 | 	 */ | 
 | 666 |  | 
 | 667 | 	while (retries--) { | 
 | 668 | 		result = usb_control_msg(serial->dev, | 
 | 669 | 				usb_sndctrlpipe(serial->dev, 0), 0x22, 0x21, | 
 | 670 | 				0x1, 0, NULL, 0, 100); | 
| Luiz Fernando N. Capitulino | 014aa2a | 2006-07-27 10:30:43 -0300 | [diff] [blame] | 671 | 		if (!result) | 
 | 672 | 			break; | 
 | 673 |  | 
| Frank Gevaerts | b33488e | 2006-06-30 02:34:45 -0700 | [diff] [blame] | 674 | 		msleep(1000); | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 675 | 	} | 
| Luiz Fernando N. Capitulino | 014aa2a | 2006-07-27 10:30:43 -0300 | [diff] [blame] | 676 |  | 
 | 677 | 	if (!retries && result) { | 
| Greg Kroah-Hartman | 194343d | 2008-08-20 16:56:34 -0700 | [diff] [blame] | 678 | 		dev_err(&port->dev, "%s - failed doing control urb, error %d\n",			__func__, result); | 
| Luiz Fernando N. Capitulino | 014aa2a | 2006-07-27 10:30:43 -0300 | [diff] [blame] | 679 | 		goto error; | 
 | 680 | 	} | 
 | 681 |  | 
 | 682 | 	/* Start reading from the device */ | 
 | 683 | 	usb_fill_bulk_urb(port->read_urb, serial->dev, | 
| Alan Cox | eb6215c | 2008-07-22 11:12:41 +0100 | [diff] [blame] | 684 | 		usb_rcvbulkpipe(serial->dev, port->bulk_in_endpointAddress), | 
 | 685 | 		port->read_urb->transfer_buffer, | 
 | 686 | 		port->read_urb->transfer_buffer_length, | 
 | 687 | 		ipaq_read_bulk_callback, port); | 
| Luiz Fernando N. Capitulino | 014aa2a | 2006-07-27 10:30:43 -0300 | [diff] [blame] | 688 |  | 
 | 689 | 	result = usb_submit_urb(port->read_urb, GFP_KERNEL); | 
 | 690 | 	if (result) { | 
| Greg Kroah-Hartman | 194343d | 2008-08-20 16:56:34 -0700 | [diff] [blame] | 691 | 		dev_err(&port->dev, | 
 | 692 | 			"%s - failed submitting read urb, error %d\n", | 
 | 693 | 			__func__, result); | 
| Luiz Fernando N. Capitulino | 014aa2a | 2006-07-27 10:30:43 -0300 | [diff] [blame] | 694 | 		goto error; | 
 | 695 | 	} | 
 | 696 |  | 
 | 697 | 	return 0; | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 698 |  | 
 | 699 | enomem: | 
 | 700 | 	result = -ENOMEM; | 
| Greg Kroah-Hartman | 194343d | 2008-08-20 16:56:34 -0700 | [diff] [blame] | 701 | 	dev_err(&port->dev, "%s - Out of memory\n", __func__); | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 702 | error: | 
 | 703 | 	ipaq_destroy_lists(port); | 
 | 704 | 	kfree(priv); | 
 | 705 | 	return result; | 
 | 706 | } | 
 | 707 |  | 
 | 708 |  | 
| Alan Cox | 335f851 | 2009-06-11 12:26:29 +0100 | [diff] [blame] | 709 | static void ipaq_close(struct usb_serial_port *port) | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 710 | { | 
 | 711 | 	struct ipaq_private	*priv = usb_get_serial_port_data(port); | 
 | 712 |  | 
| Harvey Harrison | 441b62c | 2008-03-03 16:08:34 -0800 | [diff] [blame] | 713 | 	dbg("%s - port %d", __func__, port->number); | 
| Alan Cox | eb6215c | 2008-07-22 11:12:41 +0100 | [diff] [blame] | 714 |  | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 715 | 	/* | 
 | 716 | 	 * shut down bulk read and write | 
 | 717 | 	 */ | 
 | 718 | 	usb_kill_urb(port->write_urb); | 
 | 719 | 	usb_kill_urb(port->read_urb); | 
 | 720 | 	ipaq_destroy_lists(port); | 
 | 721 | 	kfree(priv); | 
 | 722 | 	usb_set_serial_port_data(port, NULL); | 
 | 723 |  | 
| Alan Cox | eb6215c | 2008-07-22 11:12:41 +0100 | [diff] [blame] | 724 | 	/* Uncomment the following line if you want to see some statistics | 
 | 725 | 	 * in your syslog */ | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 726 | 	/* info ("Bytes In = %d  Bytes Out = %d", bytes_in, bytes_out); */ | 
 | 727 | } | 
 | 728 |  | 
| David Howells | 7d12e78 | 2006-10-05 14:55:46 +0100 | [diff] [blame] | 729 | static void ipaq_read_bulk_callback(struct urb *urb) | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 730 | { | 
| Ming Lei | cdc9779 | 2008-02-24 18:41:47 +0800 | [diff] [blame] | 731 | 	struct usb_serial_port	*port = urb->context; | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 732 | 	struct tty_struct	*tty; | 
 | 733 | 	unsigned char		*data = urb->transfer_buffer; | 
| Alan Cox | 33f0f88 | 2006-01-09 20:54:13 -0800 | [diff] [blame] | 734 | 	int			result; | 
| Greg Kroah-Hartman | 2362deb | 2007-06-15 15:44:13 -0700 | [diff] [blame] | 735 | 	int status = urb->status; | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 736 |  | 
| Harvey Harrison | 441b62c | 2008-03-03 16:08:34 -0800 | [diff] [blame] | 737 | 	dbg("%s - port %d", __func__, port->number); | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 738 |  | 
| Greg Kroah-Hartman | 2362deb | 2007-06-15 15:44:13 -0700 | [diff] [blame] | 739 | 	if (status) { | 
 | 740 | 		dbg("%s - nonzero read bulk status received: %d", | 
| Harvey Harrison | 441b62c | 2008-03-03 16:08:34 -0800 | [diff] [blame] | 741 | 		    __func__, status); | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 742 | 		return; | 
 | 743 | 	} | 
 | 744 |  | 
| Alan Cox | eb6215c | 2008-07-22 11:12:41 +0100 | [diff] [blame] | 745 | 	usb_serial_debug_data(debug, &port->dev, __func__, | 
 | 746 | 						urb->actual_length, data); | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 747 |  | 
| Alan Cox | 4a90f09 | 2008-10-13 10:39:46 +0100 | [diff] [blame] | 748 | 	tty = tty_port_tty_get(&port->port); | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 749 | 	if (tty && urb->actual_length) { | 
| Alan Cox | 33f0f88 | 2006-01-09 20:54:13 -0800 | [diff] [blame] | 750 | 		tty_buffer_request_room(tty, urb->actual_length); | 
 | 751 | 		tty_insert_flip_string(tty, data, urb->actual_length); | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 752 | 		tty_flip_buffer_push(tty); | 
 | 753 | 		bytes_in += urb->actual_length; | 
 | 754 | 	} | 
| Alan Cox | 4a90f09 | 2008-10-13 10:39:46 +0100 | [diff] [blame] | 755 | 	tty_kref_put(tty); | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 756 |  | 
 | 757 | 	/* Continue trying to always read  */ | 
| Alan Cox | eb6215c | 2008-07-22 11:12:41 +0100 | [diff] [blame] | 758 | 	usb_fill_bulk_urb(port->read_urb, port->serial->dev, | 
 | 759 | 	    usb_rcvbulkpipe(port->serial->dev, port->bulk_in_endpointAddress), | 
 | 760 | 	    port->read_urb->transfer_buffer, | 
 | 761 | 	    port->read_urb->transfer_buffer_length, | 
 | 762 | 	    ipaq_read_bulk_callback, port); | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 763 | 	result = usb_submit_urb(port->read_urb, GFP_ATOMIC); | 
 | 764 | 	if (result) | 
| Greg Kroah-Hartman | 194343d | 2008-08-20 16:56:34 -0700 | [diff] [blame] | 765 | 		dev_err(&port->dev, | 
 | 766 | 			"%s - failed resubmitting read urb, error %d\n", | 
 | 767 | 			__func__, result); | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 768 | 	return; | 
 | 769 | } | 
 | 770 |  | 
| Alan Cox | 95da310 | 2008-07-22 11:09:07 +0100 | [diff] [blame] | 771 | static int ipaq_write(struct tty_struct *tty, struct usb_serial_port *port, | 
 | 772 | 			const unsigned char *buf, int count) | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 773 | { | 
 | 774 | 	const unsigned char	*current_position = buf; | 
 | 775 | 	int			bytes_sent = 0; | 
 | 776 | 	int			transfer_size; | 
 | 777 |  | 
| Harvey Harrison | 441b62c | 2008-03-03 16:08:34 -0800 | [diff] [blame] | 778 | 	dbg("%s - port %d", __func__, port->number); | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 779 |  | 
 | 780 | 	while (count > 0) { | 
 | 781 | 		transfer_size = min(count, PACKET_SIZE); | 
| Alan Cox | eb6215c | 2008-07-22 11:12:41 +0100 | [diff] [blame] | 782 | 		if (ipaq_write_bulk(port, current_position, transfer_size)) | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 783 | 			break; | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 784 | 		current_position += transfer_size; | 
 | 785 | 		bytes_sent += transfer_size; | 
 | 786 | 		count -= transfer_size; | 
 | 787 | 		bytes_out += transfer_size; | 
 | 788 | 	} | 
 | 789 |  | 
 | 790 | 	return bytes_sent; | 
| Alan Cox | eb6215c | 2008-07-22 11:12:41 +0100 | [diff] [blame] | 791 | } | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 792 |  | 
| Alan Cox | eb6215c | 2008-07-22 11:12:41 +0100 | [diff] [blame] | 793 | static int ipaq_write_bulk(struct usb_serial_port *port, | 
 | 794 | 					const unsigned char *buf, int count) | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 795 | { | 
 | 796 | 	struct ipaq_private	*priv = usb_get_serial_port_data(port); | 
 | 797 | 	struct ipaq_packet	*pkt = NULL; | 
 | 798 | 	int			result = 0; | 
 | 799 | 	unsigned long		flags; | 
 | 800 |  | 
 | 801 | 	if (priv->free_len <= 0) { | 
| Harvey Harrison | 441b62c | 2008-03-03 16:08:34 -0800 | [diff] [blame] | 802 | 		dbg("%s - we're stuffed", __func__); | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 803 | 		return -EAGAIN; | 
 | 804 | 	} | 
 | 805 |  | 
 | 806 | 	spin_lock_irqsave(&write_list_lock, flags); | 
 | 807 | 	if (!list_empty(&priv->freelist)) { | 
 | 808 | 		pkt = list_entry(priv->freelist.next, struct ipaq_packet, list); | 
 | 809 | 		list_del(&pkt->list); | 
 | 810 | 		priv->free_len -= PACKET_SIZE; | 
 | 811 | 	} | 
 | 812 | 	spin_unlock_irqrestore(&write_list_lock, flags); | 
 | 813 | 	if (pkt == NULL) { | 
| Harvey Harrison | 441b62c | 2008-03-03 16:08:34 -0800 | [diff] [blame] | 814 | 		dbg("%s - we're stuffed", __func__); | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 815 | 		return -EAGAIN; | 
 | 816 | 	} | 
 | 817 |  | 
 | 818 | 	memcpy(pkt->data, buf, count); | 
| Harvey Harrison | 441b62c | 2008-03-03 16:08:34 -0800 | [diff] [blame] | 819 | 	usb_serial_debug_data(debug, &port->dev, __func__, count, pkt->data); | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 820 |  | 
 | 821 | 	pkt->len = count; | 
 | 822 | 	pkt->written = 0; | 
 | 823 | 	spin_lock_irqsave(&write_list_lock, flags); | 
 | 824 | 	list_add_tail(&pkt->list, &priv->queue); | 
 | 825 | 	priv->queue_len += count; | 
 | 826 | 	if (priv->active == 0) { | 
 | 827 | 		priv->active = 1; | 
 | 828 | 		ipaq_write_gather(port); | 
 | 829 | 		spin_unlock_irqrestore(&write_list_lock, flags); | 
 | 830 | 		result = usb_submit_urb(port->write_urb, GFP_ATOMIC); | 
| Alan Cox | eb6215c | 2008-07-22 11:12:41 +0100 | [diff] [blame] | 831 | 		if (result) | 
| Greg Kroah-Hartman | 194343d | 2008-08-20 16:56:34 -0700 | [diff] [blame] | 832 | 			dev_err(&port->dev, | 
 | 833 | 				"%s - failed submitting write urb, error %d\n", | 
| Alan Cox | eb6215c | 2008-07-22 11:12:41 +0100 | [diff] [blame] | 834 | 				__func__, result); | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 835 | 	} else { | 
 | 836 | 		spin_unlock_irqrestore(&write_list_lock, flags); | 
 | 837 | 	} | 
 | 838 | 	return result; | 
 | 839 | } | 
 | 840 |  | 
 | 841 | static void ipaq_write_gather(struct usb_serial_port *port) | 
 | 842 | { | 
 | 843 | 	struct ipaq_private	*priv = usb_get_serial_port_data(port); | 
 | 844 | 	struct usb_serial	*serial = port->serial; | 
 | 845 | 	int			count, room; | 
 | 846 | 	struct ipaq_packet	*pkt, *tmp; | 
 | 847 | 	struct urb		*urb = port->write_urb; | 
 | 848 |  | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 849 | 	room = URBDATA_SIZE; | 
 | 850 | 	list_for_each_entry_safe(pkt, tmp, &priv->queue, list) { | 
 | 851 | 		count = min(room, (int)(pkt->len - pkt->written)); | 
 | 852 | 		memcpy(urb->transfer_buffer + (URBDATA_SIZE - room), | 
 | 853 | 		       pkt->data + pkt->written, count); | 
 | 854 | 		room -= count; | 
 | 855 | 		pkt->written += count; | 
 | 856 | 		priv->queue_len -= count; | 
 | 857 | 		if (pkt->written == pkt->len) { | 
 | 858 | 			list_move(&pkt->list, &priv->freelist); | 
 | 859 | 			priv->free_len += PACKET_SIZE; | 
 | 860 | 		} | 
| Alan Cox | eb6215c | 2008-07-22 11:12:41 +0100 | [diff] [blame] | 861 | 		if (room == 0) | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 862 | 			break; | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 863 | 	} | 
 | 864 |  | 
 | 865 | 	count = URBDATA_SIZE - room; | 
| Alan Cox | eb6215c | 2008-07-22 11:12:41 +0100 | [diff] [blame] | 866 | 	usb_fill_bulk_urb(port->write_urb, serial->dev, | 
 | 867 | 		usb_sndbulkpipe(serial->dev, port->bulk_out_endpointAddress), | 
 | 868 | 		port->write_urb->transfer_buffer, count, | 
 | 869 | 		ipaq_write_bulk_callback, port); | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 870 | 	return; | 
 | 871 | } | 
 | 872 |  | 
| David Howells | 7d12e78 | 2006-10-05 14:55:46 +0100 | [diff] [blame] | 873 | static void ipaq_write_bulk_callback(struct urb *urb) | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 874 | { | 
| Ming Lei | cdc9779 | 2008-02-24 18:41:47 +0800 | [diff] [blame] | 875 | 	struct usb_serial_port	*port = urb->context; | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 876 | 	struct ipaq_private	*priv = usb_get_serial_port_data(port); | 
 | 877 | 	unsigned long		flags; | 
 | 878 | 	int			result; | 
| Greg Kroah-Hartman | 2362deb | 2007-06-15 15:44:13 -0700 | [diff] [blame] | 879 | 	int status = urb->status; | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 880 |  | 
| Harvey Harrison | 441b62c | 2008-03-03 16:08:34 -0800 | [diff] [blame] | 881 | 	dbg("%s - port %d", __func__, port->number); | 
| Greg Kroah-Hartman | 2362deb | 2007-06-15 15:44:13 -0700 | [diff] [blame] | 882 |  | 
 | 883 | 	if (status) { | 
 | 884 | 		dbg("%s - nonzero write bulk status received: %d", | 
| Harvey Harrison | 441b62c | 2008-03-03 16:08:34 -0800 | [diff] [blame] | 885 | 		    __func__, status); | 
| Frank Gevaerts | b512504 | 2006-06-30 02:34:44 -0700 | [diff] [blame] | 886 | 		return; | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 887 | 	} | 
 | 888 |  | 
 | 889 | 	spin_lock_irqsave(&write_list_lock, flags); | 
 | 890 | 	if (!list_empty(&priv->queue)) { | 
 | 891 | 		ipaq_write_gather(port); | 
 | 892 | 		spin_unlock_irqrestore(&write_list_lock, flags); | 
 | 893 | 		result = usb_submit_urb(port->write_urb, GFP_ATOMIC); | 
| Alan Cox | eb6215c | 2008-07-22 11:12:41 +0100 | [diff] [blame] | 894 | 		if (result) | 
| Greg Kroah-Hartman | 194343d | 2008-08-20 16:56:34 -0700 | [diff] [blame] | 895 | 			dev_err(&port->dev, | 
 | 896 | 				"%s - failed submitting write urb, error %d\n", | 
 | 897 | 				__func__, result); | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 898 | 	} else { | 
 | 899 | 		priv->active = 0; | 
 | 900 | 		spin_unlock_irqrestore(&write_list_lock, flags); | 
 | 901 | 	} | 
 | 902 |  | 
| Pete Zaitcev | cf2c748 | 2006-05-22 21:58:49 -0700 | [diff] [blame] | 903 | 	usb_serial_port_softint(port); | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 904 | } | 
 | 905 |  | 
| Alan Cox | 95da310 | 2008-07-22 11:09:07 +0100 | [diff] [blame] | 906 | static int ipaq_write_room(struct tty_struct *tty) | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 907 | { | 
| Alan Cox | 95da310 | 2008-07-22 11:09:07 +0100 | [diff] [blame] | 908 | 	struct usb_serial_port *port = tty->driver_data; | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 909 | 	struct ipaq_private	*priv = usb_get_serial_port_data(port); | 
 | 910 |  | 
| Harvey Harrison | 441b62c | 2008-03-03 16:08:34 -0800 | [diff] [blame] | 911 | 	dbg("%s - freelen %d", __func__, priv->free_len); | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 912 | 	return priv->free_len; | 
 | 913 | } | 
 | 914 |  | 
| Alan Cox | 95da310 | 2008-07-22 11:09:07 +0100 | [diff] [blame] | 915 | static int ipaq_chars_in_buffer(struct tty_struct *tty) | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 916 | { | 
| Alan Cox | 95da310 | 2008-07-22 11:09:07 +0100 | [diff] [blame] | 917 | 	struct usb_serial_port *port = tty->driver_data; | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 918 | 	struct ipaq_private	*priv = usb_get_serial_port_data(port); | 
 | 919 |  | 
| Harvey Harrison | 441b62c | 2008-03-03 16:08:34 -0800 | [diff] [blame] | 920 | 	dbg("%s - queuelen %d", __func__, priv->queue_len); | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 921 | 	return priv->queue_len; | 
 | 922 | } | 
 | 923 |  | 
 | 924 | static void ipaq_destroy_lists(struct usb_serial_port *port) | 
 | 925 | { | 
 | 926 | 	struct ipaq_private	*priv = usb_get_serial_port_data(port); | 
 | 927 | 	struct ipaq_packet	*pkt, *tmp; | 
 | 928 |  | 
 | 929 | 	list_for_each_entry_safe(pkt, tmp, &priv->queue, list) { | 
 | 930 | 		kfree(pkt->data); | 
 | 931 | 		kfree(pkt); | 
 | 932 | 	} | 
 | 933 | 	list_for_each_entry_safe(pkt, tmp, &priv->freelist, list) { | 
 | 934 | 		kfree(pkt->data); | 
 | 935 | 		kfree(pkt); | 
 | 936 | 	} | 
 | 937 | } | 
 | 938 |  | 
 | 939 |  | 
| Mark Ellis | 1b8fb41 | 2009-03-09 22:24:29 +0000 | [diff] [blame] | 940 | static int ipaq_calc_num_ports(struct usb_serial *serial) | 
 | 941 | { | 
 | 942 | 	/* | 
 | 943 | 	 * some devices have 3 endpoints, the 3rd of which | 
 | 944 | 	 * must be ignored as it would make the core | 
 | 945 | 	 * create a second port which oopses when used | 
 | 946 | 	 */ | 
 | 947 | 	int ipaq_num_ports = 1; | 
 | 948 |  | 
 | 949 | 	dbg("%s - numberofendpoints: %d", __FUNCTION__, | 
 | 950 | 		(int)serial->interface->cur_altsetting->desc.bNumEndpoints); | 
 | 951 |  | 
 | 952 | 	/* | 
 | 953 | 	 * a few devices have 4 endpoints, seemingly Yakuma devices, | 
 | 954 | 	 * and we need the second pair, so let them have 2 ports | 
 | 955 | 	 * | 
 | 956 | 	 * TODO: can we drop port 1 ? | 
 | 957 | 	 */ | 
 | 958 | 	if (serial->interface->cur_altsetting->desc.bNumEndpoints > 3) { | 
 | 959 | 		ipaq_num_ports = 2; | 
 | 960 | 	} | 
 | 961 |  | 
 | 962 | 	return ipaq_num_ports; | 
 | 963 | } | 
 | 964 |  | 
 | 965 |  | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 966 | static int ipaq_startup(struct usb_serial *serial) | 
 | 967 | { | 
| Harvey Harrison | 441b62c | 2008-03-03 16:08:34 -0800 | [diff] [blame] | 968 | 	dbg("%s", __func__); | 
| Alan Stern | 06bad89 | 2009-10-05 15:53:58 -0400 | [diff] [blame] | 969 |  | 
 | 970 | 	/* Some of the devices in ipaq_id_table[] are composite, and we | 
 | 971 | 	 * shouldn't bind to all the interfaces.  This test will rule out | 
 | 972 | 	 * some obviously invalid possibilities. | 
 | 973 | 	 */ | 
 | 974 | 	if (serial->num_bulk_in < serial->num_ports || | 
 | 975 | 			serial->num_bulk_out < serial->num_ports) | 
 | 976 | 		return -ENODEV; | 
 | 977 |  | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 978 | 	if (serial->dev->actconfig->desc.bConfigurationValue != 1) { | 
| Mark Ellis | 1b8fb41 | 2009-03-09 22:24:29 +0000 | [diff] [blame] | 979 | 		/* | 
 | 980 | 		 * FIXME: HP iPaq rx3715, possibly others, have 1 config that | 
 | 981 | 		 * is labeled as 2 | 
 | 982 | 		 */ | 
 | 983 |  | 
| Greg Kroah-Hartman | 194343d | 2008-08-20 16:56:34 -0700 | [diff] [blame] | 984 | 		dev_err(&serial->dev->dev, "active config #%d != 1 ??\n", | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 985 | 			serial->dev->actconfig->desc.bConfigurationValue); | 
 | 986 | 		return -ENODEV; | 
 | 987 | 	} | 
| Mark Ellis | 1b8fb41 | 2009-03-09 22:24:29 +0000 | [diff] [blame] | 988 |  | 
 | 989 | 	dbg("%s - iPAQ module configured for %d ports", | 
 | 990 | 		__FUNCTION__, serial->num_ports); | 
 | 991 |  | 
| Alan Cox | eb6215c | 2008-07-22 11:12:41 +0100 | [diff] [blame] | 992 | 	return usb_reset_configuration(serial->dev); | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 993 | } | 
 | 994 |  | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 995 | static int __init ipaq_init(void) | 
 | 996 | { | 
 | 997 | 	int retval; | 
 | 998 | 	spin_lock_init(&write_list_lock); | 
 | 999 | 	retval = usb_serial_register(&ipaq_device); | 
| Alan Cox | eb6215c | 2008-07-22 11:12:41 +0100 | [diff] [blame] | 1000 | 	if (retval) | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1001 | 		goto failed_usb_serial_register; | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1002 | 	if (vendor) { | 
 | 1003 | 		ipaq_id_table[0].idVendor = vendor; | 
 | 1004 | 		ipaq_id_table[0].idProduct = product; | 
 | 1005 | 	} | 
 | 1006 | 	retval = usb_register(&ipaq_driver); | 
 | 1007 | 	if (retval) | 
 | 1008 | 		goto failed_usb_register; | 
| Alan Cox | eb6215c | 2008-07-22 11:12:41 +0100 | [diff] [blame] | 1009 |  | 
| Greg Kroah-Hartman | c197a8d | 2008-08-18 13:21:04 -0700 | [diff] [blame] | 1010 | 	printk(KERN_INFO KBUILD_MODNAME ": " DRIVER_VERSION ":" | 
 | 1011 | 	       DRIVER_DESC "\n"); | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1012 | 	return 0; | 
 | 1013 | failed_usb_register: | 
 | 1014 | 	usb_serial_deregister(&ipaq_device); | 
 | 1015 | failed_usb_serial_register: | 
 | 1016 | 	return retval; | 
 | 1017 | } | 
 | 1018 |  | 
 | 1019 |  | 
 | 1020 | static void __exit ipaq_exit(void) | 
 | 1021 | { | 
 | 1022 | 	usb_deregister(&ipaq_driver); | 
 | 1023 | 	usb_serial_deregister(&ipaq_device); | 
 | 1024 | } | 
 | 1025 |  | 
 | 1026 |  | 
 | 1027 | module_init(ipaq_init); | 
 | 1028 | module_exit(ipaq_exit); | 
 | 1029 |  | 
| Alan Cox | eb6215c | 2008-07-22 11:12:41 +0100 | [diff] [blame] | 1030 | MODULE_AUTHOR(DRIVER_AUTHOR); | 
 | 1031 | MODULE_DESCRIPTION(DRIVER_DESC); | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1032 | MODULE_LICENSE("GPL"); | 
 | 1033 |  | 
 | 1034 | module_param(debug, bool, S_IRUGO | S_IWUSR); | 
 | 1035 | MODULE_PARM_DESC(debug, "Debug enabled or not"); | 
 | 1036 |  | 
 | 1037 | module_param(vendor, ushort, 0); | 
 | 1038 | MODULE_PARM_DESC(vendor, "User specified USB idVendor"); | 
 | 1039 |  | 
 | 1040 | module_param(product, ushort, 0); | 
 | 1041 | MODULE_PARM_DESC(product, "User specified USB idProduct"); | 
| Frank Gevaerts | b33488e | 2006-06-30 02:34:45 -0700 | [diff] [blame] | 1042 |  | 
 | 1043 | module_param(connect_retries, int, S_IRUGO|S_IWUSR); | 
| Alan Cox | eb6215c | 2008-07-22 11:12:41 +0100 | [diff] [blame] | 1044 | MODULE_PARM_DESC(connect_retries, | 
 | 1045 | 		"Maximum number of connect retries (one second each)"); | 
| Frank Gevaerts | b33488e | 2006-06-30 02:34:45 -0700 | [diff] [blame] | 1046 |  | 
 | 1047 | module_param(initial_wait, int, S_IRUGO|S_IWUSR); | 
| Alan Cox | eb6215c | 2008-07-22 11:12:41 +0100 | [diff] [blame] | 1048 | MODULE_PARM_DESC(initial_wait, | 
 | 1049 | 		"Time to wait before attempting a connection (in seconds)"); |