1 /* $NetBSD: usb_quirks.c,v 1.50 2004/06/23 02:30:52 mycroft Exp $ */
2 /* $FreeBSD: src/sys/dev/usb/usb_quirks.c,v 1.41.2.4 2006/02/15 22:51:08 iedowse Exp $ */
3 /* $DragonFly: src/sys/bus/usb/usb_quirks.c,v 1.8 2007/11/05 13:32:27 hasso Exp $ */
6 * Copyright (c) 1998 The NetBSD Foundation, Inc.
9 * This code is derived from software contributed to The NetBSD Foundation
10 * by Lennart Augustsson (lennart@augustsson.net) at
11 * Carlstedt Research & Technology.
13 * Redistribution and use in source and binary forms, with or without
14 * modification, are permitted provided that the following conditions
16 * 1. Redistributions of source code must retain the above copyright
17 * notice, this list of conditions and the following disclaimer.
18 * 2. Redistributions in binary form must reproduce the above copyright
19 * notice, this list of conditions and the following disclaimer in the
20 * documentation and/or other materials provided with the distribution.
21 * 3. All advertising materials mentioning features or use of this software
22 * must display the following acknowledgement:
23 * This product includes software developed by the NetBSD
24 * Foundation, Inc. and its contributors.
25 * 4. Neither the name of The NetBSD Foundation nor the names of its
26 * contributors may be used to endorse or promote products derived
27 * from this software without specific prior written permission.
29 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
30 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
31 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
32 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
33 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
34 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
35 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
36 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
37 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
38 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
39 * POSSIBILITY OF SUCH DAMAGE.
42 #include <sys/param.h>
43 #include <sys/systm.h>
45 #include <bus/usb/usb.h>
48 #include <bus/usb/usb_quirks.h>
56 static const struct usbd_quirk_entry {
60 struct usbd_quirks quirks;
63 { .idVendor = 0x0458, .idProduct = 0x0001, .bcdDevice = 0x100,
64 .quirks = { UQ_NO_SET_PROTO}},
65 /* Inside Out Networks EdgePort/4 RS232 */
66 { .idVendor = 0x1608, .idProduct = 0x0001, .bcdDevice = 0x094,
67 .quirks = { UQ_SWAP_UNICODE}},
68 /* Dallas Semiconductor J-6502 speakers */
69 { .idVendor = 0x04fa, .idProduct = 0x4201, .bcdDevice = 0x0a2,
70 .quirks = { UQ_BAD_ADC | UQ_AU_NO_XU }},
71 /* Altec Lansing ADA70 speakers */
72 { .idVendor = 0x04d2, .idProduct = 0x0070, .bcdDevice = 0x103,
73 .quirks = { UQ_BAD_ADC }},
74 /* Altec Lansing ASC495 speakers */
75 { .idVendor = 0x04d2, .idProduct = 0xff05, .bcdDevice = 0x000,
76 .quirks = { UQ_BAD_AUDIO }},
77 /* Qtronix Scorpion-980N keyboard */
78 { .idVendor = 0x05c7, .idProduct = 0x2011, .bcdDevice = 0x110,
79 .quirks = { UQ_SPUR_BUT_UP }},
80 /* Alcor Micro, Inc. kbd hub */
81 { .idVendor = 0x0566, .idProduct = 0x2802, .bcdDevice = 0x001,
82 .quirks = { UQ_SPUR_BUT_UP }},
84 { .idVendor = 0x0711, .idProduct = 0x0100, .bcdDevice = 0x102,
85 .quirks = { UQ_BUS_POWERED }},
86 /* MCT Corp. USB-232 interface */
87 { .idVendor = 0x0711, .idProduct = 0x0210, .bcdDevice = 0x102,
88 .quirks = { UQ_BUS_POWERED }},
89 /* Metricom Ricochet GS */
90 { .idVendor = 0x0870, .idProduct = 0x0001, .bcdDevice = 0x100,
91 .quirks = { UQ_ASSUME_CM_OVER_DATA }},
92 /* Sanyo SCP-4900 USB Phone */
93 { .idVendor = 0x0474, .idProduct = 0x0701, .bcdDevice = 0x000,
94 .quirks = { UQ_ASSUME_CM_OVER_DATA }},
95 /* Texas Instruments UT-USB41 hub */
96 { .idVendor = 0x0451, .idProduct = 0x1446, .bcdDevice = 0x110,
97 .quirks = { UQ_POWER_CLAIM }},
98 /* Telex Communications Enhanced USB Microphone */
99 { .idVendor = 0x0562, .idProduct = 0x0001, .bcdDevice = 0x009,
100 .quirks = { UQ_AU_NO_FRAC }},
101 /* Silicon Portals Inc. YAP Phone */
102 { .idVendor = 0x1527, .idProduct = 0x0201, .bcdDevice = 0x100,
103 .quirks = { UQ_AU_INP_ASYNC }},
106 * XXX All these HP devices should have a revision number,
107 * but I don't know what they are.
109 /* HP DeskJet 895C */
110 { .idVendor = 0x03f0, .idProduct = 0x0004, .bcdDevice = ANY,
111 .quirks = { UQ_BROKEN_BIDIR }},
112 /* HP DeskJet 880C */
113 { .idVendor = 0x03f0, .idProduct = 0x0104, .bcdDevice = ANY,
114 .quirks = { UQ_BROKEN_BIDIR }},
115 /* HP DeskJet 815C */
116 { .idVendor = 0x03f0, .idProduct = 0x0204, .bcdDevice = ANY,
117 .quirks = { UQ_BROKEN_BIDIR }},
118 /* HP DeskJet 810C/812C */
119 { .idVendor = 0x03f0, .idProduct = 0x0304, .bcdDevice = ANY,
120 .quirks = { UQ_BROKEN_BIDIR }},
121 /* HP DeskJet 830C */
122 { .idVendor = 0x03f0, .idProduct = 0x0404, .bcdDevice = ANY,
123 .quirks = { UQ_BROKEN_BIDIR }},
124 /* HP DeskJet 1220C */
125 { .idVendor = 0x03f0, .idProduct = 0x0212, .bcdDevice = ANY,
126 .quirks = { UQ_BROKEN_BIDIR }},
129 * YAMAHA router's ucdDevice is the version of firmware and
132 /* YAMAHA NetVolante RTA54i Broadband&ISDN Router */
133 { .idVendor = 0x0499, .idProduct = 0x4000, .bcdDevice = ANY,
134 .quirks = { UQ_ASSUME_CM_OVER_DATA }},
135 /* YAMAHA NetVolante RTA55i Broadband VoIP Router */
136 { .idVendor = 0x0499, .idProduct = 0x4004, .bcdDevice = ANY,
137 .quirks = { UQ_ASSUME_CM_OVER_DATA }},
138 /* YAMAHA NetVolante RTW65b Broadband Wireless Router */
139 { .idVendor = 0x0499, .idProduct = 0x4001, .bcdDevice = ANY,
140 .quirks = { UQ_ASSUME_CM_OVER_DATA }},
141 /* YAMAHA NetVolante RTW65i Broadband&ISDN Wireless Router */
142 { .idVendor = 0x0499, .idProduct = 0x4002, .bcdDevice = ANY,
143 .quirks = { UQ_ASSUME_CM_OVER_DATA }},
145 /* Qualcomm CDMA Technologies MSM modem */
146 { .idVendor = 0x05c6, .idProduct = 0x3196, .bcdDevice = ANY,
147 .quirks = { UQ_ASSUME_CM_OVER_DATA }},
148 /* Qualcomm CDMA Technologies MSM phone */
149 { .idVendor = 0x1004, .idProduct = 0x6000, .bcdDevice = ANY,
150 .quirks = { UQ_ASSUME_CM_OVER_DATA }},
151 /* SUNTAC U-Cable type A3 */
152 { .idVendor = 0x05db, .idProduct = 0x000b, .bcdDevice = 0x100,
153 .quirks = { UQ_ASSUME_CM_OVER_DATA }},
155 /* Devices which should be ignored by uhid */
156 /* APC Back-UPS Pro 500 */
157 { .idVendor = 0x051d, .idProduct = 0x0002, .bcdDevice = ANY,
158 .quirks = { UQ_HID_IGNORE }},
159 /* Delorme Publishing Earthmate GPS */
160 { .idVendor = 0x1163, .idProduct = 0x0100, .bcdDevice = ANY,
161 .quirks = { UQ_HID_IGNORE }},
162 /* MGE UPS Systems ProtectionCenter */
163 { .idVendor = 0x0463, .idProduct = 0x0001, .bcdDevice = ANY,
164 .quirks = { UQ_HID_IGNORE }},
165 /* MGE UPS Systems ProtectionCenter */
166 { .idVendor = 0x0463, .idProduct = 0xffff, .bcdDevice = ANY,
167 .quirks = { UQ_HID_IGNORE }},
171 const struct usbd_quirks usbd_no_quirk = { 0 };
173 const struct usbd_quirks *
174 usbd_find_quirk(usb_device_descriptor_t *d)
176 const struct usbd_quirk_entry *t;
177 u_int16_t vendor = UGETW(d->idVendor);
178 u_int16_t product = UGETW(d->idProduct);
179 u_int16_t revision = UGETW(d->bcdDevice);
181 for (t = usb_quirks; t->idVendor != 0; t++) {
182 if (t->idVendor == vendor &&
183 t->idProduct == product &&
184 (t->bcdDevice == ANY || t->bcdDevice == revision))
188 if (usbdebug && t->quirks.uq_flags)
189 kprintf("usbd_find_quirk 0x%04x/0x%04x/%x: %d\n",
190 UGETW(d->idVendor), UGETW(d->idProduct),
191 UGETW(d->bcdDevice), t->quirks.uq_flags);