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