1 /* $NetBSD: uipaq.c,v 1.4 2006/11/16 01:33:27 christos Exp $ */
2 /* $OpenBSD: uipaq.c,v 1.1 2005/06/17 23:50:33 deraadt Exp $ */
3
4 /*-
5 * SPDX-License-Identifier: BSD-2-Clause
6 *
7 * Copyright (c) 2000-2005 The NetBSD Foundation, Inc.
8 * All rights reserved.
9 *
10 * This code is derived from software contributed to The NetBSD Foundation
11 * by Lennart Augustsson (lennart@augustsson.net) at
12 * Carlstedt Research & Technology.
13 *
14 * Redistribution and use in source and binary forms, with or without
15 * modification, are permitted provided that the following conditions
16 * are met:
17 * 1. Redistributions of source code must retain the above copyright
18 * notice, this list of conditions and the following disclaimer.
19 * 2. Redistributions in binary form must reproduce the above copyright
20 * notice, this list of conditions and the following disclaimer in the
21 * documentation and/or other materials provided with the distribution.
22 *
23 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
24 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
25 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
26 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
27 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
28 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
29 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
30 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
31 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
32 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
33 * POSSIBILITY OF SUCH DAMAGE.
34 */
35
36 /*
37 * iPAQ driver
38 *
39 * 19 July 2003: Incorporated changes suggested by Sam Lawrance from
40 * the uppc module
41 *
42 *
43 * Contact isis@cs.umd.edu if you have any questions/comments about this driver
44 */
45
46 #include <sys/cdefs.h>
47 #include <sys/stdint.h>
48 #include <sys/stddef.h>
49 #include <sys/param.h>
50 #include <sys/queue.h>
51 #include <sys/types.h>
52 #include <sys/systm.h>
53 #include <sys/kernel.h>
54 #include <sys/bus.h>
55 #include <sys/module.h>
56 #include <sys/lock.h>
57 #include <sys/mutex.h>
58 #include <sys/condvar.h>
59 #include <sys/sysctl.h>
60 #include <sys/sx.h>
61 #include <sys/unistd.h>
62 #include <sys/callout.h>
63 #include <sys/malloc.h>
64 #include <sys/priv.h>
65
66 #include <dev/usb/usb.h>
67 #include <dev/usb/usbdi.h>
68 #include <dev/usb/usbdi_util.h>
69 #include <dev/usb/usb_cdc.h>
70 #include "usbdevs.h"
71
72 #define USB_DEBUG_VAR usb_debug
73 #include <dev/usb/usb_debug.h>
74 #include <dev/usb/usb_process.h>
75
76 #include <dev/usb/serial/usb_serial.h>
77
78 #define UIPAQ_CONFIG_INDEX 0 /* config number 1 */
79 #define UIPAQ_IFACE_INDEX 0
80
81 #define UIPAQ_BUF_SIZE 1024
82
83 enum {
84 UIPAQ_BULK_DT_WR,
85 UIPAQ_BULK_DT_RD,
86 UIPAQ_N_TRANSFER,
87 };
88
89 struct uipaq_softc {
90 struct ucom_super_softc sc_super_ucom;
91 struct ucom_softc sc_ucom;
92
93 struct usb_xfer *sc_xfer[UIPAQ_N_TRANSFER];
94 struct usb_device *sc_udev;
95 struct mtx sc_mtx;
96
97 uint16_t sc_line;
98
99 uint8_t sc_lsr; /* local status register */
100 uint8_t sc_msr; /* modem status register */
101 };
102
103 static device_probe_t uipaq_probe;
104 static device_attach_t uipaq_attach;
105 static device_detach_t uipaq_detach;
106 static void uipaq_free_softc(struct uipaq_softc *);
107
108 static usb_callback_t uipaq_write_callback;
109 static usb_callback_t uipaq_read_callback;
110
111 static void uipaq_free(struct ucom_softc *);
112 static void uipaq_start_read(struct ucom_softc *);
113 static void uipaq_stop_read(struct ucom_softc *);
114 static void uipaq_start_write(struct ucom_softc *);
115 static void uipaq_stop_write(struct ucom_softc *);
116 static void uipaq_cfg_set_dtr(struct ucom_softc *, uint8_t);
117 static void uipaq_cfg_set_rts(struct ucom_softc *, uint8_t);
118 static void uipaq_cfg_set_break(struct ucom_softc *, uint8_t);
119 static void uipaq_poll(struct ucom_softc *ucom);
120
121 static const struct usb_config uipaq_config_data[UIPAQ_N_TRANSFER] = {
122 [UIPAQ_BULK_DT_WR] = {
123 .type = UE_BULK,
124 .endpoint = UE_ADDR_ANY,
125 .direction = UE_DIR_OUT,
126 .bufsize = UIPAQ_BUF_SIZE,
127 .flags = {.pipe_bof = 1,.force_short_xfer = 1,},
128 .callback = &uipaq_write_callback,
129 },
130
131 [UIPAQ_BULK_DT_RD] = {
132 .type = UE_BULK,
133 .endpoint = UE_ADDR_ANY,
134 .direction = UE_DIR_IN,
135 .bufsize = UIPAQ_BUF_SIZE,
136 .flags = {.pipe_bof = 1,.short_xfer_ok = 1,},
137 .callback = &uipaq_read_callback,
138 },
139 };
140
141 static const struct ucom_callback uipaq_callback = {
142 .ucom_cfg_set_dtr = &uipaq_cfg_set_dtr,
143 .ucom_cfg_set_rts = &uipaq_cfg_set_rts,
144 .ucom_cfg_set_break = &uipaq_cfg_set_break,
145 .ucom_start_read = &uipaq_start_read,
146 .ucom_stop_read = &uipaq_stop_read,
147 .ucom_start_write = &uipaq_start_write,
148 .ucom_stop_write = &uipaq_stop_write,
149 .ucom_poll = &uipaq_poll,
150 .ucom_free = &uipaq_free,
151 };
152
153 /*
154 * Much of this list is generated from lists of other drivers that
155 * support the same hardware. Numeric values are used where no usbdevs
156 * entries exist.
157 */
158 static const STRUCT_USB_HOST_ID uipaq_devs[] = {
159 /* Socket USB Sync */
160 {USB_VPI(0x0104, 0x00be, 0)},
161 /* USB Sync 0301 */
162 {USB_VPI(0x04ad, 0x0301, 0)},
163 /* USB Sync 0302 */
164 {USB_VPI(0x04ad, 0x0302, 0)},
165 /* USB Sync 0303 */
166 {USB_VPI(0x04ad, 0x0303, 0)},
167 /* GPS Pocket PC USB Sync */
168 {USB_VPI(0x04ad, 0x0306, 0)},
169 /* HHP PDT */
170 {USB_VPI(0x0536, 0x01a0, 0)},
171 /* Intermec Mobile Computer */
172 {USB_VPI(0x067e, 0x1001, 0)},
173 /* Linkup Systems USB Sync */
174 {USB_VPI(0x094b, 0x0001, 0)},
175 /* BCOM USB Sync 0065 */
176 {USB_VPI(0x0960, 0x0065, 0)},
177 /* BCOM USB Sync 0066 */
178 {USB_VPI(0x0960, 0x0066, 0)},
179 /* BCOM USB Sync 0067 */
180 {USB_VPI(0x0960, 0x0067, 0)},
181 /* Portatec USB Sync */
182 {USB_VPI(0x0961, 0x0010, 0)},
183 /* Trimble GeoExplorer */
184 {USB_VPI(0x099e, 0x0052, 0)},
185 /* TDS Data Collector */
186 {USB_VPI(0x099e, 0x4000, 0)},
187 /* Motorola iDEN Smartphone */
188 {USB_VPI(0x0c44, 0x03a2, 0)},
189 /* Cesscom Luxian Series */
190 {USB_VPI(0x0c8e, 0x6000, 0)},
191 /* Motorola PowerPad Pocket PCDevice */
192 {USB_VPI(0x0cad, 0x9001, 0)},
193 /* Freedom Scientific USB Sync */
194 {USB_VPI(0x0f4e, 0x0200, 0)},
195 /* Cyberbank USB Sync */
196 {USB_VPI(0x0f98, 0x0201, 0)},
197 /* Wistron USB Sync */
198 {USB_VPI(0x0fb8, 0x3001, 0)},
199 /* Wistron USB Sync */
200 {USB_VPI(0x0fb8, 0x3002, 0)},
201 /* Wistron USB Sync */
202 {USB_VPI(0x0fb8, 0x3003, 0)},
203 /* Wistron USB Sync */
204 {USB_VPI(0x0fb8, 0x4001, 0)},
205 /* E-TEN USB Sync */
206 {USB_VPI(0x1066, 0x00ce, 0)},
207 /* E-TEN P3XX Pocket PC */
208 {USB_VPI(0x1066, 0x0300, 0)},
209 /* E-TEN P5XX Pocket PC */
210 {USB_VPI(0x1066, 0x0500, 0)},
211 /* E-TEN P6XX Pocket PC */
212 {USB_VPI(0x1066, 0x0600, 0)},
213 /* E-TEN P7XX Pocket PC */
214 {USB_VPI(0x1066, 0x0700, 0)},
215 /* Psion Teklogix Sync 753x */
216 {USB_VPI(0x1114, 0x0001, 0)},
217 /* Psion Teklogix Sync netBookPro */
218 {USB_VPI(0x1114, 0x0004, 0)},
219 /* Psion Teklogix Sync 7525 */
220 {USB_VPI(0x1114, 0x0006, 0)},
221 /* VES USB Sync */
222 {USB_VPI(0x1182, 0x1388, 0)},
223 /* Rugged Pocket PC 2003 */
224 {USB_VPI(0x11d9, 0x1002, 0)},
225 /* Rugged Pocket PC 2003 */
226 {USB_VPI(0x11d9, 0x1003, 0)},
227 /* USB Sync 03 */
228 {USB_VPI(0x1231, 0xce01, 0)},
229 /* USB Sync 03 */
230 {USB_VPI(0x1231, 0xce02, 0)},
231 /* Mio DigiWalker PPC StrongARM */
232 {USB_VPI(0x3340, 0x011c, 0)},
233 /* Mio DigiWalker 338 */
234 {USB_VPI(0x3340, 0x0326, 0)},
235 /* Mio DigiWalker 338 */
236 {USB_VPI(0x3340, 0x0426, 0)},
237 /* Mio DigiWalker USB Sync */
238 {USB_VPI(0x3340, 0x043a, 0)},
239 /* MiTAC USB Sync 528 */
240 {USB_VPI(0x3340, 0x051c, 0)},
241 /* Mio DigiWalker SmartPhone USB Sync */
242 {USB_VPI(0x3340, 0x053a, 0)},
243 /* MiTAC USB Sync */
244 {USB_VPI(0x3340, 0x071c, 0)},
245 /* Generic PPC StrongARM */
246 {USB_VPI(0x3340, 0x0b1c, 0)},
247 /* Generic PPC USB Sync */
248 {USB_VPI(0x3340, 0x0e3a, 0)},
249 /* Itautec USB Sync */
250 {USB_VPI(0x3340, 0x0f1c, 0)},
251 /* Generic SmartPhone USB Sync */
252 {USB_VPI(0x3340, 0x0f3a, 0)},
253 /* Itautec USB Sync */
254 {USB_VPI(0x3340, 0x1326, 0)},
255 /* YAKUMO USB Sync */
256 {USB_VPI(0x3340, 0x191c, 0)},
257 /* Vobis USB Sync */
258 {USB_VPI(0x3340, 0x2326, 0)},
259 /* MEDION Winodws Moble USB Sync */
260 {USB_VPI(0x3340, 0x3326, 0)},
261 /* Legend USB Sync */
262 {USB_VPI(0x3708, 0x20ce, 0)},
263 /* Lenovo USB Sync */
264 {USB_VPI(0x3708, 0x21ce, 0)},
265 /* Mobile Media Technology USB Sync */
266 {USB_VPI(0x4113, 0x0210, 0)},
267 /* Mobile Media Technology USB Sync */
268 {USB_VPI(0x4113, 0x0211, 0)},
269 /* Mobile Media Technology USB Sync */
270 {USB_VPI(0x4113, 0x0400, 0)},
271 /* Mobile Media Technology USB Sync */
272 {USB_VPI(0x4113, 0x0410, 0)},
273 /* Smartphone */
274 {USB_VPI(0x4505, 0x0010, 0)},
275 /* SAGEM Wireless Assistant */
276 {USB_VPI(0x5e04, 0xce00, 0)},
277 /* c10 Series */
278 {USB_VPI(USB_VENDOR_ACER, 0x1631, 0)},
279 /* c20 Series */
280 {USB_VPI(USB_VENDOR_ACER, 0x1632, 0)},
281 /* Acer n10 Handheld USB Sync */
282 {USB_VPI(USB_VENDOR_ACER, 0x16e1, 0)},
283 /* Acer n20 Handheld USB Sync */
284 {USB_VPI(USB_VENDOR_ACER, 0x16e2, 0)},
285 /* Acer n30 Handheld USB Sync */
286 {USB_VPI(USB_VENDOR_ACER, 0x16e3, 0)},
287 /* ASUS USB Sync */
288 {USB_VPI(USB_VENDOR_ASUS, 0x4200, 0)},
289 /* ASUS USB Sync */
290 {USB_VPI(USB_VENDOR_ASUS, 0x4201, 0)},
291 /* ASUS USB Sync */
292 {USB_VPI(USB_VENDOR_ASUS, 0x4202, 0)},
293 /* ASUS USB Sync */
294 {USB_VPI(USB_VENDOR_ASUS, 0x9200, 0)},
295 /* ASUS USB Sync */
296 {USB_VPI(USB_VENDOR_ASUS, 0x9202, 0)},
297 /**/
298 {USB_VPI(USB_VENDOR_ASUS, USB_PRODUCT_ASUS_P535, 0)},
299 /* CASIO USB Sync 2001 */
300 {USB_VPI(USB_VENDOR_CASIO, 0x2001, 0)},
301 /* CASIO USB Sync 2003 */
302 {USB_VPI(USB_VENDOR_CASIO, 0x2003, 0)},
303 /**/
304 {USB_VPI(USB_VENDOR_CASIO, USB_PRODUCT_CASIO_BE300, 0)},
305 /* MyGuide 7000 XL USB Sync */
306 {USB_VPI(USB_VENDOR_COMPAL, 0x0531, 0)},
307 /* Compaq iPAQ USB Sync */
308 {USB_VPI(USB_VENDOR_COMPAQ, 0x0032, 0)},
309 /**/
310 {USB_VPI(USB_VENDOR_COMPAQ, USB_PRODUCT_COMPAQ_IPAQPOCKETPC, 0)},
311 /* Dell Axim USB Sync */
312 {USB_VPI(USB_VENDOR_DELL, 0x4001, 0)},
313 /* Dell Axim USB Sync */
314 {USB_VPI(USB_VENDOR_DELL, 0x4002, 0)},
315 /* Dell Axim USB Sync */
316 {USB_VPI(USB_VENDOR_DELL, 0x4003, 0)},
317 /* Dell Axim USB Sync */
318 {USB_VPI(USB_VENDOR_DELL, 0x4004, 0)},
319 /* Dell Axim USB Sync */
320 {USB_VPI(USB_VENDOR_DELL, 0x4005, 0)},
321 /* Dell Axim USB Sync */
322 {USB_VPI(USB_VENDOR_DELL, 0x4006, 0)},
323 /* Dell Axim USB Sync */
324 {USB_VPI(USB_VENDOR_DELL, 0x4007, 0)},
325 /* Dell Axim USB Sync */
326 {USB_VPI(USB_VENDOR_DELL, 0x4008, 0)},
327 /* Dell Axim USB Sync */
328 {USB_VPI(USB_VENDOR_DELL, 0x4009, 0)},
329 /* Fujitsu Siemens Computers USB Sync */
330 {USB_VPI(USB_VENDOR_FSC, 0x1001, 0)},
331 /* FUJITSU USB Sync */
332 {USB_VPI(USB_VENDOR_FUJITSU, 0x1058, 0)},
333 /* FUJITSU USB Sync */
334 {USB_VPI(USB_VENDOR_FUJITSU, 0x1079, 0)},
335 /* Askey USB Sync */
336 {USB_VPI(USB_VENDOR_GIGASET, 0x0601, 0)},
337 /* Hitachi USB Sync */
338 {USB_VPI(USB_VENDOR_HITACHI, 0x0014, 0)},
339 /* HP USB Sync 1612 */
340 {USB_VPI(USB_VENDOR_HP, 0x1216, 0)},
341 /* HP USB Sync 1620 */
342 {USB_VPI(USB_VENDOR_HP, 0x2016, 0)},
343 /* HP USB Sync 1621 */
344 {USB_VPI(USB_VENDOR_HP, 0x2116, 0)},
345 /* HP USB Sync 1622 */
346 {USB_VPI(USB_VENDOR_HP, 0x2216, 0)},
347 /* HP USB Sync 1630 */
348 {USB_VPI(USB_VENDOR_HP, 0x3016, 0)},
349 /* HP USB Sync 1631 */
350 {USB_VPI(USB_VENDOR_HP, 0x3116, 0)},
351 /* HP USB Sync 1632 */
352 {USB_VPI(USB_VENDOR_HP, 0x3216, 0)},
353 /* HP USB Sync 1640 */
354 {USB_VPI(USB_VENDOR_HP, 0x4016, 0)},
355 /* HP USB Sync 1641 */
356 {USB_VPI(USB_VENDOR_HP, 0x4116, 0)},
357 /* HP USB Sync 1642 */
358 {USB_VPI(USB_VENDOR_HP, 0x4216, 0)},
359 /* HP USB Sync 1650 */
360 {USB_VPI(USB_VENDOR_HP, 0x5016, 0)},
361 /* HP USB Sync 1651 */
362 {USB_VPI(USB_VENDOR_HP, 0x5116, 0)},
363 /* HP USB Sync 1652 */
364 {USB_VPI(USB_VENDOR_HP, 0x5216, 0)},
365 /**/
366 {USB_VPI(USB_VENDOR_HP, USB_PRODUCT_HP_2215, 0)},
367 /**/
368 {USB_VPI(USB_VENDOR_HP, USB_PRODUCT_HP_568J, 0)},
369 /* HTC USB Modem */
370 {USB_VPI(USB_VENDOR_HTC, 0x00cf, 0)},
371 /* PocketPC USB Sync */
372 {USB_VPI(USB_VENDOR_HTC, 0x0a01, 0)},
373 /* PocketPC USB Sync */
374 {USB_VPI(USB_VENDOR_HTC, 0x0a02, 0)},
375 /* PocketPC USB Sync */
376 {USB_VPI(USB_VENDOR_HTC, 0x0a03, 0)},
377 /* PocketPC USB Sync */
378 {USB_VPI(USB_VENDOR_HTC, 0x0a04, 0)},
379 /* PocketPC USB Sync */
380 {USB_VPI(USB_VENDOR_HTC, 0x0a05, 0)},
381 /* PocketPC USB Sync */
382 {USB_VPI(USB_VENDOR_HTC, 0x0a06, 0)},
383 /* PocketPC USB Sync */
384 {USB_VPI(USB_VENDOR_HTC, 0x0a07, 0)},
385 /* PocketPC USB Sync */
386 {USB_VPI(USB_VENDOR_HTC, 0x0a08, 0)},
387 /* PocketPC USB Sync */
388 {USB_VPI(USB_VENDOR_HTC, 0x0a09, 0)},
389 /* PocketPC USB Sync */
390 {USB_VPI(USB_VENDOR_HTC, 0x0a0a, 0)},
391 /* PocketPC USB Sync */
392 {USB_VPI(USB_VENDOR_HTC, 0x0a0b, 0)},
393 /* PocketPC USB Sync */
394 {USB_VPI(USB_VENDOR_HTC, 0x0a0c, 0)},
395 /* PocketPC USB Sync */
396 {USB_VPI(USB_VENDOR_HTC, 0x0a0d, 0)},
397 /* PocketPC USB Sync */
398 {USB_VPI(USB_VENDOR_HTC, 0x0a0e, 0)},
399 /* PocketPC USB Sync */
400 {USB_VPI(USB_VENDOR_HTC, 0x0a0f, 0)},
401 /* PocketPC USB Sync */
402 {USB_VPI(USB_VENDOR_HTC, 0x0a10, 0)},
403 /* PocketPC USB Sync */
404 {USB_VPI(USB_VENDOR_HTC, 0x0a11, 0)},
405 /* PocketPC USB Sync */
406 {USB_VPI(USB_VENDOR_HTC, 0x0a12, 0)},
407 /* PocketPC USB Sync */
408 {USB_VPI(USB_VENDOR_HTC, 0x0a13, 0)},
409 /* PocketPC USB Sync */
410 {USB_VPI(USB_VENDOR_HTC, 0x0a14, 0)},
411 /* PocketPC USB Sync */
412 {USB_VPI(USB_VENDOR_HTC, 0x0a15, 0)},
413 /* PocketPC USB Sync */
414 {USB_VPI(USB_VENDOR_HTC, 0x0a16, 0)},
415 /* PocketPC USB Sync */
416 {USB_VPI(USB_VENDOR_HTC, 0x0a17, 0)},
417 /* PocketPC USB Sync */
418 {USB_VPI(USB_VENDOR_HTC, 0x0a18, 0)},
419 /* PocketPC USB Sync */
420 {USB_VPI(USB_VENDOR_HTC, 0x0a19, 0)},
421 /* PocketPC USB Sync */
422 {USB_VPI(USB_VENDOR_HTC, 0x0a1a, 0)},
423 /* PocketPC USB Sync */
424 {USB_VPI(USB_VENDOR_HTC, 0x0a1b, 0)},
425 /* PocketPC USB Sync */
426 {USB_VPI(USB_VENDOR_HTC, 0x0a1c, 0)},
427 /* PocketPC USB Sync */
428 {USB_VPI(USB_VENDOR_HTC, 0x0a1d, 0)},
429 /* PocketPC USB Sync */
430 {USB_VPI(USB_VENDOR_HTC, 0x0a1e, 0)},
431 /* PocketPC USB Sync */
432 {USB_VPI(USB_VENDOR_HTC, 0x0a1f, 0)},
433 /* PocketPC USB Sync */
434 {USB_VPI(USB_VENDOR_HTC, 0x0a20, 0)},
435 /* PocketPC USB Sync */
436 {USB_VPI(USB_VENDOR_HTC, 0x0a21, 0)},
437 /* PocketPC USB Sync */
438 {USB_VPI(USB_VENDOR_HTC, 0x0a22, 0)},
439 /* PocketPC USB Sync */
440 {USB_VPI(USB_VENDOR_HTC, 0x0a23, 0)},
441 /* PocketPC USB Sync */
442 {USB_VPI(USB_VENDOR_HTC, 0x0a24, 0)},
443 /* PocketPC USB Sync */
444 {USB_VPI(USB_VENDOR_HTC, 0x0a25, 0)},
445 /* PocketPC USB Sync */
446 {USB_VPI(USB_VENDOR_HTC, 0x0a26, 0)},
447 /* PocketPC USB Sync */
448 {USB_VPI(USB_VENDOR_HTC, 0x0a27, 0)},
449 /* PocketPC USB Sync */
450 {USB_VPI(USB_VENDOR_HTC, 0x0a28, 0)},
451 /* PocketPC USB Sync */
452 {USB_VPI(USB_VENDOR_HTC, 0x0a29, 0)},
453 /* PocketPC USB Sync */
454 {USB_VPI(USB_VENDOR_HTC, 0x0a2a, 0)},
455 /* PocketPC USB Sync */
456 {USB_VPI(USB_VENDOR_HTC, 0x0a2b, 0)},
457 /* PocketPC USB Sync */
458 {USB_VPI(USB_VENDOR_HTC, 0x0a2c, 0)},
459 /* PocketPC USB Sync */
460 {USB_VPI(USB_VENDOR_HTC, 0x0a2d, 0)},
461 /* PocketPC USB Sync */
462 {USB_VPI(USB_VENDOR_HTC, 0x0a2e, 0)},
463 /* PocketPC USB Sync */
464 {USB_VPI(USB_VENDOR_HTC, 0x0a2f, 0)},
465 /* PocketPC USB Sync */
466 {USB_VPI(USB_VENDOR_HTC, 0x0a30, 0)},
467 /* PocketPC USB Sync */
468 {USB_VPI(USB_VENDOR_HTC, 0x0a31, 0)},
469 /* PocketPC USB Sync */
470 {USB_VPI(USB_VENDOR_HTC, 0x0a32, 0)},
471 /* PocketPC USB Sync */
472 {USB_VPI(USB_VENDOR_HTC, 0x0a33, 0)},
473 /* PocketPC USB Sync */
474 {USB_VPI(USB_VENDOR_HTC, 0x0a34, 0)},
475 /* PocketPC USB Sync */
476 {USB_VPI(USB_VENDOR_HTC, 0x0a35, 0)},
477 /* PocketPC USB Sync */
478 {USB_VPI(USB_VENDOR_HTC, 0x0a36, 0)},
479 /* PocketPC USB Sync */
480 {USB_VPI(USB_VENDOR_HTC, 0x0a37, 0)},
481 /* PocketPC USB Sync */
482 {USB_VPI(USB_VENDOR_HTC, 0x0a38, 0)},
483 /* PocketPC USB Sync */
484 {USB_VPI(USB_VENDOR_HTC, 0x0a39, 0)},
485 /* PocketPC USB Sync */
486 {USB_VPI(USB_VENDOR_HTC, 0x0a3a, 0)},
487 /* PocketPC USB Sync */
488 {USB_VPI(USB_VENDOR_HTC, 0x0a3b, 0)},
489 /* PocketPC USB Sync */
490 {USB_VPI(USB_VENDOR_HTC, 0x0a3c, 0)},
491 /* PocketPC USB Sync */
492 {USB_VPI(USB_VENDOR_HTC, 0x0a3d, 0)},
493 /* PocketPC USB Sync */
494 {USB_VPI(USB_VENDOR_HTC, 0x0a3e, 0)},
495 /* PocketPC USB Sync */
496 {USB_VPI(USB_VENDOR_HTC, 0x0a3f, 0)},
497 /* PocketPC USB Sync */
498 {USB_VPI(USB_VENDOR_HTC, 0x0a40, 0)},
499 /* PocketPC USB Sync */
500 {USB_VPI(USB_VENDOR_HTC, 0x0a41, 0)},
501 /* PocketPC USB Sync */
502 {USB_VPI(USB_VENDOR_HTC, 0x0a42, 0)},
503 /* PocketPC USB Sync */
504 {USB_VPI(USB_VENDOR_HTC, 0x0a43, 0)},
505 /* PocketPC USB Sync */
506 {USB_VPI(USB_VENDOR_HTC, 0x0a44, 0)},
507 /* PocketPC USB Sync */
508 {USB_VPI(USB_VENDOR_HTC, 0x0a45, 0)},
509 /* PocketPC USB Sync */
510 {USB_VPI(USB_VENDOR_HTC, 0x0a46, 0)},
511 /* PocketPC USB Sync */
512 {USB_VPI(USB_VENDOR_HTC, 0x0a47, 0)},
513 /* PocketPC USB Sync */
514 {USB_VPI(USB_VENDOR_HTC, 0x0a48, 0)},
515 /* PocketPC USB Sync */
516 {USB_VPI(USB_VENDOR_HTC, 0x0a49, 0)},
517 /* PocketPC USB Sync */
518 {USB_VPI(USB_VENDOR_HTC, 0x0a4a, 0)},
519 /* PocketPC USB Sync */
520 {USB_VPI(USB_VENDOR_HTC, 0x0a4b, 0)},
521 /* PocketPC USB Sync */
522 {USB_VPI(USB_VENDOR_HTC, 0x0a4c, 0)},
523 /* PocketPC USB Sync */
524 {USB_VPI(USB_VENDOR_HTC, 0x0a4d, 0)},
525 /* PocketPC USB Sync */
526 {USB_VPI(USB_VENDOR_HTC, 0x0a4e, 0)},
527 /* PocketPC USB Sync */
528 {USB_VPI(USB_VENDOR_HTC, 0x0a4f, 0)},
529 /* HTC SmartPhone USB Sync */
530 {USB_VPI(USB_VENDOR_HTC, 0x0a50, 0)},
531 /* SmartPhone USB Sync */
532 {USB_VPI(USB_VENDOR_HTC, 0x0a52, 0)},
533 /* SmartPhone USB Sync */
534 {USB_VPI(USB_VENDOR_HTC, 0x0a53, 0)},
535 /* SmartPhone USB Sync */
536 {USB_VPI(USB_VENDOR_HTC, 0x0a54, 0)},
537 /* SmartPhone USB Sync */
538 {USB_VPI(USB_VENDOR_HTC, 0x0a55, 0)},
539 /* SmartPhone USB Sync */
540 {USB_VPI(USB_VENDOR_HTC, 0x0a56, 0)},
541 /* SmartPhone USB Sync */
542 {USB_VPI(USB_VENDOR_HTC, 0x0a57, 0)},
543 /* SmartPhone USB Sync */
544 {USB_VPI(USB_VENDOR_HTC, 0x0a58, 0)},
545 /* SmartPhone USB Sync */
546 {USB_VPI(USB_VENDOR_HTC, 0x0a59, 0)},
547 /* SmartPhone USB Sync */
548 {USB_VPI(USB_VENDOR_HTC, 0x0a5a, 0)},
549 /* SmartPhone USB Sync */
550 {USB_VPI(USB_VENDOR_HTC, 0x0a5b, 0)},
551 /* SmartPhone USB Sync */
552 {USB_VPI(USB_VENDOR_HTC, 0x0a5c, 0)},
553 /* SmartPhone USB Sync */
554 {USB_VPI(USB_VENDOR_HTC, 0x0a5d, 0)},
555 /* SmartPhone USB Sync */
556 {USB_VPI(USB_VENDOR_HTC, 0x0a5e, 0)},
557 /* SmartPhone USB Sync */
558 {USB_VPI(USB_VENDOR_HTC, 0x0a5f, 0)},
559 /* SmartPhone USB Sync */
560 {USB_VPI(USB_VENDOR_HTC, 0x0a60, 0)},
561 /* SmartPhone USB Sync */
562 {USB_VPI(USB_VENDOR_HTC, 0x0a61, 0)},
563 /* SmartPhone USB Sync */
564 {USB_VPI(USB_VENDOR_HTC, 0x0a62, 0)},
565 /* SmartPhone USB Sync */
566 {USB_VPI(USB_VENDOR_HTC, 0x0a63, 0)},
567 /* SmartPhone USB Sync */
568 {USB_VPI(USB_VENDOR_HTC, 0x0a64, 0)},
569 /* SmartPhone USB Sync */
570 {USB_VPI(USB_VENDOR_HTC, 0x0a65, 0)},
571 /* SmartPhone USB Sync */
572 {USB_VPI(USB_VENDOR_HTC, 0x0a66, 0)},
573 /* SmartPhone USB Sync */
574 {USB_VPI(USB_VENDOR_HTC, 0x0a67, 0)},
575 /* SmartPhone USB Sync */
576 {USB_VPI(USB_VENDOR_HTC, 0x0a68, 0)},
577 /* SmartPhone USB Sync */
578 {USB_VPI(USB_VENDOR_HTC, 0x0a69, 0)},
579 /* SmartPhone USB Sync */
580 {USB_VPI(USB_VENDOR_HTC, 0x0a6a, 0)},
581 /* SmartPhone USB Sync */
582 {USB_VPI(USB_VENDOR_HTC, 0x0a6b, 0)},
583 /* SmartPhone USB Sync */
584 {USB_VPI(USB_VENDOR_HTC, 0x0a6c, 0)},
585 /* SmartPhone USB Sync */
586 {USB_VPI(USB_VENDOR_HTC, 0x0a6d, 0)},
587 /* SmartPhone USB Sync */
588 {USB_VPI(USB_VENDOR_HTC, 0x0a6e, 0)},
589 /* SmartPhone USB Sync */
590 {USB_VPI(USB_VENDOR_HTC, 0x0a6f, 0)},
591 /* SmartPhone USB Sync */
592 {USB_VPI(USB_VENDOR_HTC, 0x0a70, 0)},
593 /* SmartPhone USB Sync */
594 {USB_VPI(USB_VENDOR_HTC, 0x0a71, 0)},
595 /* SmartPhone USB Sync */
596 {USB_VPI(USB_VENDOR_HTC, 0x0a72, 0)},
597 /* SmartPhone USB Sync */
598 {USB_VPI(USB_VENDOR_HTC, 0x0a73, 0)},
599 /* SmartPhone USB Sync */
600 {USB_VPI(USB_VENDOR_HTC, 0x0a74, 0)},
601 /* SmartPhone USB Sync */
602 {USB_VPI(USB_VENDOR_HTC, 0x0a75, 0)},
603 /* SmartPhone USB Sync */
604 {USB_VPI(USB_VENDOR_HTC, 0x0a76, 0)},
605 /* SmartPhone USB Sync */
606 {USB_VPI(USB_VENDOR_HTC, 0x0a77, 0)},
607 /* SmartPhone USB Sync */
608 {USB_VPI(USB_VENDOR_HTC, 0x0a78, 0)},
609 /* SmartPhone USB Sync */
610 {USB_VPI(USB_VENDOR_HTC, 0x0a79, 0)},
611 /* SmartPhone USB Sync */
612 {USB_VPI(USB_VENDOR_HTC, 0x0a7a, 0)},
613 /* SmartPhone USB Sync */
614 {USB_VPI(USB_VENDOR_HTC, 0x0a7b, 0)},
615 /* SmartPhone USB Sync */
616 {USB_VPI(USB_VENDOR_HTC, 0x0a7c, 0)},
617 /* SmartPhone USB Sync */
618 {USB_VPI(USB_VENDOR_HTC, 0x0a7d, 0)},
619 /* SmartPhone USB Sync */
620 {USB_VPI(USB_VENDOR_HTC, 0x0a7e, 0)},
621 /* SmartPhone USB Sync */
622 {USB_VPI(USB_VENDOR_HTC, 0x0a7f, 0)},
623 /* SmartPhone USB Sync */
624 {USB_VPI(USB_VENDOR_HTC, 0x0a80, 0)},
625 /* SmartPhone USB Sync */
626 {USB_VPI(USB_VENDOR_HTC, 0x0a81, 0)},
627 /* SmartPhone USB Sync */
628 {USB_VPI(USB_VENDOR_HTC, 0x0a82, 0)},
629 /* SmartPhone USB Sync */
630 {USB_VPI(USB_VENDOR_HTC, 0x0a83, 0)},
631 /* SmartPhone USB Sync */
632 {USB_VPI(USB_VENDOR_HTC, 0x0a84, 0)},
633 /* SmartPhone USB Sync */
634 {USB_VPI(USB_VENDOR_HTC, 0x0a85, 0)},
635 /* SmartPhone USB Sync */
636 {USB_VPI(USB_VENDOR_HTC, 0x0a86, 0)},
637 /* SmartPhone USB Sync */
638 {USB_VPI(USB_VENDOR_HTC, 0x0a87, 0)},
639 /* SmartPhone USB Sync */
640 {USB_VPI(USB_VENDOR_HTC, 0x0a88, 0)},
641 /* SmartPhone USB Sync */
642 {USB_VPI(USB_VENDOR_HTC, 0x0a89, 0)},
643 /* SmartPhone USB Sync */
644 {USB_VPI(USB_VENDOR_HTC, 0x0a8a, 0)},
645 /* SmartPhone USB Sync */
646 {USB_VPI(USB_VENDOR_HTC, 0x0a8b, 0)},
647 /* SmartPhone USB Sync */
648 {USB_VPI(USB_VENDOR_HTC, 0x0a8c, 0)},
649 /* SmartPhone USB Sync */
650 {USB_VPI(USB_VENDOR_HTC, 0x0a8d, 0)},
651 /* SmartPhone USB Sync */
652 {USB_VPI(USB_VENDOR_HTC, 0x0a8e, 0)},
653 /* SmartPhone USB Sync */
654 {USB_VPI(USB_VENDOR_HTC, 0x0a8f, 0)},
655 /* SmartPhone USB Sync */
656 {USB_VPI(USB_VENDOR_HTC, 0x0a90, 0)},
657 /* SmartPhone USB Sync */
658 {USB_VPI(USB_VENDOR_HTC, 0x0a91, 0)},
659 /* SmartPhone USB Sync */
660 {USB_VPI(USB_VENDOR_HTC, 0x0a92, 0)},
661 /* SmartPhone USB Sync */
662 {USB_VPI(USB_VENDOR_HTC, 0x0a93, 0)},
663 /* SmartPhone USB Sync */
664 {USB_VPI(USB_VENDOR_HTC, 0x0a94, 0)},
665 /* SmartPhone USB Sync */
666 {USB_VPI(USB_VENDOR_HTC, 0x0a95, 0)},
667 /* SmartPhone USB Sync */
668 {USB_VPI(USB_VENDOR_HTC, 0x0a96, 0)},
669 /* SmartPhone USB Sync */
670 {USB_VPI(USB_VENDOR_HTC, 0x0a97, 0)},
671 /* SmartPhone USB Sync */
672 {USB_VPI(USB_VENDOR_HTC, 0x0a98, 0)},
673 /* SmartPhone USB Sync */
674 {USB_VPI(USB_VENDOR_HTC, 0x0a99, 0)},
675 /* SmartPhone USB Sync */
676 {USB_VPI(USB_VENDOR_HTC, 0x0a9a, 0)},
677 /* SmartPhone USB Sync */
678 {USB_VPI(USB_VENDOR_HTC, 0x0a9b, 0)},
679 /* SmartPhone USB Sync */
680 {USB_VPI(USB_VENDOR_HTC, 0x0a9c, 0)},
681 /* SmartPhone USB Sync */
682 {USB_VPI(USB_VENDOR_HTC, 0x0a9d, 0)},
683 /* SmartPhone USB Sync */
684 {USB_VPI(USB_VENDOR_HTC, 0x0a9e, 0)},
685 /* SmartPhone USB Sync */
686 {USB_VPI(USB_VENDOR_HTC, 0x0a9f, 0)},
687 /**/
688 {USB_VPI(USB_VENDOR_HTC, USB_PRODUCT_HTC_PPC6700MODEM, 0)},
689 /**/
690 {USB_VPI(USB_VENDOR_HTC, USB_PRODUCT_HTC_SMARTPHONE, 0)},
691 /**/
692 {USB_VPI(USB_VENDOR_HTC, USB_PRODUCT_HTC_WINMOBILE, 0)},
693 /* High Tech Computer Wizard Smartphone */
694 {USB_VPI(USB_VENDOR_HTC, USB_PRODUCT_HTC_WIZARD, 0)},
695 /* JVC USB Sync */
696 {USB_VPI(USB_VENDOR_JVC, 0x3011, 0)},
697 /* JVC USB Sync */
698 {USB_VPI(USB_VENDOR_JVC, 0x3012, 0)},
699 /* LGE USB Sync */
700 {USB_VPI(USB_VENDOR_LG, 0x9c01, 0)},
701 /* Microsoft USB Sync */
702 {USB_VPI(USB_VENDOR_MICROSOFT, 0x00ce, 0)},
703 /* Windows Pocket PC 2002 */
704 {USB_VPI(USB_VENDOR_MICROSOFT, 0x0400, 0)},
705 /* Windows Pocket PC 2002 */
706 {USB_VPI(USB_VENDOR_MICROSOFT, 0x0401, 0)},
707 /* Windows Pocket PC 2002 */
708 {USB_VPI(USB_VENDOR_MICROSOFT, 0x0402, 0)},
709 /* Windows Pocket PC 2002 */
710 {USB_VPI(USB_VENDOR_MICROSOFT, 0x0403, 0)},
711 /* Windows Pocket PC 2002 */
712 {USB_VPI(USB_VENDOR_MICROSOFT, 0x0404, 0)},
713 /* Windows Pocket PC 2002 */
714 {USB_VPI(USB_VENDOR_MICROSOFT, 0x0405, 0)},
715 /* Windows Pocket PC 2002 */
716 {USB_VPI(USB_VENDOR_MICROSOFT, 0x0406, 0)},
717 /* Windows Pocket PC 2002 */
718 {USB_VPI(USB_VENDOR_MICROSOFT, 0x0407, 0)},
719 /* Windows Pocket PC 2002 */
720 {USB_VPI(USB_VENDOR_MICROSOFT, 0x0408, 0)},
721 /* Windows Pocket PC 2002 */
722 {USB_VPI(USB_VENDOR_MICROSOFT, 0x0409, 0)},
723 /* Windows Pocket PC 2002 */
724 {USB_VPI(USB_VENDOR_MICROSOFT, 0x040a, 0)},
725 /* Windows Pocket PC 2002 */
726 {USB_VPI(USB_VENDOR_MICROSOFT, 0x040b, 0)},
727 /* Windows Pocket PC 2002 */
728 {USB_VPI(USB_VENDOR_MICROSOFT, 0x040c, 0)},
729 /* Windows Pocket PC 2002 */
730 {USB_VPI(USB_VENDOR_MICROSOFT, 0x040d, 0)},
731 /* Windows Pocket PC 2002 */
732 {USB_VPI(USB_VENDOR_MICROSOFT, 0x040e, 0)},
733 /* Windows Pocket PC 2002 */
734 {USB_VPI(USB_VENDOR_MICROSOFT, 0x040f, 0)},
735 /* Windows Pocket PC 2002 */
736 {USB_VPI(USB_VENDOR_MICROSOFT, 0x0410, 0)},
737 /* Windows Pocket PC 2002 */
738 {USB_VPI(USB_VENDOR_MICROSOFT, 0x0411, 0)},
739 /* Windows Pocket PC 2002 */
740 {USB_VPI(USB_VENDOR_MICROSOFT, 0x0412, 0)},
741 /* Windows Pocket PC 2002 */
742 {USB_VPI(USB_VENDOR_MICROSOFT, 0x0413, 0)},
743 /* Windows Pocket PC 2002 */
744 {USB_VPI(USB_VENDOR_MICROSOFT, 0x0414, 0)},
745 /* Windows Pocket PC 2002 */
746 {USB_VPI(USB_VENDOR_MICROSOFT, 0x0415, 0)},
747 /* Windows Pocket PC 2002 */
748 {USB_VPI(USB_VENDOR_MICROSOFT, 0x0416, 0)},
749 /* Windows Pocket PC 2002 */
750 {USB_VPI(USB_VENDOR_MICROSOFT, 0x0417, 0)},
751 /* Windows Pocket PC 2003 */
752 {USB_VPI(USB_VENDOR_MICROSOFT, 0x0432, 0)},
753 /* Windows Pocket PC 2003 */
754 {USB_VPI(USB_VENDOR_MICROSOFT, 0x0433, 0)},
755 /* Windows Pocket PC 2003 */
756 {USB_VPI(USB_VENDOR_MICROSOFT, 0x0434, 0)},
757 /* Windows Pocket PC 2003 */
758 {USB_VPI(USB_VENDOR_MICROSOFT, 0x0435, 0)},
759 /* Windows Pocket PC 2003 */
760 {USB_VPI(USB_VENDOR_MICROSOFT, 0x0436, 0)},
761 /* Windows Pocket PC 2003 */
762 {USB_VPI(USB_VENDOR_MICROSOFT, 0x0437, 0)},
763 /* Windows Pocket PC 2003 */
764 {USB_VPI(USB_VENDOR_MICROSOFT, 0x0438, 0)},
765 /* Windows Pocket PC 2003 */
766 {USB_VPI(USB_VENDOR_MICROSOFT, 0x0439, 0)},
767 /* Windows Pocket PC 2003 */
768 {USB_VPI(USB_VENDOR_MICROSOFT, 0x043a, 0)},
769 /* Windows Pocket PC 2003 */
770 {USB_VPI(USB_VENDOR_MICROSOFT, 0x043b, 0)},
771 /* Windows Pocket PC 2003 */
772 {USB_VPI(USB_VENDOR_MICROSOFT, 0x043c, 0)},
773 /* Windows Pocket PC 2003 */
774 {USB_VPI(USB_VENDOR_MICROSOFT, 0x043d, 0)},
775 /* Windows Pocket PC 2003 */
776 {USB_VPI(USB_VENDOR_MICROSOFT, 0x043e, 0)},
777 /* Windows Pocket PC 2003 */
778 {USB_VPI(USB_VENDOR_MICROSOFT, 0x043f, 0)},
779 /* Windows Pocket PC 2003 */
780 {USB_VPI(USB_VENDOR_MICROSOFT, 0x0440, 0)},
781 /* Windows Pocket PC 2003 */
782 {USB_VPI(USB_VENDOR_MICROSOFT, 0x0441, 0)},
783 /* Windows Pocket PC 2003 */
784 {USB_VPI(USB_VENDOR_MICROSOFT, 0x0442, 0)},
785 /* Windows Pocket PC 2003 */
786 {USB_VPI(USB_VENDOR_MICROSOFT, 0x0443, 0)},
787 /* Windows Pocket PC 2003 */
788 {USB_VPI(USB_VENDOR_MICROSOFT, 0x0444, 0)},
789 /* Windows Pocket PC 2003 */
790 {USB_VPI(USB_VENDOR_MICROSOFT, 0x0445, 0)},
791 /* Windows Pocket PC 2003 */
792 {USB_VPI(USB_VENDOR_MICROSOFT, 0x0446, 0)},
793 /* Windows Pocket PC 2003 */
794 {USB_VPI(USB_VENDOR_MICROSOFT, 0x0447, 0)},
795 /* Windows Pocket PC 2003 */
796 {USB_VPI(USB_VENDOR_MICROSOFT, 0x0448, 0)},
797 /* Windows Pocket PC 2003 */
798 {USB_VPI(USB_VENDOR_MICROSOFT, 0x0449, 0)},
799 /* Windows Pocket PC 2003 */
800 {USB_VPI(USB_VENDOR_MICROSOFT, 0x044a, 0)},
801 /* Windows Pocket PC 2003 */
802 {USB_VPI(USB_VENDOR_MICROSOFT, 0x044b, 0)},
803 /* Windows Pocket PC 2003 */
804 {USB_VPI(USB_VENDOR_MICROSOFT, 0x044c, 0)},
805 /* Windows Pocket PC 2003 */
806 {USB_VPI(USB_VENDOR_MICROSOFT, 0x044d, 0)},
807 /* Windows Pocket PC 2003 */
808 {USB_VPI(USB_VENDOR_MICROSOFT, 0x044e, 0)},
809 /* Windows Pocket PC 2003 */
810 {USB_VPI(USB_VENDOR_MICROSOFT, 0x044f, 0)},
811 /* Windows Pocket PC 2003 */
812 {USB_VPI(USB_VENDOR_MICROSOFT, 0x0450, 0)},
813 /* Windows Pocket PC 2003 */
814 {USB_VPI(USB_VENDOR_MICROSOFT, 0x0451, 0)},
815 /* Windows Pocket PC 2003 */
816 {USB_VPI(USB_VENDOR_MICROSOFT, 0x0452, 0)},
817 /* Windows Pocket PC 2003 */
818 {USB_VPI(USB_VENDOR_MICROSOFT, 0x0453, 0)},
819 /* Windows Pocket PC 2003 */
820 {USB_VPI(USB_VENDOR_MICROSOFT, 0x0454, 0)},
821 /* Windows Pocket PC 2003 */
822 {USB_VPI(USB_VENDOR_MICROSOFT, 0x0455, 0)},
823 /* Windows Pocket PC 2003 */
824 {USB_VPI(USB_VENDOR_MICROSOFT, 0x0456, 0)},
825 /* Windows Pocket PC 2003 */
826 {USB_VPI(USB_VENDOR_MICROSOFT, 0x0457, 0)},
827 /* Windows Pocket PC 2003 */
828 {USB_VPI(USB_VENDOR_MICROSOFT, 0x0458, 0)},
829 /* Windows Pocket PC 2003 */
830 {USB_VPI(USB_VENDOR_MICROSOFT, 0x0459, 0)},
831 /* Windows Pocket PC 2003 */
832 {USB_VPI(USB_VENDOR_MICROSOFT, 0x045a, 0)},
833 /* Windows Pocket PC 2003 */
834 {USB_VPI(USB_VENDOR_MICROSOFT, 0x045b, 0)},
835 /* Windows Pocket PC 2003 */
836 {USB_VPI(USB_VENDOR_MICROSOFT, 0x045c, 0)},
837 /* Windows Pocket PC 2003 */
838 {USB_VPI(USB_VENDOR_MICROSOFT, 0x045d, 0)},
839 /* Windows Pocket PC 2003 */
840 {USB_VPI(USB_VENDOR_MICROSOFT, 0x045e, 0)},
841 /* Windows Pocket PC 2003 */
842 {USB_VPI(USB_VENDOR_MICROSOFT, 0x045f, 0)},
843 /* Windows Pocket PC 2003 */
844 {USB_VPI(USB_VENDOR_MICROSOFT, 0x0460, 0)},
845 /* Windows Pocket PC 2003 */
846 {USB_VPI(USB_VENDOR_MICROSOFT, 0x0461, 0)},
847 /* Windows Pocket PC 2003 */
848 {USB_VPI(USB_VENDOR_MICROSOFT, 0x0462, 0)},
849 /* Windows Pocket PC 2003 */
850 {USB_VPI(USB_VENDOR_MICROSOFT, 0x0463, 0)},
851 /* Windows Pocket PC 2003 */
852 {USB_VPI(USB_VENDOR_MICROSOFT, 0x0464, 0)},
853 /* Windows Pocket PC 2003 */
854 {USB_VPI(USB_VENDOR_MICROSOFT, 0x0465, 0)},
855 /* Windows Pocket PC 2003 */
856 {USB_VPI(USB_VENDOR_MICROSOFT, 0x0466, 0)},
857 /* Windows Pocket PC 2003 */
858 {USB_VPI(USB_VENDOR_MICROSOFT, 0x0467, 0)},
859 /* Windows Pocket PC 2003 */
860 {USB_VPI(USB_VENDOR_MICROSOFT, 0x0468, 0)},
861 /* Windows Pocket PC 2003 */
862 {USB_VPI(USB_VENDOR_MICROSOFT, 0x0469, 0)},
863 /* Windows Pocket PC 2003 */
864 {USB_VPI(USB_VENDOR_MICROSOFT, 0x046a, 0)},
865 /* Windows Pocket PC 2003 */
866 {USB_VPI(USB_VENDOR_MICROSOFT, 0x046b, 0)},
867 /* Windows Pocket PC 2003 */
868 {USB_VPI(USB_VENDOR_MICROSOFT, 0x046c, 0)},
869 /* Windows Pocket PC 2003 */
870 {USB_VPI(USB_VENDOR_MICROSOFT, 0x046d, 0)},
871 /* Windows Pocket PC 2003 */
872 {USB_VPI(USB_VENDOR_MICROSOFT, 0x046e, 0)},
873 /* Windows Pocket PC 2003 */
874 {USB_VPI(USB_VENDOR_MICROSOFT, 0x046f, 0)},
875 /* Windows Pocket PC 2003 */
876 {USB_VPI(USB_VENDOR_MICROSOFT, 0x0470, 0)},
877 /* Windows Pocket PC 2003 */
878 {USB_VPI(USB_VENDOR_MICROSOFT, 0x0471, 0)},
879 /* Windows Pocket PC 2003 */
880 {USB_VPI(USB_VENDOR_MICROSOFT, 0x0472, 0)},
881 /* Windows Pocket PC 2003 */
882 {USB_VPI(USB_VENDOR_MICROSOFT, 0x0473, 0)},
883 /* Windows Pocket PC 2003 */
884 {USB_VPI(USB_VENDOR_MICROSOFT, 0x0474, 0)},
885 /* Windows Pocket PC 2003 */
886 {USB_VPI(USB_VENDOR_MICROSOFT, 0x0475, 0)},
887 /* Windows Pocket PC 2003 */
888 {USB_VPI(USB_VENDOR_MICROSOFT, 0x0476, 0)},
889 /* Windows Pocket PC 2003 */
890 {USB_VPI(USB_VENDOR_MICROSOFT, 0x0477, 0)},
891 /* Windows Pocket PC 2003 */
892 {USB_VPI(USB_VENDOR_MICROSOFT, 0x0478, 0)},
893 /* Windows Pocket PC 2003 */
894 {USB_VPI(USB_VENDOR_MICROSOFT, 0x0479, 0)},
895 /* Windows Pocket PC 2003 */
896 {USB_VPI(USB_VENDOR_MICROSOFT, 0x047a, 0)},
897 /* Windows Pocket PC 2003 */
898 {USB_VPI(USB_VENDOR_MICROSOFT, 0x047b, 0)},
899 /* Windows Smartphone 2002 */
900 {USB_VPI(USB_VENDOR_MICROSOFT, 0x04c8, 0)},
901 /* Windows Smartphone 2002 */
902 {USB_VPI(USB_VENDOR_MICROSOFT, 0x04c9, 0)},
903 /* Windows Smartphone 2002 */
904 {USB_VPI(USB_VENDOR_MICROSOFT, 0x04ca, 0)},
905 /* Windows Smartphone 2002 */
906 {USB_VPI(USB_VENDOR_MICROSOFT, 0x04cb, 0)},
907 /* Windows Smartphone 2002 */
908 {USB_VPI(USB_VENDOR_MICROSOFT, 0x04cc, 0)},
909 /* Windows Smartphone 2002 */
910 {USB_VPI(USB_VENDOR_MICROSOFT, 0x04cd, 0)},
911 /* Windows Smartphone 2002 */
912 {USB_VPI(USB_VENDOR_MICROSOFT, 0x04ce, 0)},
913 /* Windows Smartphone 2003 */
914 {USB_VPI(USB_VENDOR_MICROSOFT, 0x04d7, 0)},
915 /* Windows Smartphone 2003 */
916 {USB_VPI(USB_VENDOR_MICROSOFT, 0x04d8, 0)},
917 /* Windows Smartphone 2003 */
918 {USB_VPI(USB_VENDOR_MICROSOFT, 0x04d9, 0)},
919 /* Windows Smartphone 2003 */
920 {USB_VPI(USB_VENDOR_MICROSOFT, 0x04da, 0)},
921 /* Windows Smartphone 2003 */
922 {USB_VPI(USB_VENDOR_MICROSOFT, 0x04db, 0)},
923 /* Windows Smartphone 2003 */
924 {USB_VPI(USB_VENDOR_MICROSOFT, 0x04dc, 0)},
925 /* Windows Smartphone 2003 */
926 {USB_VPI(USB_VENDOR_MICROSOFT, 0x04dd, 0)},
927 /* Windows Smartphone 2003 */
928 {USB_VPI(USB_VENDOR_MICROSOFT, 0x04de, 0)},
929 /* Windows Smartphone 2003 */
930 {USB_VPI(USB_VENDOR_MICROSOFT, 0x04df, 0)},
931 /* Windows Smartphone 2003 */
932 {USB_VPI(USB_VENDOR_MICROSOFT, 0x04e0, 0)},
933 /* Windows Smartphone 2003 */
934 {USB_VPI(USB_VENDOR_MICROSOFT, 0x04e1, 0)},
935 /* Windows Smartphone 2003 */
936 {USB_VPI(USB_VENDOR_MICROSOFT, 0x04e2, 0)},
937 /* Windows Smartphone 2003 */
938 {USB_VPI(USB_VENDOR_MICROSOFT, 0x04e3, 0)},
939 /* Windows Smartphone 2003 */
940 {USB_VPI(USB_VENDOR_MICROSOFT, 0x04e4, 0)},
941 /* Windows Smartphone 2003 */
942 {USB_VPI(USB_VENDOR_MICROSOFT, 0x04e5, 0)},
943 /* Windows Smartphone 2003 */
944 {USB_VPI(USB_VENDOR_MICROSOFT, 0x04e6, 0)},
945 /* Windows Smartphone 2003 */
946 {USB_VPI(USB_VENDOR_MICROSOFT, 0x04e7, 0)},
947 /* Windows Smartphone 2003 */
948 {USB_VPI(USB_VENDOR_MICROSOFT, 0x04e8, 0)},
949 /* Windows Smartphone 2003 */
950 {USB_VPI(USB_VENDOR_MICROSOFT, 0x04e9, 0)},
951 /* Windows Smartphone 2003 */
952 {USB_VPI(USB_VENDOR_MICROSOFT, 0x04ea, 0)},
953 /* Motorola MPx200 Smartphone */
954 {USB_VPI(USB_VENDOR_MOTOROLA2, 0x4204, 0)},
955 /* Motorola MPc GSM */
956 {USB_VPI(USB_VENDOR_MOTOROLA2, 0x4214, 0)},
957 /* Motorola MPx220 Smartphone */
958 {USB_VPI(USB_VENDOR_MOTOROLA2, 0x4224, 0)},
959 /* Motorola MPc CDMA */
960 {USB_VPI(USB_VENDOR_MOTOROLA2, 0x4234, 0)},
961 /* Motorola MPx100 Smartphone */
962 {USB_VPI(USB_VENDOR_MOTOROLA2, 0x4244, 0)},
963 /* NEC USB Sync */
964 {USB_VPI(USB_VENDOR_NEC, 0x00d5, 0)},
965 /* NEC USB Sync */
966 {USB_VPI(USB_VENDOR_NEC, 0x00d6, 0)},
967 /* NEC USB Sync */
968 {USB_VPI(USB_VENDOR_NEC, 0x00d7, 0)},
969 /* NEC USB Sync */
970 {USB_VPI(USB_VENDOR_NEC, 0x8024, 0)},
971 /* NEC USB Sync */
972 {USB_VPI(USB_VENDOR_NEC, 0x8025, 0)},
973 /* Panasonic USB Sync */
974 {USB_VPI(USB_VENDOR_PANASONIC, 0x2500, 0)},
975 /* Samsung NEXiO USB Sync */
976 {USB_VPI(USB_VENDOR_SAMSUNG, 0x5f00, 0)},
977 /* Samsung NEXiO USB Sync */
978 {USB_VPI(USB_VENDOR_SAMSUNG, 0x5f01, 0)},
979 /* Samsung NEXiO USB Sync */
980 {USB_VPI(USB_VENDOR_SAMSUNG, 0x5f02, 0)},
981 /* Samsung NEXiO USB Sync */
982 {USB_VPI(USB_VENDOR_SAMSUNG, 0x5f03, 0)},
983 /* Samsung NEXiO USB Sync */
984 {USB_VPI(USB_VENDOR_SAMSUNG, 0x5f04, 0)},
985 /* Samsung MITs USB Sync */
986 {USB_VPI(USB_VENDOR_SAMSUNG, 0x6611, 0)},
987 /* Samsung MITs USB Sync */
988 {USB_VPI(USB_VENDOR_SAMSUNG, 0x6613, 0)},
989 /* Samsung MITs USB Sync */
990 {USB_VPI(USB_VENDOR_SAMSUNG, 0x6615, 0)},
991 /* Samsung MITs USB Sync */
992 {USB_VPI(USB_VENDOR_SAMSUNG, 0x6617, 0)},
993 /* Samsung MITs USB Sync */
994 {USB_VPI(USB_VENDOR_SAMSUNG, 0x6619, 0)},
995 /* Samsung MITs USB Sync */
996 {USB_VPI(USB_VENDOR_SAMSUNG, 0x661b, 0)},
997 /* Samsung MITs USB Sync */
998 {USB_VPI(USB_VENDOR_SAMSUNG, 0x662e, 0)},
999 /* Samsung MITs USB Sync */
1000 {USB_VPI(USB_VENDOR_SAMSUNG, 0x6630, 0)},
1001 /* Samsung MITs USB Sync */
1002 {USB_VPI(USB_VENDOR_SAMSUNG, 0x6632, 0)},
1003 /* SHARP WS003SH USB Modem */
1004 {USB_VPI(USB_VENDOR_SHARP, 0x9102, 0)},
1005 /* SHARP WS004SH USB Modem */
1006 {USB_VPI(USB_VENDOR_SHARP, 0x9121, 0)},
1007 /* SHARP S01SH USB Modem */
1008 {USB_VPI(USB_VENDOR_SHARP, 0x9151, 0)},
1009 /**/
1010 {USB_VPI(USB_VENDOR_SHARP, USB_PRODUCT_SHARP_WZERO3ES, 0)},
1011 /**/
1012 {USB_VPI(USB_VENDOR_SHARP, USB_PRODUCT_SHARP_WZERO3ADES, 0)},
1013 /**/
1014 {USB_VPI(USB_VENDOR_SHARP, USB_PRODUCT_SHARP_WILLCOM03, 0)},
1015 /* Symbol USB Sync */
1016 {USB_VPI(USB_VENDOR_SYMBOL, 0x2000, 0)},
1017 /* Symbol USB Sync 0x2001 */
1018 {USB_VPI(USB_VENDOR_SYMBOL, 0x2001, 0)},
1019 /* Symbol USB Sync 0x2002 */
1020 {USB_VPI(USB_VENDOR_SYMBOL, 0x2002, 0)},
1021 /* Symbol USB Sync 0x2003 */
1022 {USB_VPI(USB_VENDOR_SYMBOL, 0x2003, 0)},
1023 /* Symbol USB Sync 0x2004 */
1024 {USB_VPI(USB_VENDOR_SYMBOL, 0x2004, 0)},
1025 /* Symbol USB Sync 0x2005 */
1026 {USB_VPI(USB_VENDOR_SYMBOL, 0x2005, 0)},
1027 /* Symbol USB Sync 0x2006 */
1028 {USB_VPI(USB_VENDOR_SYMBOL, 0x2006, 0)},
1029 /* Symbol USB Sync 0x2007 */
1030 {USB_VPI(USB_VENDOR_SYMBOL, 0x2007, 0)},
1031 /* Symbol USB Sync 0x2008 */
1032 {USB_VPI(USB_VENDOR_SYMBOL, 0x2008, 0)},
1033 /* Symbol USB Sync 0x2009 */
1034 {USB_VPI(USB_VENDOR_SYMBOL, 0x2009, 0)},
1035 /* Symbol USB Sync 0x200a */
1036 {USB_VPI(USB_VENDOR_SYMBOL, 0x200a, 0)},
1037 /* TOSHIBA USB Sync 0700 */
1038 {USB_VPI(USB_VENDOR_TOSHIBA, 0x0700, 0)},
1039 /* TOSHIBA Pocket PC e310 */
1040 {USB_VPI(USB_VENDOR_TOSHIBA, 0x0705, 0)},
1041 /* TOSHIBA Pocket PC e330 Series */
1042 {USB_VPI(USB_VENDOR_TOSHIBA, 0x0707, 0)},
1043 /* TOSHIBA Pocket PC e350Series */
1044 {USB_VPI(USB_VENDOR_TOSHIBA, 0x0708, 0)},
1045 /* TOSHIBA Pocket PC e750 Series */
1046 {USB_VPI(USB_VENDOR_TOSHIBA, 0x0709, 0)},
1047 /* TOSHIBA Pocket PC e400 Series */
1048 {USB_VPI(USB_VENDOR_TOSHIBA, 0x070a, 0)},
1049 /* TOSHIBA Pocket PC e800 Series */
1050 {USB_VPI(USB_VENDOR_TOSHIBA, 0x070b, 0)},
1051 /* TOSHIBA Pocket PC e740 */
1052 {USB_VPI(USB_VENDOR_TOSHIBA, USB_PRODUCT_TOSHIBA_POCKETPC_E740, 0)},
1053 /* ViewSonic Color Pocket PC V35 */
1054 {USB_VPI(USB_VENDOR_VIEWSONIC, 0x0ed9, 0)},
1055 /* ViewSonic Color Pocket PC V36 */
1056 {USB_VPI(USB_VENDOR_VIEWSONIC, 0x1527, 0)},
1057 /* ViewSonic Color Pocket PC V37 */
1058 {USB_VPI(USB_VENDOR_VIEWSONIC, 0x1529, 0)},
1059 /* ViewSonic Color Pocket PC V38 */
1060 {USB_VPI(USB_VENDOR_VIEWSONIC, 0x152b, 0)},
1061 /* ViewSonic Pocket PC */
1062 {USB_VPI(USB_VENDOR_VIEWSONIC, 0x152e, 0)},
1063 /* ViewSonic Communicator Pocket PC */
1064 {USB_VPI(USB_VENDOR_VIEWSONIC, 0x1921, 0)},
1065 /* ViewSonic Smartphone */
1066 {USB_VPI(USB_VENDOR_VIEWSONIC, 0x1922, 0)},
1067 /* ViewSonic Pocket PC V30 */
1068 {USB_VPI(USB_VENDOR_VIEWSONIC, 0x1923, 0)},
1069 };
1070
1071 static device_method_t uipaq_methods[] = {
1072 DEVMETHOD(device_probe, uipaq_probe),
1073 DEVMETHOD(device_attach, uipaq_attach),
1074 DEVMETHOD(device_detach, uipaq_detach),
1075 DEVMETHOD_END
1076 };
1077
1078 static driver_t uipaq_driver = {
1079 .name = "uipaq",
1080 .methods = uipaq_methods,
1081 .size = sizeof(struct uipaq_softc),
1082 };
1083
1084 DRIVER_MODULE(uipaq, uhub, uipaq_driver, NULL, NULL);
1085 MODULE_DEPEND(uipaq, ucom, 1, 1, 1);
1086 MODULE_DEPEND(uipaq, usb, 1, 1, 1);
1087 MODULE_VERSION(uipaq, 1);
1088 USB_PNP_HOST_INFO(uipaq_devs);
1089
1090 static int
uipaq_probe(device_t dev)1091 uipaq_probe(device_t dev)
1092 {
1093 struct usb_attach_arg *uaa = device_get_ivars(dev);
1094
1095 if (uaa->usb_mode != USB_MODE_HOST) {
1096 return (ENXIO);
1097 }
1098 if (uaa->info.bConfigIndex != UIPAQ_CONFIG_INDEX) {
1099 return (ENXIO);
1100 }
1101 if (uaa->info.bIfaceIndex != UIPAQ_IFACE_INDEX) {
1102 return (ENXIO);
1103 }
1104 if (uaa->info.bInterfaceClass == UICLASS_IAD) {
1105 DPRINTF("IAD detected - not UIPAQ serial device\n");
1106 return (ENXIO);
1107 }
1108 return (usbd_lookup_id_by_uaa(uipaq_devs, sizeof(uipaq_devs), uaa));
1109 }
1110
1111 static int
uipaq_attach(device_t dev)1112 uipaq_attach(device_t dev)
1113 {
1114 struct usb_device_request req;
1115 struct usb_attach_arg *uaa = device_get_ivars(dev);
1116 struct uipaq_softc *sc = device_get_softc(dev);
1117 int error;
1118 uint8_t iface_index;
1119 uint8_t i;
1120
1121 sc->sc_udev = uaa->device;
1122
1123 device_set_usb_desc(dev);
1124 mtx_init(&sc->sc_mtx, "uipaq", NULL, MTX_DEF);
1125 ucom_ref(&sc->sc_super_ucom);
1126
1127 /*
1128 * Send magic bytes, cribbed from Linux ipaq driver that
1129 * claims to have sniffed them from Win98. Wait for driver to
1130 * become ready on device side?
1131 */
1132 req.bmRequestType = UT_WRITE_CLASS_INTERFACE;
1133 req.bRequest = UCDC_SET_CONTROL_LINE_STATE;
1134 USETW(req.wValue, UCDC_LINE_DTR);
1135 USETW(req.wIndex, 0x0);
1136 USETW(req.wLength, 0);
1137 for (i = 0; i != 64; i++) {
1138 error =
1139 usbd_do_request_flags(uaa->device, NULL, &req,
1140 NULL, 0, NULL, 100);
1141 if (error == 0)
1142 break;
1143 usb_pause_mtx(NULL, hz / 10);
1144 }
1145
1146 iface_index = UIPAQ_IFACE_INDEX;
1147 error = usbd_transfer_setup(uaa->device, &iface_index,
1148 sc->sc_xfer, uipaq_config_data,
1149 UIPAQ_N_TRANSFER, sc, &sc->sc_mtx);
1150
1151 if (error) {
1152 goto detach;
1153 }
1154 /* clear stall at first run */
1155 mtx_lock(&sc->sc_mtx);
1156 usbd_xfer_set_stall(sc->sc_xfer[UIPAQ_BULK_DT_WR]);
1157 usbd_xfer_set_stall(sc->sc_xfer[UIPAQ_BULK_DT_RD]);
1158 mtx_unlock(&sc->sc_mtx);
1159
1160 error = ucom_attach(&sc->sc_super_ucom, &sc->sc_ucom, 1, sc,
1161 &uipaq_callback, &sc->sc_mtx);
1162 if (error) {
1163 goto detach;
1164 }
1165 ucom_set_pnpinfo_usb(&sc->sc_super_ucom, dev);
1166
1167 return (0);
1168
1169 detach:
1170 uipaq_detach(dev);
1171 return (ENXIO);
1172 }
1173
1174 int
uipaq_detach(device_t dev)1175 uipaq_detach(device_t dev)
1176 {
1177 struct uipaq_softc *sc = device_get_softc(dev);
1178
1179 ucom_detach(&sc->sc_super_ucom, &sc->sc_ucom);
1180 usbd_transfer_unsetup(sc->sc_xfer, UIPAQ_N_TRANSFER);
1181
1182 device_claim_softc(dev);
1183
1184 uipaq_free_softc(sc);
1185
1186 return (0);
1187 }
1188
1189 UCOM_UNLOAD_DRAIN(uipaq);
1190
1191 static void
uipaq_free_softc(struct uipaq_softc * sc)1192 uipaq_free_softc(struct uipaq_softc *sc)
1193 {
1194 if (ucom_unref(&sc->sc_super_ucom)) {
1195 mtx_destroy(&sc->sc_mtx);
1196 device_free_softc(sc);
1197 }
1198 }
1199
1200 static void
uipaq_free(struct ucom_softc * ucom)1201 uipaq_free(struct ucom_softc *ucom)
1202 {
1203 uipaq_free_softc(ucom->sc_parent);
1204 }
1205
1206 static void
uipaq_start_read(struct ucom_softc * ucom)1207 uipaq_start_read(struct ucom_softc *ucom)
1208 {
1209 struct uipaq_softc *sc = ucom->sc_parent;
1210
1211 /* start read endpoint */
1212 usbd_transfer_start(sc->sc_xfer[UIPAQ_BULK_DT_RD]);
1213 }
1214
1215 static void
uipaq_stop_read(struct ucom_softc * ucom)1216 uipaq_stop_read(struct ucom_softc *ucom)
1217 {
1218 struct uipaq_softc *sc = ucom->sc_parent;
1219
1220 /* stop read endpoint */
1221 usbd_transfer_stop(sc->sc_xfer[UIPAQ_BULK_DT_RD]);
1222 }
1223
1224 static void
uipaq_start_write(struct ucom_softc * ucom)1225 uipaq_start_write(struct ucom_softc *ucom)
1226 {
1227 struct uipaq_softc *sc = ucom->sc_parent;
1228
1229 usbd_transfer_start(sc->sc_xfer[UIPAQ_BULK_DT_WR]);
1230 }
1231
1232 static void
uipaq_stop_write(struct ucom_softc * ucom)1233 uipaq_stop_write(struct ucom_softc *ucom)
1234 {
1235 struct uipaq_softc *sc = ucom->sc_parent;
1236
1237 usbd_transfer_stop(sc->sc_xfer[UIPAQ_BULK_DT_WR]);
1238 }
1239
1240 static void
uipaq_cfg_set_dtr(struct ucom_softc * ucom,uint8_t onoff)1241 uipaq_cfg_set_dtr(struct ucom_softc *ucom, uint8_t onoff)
1242 {
1243 struct uipaq_softc *sc = ucom->sc_parent;
1244 struct usb_device_request req;
1245
1246 DPRINTF("onoff=%d\n", onoff);
1247
1248 if (onoff)
1249 sc->sc_line |= UCDC_LINE_DTR;
1250 else
1251 sc->sc_line &= ~UCDC_LINE_DTR;
1252
1253 req.bmRequestType = UT_WRITE_CLASS_INTERFACE;
1254 req.bRequest = UCDC_SET_CONTROL_LINE_STATE;
1255 USETW(req.wValue, sc->sc_line);
1256 req.wIndex[0] = UIPAQ_IFACE_INDEX;
1257 req.wIndex[1] = 0;
1258 USETW(req.wLength, 0);
1259
1260 ucom_cfg_do_request(sc->sc_udev, &sc->sc_ucom,
1261 &req, NULL, 0, 1000);
1262 }
1263
1264 static void
uipaq_cfg_set_rts(struct ucom_softc * ucom,uint8_t onoff)1265 uipaq_cfg_set_rts(struct ucom_softc *ucom, uint8_t onoff)
1266 {
1267 struct uipaq_softc *sc = ucom->sc_parent;
1268 struct usb_device_request req;
1269
1270 DPRINTF("onoff=%d\n", onoff);
1271
1272 if (onoff)
1273 sc->sc_line |= UCDC_LINE_RTS;
1274 else
1275 sc->sc_line &= ~UCDC_LINE_RTS;
1276
1277 req.bmRequestType = UT_WRITE_CLASS_INTERFACE;
1278 req.bRequest = UCDC_SET_CONTROL_LINE_STATE;
1279 USETW(req.wValue, sc->sc_line);
1280 req.wIndex[0] = UIPAQ_IFACE_INDEX;
1281 req.wIndex[1] = 0;
1282 USETW(req.wLength, 0);
1283
1284 ucom_cfg_do_request(sc->sc_udev, &sc->sc_ucom,
1285 &req, NULL, 0, 1000);
1286 }
1287
1288 static void
uipaq_cfg_set_break(struct ucom_softc * ucom,uint8_t onoff)1289 uipaq_cfg_set_break(struct ucom_softc *ucom, uint8_t onoff)
1290 {
1291 struct uipaq_softc *sc = ucom->sc_parent;
1292 struct usb_device_request req;
1293 uint16_t temp;
1294
1295 temp = onoff ? UCDC_BREAK_ON : UCDC_BREAK_OFF;
1296
1297 req.bmRequestType = UT_WRITE_CLASS_INTERFACE;
1298 req.bRequest = UCDC_SEND_BREAK;
1299 USETW(req.wValue, temp);
1300 req.wIndex[0] = UIPAQ_IFACE_INDEX;
1301 req.wIndex[1] = 0;
1302 USETW(req.wLength, 0);
1303
1304 ucom_cfg_do_request(sc->sc_udev, &sc->sc_ucom,
1305 &req, NULL, 0, 1000);
1306 }
1307
1308 static void
uipaq_write_callback(struct usb_xfer * xfer,usb_error_t error)1309 uipaq_write_callback(struct usb_xfer *xfer, usb_error_t error)
1310 {
1311 struct uipaq_softc *sc = usbd_xfer_softc(xfer);
1312 struct usb_page_cache *pc;
1313 uint32_t actlen;
1314
1315 switch (USB_GET_STATE(xfer)) {
1316 case USB_ST_SETUP:
1317 case USB_ST_TRANSFERRED:
1318 tr_setup:
1319 pc = usbd_xfer_get_frame(xfer, 0);
1320 if (ucom_get_data(&sc->sc_ucom, pc, 0,
1321 UIPAQ_BUF_SIZE, &actlen)) {
1322 usbd_xfer_set_frame_len(xfer, 0, actlen);
1323 usbd_transfer_submit(xfer);
1324 }
1325 return;
1326
1327 default: /* Error */
1328 if (error != USB_ERR_CANCELLED) {
1329 /* try to clear stall first */
1330 usbd_xfer_set_stall(xfer);
1331 goto tr_setup;
1332 }
1333 return;
1334 }
1335 }
1336
1337 static void
uipaq_read_callback(struct usb_xfer * xfer,usb_error_t error)1338 uipaq_read_callback(struct usb_xfer *xfer, usb_error_t error)
1339 {
1340 struct uipaq_softc *sc = usbd_xfer_softc(xfer);
1341 struct usb_page_cache *pc;
1342 int actlen;
1343
1344 usbd_xfer_status(xfer, &actlen, NULL, NULL, NULL);
1345
1346 switch (USB_GET_STATE(xfer)) {
1347 case USB_ST_TRANSFERRED:
1348 pc = usbd_xfer_get_frame(xfer, 0);
1349 ucom_put_data(&sc->sc_ucom, pc, 0, actlen);
1350
1351 case USB_ST_SETUP:
1352 tr_setup:
1353 usbd_xfer_set_frame_len(xfer, 0, usbd_xfer_max_len(xfer));
1354 usbd_transfer_submit(xfer);
1355 return;
1356
1357 default: /* Error */
1358 if (error != USB_ERR_CANCELLED) {
1359 /* try to clear stall first */
1360 usbd_xfer_set_stall(xfer);
1361 goto tr_setup;
1362 }
1363 return;
1364 }
1365 }
1366
1367 static void
uipaq_poll(struct ucom_softc * ucom)1368 uipaq_poll(struct ucom_softc *ucom)
1369 {
1370 struct uipaq_softc *sc = ucom->sc_parent;
1371 usbd_transfer_poll(sc->sc_xfer, UIPAQ_N_TRANSFER);
1372 }
1373