1
2
3
4
5
6
7
8
9#include <linux/kernel.h>
10#include <linux/errno.h>
11#include <linux/slab.h>
12#include <linux/tty.h>
13#include <linux/tty_driver.h>
14#include <linux/tty_flip.h>
15#include <linux/module.h>
16#include <linux/spinlock.h>
17#include <linux/uaccess.h>
18#include <linux/usb.h>
19#include <linux/usb/serial.h>
20
21#define KP_RETRIES 100
22
23#define DRIVER_AUTHOR "Ganesh Varadarajan <ganesh@veritas.com>"
24#define DRIVER_DESC "USB PocketPC PDA driver"
25
26static int connect_retries = KP_RETRIES;
27static int initial_wait;
28
29
30static int ipaq_open(struct tty_struct *tty,
31 struct usb_serial_port *port);
32static int ipaq_calc_num_ports(struct usb_serial *serial,
33 struct usb_serial_endpoints *epds);
34static int ipaq_startup(struct usb_serial *serial);
35
36static const struct usb_device_id ipaq_id_table[] = {
37 { USB_DEVICE(0x0104, 0x00BE) },
38 { USB_DEVICE(0x03F0, 0x1016) },
39 { USB_DEVICE(0x03F0, 0x1116) },
40 { USB_DEVICE(0x03F0, 0x1216) },
41 { USB_DEVICE(0x03F0, 0x2016) },
42 { USB_DEVICE(0x03F0, 0x2116) },
43 { USB_DEVICE(0x03F0, 0x2216) },
44 { USB_DEVICE(0x03F0, 0x3016) },
45 { USB_DEVICE(0x03F0, 0x3116) },
46 { USB_DEVICE(0x03F0, 0x3216) },
47 { USB_DEVICE(0x03F0, 0x4016) },
48 { USB_DEVICE(0x03F0, 0x4116) },
49 { USB_DEVICE(0x03F0, 0x4216) },
50 { USB_DEVICE(0x03F0, 0x5016) },
51 { USB_DEVICE(0x03F0, 0x5116) },
52 { USB_DEVICE(0x03F0, 0x5216) },
53 { USB_DEVICE(0x0409, 0x00D5) },
54 { USB_DEVICE(0x0409, 0x00D6) },
55 { USB_DEVICE(0x0409, 0x00D7) },
56 { USB_DEVICE(0x0409, 0x8024) },
57 { USB_DEVICE(0x0409, 0x8025) },
58 { USB_DEVICE(0x043E, 0x9C01) },
59 { USB_DEVICE(0x045E, 0x00CE) },
60 { USB_DEVICE(0x045E, 0x0400) },
61 { USB_DEVICE(0x045E, 0x0401) },
62 { USB_DEVICE(0x045E, 0x0402) },
63 { USB_DEVICE(0x045E, 0x0403) },
64 { USB_DEVICE(0x045E, 0x0404) },
65 { USB_DEVICE(0x045E, 0x0405) },
66 { USB_DEVICE(0x045E, 0x0406) },
67 { USB_DEVICE(0x045E, 0x0407) },
68 { USB_DEVICE(0x045E, 0x0408) },
69 { USB_DEVICE(0x045E, 0x0409) },
70 { USB_DEVICE(0x045E, 0x040A) },
71 { USB_DEVICE(0x045E, 0x040B) },
72 { USB_DEVICE(0x045E, 0x040C) },
73 { USB_DEVICE(0x045E, 0x040D) },
74 { USB_DEVICE(0x045E, 0x040E) },
75 { USB_DEVICE(0x045E, 0x040F) },
76 { USB_DEVICE(0x045E, 0x0410) },
77 { USB_DEVICE(0x045E, 0x0411) },
78 { USB_DEVICE(0x045E, 0x0412) },
79 { USB_DEVICE(0x045E, 0x0413) },
80 { USB_DEVICE(0x045E, 0x0414) },
81 { USB_DEVICE(0x045E, 0x0415) },
82 { USB_DEVICE(0x045E, 0x0416) },
83 { USB_DEVICE(0x045E, 0x0417) },
84 { USB_DEVICE(0x045E, 0x0432) },
85 { USB_DEVICE(0x045E, 0x0433) },
86 { USB_DEVICE(0x045E, 0x0434) },
87 { USB_DEVICE(0x045E, 0x0435) },
88 { USB_DEVICE(0x045E, 0x0436) },
89 { USB_DEVICE(0x045E, 0x0437) },
90 { USB_DEVICE(0x045E, 0x0438) },
91 { USB_DEVICE(0x045E, 0x0439) },
92 { USB_DEVICE(0x045E, 0x043A) },
93 { USB_DEVICE(0x045E, 0x043B) },
94 { USB_DEVICE(0x045E, 0x043C) },
95 { USB_DEVICE(0x045E, 0x043D) },
96 { USB_DEVICE(0x045E, 0x043E) },
97 { USB_DEVICE(0x045E, 0x043F) },
98 { USB_DEVICE(0x045E, 0x0440) },
99 { USB_DEVICE(0x045E, 0x0441) },
100 { USB_DEVICE(0x045E, 0x0442) },
101 { USB_DEVICE(0x045E, 0x0443) },
102 { USB_DEVICE(0x045E, 0x0444) },
103 { USB_DEVICE(0x045E, 0x0445) },
104 { USB_DEVICE(0x045E, 0x0446) },
105 { USB_DEVICE(0x045E, 0x0447) },
106 { USB_DEVICE(0x045E, 0x0448) },
107 { USB_DEVICE(0x045E, 0x0449) },
108 { USB_DEVICE(0x045E, 0x044A) },
109 { USB_DEVICE(0x045E, 0x044B) },
110 { USB_DEVICE(0x045E, 0x044C) },
111 { USB_DEVICE(0x045E, 0x044D) },
112 { USB_DEVICE(0x045E, 0x044E) },
113 { USB_DEVICE(0x045E, 0x044F) },
114 { USB_DEVICE(0x045E, 0x0450) },
115 { USB_DEVICE(0x045E, 0x0451) },
116 { USB_DEVICE(0x045E, 0x0452) },
117 { USB_DEVICE(0x045E, 0x0453) },
118 { USB_DEVICE(0x045E, 0x0454) },
119 { USB_DEVICE(0x045E, 0x0455) },
120 { USB_DEVICE(0x045E, 0x0456) },
121 { USB_DEVICE(0x045E, 0x0457) },
122 { USB_DEVICE(0x045E, 0x0458) },
123 { USB_DEVICE(0x045E, 0x0459) },
124 { USB_DEVICE(0x045E, 0x045A) },
125 { USB_DEVICE(0x045E, 0x045B) },
126 { USB_DEVICE(0x045E, 0x045C) },
127 { USB_DEVICE(0x045E, 0x045D) },
128 { USB_DEVICE(0x045E, 0x045E) },
129 { USB_DEVICE(0x045E, 0x045F) },
130 { USB_DEVICE(0x045E, 0x0460) },
131 { USB_DEVICE(0x045E, 0x0461) },
132 { USB_DEVICE(0x045E, 0x0462) },
133 { USB_DEVICE(0x045E, 0x0463) },
134 { USB_DEVICE(0x045E, 0x0464) },
135 { USB_DEVICE(0x045E, 0x0465) },
136 { USB_DEVICE(0x045E, 0x0466) },
137 { USB_DEVICE(0x045E, 0x0467) },
138 { USB_DEVICE(0x045E, 0x0468) },
139 { USB_DEVICE(0x045E, 0x0469) },
140 { USB_DEVICE(0x045E, 0x046A) },
141 { USB_DEVICE(0x045E, 0x046B) },
142 { USB_DEVICE(0x045E, 0x046C) },
143 { USB_DEVICE(0x045E, 0x046D) },
144 { USB_DEVICE(0x045E, 0x046E) },
145 { USB_DEVICE(0x045E, 0x046F) },
146 { USB_DEVICE(0x045E, 0x0470) },
147 { USB_DEVICE(0x045E, 0x0471) },
148 { USB_DEVICE(0x045E, 0x0472) },
149 { USB_DEVICE(0x045E, 0x0473) },
150 { USB_DEVICE(0x045E, 0x0474) },
151 { USB_DEVICE(0x045E, 0x0475) },
152 { USB_DEVICE(0x045E, 0x0476) },
153 { USB_DEVICE(0x045E, 0x0477) },
154 { USB_DEVICE(0x045E, 0x0478) },
155 { USB_DEVICE(0x045E, 0x0479) },
156 { USB_DEVICE(0x045E, 0x047A) },
157 { USB_DEVICE(0x045E, 0x047B) },
158 { USB_DEVICE(0x045E, 0x04C8) },
159 { USB_DEVICE(0x045E, 0x04C9) },
160 { USB_DEVICE(0x045E, 0x04CA) },
161 { USB_DEVICE(0x045E, 0x04CB) },
162 { USB_DEVICE(0x045E, 0x04CC) },
163 { USB_DEVICE(0x045E, 0x04CD) },
164 { USB_DEVICE(0x045E, 0x04CE) },
165 { USB_DEVICE(0x045E, 0x04D7) },
166 { USB_DEVICE(0x045E, 0x04D8) },
167 { USB_DEVICE(0x045E, 0x04D9) },
168 { USB_DEVICE(0x045E, 0x04DA) },
169 { USB_DEVICE(0x045E, 0x04DB) },
170 { USB_DEVICE(0x045E, 0x04DC) },
171 { USB_DEVICE(0x045E, 0x04DD) },
172 { USB_DEVICE(0x045E, 0x04DE) },
173 { USB_DEVICE(0x045E, 0x04DF) },
174 { USB_DEVICE(0x045E, 0x04E0) },
175 { USB_DEVICE(0x045E, 0x04E1) },
176 { USB_DEVICE(0x045E, 0x04E2) },
177 { USB_DEVICE(0x045E, 0x04E3) },
178 { USB_DEVICE(0x045E, 0x04E4) },
179 { USB_DEVICE(0x045E, 0x04E5) },
180 { USB_DEVICE(0x045E, 0x04E6) },
181 { USB_DEVICE(0x045E, 0x04E7) },
182 { USB_DEVICE(0x045E, 0x04E8) },
183 { USB_DEVICE(0x045E, 0x04E9) },
184 { USB_DEVICE(0x045E, 0x04EA) },
185 { USB_DEVICE(0x049F, 0x0003) },
186 { USB_DEVICE(0x049F, 0x0032) },
187 { USB_DEVICE(0x04A4, 0x0014) },
188 { USB_DEVICE(0x04AD, 0x0301) },
189 { USB_DEVICE(0x04AD, 0x0302) },
190 { USB_DEVICE(0x04AD, 0x0303) },
191 { USB_DEVICE(0x04AD, 0x0306) },
192 { USB_DEVICE(0x04B7, 0x0531) },
193 { USB_DEVICE(0x04C5, 0x1058) },
194 { USB_DEVICE(0x04C5, 0x1079) },
195 { USB_DEVICE(0x04DA, 0x2500) },
196 { USB_DEVICE(0x04DD, 0x9102) },
197 { USB_DEVICE(0x04DD, 0x9121) },
198 { USB_DEVICE(0x04DD, 0x9123) },
199 { USB_DEVICE(0x04DD, 0x9151) },
200 { USB_DEVICE(0x04DD, 0x91AC) },
201 { USB_DEVICE(0x04E8, 0x5F00) },
202 { USB_DEVICE(0x04E8, 0x5F01) },
203 { USB_DEVICE(0x04E8, 0x5F02) },
204 { USB_DEVICE(0x04E8, 0x5F03) },
205 { USB_DEVICE(0x04E8, 0x5F04) },
206 { USB_DEVICE(0x04E8, 0x6611) },
207 { USB_DEVICE(0x04E8, 0x6613) },
208 { USB_DEVICE(0x04E8, 0x6615) },
209 { USB_DEVICE(0x04E8, 0x6617) },
210 { USB_DEVICE(0x04E8, 0x6619) },
211 { USB_DEVICE(0x04E8, 0x661B) },
212 { USB_DEVICE(0x04E8, 0x662E) },
213 { USB_DEVICE(0x04E8, 0x6630) },
214 { USB_DEVICE(0x04E8, 0x6632) },
215 { USB_DEVICE(0x04f1, 0x3011) },
216 { USB_DEVICE(0x04F1, 0x3012) },
217 { USB_DEVICE(0x0502, 0x1631) },
218 { USB_DEVICE(0x0502, 0x1632) },
219 { USB_DEVICE(0x0502, 0x16E1) },
220 { USB_DEVICE(0x0502, 0x16E2) },
221 { USB_DEVICE(0x0502, 0x16E3) },
222 { USB_DEVICE(0x0536, 0x01A0) },
223 { USB_DEVICE(0x0543, 0x0ED9) },
224 { USB_DEVICE(0x0543, 0x1527) },
225 { USB_DEVICE(0x0543, 0x1529) },
226 { USB_DEVICE(0x0543, 0x152B) },
227 { USB_DEVICE(0x0543, 0x152E) },
228 { USB_DEVICE(0x0543, 0x1921) },
229 { USB_DEVICE(0x0543, 0x1922) },
230 { USB_DEVICE(0x0543, 0x1923) },
231 { USB_DEVICE(0x05E0, 0x2000) },
232 { USB_DEVICE(0x05E0, 0x2001) },
233 { USB_DEVICE(0x05E0, 0x2002) },
234 { USB_DEVICE(0x05E0, 0x2003) },
235 { USB_DEVICE(0x05E0, 0x2004) },
236 { USB_DEVICE(0x05E0, 0x2005) },
237 { USB_DEVICE(0x05E0, 0x2006) },
238 { USB_DEVICE(0x05E0, 0x2007) },
239 { USB_DEVICE(0x05E0, 0x2008) },
240 { USB_DEVICE(0x05E0, 0x2009) },
241 { USB_DEVICE(0x05E0, 0x200A) },
242 { USB_DEVICE(0x067E, 0x1001) },
243 { USB_DEVICE(0x07CF, 0x2001) },
244 { USB_DEVICE(0x07CF, 0x2002) },
245 { USB_DEVICE(0x07CF, 0x2003) },
246 { USB_DEVICE(0x0930, 0x0700) },
247 { USB_DEVICE(0x0930, 0x0705) },
248 { USB_DEVICE(0x0930, 0x0706) },
249 { USB_DEVICE(0x0930, 0x0707) },
250 { USB_DEVICE(0x0930, 0x0708) },
251 { USB_DEVICE(0x0930, 0x0709) },
252 { USB_DEVICE(0x0930, 0x070A) },
253 { USB_DEVICE(0x0930, 0x070B) },
254 { USB_DEVICE(0x094B, 0x0001) },
255 { USB_DEVICE(0x0960, 0x0065) },
256 { USB_DEVICE(0x0960, 0x0066) },
257 { USB_DEVICE(0x0960, 0x0067) },
258 { USB_DEVICE(0x0961, 0x0010) },
259 { USB_DEVICE(0x099E, 0x0052) },
260 { USB_DEVICE(0x099E, 0x4000) },
261 { USB_DEVICE(0x0B05, 0x4200) },
262 { USB_DEVICE(0x0B05, 0x4201) },
263 { USB_DEVICE(0x0B05, 0x4202) },
264 { USB_DEVICE(0x0B05, 0x420F) },
265 { USB_DEVICE(0x0B05, 0x9200) },
266 { USB_DEVICE(0x0B05, 0x9202) },
267 { USB_DEVICE(0x0BB4, 0x00CE) },
268 { USB_DEVICE(0x0BB4, 0x00CF) },
269 { USB_DEVICE(0x0BB4, 0x0A01) },
270 { USB_DEVICE(0x0BB4, 0x0A02) },
271 { USB_DEVICE(0x0BB4, 0x0A03) },
272 { USB_DEVICE(0x0BB4, 0x0A04) },
273 { USB_DEVICE(0x0BB4, 0x0A05) },
274 { USB_DEVICE(0x0BB4, 0x0A06) },
275 { USB_DEVICE(0x0BB4, 0x0A07) },
276 { USB_DEVICE(0x0BB4, 0x0A08) },
277 { USB_DEVICE(0x0BB4, 0x0A09) },
278 { USB_DEVICE(0x0BB4, 0x0A0A) },
279 { USB_DEVICE(0x0BB4, 0x0A0B) },
280 { USB_DEVICE(0x0BB4, 0x0A0C) },
281 { USB_DEVICE(0x0BB4, 0x0A0D) },
282 { USB_DEVICE(0x0BB4, 0x0A0E) },
283 { USB_DEVICE(0x0BB4, 0x0A0F) },
284 { USB_DEVICE(0x0BB4, 0x0A10) },
285 { USB_DEVICE(0x0BB4, 0x0A11) },
286 { USB_DEVICE(0x0BB4, 0x0A12) },
287 { USB_DEVICE(0x0BB4, 0x0A13) },
288 { USB_DEVICE(0x0BB4, 0x0A14) },
289 { USB_DEVICE(0x0BB4, 0x0A15) },
290 { USB_DEVICE(0x0BB4, 0x0A16) },
291 { USB_DEVICE(0x0BB4, 0x0A17) },
292 { USB_DEVICE(0x0BB4, 0x0A18) },
293 { USB_DEVICE(0x0BB4, 0x0A19) },
294 { USB_DEVICE(0x0BB4, 0x0A1A) },
295 { USB_DEVICE(0x0BB4, 0x0A1B) },
296 { USB_DEVICE(0x0BB4, 0x0A1C) },
297 { USB_DEVICE(0x0BB4, 0x0A1D) },
298 { USB_DEVICE(0x0BB4, 0x0A1E) },
299 { USB_DEVICE(0x0BB4, 0x0A1F) },
300 { USB_DEVICE(0x0BB4, 0x0A20) },
301 { USB_DEVICE(0x0BB4, 0x0A21) },
302 { USB_DEVICE(0x0BB4, 0x0A22) },
303 { USB_DEVICE(0x0BB4, 0x0A23) },
304 { USB_DEVICE(0x0BB4, 0x0A24) },
305 { USB_DEVICE(0x0BB4, 0x0A25) },
306 { USB_DEVICE(0x0BB4, 0x0A26) },
307 { USB_DEVICE(0x0BB4, 0x0A27) },
308 { USB_DEVICE(0x0BB4, 0x0A28) },
309 { USB_DEVICE(0x0BB4, 0x0A29) },
310 { USB_DEVICE(0x0BB4, 0x0A2A) },
311 { USB_DEVICE(0x0BB4, 0x0A2B) },
312 { USB_DEVICE(0x0BB4, 0x0A2C) },
313 { USB_DEVICE(0x0BB4, 0x0A2D) },
314 { USB_DEVICE(0x0BB4, 0x0A2E) },
315 { USB_DEVICE(0x0BB4, 0x0A2F) },
316 { USB_DEVICE(0x0BB4, 0x0A30) },
317 { USB_DEVICE(0x0BB4, 0x0A31) },
318 { USB_DEVICE(0x0BB4, 0x0A32) },
319 { USB_DEVICE(0x0BB4, 0x0A33) },
320 { USB_DEVICE(0x0BB4, 0x0A34) },
321 { USB_DEVICE(0x0BB4, 0x0A35) },
322 { USB_DEVICE(0x0BB4, 0x0A36) },
323 { USB_DEVICE(0x0BB4, 0x0A37) },
324 { USB_DEVICE(0x0BB4, 0x0A38) },
325 { USB_DEVICE(0x0BB4, 0x0A39) },
326 { USB_DEVICE(0x0BB4, 0x0A3A) },
327 { USB_DEVICE(0x0BB4, 0x0A3B) },
328 { USB_DEVICE(0x0BB4, 0x0A3C) },
329 { USB_DEVICE(0x0BB4, 0x0A3D) },
330 { USB_DEVICE(0x0BB4, 0x0A3E) },
331 { USB_DEVICE(0x0BB4, 0x0A3F) },
332 { USB_DEVICE(0x0BB4, 0x0A40) },
333 { USB_DEVICE(0x0BB4, 0x0A41) },
334 { USB_DEVICE(0x0BB4, 0x0A42) },
335 { USB_DEVICE(0x0BB4, 0x0A43) },
336 { USB_DEVICE(0x0BB4, 0x0A44) },
337 { USB_DEVICE(0x0BB4, 0x0A45) },
338 { USB_DEVICE(0x0BB4, 0x0A46) },
339 { USB_DEVICE(0x0BB4, 0x0A47) },
340 { USB_DEVICE(0x0BB4, 0x0A48) },
341 { USB_DEVICE(0x0BB4, 0x0A49) },
342 { USB_DEVICE(0x0BB4, 0x0A4A) },
343 { USB_DEVICE(0x0BB4, 0x0A4B) },
344 { USB_DEVICE(0x0BB4, 0x0A4C) },
345 { USB_DEVICE(0x0BB4, 0x0A4D) },
346 { USB_DEVICE(0x0BB4, 0x0A4E) },
347 { USB_DEVICE(0x0BB4, 0x0A4F) },
348 { USB_DEVICE(0x0BB4, 0x0A50) },
349 { USB_DEVICE(0x0BB4, 0x0A51) },
350 { USB_DEVICE(0x0BB4, 0x0A52) },
351 { USB_DEVICE(0x0BB4, 0x0A53) },
352 { USB_DEVICE(0x0BB4, 0x0A54) },
353 { USB_DEVICE(0x0BB4, 0x0A55) },
354 { USB_DEVICE(0x0BB4, 0x0A56) },
355 { USB_DEVICE(0x0BB4, 0x0A57) },
356 { USB_DEVICE(0x0BB4, 0x0A58) },
357 { USB_DEVICE(0x0BB4, 0x0A59) },
358 { USB_DEVICE(0x0BB4, 0x0A5A) },
359 { USB_DEVICE(0x0BB4, 0x0A5B) },
360 { USB_DEVICE(0x0BB4, 0x0A5C) },
361 { USB_DEVICE(0x0BB4, 0x0A5D) },
362 { USB_DEVICE(0x0BB4, 0x0A5E) },
363 { USB_DEVICE(0x0BB4, 0x0A5F) },
364 { USB_DEVICE(0x0BB4, 0x0A60) },
365 { USB_DEVICE(0x0BB4, 0x0A61) },
366 { USB_DEVICE(0x0BB4, 0x0A62) },
367 { USB_DEVICE(0x0BB4, 0x0A63) },
368 { USB_DEVICE(0x0BB4, 0x0A64) },
369 { USB_DEVICE(0x0BB4, 0x0A65) },
370 { USB_DEVICE(0x0BB4, 0x0A66) },
371 { USB_DEVICE(0x0BB4, 0x0A67) },
372 { USB_DEVICE(0x0BB4, 0x0A68) },
373 { USB_DEVICE(0x0BB4, 0x0A69) },
374 { USB_DEVICE(0x0BB4, 0x0A6A) },
375 { USB_DEVICE(0x0BB4, 0x0A6B) },
376 { USB_DEVICE(0x0BB4, 0x0A6C) },
377 { USB_DEVICE(0x0BB4, 0x0A6D) },
378 { USB_DEVICE(0x0BB4, 0x0A6E) },
379 { USB_DEVICE(0x0BB4, 0x0A6F) },
380 { USB_DEVICE(0x0BB4, 0x0A70) },
381 { USB_DEVICE(0x0BB4, 0x0A71) },
382 { USB_DEVICE(0x0BB4, 0x0A72) },
383 { USB_DEVICE(0x0BB4, 0x0A73) },
384 { USB_DEVICE(0x0BB4, 0x0A74) },
385 { USB_DEVICE(0x0BB4, 0x0A75) },
386 { USB_DEVICE(0x0BB4, 0x0A76) },
387 { USB_DEVICE(0x0BB4, 0x0A77) },
388 { USB_DEVICE(0x0BB4, 0x0A78) },
389 { USB_DEVICE(0x0BB4, 0x0A79) },
390 { USB_DEVICE(0x0BB4, 0x0A7A) },
391 { USB_DEVICE(0x0BB4, 0x0A7B) },
392 { USB_DEVICE(0x0BB4, 0x0A7C) },
393 { USB_DEVICE(0x0BB4, 0x0A7D) },
394 { USB_DEVICE(0x0BB4, 0x0A7E) },
395 { USB_DEVICE(0x0BB4, 0x0A7F) },
396 { USB_DEVICE(0x0BB4, 0x0A80) },
397 { USB_DEVICE(0x0BB4, 0x0A81) },
398 { USB_DEVICE(0x0BB4, 0x0A82) },
399 { USB_DEVICE(0x0BB4, 0x0A83) },
400 { USB_DEVICE(0x0BB4, 0x0A84) },
401 { USB_DEVICE(0x0BB4, 0x0A85) },
402 { USB_DEVICE(0x0BB4, 0x0A86) },
403 { USB_DEVICE(0x0BB4, 0x0A87) },
404 { USB_DEVICE(0x0BB4, 0x0A88) },
405 { USB_DEVICE(0x0BB4, 0x0A89) },
406 { USB_DEVICE(0x0BB4, 0x0A8A) },
407 { USB_DEVICE(0x0BB4, 0x0A8B) },
408 { USB_DEVICE(0x0BB4, 0x0A8C) },
409 { USB_DEVICE(0x0BB4, 0x0A8D) },
410 { USB_DEVICE(0x0BB4, 0x0A8E) },
411 { USB_DEVICE(0x0BB4, 0x0A8F) },
412 { USB_DEVICE(0x0BB4, 0x0A90) },
413 { USB_DEVICE(0x0BB4, 0x0A91) },
414 { USB_DEVICE(0x0BB4, 0x0A92) },
415 { USB_DEVICE(0x0BB4, 0x0A93) },
416 { USB_DEVICE(0x0BB4, 0x0A94) },
417 { USB_DEVICE(0x0BB4, 0x0A95) },
418 { USB_DEVICE(0x0BB4, 0x0A96) },
419 { USB_DEVICE(0x0BB4, 0x0A97) },
420 { USB_DEVICE(0x0BB4, 0x0A98) },
421 { USB_DEVICE(0x0BB4, 0x0A99) },
422 { USB_DEVICE(0x0BB4, 0x0A9A) },
423 { USB_DEVICE(0x0BB4, 0x0A9B) },
424 { USB_DEVICE(0x0BB4, 0x0A9C) },
425 { USB_DEVICE(0x0BB4, 0x0A9D) },
426 { USB_DEVICE(0x0BB4, 0x0A9E) },
427 { USB_DEVICE(0x0BB4, 0x0A9F) },
428 { USB_DEVICE(0x0BB4, 0x0BCE) },
429 { USB_DEVICE(0x0BF8, 0x1001) },
430 { USB_DEVICE(0x0C44, 0x03A2) },
431 { USB_DEVICE(0x0C8E, 0x6000) },
432 { USB_DEVICE(0x0CAD, 0x9001) },
433 { USB_DEVICE(0x0F4E, 0x0200) },
434 { USB_DEVICE(0x0F98, 0x0201) },
435 { USB_DEVICE(0x0FB8, 0x3001) },
436 { USB_DEVICE(0x0FB8, 0x3002) },
437 { USB_DEVICE(0x0FB8, 0x3003) },
438 { USB_DEVICE(0x0FB8, 0x4001) },
439 { USB_DEVICE(0x1066, 0x00CE) },
440 { USB_DEVICE(0x1066, 0x0300) },
441 { USB_DEVICE(0x1066, 0x0500) },
442 { USB_DEVICE(0x1066, 0x0600) },
443 { USB_DEVICE(0x1066, 0x0700) },
444 { USB_DEVICE(0x1114, 0x0001) },
445 { USB_DEVICE(0x1114, 0x0004) },
446 { USB_DEVICE(0x1114, 0x0006) },
447 { USB_DEVICE(0x1182, 0x1388) },
448 { USB_DEVICE(0x11D9, 0x1002) },
449 { USB_DEVICE(0x11D9, 0x1003) },
450 { USB_DEVICE(0x1231, 0xCE01) },
451 { USB_DEVICE(0x1231, 0xCE02) },
452 { USB_DEVICE(0x1690, 0x0601) },
453 { USB_DEVICE(0x22B8, 0x4204) },
454 { USB_DEVICE(0x22B8, 0x4214) },
455 { USB_DEVICE(0x22B8, 0x4224) },
456 { USB_DEVICE(0x22B8, 0x4234) },
457 { USB_DEVICE(0x22B8, 0x4244) },
458 { USB_DEVICE(0x3340, 0x011C) },
459 { USB_DEVICE(0x3340, 0x0326) },
460 { USB_DEVICE(0x3340, 0x0426) },
461 { USB_DEVICE(0x3340, 0x043A) },
462 { USB_DEVICE(0x3340, 0x051C) },
463 { USB_DEVICE(0x3340, 0x053A) },
464 { USB_DEVICE(0x3340, 0x071C) },
465 { USB_DEVICE(0x3340, 0x0B1C) },
466 { USB_DEVICE(0x3340, 0x0E3A) },
467 { USB_DEVICE(0x3340, 0x0F1C) },
468 { USB_DEVICE(0x3340, 0x0F3A) },
469 { USB_DEVICE(0x3340, 0x1326) },
470 { USB_DEVICE(0x3340, 0x191C) },
471 { USB_DEVICE(0x3340, 0x2326) },
472 { USB_DEVICE(0x3340, 0x3326) },
473 { USB_DEVICE(0x3708, 0x20CE) },
474 { USB_DEVICE(0x3708, 0x21CE) },
475 { USB_DEVICE(0x4113, 0x0210) },
476 { USB_DEVICE(0x4113, 0x0211) },
477 { USB_DEVICE(0x4113, 0x0400) },
478 { USB_DEVICE(0x4113, 0x0410) },
479 { USB_DEVICE(0x413C, 0x4001) },
480 { USB_DEVICE(0x413C, 0x4002) },
481 { USB_DEVICE(0x413C, 0x4003) },
482 { USB_DEVICE(0x413C, 0x4004) },
483 { USB_DEVICE(0x413C, 0x4005) },
484 { USB_DEVICE(0x413C, 0x4006) },
485 { USB_DEVICE(0x413C, 0x4007) },
486 { USB_DEVICE(0x413C, 0x4008) },
487 { USB_DEVICE(0x413C, 0x4009) },
488 { USB_DEVICE(0x4505, 0x0010) },
489 { USB_DEVICE(0x5E04, 0xCE00) },
490 { }
491};
492
493MODULE_DEVICE_TABLE(usb, ipaq_id_table);
494
495
496
497static struct usb_serial_driver ipaq_device = {
498 .driver = {
499 .owner = THIS_MODULE,
500 .name = "ipaq",
501 },
502 .description = "PocketPC PDA",
503 .id_table = ipaq_id_table,
504 .bulk_in_size = 256,
505 .bulk_out_size = 256,
506 .open = ipaq_open,
507 .attach = ipaq_startup,
508 .calc_num_ports = ipaq_calc_num_ports,
509};
510
511static struct usb_serial_driver * const serial_drivers[] = {
512 &ipaq_device, NULL
513};
514
515static int ipaq_open(struct tty_struct *tty,
516 struct usb_serial_port *port)
517{
518 struct usb_serial *serial = port->serial;
519 int result = 0;
520 int retries = connect_retries;
521
522 msleep(1000*initial_wait);
523
524
525
526
527
528
529
530
531 while (retries) {
532 retries--;
533 result = usb_control_msg(serial->dev,
534 usb_sndctrlpipe(serial->dev, 0), 0x22, 0x21,
535 0x1, 0, NULL, 0, 100);
536 if (!result)
537 break;
538
539 msleep(1000);
540 }
541 if (!retries && result) {
542 dev_err(&port->dev, "%s - failed doing control urb, error %d\n",
543 __func__, result);
544 return result;
545 }
546
547 return usb_serial_generic_open(tty, port);
548}
549
550static int ipaq_calc_num_ports(struct usb_serial *serial,
551 struct usb_serial_endpoints *epds)
552{
553
554
555
556
557
558 if (epds->num_bulk_in == 0 || epds->num_bulk_out == 0)
559 return -ENODEV;
560
561
562
563
564
565 if (epds->num_bulk_in > 1 && epds->num_bulk_out > 1) {
566 epds->bulk_in[0] = epds->bulk_in[1];
567 epds->bulk_out[0] = epds->bulk_out[1];
568 }
569
570
571
572
573
574 epds->num_bulk_in = 1;
575 epds->num_bulk_out = 1;
576
577 return 1;
578}
579
580static int ipaq_startup(struct usb_serial *serial)
581{
582 if (serial->dev->actconfig->desc.bConfigurationValue != 1) {
583
584
585
586
587
588 dev_err(&serial->dev->dev, "active config #%d != 1 ??\n",
589 serial->dev->actconfig->desc.bConfigurationValue);
590 return -ENODEV;
591 }
592
593 return usb_reset_configuration(serial->dev);
594}
595
596module_usb_serial_driver(serial_drivers, ipaq_id_table);
597
598MODULE_AUTHOR(DRIVER_AUTHOR);
599MODULE_DESCRIPTION(DRIVER_DESC);
600MODULE_LICENSE("GPL");
601
602module_param(connect_retries, int, S_IRUGO|S_IWUSR);
603MODULE_PARM_DESC(connect_retries,
604 "Maximum number of connect retries (one second each)");
605
606module_param(initial_wait, int, S_IRUGO|S_IWUSR);
607MODULE_PARM_DESC(initial_wait,
608 "Time to wait before attempting a connection (in seconds)");
609