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