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.9 2007/11/05 19:09:42 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>
46 #include <bus/usb/usb_quirks.h>
54 static const struct usbd_quirk_entry {
58 struct usbd_quirks quirks;
61 { .idVendor = 0x0458, .idProduct = 0x0001, .bcdDevice = 0x100,
62 .quirks = { UQ_NO_SET_PROTO}},
63 /* Inside Out Networks EdgePort/4 RS232 */
64 { .idVendor = 0x1608, .idProduct = 0x0001, .bcdDevice = 0x094,
65 .quirks = { UQ_SWAP_UNICODE}},
66 /* Dallas Semiconductor J-6502 speakers */
67 { .idVendor = 0x04fa, .idProduct = 0x4201, .bcdDevice = 0x0a2,
68 .quirks = { UQ_BAD_ADC | UQ_AU_NO_XU }},
69 /* Altec Lansing ADA70 speakers */
70 { .idVendor = 0x04d2, .idProduct = 0x0070, .bcdDevice = 0x103,
71 .quirks = { UQ_BAD_ADC }},
72 /* Altec Lansing ASC495 speakers */
73 { .idVendor = 0x04d2, .idProduct = 0xff05, .bcdDevice = 0x000,
74 .quirks = { UQ_BAD_AUDIO }},
75 /* Qtronix Scorpion-980N keyboard */
76 { .idVendor = 0x05c7, .idProduct = 0x2011, .bcdDevice = 0x110,
77 .quirks = { UQ_SPUR_BUT_UP }},
78 /* Alcor Micro, Inc. kbd hub */
79 { .idVendor = 0x0566, .idProduct = 0x2802, .bcdDevice = 0x001,
80 .quirks = { UQ_SPUR_BUT_UP }},
82 { .idVendor = 0x0711, .idProduct = 0x0100, .bcdDevice = 0x102,
83 .quirks = { UQ_BUS_POWERED }},
84 /* MCT Corp. USB-232 interface */
85 { .idVendor = 0x0711, .idProduct = 0x0210, .bcdDevice = 0x102,
86 .quirks = { UQ_BUS_POWERED }},
87 /* Metricom Ricochet GS */
88 { .idVendor = 0x0870, .idProduct = 0x0001, .bcdDevice = 0x100,
89 .quirks = { UQ_ASSUME_CM_OVER_DATA }},
90 /* Sanyo SCP-4900 USB Phone */
91 { .idVendor = 0x0474, .idProduct = 0x0701, .bcdDevice = 0x000,
92 .quirks = { UQ_ASSUME_CM_OVER_DATA }},
93 /* Texas Instruments UT-USB41 hub */
94 { .idVendor = 0x0451, .idProduct = 0x1446, .bcdDevice = 0x110,
95 .quirks = { UQ_POWER_CLAIM }},
96 /* Telex Communications Enhanced USB Microphone */
97 { .idVendor = 0x0562, .idProduct = 0x0001, .bcdDevice = 0x009,
98 .quirks = { UQ_AU_NO_FRAC }},
99 /* Silicon Portals Inc. YAP Phone */
100 { .idVendor = 0x1527, .idProduct = 0x0201, .bcdDevice = 0x100,
101 .quirks = { UQ_AU_INP_ASYNC }},
104 * XXX All these HP devices should have a revision number,
105 * but I don't know what they are.
107 /* HP DeskJet 895C */
108 { .idVendor = 0x03f0, .idProduct = 0x0004, .bcdDevice = ANY,
109 .quirks = { UQ_BROKEN_BIDIR }},
110 /* HP DeskJet 880C */
111 { .idVendor = 0x03f0, .idProduct = 0x0104, .bcdDevice = ANY,
112 .quirks = { UQ_BROKEN_BIDIR }},
113 /* HP DeskJet 815C */
114 { .idVendor = 0x03f0, .idProduct = 0x0204, .bcdDevice = ANY,
115 .quirks = { UQ_BROKEN_BIDIR }},
116 /* HP DeskJet 810C/812C */
117 { .idVendor = 0x03f0, .idProduct = 0x0304, .bcdDevice = ANY,
118 .quirks = { UQ_BROKEN_BIDIR }},
119 /* HP DeskJet 830C */
120 { .idVendor = 0x03f0, .idProduct = 0x0404, .bcdDevice = ANY,
121 .quirks = { UQ_BROKEN_BIDIR }},
122 /* HP DeskJet 1220C */
123 { .idVendor = 0x03f0, .idProduct = 0x0212, .bcdDevice = ANY,
124 .quirks = { UQ_BROKEN_BIDIR }},
127 * YAMAHA router's ucdDevice is the version of firmware and
130 /* YAMAHA NetVolante RTA54i Broadband&ISDN Router */
131 { .idVendor = 0x0499, .idProduct = 0x4000, .bcdDevice = ANY,
132 .quirks = { UQ_ASSUME_CM_OVER_DATA }},
133 /* YAMAHA NetVolante RTA55i Broadband VoIP Router */
134 { .idVendor = 0x0499, .idProduct = 0x4004, .bcdDevice = ANY,
135 .quirks = { UQ_ASSUME_CM_OVER_DATA }},
136 /* YAMAHA NetVolante RTW65b Broadband Wireless Router */
137 { .idVendor = 0x0499, .idProduct = 0x4001, .bcdDevice = ANY,
138 .quirks = { UQ_ASSUME_CM_OVER_DATA }},
139 /* YAMAHA NetVolante RTW65i Broadband&ISDN Wireless Router */
140 { .idVendor = 0x0499, .idProduct = 0x4002, .bcdDevice = ANY,
141 .quirks = { UQ_ASSUME_CM_OVER_DATA }},
143 /* Qualcomm CDMA Technologies MSM modem */
144 { .idVendor = 0x05c6, .idProduct = 0x3196, .bcdDevice = ANY,
145 .quirks = { UQ_ASSUME_CM_OVER_DATA }},
146 /* Qualcomm CDMA Technologies MSM phone */
147 { .idVendor = 0x1004, .idProduct = 0x6000, .bcdDevice = ANY,
148 .quirks = { UQ_ASSUME_CM_OVER_DATA }},
149 /* SUNTAC U-Cable type A3 */
150 { .idVendor = 0x05db, .idProduct = 0x000b, .bcdDevice = 0x100,
151 .quirks = { UQ_ASSUME_CM_OVER_DATA }},
153 /* Devices which should be ignored by uhid */
154 /* APC Back-UPS Pro 500 */
155 { .idVendor = 0x051d, .idProduct = 0x0002, .bcdDevice = ANY,
156 .quirks = { UQ_HID_IGNORE }},
157 /* Delorme Publishing Earthmate GPS */
158 { .idVendor = 0x1163, .idProduct = 0x0100, .bcdDevice = ANY,
159 .quirks = { UQ_HID_IGNORE }},
160 /* MGE UPS Systems ProtectionCenter */
161 { .idVendor = 0x0463, .idProduct = 0x0001, .bcdDevice = ANY,
162 .quirks = { UQ_HID_IGNORE }},
163 /* MGE UPS Systems ProtectionCenter */
164 { .idVendor = 0x0463, .idProduct = 0xffff, .bcdDevice = ANY,
165 .quirks = { UQ_HID_IGNORE }},
167 /* Apple usb keyboard */
168 { .idVendor = 0x05ac, .idProduct = 0x0221, .bcdDevice = ANY,
169 .quirks = { UQ_NO_SET_PROTO}},
174 const struct usbd_quirks usbd_no_quirk = { 0 };
176 const struct usbd_quirks *
177 usbd_find_quirk(usb_device_descriptor_t *d)
179 const struct usbd_quirk_entry *t;
180 u_int16_t vendor = UGETW(d->idVendor);
181 u_int16_t product = UGETW(d->idProduct);
182 u_int16_t revision = UGETW(d->bcdDevice);
184 for (t = usb_quirks; t->idVendor != 0; t++) {
185 if (t->idVendor == vendor &&
186 t->idProduct == product &&
187 (t->bcdDevice == ANY || t->bcdDevice == revision))
191 if (usbdebug && t->quirks.uq_flags)
192 kprintf("usbd_find_quirk 0x%04x/0x%04x/%x: %d\n",
193 UGETW(d->idVendor), UGETW(d->idProduct),
194 UGETW(d->bcdDevice), t->quirks.uq_flags);