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