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