1 /*- 2 * SPDX-License-Identifier: BSD-2-Clause 3 * 4 * Copyright (c) 1998 The NetBSD Foundation, Inc. All rights reserved. 5 * Copyright (c) 1998 Lennart Augustsson. All rights reserved. 6 * Copyright (c) 2008 Hans Petter Selasky. All rights reserved. 7 * 8 * Redistribution and use in source and binary forms, with or without 9 * modification, are permitted provided that the following conditions 10 * are met: 11 * 1. Redistributions of source code must retain the above copyright 12 * notice, this list of conditions and the following disclaimer. 13 * 2. Redistributions in binary form must reproduce the above copyright 14 * notice, this list of conditions and the following disclaimer in the 15 * documentation and/or other materials provided with the distribution. 16 * 17 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 18 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 19 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 20 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 21 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 22 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 23 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 24 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 25 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 27 * SUCH DAMAGE. 28 */ 29 30 #include <sys/stdint.h> 31 #include <sys/stddef.h> 32 #include <sys/param.h> 33 #include <sys/queue.h> 34 #include <sys/types.h> 35 #include <sys/systm.h> 36 #include <sys/kernel.h> 37 #include <sys/bus.h> 38 #include <sys/module.h> 39 #include <sys/lock.h> 40 #include <sys/mutex.h> 41 #include <sys/condvar.h> 42 #include <sys/sysctl.h> 43 #include <sys/sx.h> 44 #include <sys/unistd.h> 45 #include <sys/callout.h> 46 #include <sys/malloc.h> 47 #include <sys/priv.h> 48 49 #include <dev/usb/usb.h> 50 #include <dev/usb/usb_ioctl.h> 51 #include <dev/usb/usbdi.h> 52 #include "usbdevs.h" 53 54 #define USB_DEBUG_VAR usb_debug 55 #include <dev/usb/usb_debug.h> 56 #include <dev/usb/usb_dynamic.h> 57 58 #include <dev/usb/quirk/usb_quirk.h> 59 60 MODULE_DEPEND(usb_quirk, usb, 1, 1, 1); 61 MODULE_VERSION(usb_quirk, 1); 62 63 #define USB_DEV_QUIRKS_MAX 384 64 #define USB_SUB_QUIRKS_MAX 8 65 #define USB_QUIRK_ENVROOT "hw.usb.quirk." 66 67 struct usb_quirk_entry { 68 uint16_t vid; 69 uint16_t pid; 70 uint16_t lo_rev; 71 uint16_t hi_rev; 72 uint16_t quirks[USB_SUB_QUIRKS_MAX]; 73 }; 74 75 static struct mtx usb_quirk_mtx; 76 77 #define USB_QUIRK_VP(v,p,l,h,...) \ 78 { .vid = (v), .pid = (p), .lo_rev = (l), .hi_rev = (h), \ 79 .quirks = { __VA_ARGS__ } } 80 #define USB_QUIRK(v,p,l,h,...) \ 81 USB_QUIRK_VP(USB_VENDOR_##v, USB_PRODUCT_##v##_##p, l, h, __VA_ARGS__) 82 83 static struct usb_quirk_entry usb_quirks[USB_DEV_QUIRKS_MAX] = { 84 USB_QUIRK(ASUS, LCM, 0x0000, 0xffff, UQ_HID_IGNORE), 85 USB_QUIRK(INSIDEOUT, EDGEPORT4, 0x094, 0x094, UQ_SWAP_UNICODE), 86 USB_QUIRK(DALLAS, J6502, 0x0a2, 0x0a2, UQ_BAD_ADC), 87 USB_QUIRK(DALLAS, J6502, 0x0a2, 0x0a2, UQ_AU_NO_XU), 88 USB_QUIRK(ALTEC, ADA70, 0x103, 0x103, UQ_BAD_ADC), 89 USB_QUIRK(ALTEC, ASC495, 0x000, 0x000, UQ_BAD_AUDIO), 90 USB_QUIRK(QTRONIX, 980N, 0x110, 0x110, UQ_SPUR_BUT_UP), 91 USB_QUIRK(ALCOR2, KBD_HUB, 0x001, 0x001, UQ_SPUR_BUT_UP), 92 USB_QUIRK(MCT, HUB0100, 0x102, 0x102, UQ_BUS_POWERED), 93 USB_QUIRK(MCT, USB232, 0x102, 0x102, UQ_BUS_POWERED), 94 USB_QUIRK(TI, UTUSB41, 0x110, 0x110, UQ_POWER_CLAIM), 95 USB_QUIRK(TELEX, MIC1, 0x009, 0x009, UQ_AU_NO_FRAC), 96 USB_QUIRK(SILICONPORTALS, YAPPHONE, 0x100, 0x100, UQ_AU_INP_ASYNC), 97 USB_QUIRK(LOGITECH, UN53B, 0x0000, 0xffff, UQ_NO_STRINGS), 98 USB_QUIRK(LOGITECH, G510S, 0x0000, 0xFFFF, UQ_KBD_BOOTPROTO), 99 USB_QUIRK(REALTEK, RTL8196EU, 0x0000, 0xffff, UQ_CFG_INDEX_1), 100 USB_QUIRK(ELSA, MODEM1, 0x0000, 0xffff, UQ_CFG_INDEX_1), 101 USB_QUIRK(PLANEX2, MZKUE150N, 0x0000, 0xffff, UQ_CFG_INDEX_1), 102 USB_QUIRK(CISCOLINKSYS, USB3GIGV1, 0x0000, 0xffff, UQ_CFG_INDEX_1), 103 USB_QUIRK(REALTEK, RTL8156, 0x0000, 0xffff, UQ_CFG_INDEX_2), 104 /* Quirks for printer devices */ 105 USB_QUIRK(HP, 895C, 0x0000, 0xffff, UQ_BROKEN_BIDIR), 106 USB_QUIRK(HP, 880C, 0x0000, 0xffff, UQ_BROKEN_BIDIR), 107 USB_QUIRK(HP, 815C, 0x0000, 0xffff, UQ_BROKEN_BIDIR), 108 USB_QUIRK(HP, 810C, 0x0000, 0xffff, UQ_BROKEN_BIDIR), 109 USB_QUIRK(HP, 830C, 0x0000, 0xffff, UQ_BROKEN_BIDIR), 110 USB_QUIRK(HP, 1220C, 0x0000, 0xffff, UQ_BROKEN_BIDIR), 111 USB_QUIRK(XEROX, WCM15, 0x0000, 0xffff, UQ_BROKEN_BIDIR), 112 /* Devices which should be ignored by uhid */ 113 USB_QUIRK(APC, UPS, 0x0000, 0xffff, UQ_HID_IGNORE), 114 USB_QUIRK(APC, UPS1000, 0x0000, 0xffff, UQ_HID_IGNORE), 115 USB_QUIRK(BELKIN, F6H375USB, 0x0000, 0xffff, UQ_HID_IGNORE), 116 USB_QUIRK(BELKIN, F6C550AVR, 0x0000, 0xffff, UQ_HID_IGNORE), 117 USB_QUIRK(BELKIN, F6C1250TWRK, 0x0000, 0xffff, UQ_HID_IGNORE), 118 USB_QUIRK(BELKIN, F6C1500TWRK, 0x0000, 0xffff, UQ_HID_IGNORE), 119 USB_QUIRK(BELKIN, F6C900UNV, 0x0000, 0xffff, UQ_HID_IGNORE), 120 USB_QUIRK(BELKIN, F6C100UNV, 0x0000, 0xffff, UQ_HID_IGNORE), 121 USB_QUIRK(BELKIN, F6C120UNV, 0x0000, 0xffff, UQ_HID_IGNORE), 122 USB_QUIRK(BELKIN, F6C800UNV, 0x0000, 0xffff, UQ_HID_IGNORE), 123 USB_QUIRK(BELKIN, F6C1100UNV, 0x0000, 0xffff, UQ_HID_IGNORE), 124 USB_QUIRK(CYBERPOWER, BC900D, 0x0000, 0xffff, UQ_HID_IGNORE), 125 USB_QUIRK(CYBERPOWER, 1500CAVRLCD, 0x0000, 0xffff, UQ_HID_IGNORE), 126 USB_QUIRK(CYBERPOWER, OR2200LCDRM2U, 0x0000, 0xffff, UQ_HID_IGNORE), 127 USB_QUIRK(DELL2, VARIOUS_UPS, 0x0000, 0xffff, UQ_HID_IGNORE), 128 USB_QUIRK(CYPRESS, SILVERSHIELD, 0x0000, 0xffff, UQ_HID_IGNORE), 129 USB_QUIRK(DELORME, EARTHMATE, 0x0000, 0xffff, UQ_HID_IGNORE), 130 USB_QUIRK(DREAMLINK, DL100B, 0x0000, 0xffff, UQ_HID_IGNORE), 131 USB_QUIRK(MICROCHIP, PICOLCD20X2, 0x0000, 0xffff, UQ_HID_IGNORE), 132 USB_QUIRK(MICROCHIP, PICOLCD4X20, 0x0000, 0xffff, UQ_HID_IGNORE), 133 USB_QUIRK(LIEBERT, POWERSURE_PXT, 0x0000, 0xffff, UQ_HID_IGNORE), 134 USB_QUIRK(LIEBERT2, PSI1000, 0x0000, 0xffff, UQ_HID_IGNORE), 135 USB_QUIRK(LIEBERT2, POWERSURE_PSA, 0x0000, 0xffff, UQ_HID_IGNORE), 136 USB_QUIRK(MGE, UPS1, 0x0000, 0xffff, UQ_HID_IGNORE), 137 USB_QUIRK(MGE, UPS2, 0x0000, 0xffff, UQ_HID_IGNORE), 138 USB_QUIRK(POWERCOM, IMPERIAL_SERIES, 0x0000, 0xffff, UQ_HID_IGNORE), 139 USB_QUIRK(POWERCOM, SMART_KING_PRO, 0x0000, 0xffff, UQ_HID_IGNORE), 140 USB_QUIRK(POWERCOM, WOW, 0x0000, 0xffff, UQ_HID_IGNORE), 141 USB_QUIRK(POWERCOM, VANGUARD, 0x0000, 0xffff, UQ_HID_IGNORE), 142 USB_QUIRK(POWERCOM, BLACK_KNIGHT_PRO, 0x0000, 0xffff, UQ_HID_IGNORE), 143 USB_QUIRK(TRIPPLITE2, AVR550U, 0x0000, 0xffff, UQ_HID_IGNORE), 144 USB_QUIRK(TRIPPLITE2, AVR750U, 0x0000, 0xffff, UQ_HID_IGNORE), 145 USB_QUIRK(TRIPPLITE2, ECO550UPS, 0x0000, 0xffff, UQ_HID_IGNORE), 146 USB_QUIRK(TRIPPLITE2, T750_INTL, 0x0000, 0xffff, UQ_HID_IGNORE), 147 USB_QUIRK(TRIPPLITE2, RT_2200_INTL, 0x0000, 0xffff, UQ_HID_IGNORE), 148 USB_QUIRK(TRIPPLITE2, OMNI1000LCD, 0x0000, 0xffff, UQ_HID_IGNORE), 149 USB_QUIRK(TRIPPLITE2, OMNI900LCD, 0x0000, 0xffff, UQ_HID_IGNORE), 150 USB_QUIRK(TRIPPLITE2, SMART_2200RMXL2U, 0x0000, 0xffff, UQ_HID_IGNORE), 151 USB_QUIRK(TRIPPLITE2, UPS_3014, 0x0000, 0xffff, UQ_HID_IGNORE), 152 USB_QUIRK(TRIPPLITE2, SU1500RTXL2UA, 0x0000, 0xffff, UQ_HID_IGNORE), 153 USB_QUIRK(TRIPPLITE2, SU6000RT4U, 0x0000, 0xffff, UQ_HID_IGNORE), 154 USB_QUIRK(TRIPPLITE2, SU1500RTXL2UA_2, 0x0000, 0xffff, UQ_HID_IGNORE), 155 USB_QUIRK(APPLE, IPHONE, 0x0000, 0xffff, UQ_HID_IGNORE), 156 USB_QUIRK(APPLE, IPHONE_3G, 0x0000, 0xffff, UQ_HID_IGNORE), 157 USB_QUIRK(MEGATEC, UPS, 0x0000, 0xffff, UQ_HID_IGNORE), 158 /* Devices which should be ignored by both ukbd and uhid */ 159 USB_QUIRK(CYPRESS, WISPY1A, 0x0000, 0xffff, UQ_KBD_IGNORE, UQ_HID_IGNORE), 160 USB_QUIRK(METAGEEK, WISPY1B, 0x0000, 0xffff, UQ_KBD_IGNORE, UQ_HID_IGNORE), 161 USB_QUIRK(METAGEEK, WISPY24X, 0x0000, 0xffff, UQ_KBD_IGNORE, UQ_HID_IGNORE), 162 USB_QUIRK(METAGEEK2, WISPYDBX, 0x0000, 0xffff, UQ_KBD_IGNORE, UQ_HID_IGNORE), 163 USB_QUIRK(TENX, UAUDIO0, 0x0101, 0x0101, UQ_AUDIO_SWAP_LR), 164 /* MS keyboards do weird things */ 165 USB_QUIRK(MICROSOFT, NATURAL4000, 0x0000, 0xFFFF, UQ_KBD_BOOTPROTO), 166 USB_QUIRK(MICROSOFT, WLINTELLIMOUSE, 0x0000, 0xffff, UQ_MS_LEADING_BYTE), 167 /* Quirk for Corsair Vengeance K60 keyboard */ 168 USB_QUIRK(CORSAIR, K60, 0x0000, 0xffff, UQ_KBD_BOOTPROTO), 169 /* Quirk for Corsair Gaming K68 keyboard */ 170 USB_QUIRK(CORSAIR, K68, 0x0000, 0xffff, UQ_KBD_BOOTPROTO), 171 /* Quirk for Corsair Vengeance K70 keyboard */ 172 USB_QUIRK(CORSAIR, K70, 0x0000, 0xffff, UQ_KBD_BOOTPROTO), 173 /* Quirk for Corsair K70 RGB keyboard */ 174 USB_QUIRK(CORSAIR, K70_RGB, 0x0000, 0xffff, UQ_KBD_BOOTPROTO), 175 /* Quirk for Corsair STRAFE Gaming keyboard */ 176 USB_QUIRK(CORSAIR, STRAFE, 0x0000, 0xffff, UQ_KBD_BOOTPROTO), 177 USB_QUIRK(CORSAIR, STRAFE2, 0x0000, 0xffff, UQ_KBD_BOOTPROTO), 178 /* Quirk for Kensington Slimblade Trackball */ 179 USB_QUIRK(KENSINGTON, SLIMBLADE, 0x0000, 0xffff, UQ_MS_VENDOR_BTN), 180 /* umodem(4) device quirks */ 181 USB_QUIRK(METRICOM, RICOCHET_GS, 0x100, 0x100, UQ_ASSUME_CM_OVER_DATA), 182 USB_QUIRK(SANYO, SCP4900, 0x000, 0x000, UQ_ASSUME_CM_OVER_DATA), 183 USB_QUIRK(MOTOROLA2, T720C, 0x001, 0x001, UQ_ASSUME_CM_OVER_DATA), 184 USB_QUIRK(EICON, DIVA852, 0x100, 0x100, UQ_ASSUME_CM_OVER_DATA), 185 USB_QUIRK(SIEMENS2, ES75, 0x000, 0x000, UQ_ASSUME_CM_OVER_DATA), 186 USB_QUIRK(QUALCOMM, CDMA_MSM, 0x0000, 0xffff, UQ_ASSUME_CM_OVER_DATA), 187 USB_QUIRK(QUALCOMM2, CDMA_MSM, 0x0000, 0xffff, UQ_ASSUME_CM_OVER_DATA), 188 USB_QUIRK(CURITEL, UM150, 0x0000, 0xffff, UQ_ASSUME_CM_OVER_DATA), 189 USB_QUIRK(CURITEL, UM175, 0x0000, 0xffff, UQ_ASSUME_CM_OVER_DATA), 190 USB_QUIRK(VERTEX, VW110L, 0x0000, 0xffff, UQ_ASSUME_CM_OVER_DATA), 191 USB_QUIRK(BALTECH, SMARTCARDREADER, 0x0000, 0xffff, UQ_IGNORE_CDC_CM), 192 193 /* USB Mass Storage Class Quirks */ 194 USB_QUIRK_VP(USB_VENDOR_ASAHIOPTICAL, 0, UQ_MSC_NO_RS_CLEAR_UA, 195 UQ_MATCH_VENDOR_ONLY), 196 USB_QUIRK(ADDON, ATTACHE, 0x0000, 0xffff, UQ_MSC_FORCE_WIRE_BBB, 197 UQ_MSC_FORCE_PROTO_SCSI, UQ_MSC_IGNORE_RESIDUE), 198 USB_QUIRK(ADDON, A256MB, 0x0000, 0xffff, UQ_MSC_FORCE_WIRE_BBB, 199 UQ_MSC_FORCE_PROTO_SCSI, UQ_MSC_IGNORE_RESIDUE), 200 USB_QUIRK(ADDON, DISKPRO512, 0x0000, 0xffff, UQ_MSC_FORCE_WIRE_BBB, 201 UQ_MSC_FORCE_PROTO_SCSI, UQ_MSC_IGNORE_RESIDUE), 202 USB_QUIRK(ADDONICS2, CABLE_205, 0x0000, 0xffff, UQ_MSC_FORCE_WIRE_BBB, 203 UQ_MSC_FORCE_PROTO_SCSI), 204 USB_QUIRK(AIPTEK, POCKETCAM3M, 0x0000, 0xffff, UQ_MSC_FORCE_WIRE_BBB, 205 UQ_MSC_FORCE_PROTO_SCSI), 206 USB_QUIRK(ALCOR, UMCR_9361, 0x0000, 0xffff, UQ_MSC_FORCE_WIRE_BBB, 207 UQ_MSC_FORCE_PROTO_SCSI, UQ_MSC_NO_GETMAXLUN), 208 USB_QUIRK(ALCOR, TRANSCEND, 0x0000, 0xffff, UQ_MSC_NO_GETMAXLUN, 209 UQ_MSC_NO_SYNC_CACHE, UQ_MSC_NO_TEST_UNIT_READY), 210 USB_QUIRK(APACER, HT202, 0x0000, 0xffff, UQ_MSC_NO_TEST_UNIT_READY, 211 UQ_MSC_NO_SYNC_CACHE), 212 USB_QUIRK(ASAHIOPTICAL, OPTIO230, 0x0000, 0xffff, UQ_MSC_FORCE_WIRE_BBB, 213 UQ_MSC_FORCE_PROTO_SCSI, UQ_MSC_NO_INQUIRY), 214 USB_QUIRK(ASAHIOPTICAL, OPTIO330, 0x0000, 0xffff, UQ_MSC_FORCE_WIRE_BBB, 215 UQ_MSC_FORCE_PROTO_SCSI, UQ_MSC_NO_INQUIRY), 216 USB_QUIRK(ATP, EUSB, 0x0000, 0xffff, UQ_MSC_NO_SYNC_CACHE), 217 USB_QUIRK(BELKIN, USB2SCSI, 0x0000, 0xffff, UQ_MSC_FORCE_WIRE_BBB, 218 UQ_MSC_FORCE_PROTO_SCSI), 219 USB_QUIRK(CASIO, QV_DIGICAM, 0x0000, 0xffff, UQ_MSC_FORCE_WIRE_CBI, 220 UQ_MSC_FORCE_PROTO_SCSI, UQ_MSC_NO_INQUIRY), 221 USB_QUIRK(CCYU, ED1064, 0x0000, 0xffff, UQ_MSC_FORCE_WIRE_BBB, 222 UQ_MSC_FORCE_PROTO_SCSI), 223 USB_QUIRK(CENTURY, EX35QUAT, 0x0000, 0xffff, UQ_MSC_FORCE_WIRE_BBB, 224 UQ_MSC_FORCE_PROTO_SCSI, UQ_MSC_FORCE_SHORT_INQ, 225 UQ_MSC_NO_START_STOP, UQ_MSC_IGNORE_RESIDUE), 226 USB_QUIRK(CREATIVE, NOMAD, 0x0001, 0xffff, UQ_MSC_FORCE_WIRE_BBB, 227 UQ_MSC_FORCE_PROTO_SCSI, UQ_MSC_READ_CAP_OFFBY1), 228 USB_QUIRK(CYPRESS, XX6830XX, 0x0000, 0xffff, UQ_MSC_NO_GETMAXLUN, 229 UQ_MSC_NO_SYNC_CACHE), 230 USB_QUIRK(EMTEC, DANEELEC4GB, 0x0000, 0xffff, UQ_MSC_NO_SYNC_CACHE), 231 USB_QUIRK(DESKNOTE, UCR_61S2B, 0x0000, 0xffff, UQ_MSC_FORCE_WIRE_BBB, 232 UQ_MSC_FORCE_PROTO_SCSI), 233 USB_QUIRK(DMI, CFSM_RW, 0x0000, 0xffff, UQ_MSC_FORCE_PROTO_SCSI, 234 UQ_MSC_NO_GETMAXLUN), 235 USB_QUIRK(EMTEC, RUF2PS, 0x0000, 0xffff, UQ_MSC_NO_SYNC_CACHE), 236 USB_QUIRK(EPSON, STYLUS_875DC, 0x0000, 0xffff, UQ_MSC_FORCE_WIRE_CBI, 237 UQ_MSC_FORCE_PROTO_SCSI, UQ_MSC_NO_INQUIRY), 238 USB_QUIRK(EPSON, STYLUS_895, 0x0000, 0xffff, UQ_MSC_FORCE_WIRE_BBB, 239 UQ_MSC_FORCE_PROTO_SCSI, UQ_MSC_NO_GETMAXLUN), 240 USB_QUIRK(FEIYA, 5IN1, 0x0000, 0xffff, UQ_MSC_FORCE_WIRE_BBB, 241 UQ_MSC_FORCE_PROTO_SCSI), 242 USB_QUIRK(FEIYA, ELANGO, 0x0000, 0xffff, UQ_MSC_NO_SYNC_CACHE), 243 USB_QUIRK(FREECOM, DVD, 0x0000, 0xffff, UQ_MSC_FORCE_PROTO_SCSI), 244 USB_QUIRK(FUJIPHOTO, MASS0100, 0x0000, 0xffff, UQ_MSC_FORCE_WIRE_CBI_I, 245 UQ_MSC_FORCE_PROTO_ATAPI, UQ_MSC_NO_RS_CLEAR_UA, UQ_MSC_NO_SYNC_CACHE), 246 USB_QUIRK(GARMIN, DAKOTA20, 0x0000, 0xffff, UQ_MSC_NO_INQUIRY), 247 USB_QUIRK(GARMIN, FORERUNNER230, 0x0000, 0xffff, UQ_MSC_NO_INQUIRY), 248 USB_QUIRK(GARMIN, GPSMAP62S, 0x0000, 0xffff, UQ_MSC_NO_INQUIRY), 249 USB_QUIRK(GARMIN, EDGETOURINGPLUS, 0x0000, 0xffff, UQ_MSC_NO_INQUIRY), 250 USB_QUIRK(GARMIN, INSTINCTSOLAR, 0x0000, 0xffff, UQ_MSC_NO_INQUIRY), 251 USB_QUIRK(GENESYS, GL641USB2IDE, 0x0000, 0xffff, UQ_MSC_FORCE_WIRE_BBB, 252 UQ_MSC_FORCE_PROTO_SCSI, UQ_MSC_FORCE_SHORT_INQ, 253 UQ_MSC_NO_START_STOP, UQ_MSC_IGNORE_RESIDUE, UQ_MSC_NO_SYNC_CACHE), 254 USB_QUIRK(GENESYS, GL641USB2IDE_2, 0x0000, 0xffff, 255 UQ_MSC_FORCE_WIRE_BBB, UQ_MSC_FORCE_PROTO_ATAPI, 256 UQ_MSC_FORCE_SHORT_INQ, UQ_MSC_NO_START_STOP, 257 UQ_MSC_IGNORE_RESIDUE), 258 USB_QUIRK(GENESYS, GL641USB, 0x0000, 0xffff, UQ_MSC_FORCE_WIRE_BBB, 259 UQ_MSC_FORCE_PROTO_SCSI, UQ_MSC_FORCE_SHORT_INQ, 260 UQ_MSC_NO_START_STOP, UQ_MSC_IGNORE_RESIDUE), 261 USB_QUIRK(GENESYS, GL641USB_2, 0x0000, 0xffff, UQ_MSC_FORCE_WIRE_BBB, 262 UQ_MSC_FORCE_PROTO_SCSI, UQ_MSC_WRONG_CSWSIG), 263 USB_QUIRK(GENESYS, GL3220, 0x0000, 0xffff, UQ_MSC_NO_INQUIRY, 264 UQ_MSC_NO_RS_CLEAR_UA), 265 USB_QUIRK(HAGIWARA, FG, 0x0000, 0xffff, UQ_MSC_FORCE_WIRE_BBB, 266 UQ_MSC_FORCE_PROTO_SCSI), 267 USB_QUIRK(HAGIWARA, FGSM, 0x0000, 0xffff, UQ_MSC_FORCE_WIRE_BBB, 268 UQ_MSC_FORCE_PROTO_SCSI), 269 USB_QUIRK(HITACHI, DVDCAM_DZ_MV100A, 0x0000, 0xffff, 270 UQ_MSC_FORCE_WIRE_CBI, UQ_MSC_FORCE_PROTO_SCSI, 271 UQ_MSC_NO_GETMAXLUN), 272 USB_QUIRK(HITACHI, DVDCAM_USB, 0x0000, 0xffff, UQ_MSC_FORCE_WIRE_CBI_I, 273 UQ_MSC_FORCE_PROTO_ATAPI, UQ_MSC_NO_INQUIRY), 274 USB_QUIRK(HP, CDW4E, 0x0000, 0xffff, UQ_MSC_FORCE_PROTO_ATAPI), 275 USB_QUIRK(HP, CDW8200, 0x0000, 0xffff, UQ_MSC_FORCE_WIRE_CBI_I, 276 UQ_MSC_FORCE_PROTO_ATAPI, UQ_MSC_NO_TEST_UNIT_READY, 277 UQ_MSC_NO_START_STOP), 278 USB_QUIRK(HUAWEI, E3372_INIT, 0, 0xffff, UQ_MSC_NO_INQUIRY, 279 UQ_MSC_NO_GETMAXLUN), 280 USB_QUIRK(IMAGINATION, DBX1, 0x0000, 0xffff, UQ_MSC_FORCE_WIRE_BBB, 281 UQ_MSC_FORCE_PROTO_SCSI, UQ_MSC_WRONG_CSWSIG), 282 USB_QUIRK(INSYSTEM, USBCABLE, 0x0000, 0xffff, UQ_MSC_FORCE_WIRE_CBI, 283 UQ_MSC_FORCE_PROTO_ATAPI, UQ_MSC_NO_TEST_UNIT_READY, 284 UQ_MSC_NO_START_STOP, UQ_MSC_ALT_IFACE_1), 285 USB_QUIRK(INSYSTEM, ATAPI, 0x0000, 0xffff, UQ_MSC_FORCE_WIRE_CBI, 286 UQ_MSC_FORCE_PROTO_RBC), 287 USB_QUIRK(INSYSTEM, STORAGE_V2, 0x0000, 0xffff, UQ_MSC_FORCE_WIRE_CBI, 288 UQ_MSC_FORCE_PROTO_RBC), 289 USB_QUIRK(VIALABS, VL701, 0x0000, 0xffff, UQ_MSC_NO_INQUIRY), 290 USB_QUIRK(IODATA, IU_CD2, 0x0000, 0xffff, UQ_MSC_FORCE_WIRE_BBB, 291 UQ_MSC_FORCE_PROTO_SCSI), 292 USB_QUIRK(IODATA, DVR_UEH8, 0x0000, 0xffff, UQ_MSC_FORCE_WIRE_BBB, 293 UQ_MSC_FORCE_PROTO_SCSI), 294 USB_QUIRK(IOMEGA, ZIP100, 0x0000, 0xffff, UQ_MSC_FORCE_WIRE_BBB, 295 UQ_MSC_FORCE_PROTO_SCSI, 296 UQ_MSC_NO_TEST_UNIT_READY), /* XXX ZIP drives can also use ATAPI */ 297 USB_QUIRK(JMICRON, JMS566, 0x0000, 0xffff, UQ_MSC_NO_GETMAXLUN), 298 USB_QUIRK(JMICRON, JMS567, 0x0000, 0xffff, UQ_MSC_NO_GETMAXLUN), 299 USB_QUIRK(JMICRON, JM20337, 0x0000, 0xffff, UQ_MSC_FORCE_WIRE_BBB, 300 UQ_MSC_FORCE_PROTO_SCSI, 301 UQ_MSC_NO_SYNC_CACHE), 302 USB_QUIRK(KINGSTON, HYPERX3_0, 0x0000, 0xffff, UQ_MSC_NO_INQUIRY), 303 USB_QUIRK(KINGSTON, DATATRAVELER3_0, 0x0000, 0xffff, UQ_MSC_NO_PREVENT_ALLOW, UQ_MSC_NO_SYNC_CACHE), 304 USB_QUIRK(KYOCERA, FINECAM_L3, 0x0000, 0xffff, UQ_MSC_FORCE_WIRE_BBB, 305 UQ_MSC_FORCE_PROTO_SCSI, UQ_MSC_NO_INQUIRY), 306 USB_QUIRK(KYOCERA, FINECAM_S3X, 0x0000, 0xffff, UQ_MSC_FORCE_WIRE_CBI, 307 UQ_MSC_FORCE_PROTO_ATAPI, UQ_MSC_NO_INQUIRY), 308 USB_QUIRK(KYOCERA, FINECAM_S4, 0x0000, 0xffff, UQ_MSC_FORCE_WIRE_CBI, 309 UQ_MSC_FORCE_PROTO_ATAPI, UQ_MSC_NO_INQUIRY), 310 USB_QUIRK(KYOCERA, FINECAM_S5, 0x0000, 0xffff, UQ_MSC_FORCE_WIRE_BBB, 311 UQ_MSC_FORCE_PROTO_SCSI, UQ_MSC_NO_INQUIRY), 312 USB_QUIRK(LACIE, HD, 0x0000, 0xffff, UQ_MSC_FORCE_WIRE_CBI, 313 UQ_MSC_FORCE_PROTO_RBC), 314 USB_QUIRK(LEXAR, CF_READER, 0x0000, 0xffff, UQ_MSC_FORCE_WIRE_BBB, 315 UQ_MSC_FORCE_PROTO_SCSI, UQ_MSC_NO_INQUIRY), 316 USB_QUIRK(LEXAR, JUMPSHOT, 0x0000, 0xffff, UQ_MSC_FORCE_PROTO_SCSI), 317 USB_QUIRK(LEXAR, JUMPDRIVE, 0x0000, 0xffff, UQ_MSC_NO_INQUIRY), 318 USB_QUIRK(LOGITEC, LDR_H443SU2, 0x0000, 0xffff, UQ_MSC_FORCE_PROTO_SCSI), 319 USB_QUIRK(LOGITEC, LDR_H443U2, 0x0000, 0xffff, UQ_MSC_FORCE_WIRE_BBB, 320 UQ_MSC_FORCE_PROTO_SCSI,), 321 USB_QUIRK(MELCO, DUBPXXG, 0x0000, 0xffff, UQ_MSC_FORCE_WIRE_BBB, 322 UQ_MSC_FORCE_PROTO_SCSI, UQ_MSC_FORCE_SHORT_INQ, 323 UQ_MSC_NO_START_STOP, UQ_MSC_IGNORE_RESIDUE), 324 USB_QUIRK(MICROTECH, DPCM, 0x0000, 0xffff, UQ_MSC_FORCE_WIRE_CBI, 325 UQ_MSC_FORCE_PROTO_SCSI, UQ_MSC_NO_TEST_UNIT_READY, 326 UQ_MSC_NO_START_STOP), 327 USB_QUIRK(MICRON, REALSSD, 0x0000, 0xffff, UQ_MSC_NO_SYNC_CACHE), 328 USB_QUIRK(MICROTECH, SCSIDB25, 0x0000, 0xffff, UQ_MSC_FORCE_WIRE_BBB, 329 UQ_MSC_FORCE_PROTO_SCSI), 330 USB_QUIRK(MICROTECH, SCSIHD50, 0x0000, 0xffff, UQ_MSC_FORCE_WIRE_BBB, 331 UQ_MSC_FORCE_PROTO_SCSI), 332 USB_QUIRK(MINOLTA, E223, 0x0000, 0xffff, UQ_MSC_FORCE_PROTO_SCSI), 333 USB_QUIRK(MINOLTA, F300, 0x0000, 0xffff, UQ_MSC_FORCE_WIRE_BBB, 334 UQ_MSC_FORCE_PROTO_SCSI), 335 USB_QUIRK(MITSUMI, CDRRW, 0x0000, 0xffff, UQ_MSC_FORCE_WIRE_CBI | 336 UQ_MSC_FORCE_PROTO_ATAPI), 337 USB_QUIRK(MOTOROLA2, E398, 0x0000, 0xffff, UQ_MSC_FORCE_WIRE_BBB, 338 UQ_MSC_FORCE_PROTO_SCSI, UQ_MSC_FORCE_SHORT_INQ, 339 UQ_MSC_NO_INQUIRY_EVPD, UQ_MSC_NO_GETMAXLUN), 340 USB_QUIRK_VP(USB_VENDOR_MPMAN, 0, UQ_MSC_NO_SYNC_CACHE, 341 UQ_MATCH_VENDOR_ONLY), 342 USB_QUIRK(MSYSTEMS, DISKONKEY, 0x0000, 0xffff, UQ_MSC_FORCE_WIRE_BBB, 343 UQ_MSC_FORCE_PROTO_SCSI, UQ_MSC_IGNORE_RESIDUE, UQ_MSC_NO_GETMAXLUN, 344 UQ_MSC_NO_RS_CLEAR_UA), 345 USB_QUIRK(MSYSTEMS, DISKONKEY2, 0x0000, 0xffff, UQ_MSC_FORCE_WIRE_BBB, 346 UQ_MSC_FORCE_PROTO_ATAPI), 347 USB_QUIRK(MYSON, HEDEN, 0x0000, 0xffff, UQ_MSC_IGNORE_RESIDUE, 348 UQ_MSC_NO_SYNC_CACHE), 349 USB_QUIRK(NEODIO, ND3260, 0x0000, 0xffff, UQ_MSC_FORCE_WIRE_BBB, 350 UQ_MSC_FORCE_PROTO_SCSI, UQ_MSC_FORCE_SHORT_INQ), 351 USB_QUIRK(NETAC, CF_CARD, 0x0000, 0xffff, UQ_MSC_FORCE_WIRE_BBB, 352 UQ_MSC_FORCE_PROTO_SCSI, UQ_MSC_NO_INQUIRY), 353 USB_QUIRK(NETAC, ONLYDISK, 0x0000, 0xffff, UQ_MSC_FORCE_WIRE_BBB, 354 UQ_MSC_FORCE_PROTO_SCSI, UQ_MSC_IGNORE_RESIDUE), 355 USB_QUIRK(NETCHIP, CLIK_40, 0x0000, 0xffff, UQ_MSC_FORCE_PROTO_ATAPI, 356 UQ_MSC_NO_INQUIRY), 357 USB_QUIRK(NETCHIP, POCKETBOOK, 0x0000, 0xffff, UQ_MSC_NO_SYNC_CACHE), 358 USB_QUIRK(NIKON, D300, 0x0000, 0xffff, UQ_MSC_FORCE_WIRE_BBB, 359 UQ_MSC_FORCE_PROTO_SCSI), 360 USB_QUIRK(NORELSYS, NS1081, 0x0000, 0xffff, UQ_MSC_NO_RS_CLEAR_UA, 361 UQ_MSC_NO_INQUIRY), 362 USB_QUIRK(OLYMPUS, C1, 0x0000, 0xffff, UQ_MSC_FORCE_WIRE_BBB, 363 UQ_MSC_FORCE_PROTO_SCSI, UQ_MSC_WRONG_CSWSIG), 364 USB_QUIRK(OLYMPUS, C700, 0x0000, 0xffff, UQ_MSC_NO_GETMAXLUN), 365 /* Selected Olympus DSLR and EVIL models. See ../usbdevs for more 366 * details. 367 * 368 * Not all quirks apply to all models. The commented-out entries are 369 * correct for that model. 370 */ 371 USB_QUIRK(OLYMPUS, E_1, 0x0000, 0xffff, UQ_MSC_NO_GETMAXLUN, 372 UQ_MSC_NO_TEST_UNIT_READY, UQ_MSC_NO_PREVENT_ALLOW, 373 UQ_MSC_NO_SYNC_CACHE), 374 /* 375 * Product code 0x118. 376 * USB_QUIRK(OLYMPUS, E_300, 0x0000, 0xffff, UQ_MSC_NO_GETMAXLUN, 377 * UQ_MSC_NO_TEST_UNIT_READY, UQ_MSC_NO_PREVENT_ALLOW, 378 * UQ_MSC_NO_SYNC_CACHE), 379 * USB_QUIRK(OLYMPUS, E_30, 0x0000, 0xffff, UQ_MSC_NO_GETMAXLUN, 380 * UQ_MSC_NO_TEST_UNIT_READY, UQ_MSC_NO_PREVENT_ALLOW, 381 * UQ_MSC_NO_SYNC_CACHE), */ 382 USB_QUIRK(OLYMPUS, E_330, 0x0000, 0xffff, UQ_MSC_NO_GETMAXLUN, 383 UQ_MSC_NO_TEST_UNIT_READY, UQ_MSC_NO_PREVENT_ALLOW, 384 UQ_MSC_NO_SYNC_CACHE, UQ_MSC_NO_START_STOP), 385 USB_QUIRK(OLYMPUS, E_PM1, 0x0000, 0xffff, UQ_MSC_NO_GETMAXLUN, 386 UQ_MSC_NO_TEST_UNIT_READY, UQ_MSC_NO_PREVENT_ALLOW, 387 UQ_MSC_NO_SYNC_CACHE, UQ_MSC_NO_START_STOP), 388 /* Product code 0x12e. 389 * USB_QUIRK(OLYMPUS, E_PM2, 0x0000, 0xffff, 0), 390 * USB_QUIRK(OLYMPUS, E_M1MarkII, 0x0000, 0xffff, UQ_MSC_NO_GETMAXLUN, 391 * UQ_MSC_NO_TEST_UNIT_READY, UQ_MSC_NO_PREVENT_ALLOW, 392 * UQ_MSC_NO_SYNC_CACHE), 393 * USB_QUIRK(OLYMPUS, E_M5MarkIII, 0x0000, 0xffff, 0), 394 */ 395 USB_QUIRK(OLYMPUS, E_M1, 0x0000, 0xffff, UQ_MSC_NO_GETMAXLUN, 396 UQ_MSC_NO_TEST_UNIT_READY, UQ_MSC_NO_PREVENT_ALLOW, 397 UQ_MSC_NO_SYNC_CACHE, UQ_MSC_NO_START_STOP), 398 USB_QUIRK(ONSPEC, SDS_HOTFIND_D, 0x0000, 0xffff, UQ_MSC_FORCE_WIRE_BBB, 399 UQ_MSC_FORCE_PROTO_SCSI, UQ_MSC_NO_GETMAXLUN, UQ_MSC_NO_SYNC_CACHE), 400 USB_QUIRK(ONSPEC, CFMS_RW, 0x0000, 0xffff, UQ_MSC_FORCE_PROTO_SCSI), 401 USB_QUIRK(ONSPEC, CFSM_COMBO, 0x0000, 0xffff, UQ_MSC_FORCE_PROTO_SCSI), 402 USB_QUIRK(ONSPEC, CFSM_READER, 0x0000, 0xffff, UQ_MSC_FORCE_PROTO_SCSI), 403 USB_QUIRK(ONSPEC, CFSM_READER2, 0x0000, 0xffff, 404 UQ_MSC_FORCE_PROTO_SCSI), 405 USB_QUIRK(ONSPEC, MDCFE_B_CF_READER, 0x0000, 0xffff, 406 UQ_MSC_FORCE_PROTO_SCSI), 407 USB_QUIRK(ONSPEC, MDSM_B_READER, 0x0000, 0xffff, 408 UQ_MSC_FORCE_PROTO_SCSI, UQ_MSC_NO_INQUIRY), 409 USB_QUIRK(ONSPEC, READER, 0x0000, 0xffff, UQ_MSC_FORCE_PROTO_SCSI), 410 USB_QUIRK(ONSPEC, UCF100, 0x0000, 0xffff, UQ_MSC_FORCE_WIRE_BBB, 411 UQ_MSC_FORCE_PROTO_ATAPI, UQ_MSC_NO_INQUIRY, UQ_MSC_NO_GETMAXLUN), 412 USB_QUIRK(ONSPEC2, IMAGEMATE_SDDR55, 0x0000, 0xffff, 413 UQ_MSC_FORCE_PROTO_SCSI, UQ_MSC_NO_GETMAXLUN), 414 USB_QUIRK(PANASONIC, KXL840AN, 0x0000, 0xffff, UQ_MSC_FORCE_WIRE_BBB, 415 UQ_MSC_FORCE_PROTO_ATAPI, UQ_MSC_NO_GETMAXLUN), 416 USB_QUIRK(PANASONIC, KXLCB20AN, 0x0000, 0xffff, UQ_MSC_FORCE_WIRE_BBB, 417 UQ_MSC_FORCE_PROTO_SCSI), 418 USB_QUIRK(PANASONIC, KXLCB35AN, 0x0000, 0xffff, UQ_MSC_FORCE_WIRE_BBB, 419 UQ_MSC_FORCE_PROTO_SCSI), 420 USB_QUIRK(PANASONIC, LS120CAM, 0x0000, 0xffff, UQ_MSC_FORCE_PROTO_UFI), 421 USB_QUIRK(PLEXTOR, 40_12_40U, 0x0000, 0xffff, UQ_MSC_FORCE_WIRE_BBB, 422 UQ_MSC_FORCE_PROTO_SCSI, UQ_MSC_NO_TEST_UNIT_READY), 423 USB_QUIRK(PNY, ATTACHE2, 0x0000, 0xffff, UQ_MSC_FORCE_WIRE_BBB, 424 UQ_MSC_FORCE_PROTO_SCSI, UQ_MSC_IGNORE_RESIDUE, 425 UQ_MSC_NO_START_STOP), 426 USB_QUIRK(PROLIFIC, PL2506, 0x0000, 0xffff, 427 UQ_MSC_NO_SYNC_CACHE, UQ_MSC_NO_PREVENT_ALLOW), 428 USB_QUIRK_VP(USB_VENDOR_SAMSUNG_TECHWIN, 429 USB_PRODUCT_SAMSUNG_TECHWIN_DIGIMAX_410, UQ_MSC_FORCE_WIRE_BBB, 430 UQ_MSC_FORCE_PROTO_SCSI, UQ_MSC_NO_INQUIRY), 431 USB_QUIRK(SANDISK, SDDR05A, 0x0000, 0xffff, UQ_MSC_FORCE_WIRE_CBI, 432 UQ_MSC_FORCE_PROTO_SCSI, UQ_MSC_READ_CAP_OFFBY1, 433 UQ_MSC_NO_GETMAXLUN), 434 USB_QUIRK(SANDISK, SDDR09, 0x0000, 0xffff, UQ_MSC_FORCE_PROTO_SCSI, 435 UQ_MSC_READ_CAP_OFFBY1, UQ_MSC_NO_GETMAXLUN), 436 USB_QUIRK(SANDISK, SDDR12, 0x0000, 0xffff, UQ_MSC_FORCE_WIRE_CBI, 437 UQ_MSC_FORCE_PROTO_SCSI, UQ_MSC_READ_CAP_OFFBY1, 438 UQ_MSC_NO_GETMAXLUN), 439 USB_QUIRK(SANDISK, SDCZ2_128, 0x0000, 0xffff, UQ_MSC_FORCE_WIRE_BBB, 440 UQ_MSC_FORCE_PROTO_SCSI, UQ_MSC_IGNORE_RESIDUE, 441 UQ_MSC_NO_SYNC_CACHE), 442 USB_QUIRK(SANDISK, SDCZ2_256, 0x0000, 0xffff, UQ_MSC_FORCE_WIRE_BBB, 443 UQ_MSC_FORCE_PROTO_SCSI, UQ_MSC_IGNORE_RESIDUE), 444 USB_QUIRK(SANDISK, SDCZ4_128, 0x0000, 0xffff, UQ_MSC_FORCE_WIRE_BBB, 445 UQ_MSC_FORCE_PROTO_SCSI, UQ_MSC_IGNORE_RESIDUE), 446 USB_QUIRK(SANDISK, SDCZ4_256, 0x0000, 0xffff, UQ_MSC_FORCE_WIRE_BBB, 447 UQ_MSC_FORCE_PROTO_SCSI, UQ_MSC_IGNORE_RESIDUE), 448 USB_QUIRK(SANDISK, SDCZ48_32, 0x0000, 0xffff, UQ_MSC_NO_SYNC_CACHE, 449 UQ_MSC_NO_TEST_UNIT_READY), 450 USB_QUIRK(SANDISK, SDDR31, 0x0000, 0xffff, UQ_MSC_FORCE_WIRE_BBB, 451 UQ_MSC_FORCE_PROTO_SCSI, UQ_MSC_READ_CAP_OFFBY1), 452 USB_QUIRK(SANDISK, IMAGEMATE_SDDR289, 0x0000, 0xffff, 453 UQ_MSC_NO_SYNC_CACHE, UQ_MSC_NO_GETMAXLUN), 454 USB_QUIRK(SCANLOGIC, SL11R, 0x0000, 0xffff, UQ_MSC_FORCE_WIRE_BBB, 455 UQ_MSC_FORCE_PROTO_ATAPI, UQ_MSC_NO_INQUIRY), 456 USB_QUIRK(SHUTTLE, EUSB, 0x0000, 0xffff, UQ_MSC_FORCE_WIRE_CBI_I, 457 UQ_MSC_FORCE_PROTO_ATAPI, UQ_MSC_NO_TEST_UNIT_READY, 458 UQ_MSC_NO_START_STOP, UQ_MSC_SHUTTLE_INIT), 459 USB_QUIRK(SHUTTLE, CDRW, 0x0000, 0xffff, UQ_MSC_FORCE_WIRE_CBI, 460 UQ_MSC_FORCE_PROTO_ATAPI), 461 USB_QUIRK(SHUTTLE, CF, 0x0000, 0xffff, UQ_MSC_FORCE_WIRE_CBI, 462 UQ_MSC_FORCE_PROTO_ATAPI), 463 USB_QUIRK(SHUTTLE, EUSBATAPI, 0x0000, 0xffff, UQ_MSC_FORCE_WIRE_CBI, 464 UQ_MSC_FORCE_PROTO_ATAPI), 465 USB_QUIRK(SHUTTLE, EUSBCFSM, 0x0000, 0xffff, UQ_MSC_FORCE_PROTO_SCSI), 466 USB_QUIRK(SHUTTLE, EUSCSI, 0x0000, 0xffff, UQ_MSC_FORCE_WIRE_BBB, 467 UQ_MSC_FORCE_PROTO_SCSI), 468 USB_QUIRK(SHUTTLE, HIFD, 0x0000, 0xffff, UQ_MSC_FORCE_WIRE_CBI, 469 UQ_MSC_FORCE_PROTO_SCSI, UQ_MSC_NO_GETMAXLUN), 470 USB_QUIRK(SHUTTLE, SDDR09, 0x0000, 0xffff, UQ_MSC_FORCE_PROTO_SCSI, 471 UQ_MSC_NO_GETMAXLUN), 472 USB_QUIRK(SHUTTLE, ZIOMMC, 0x0000, 0xffff, UQ_MSC_FORCE_WIRE_CBI, 473 UQ_MSC_FORCE_PROTO_SCSI, UQ_MSC_NO_GETMAXLUN), 474 USB_QUIRK(SIGMATEL, I_BEAD100, 0x0000, 0xffff, UQ_MSC_FORCE_WIRE_BBB, 475 UQ_MSC_FORCE_PROTO_SCSI, UQ_MSC_SHUTTLE_INIT), 476 USB_QUIRK(SIIG, WINTERREADER, 0x0000, 0xffff, UQ_MSC_FORCE_WIRE_BBB, 477 UQ_MSC_FORCE_PROTO_SCSI, UQ_MSC_IGNORE_RESIDUE), 478 USB_QUIRK(SKANHEX, MD_7425, 0x0000, 0xffff, UQ_MSC_FORCE_WIRE_BBB, 479 UQ_MSC_FORCE_PROTO_SCSI, UQ_MSC_NO_INQUIRY), 480 USB_QUIRK(SKANHEX, SX_520Z, 0x0000, 0xffff, UQ_MSC_FORCE_WIRE_BBB, 481 UQ_MSC_FORCE_PROTO_SCSI, UQ_MSC_NO_INQUIRY), 482 USB_QUIRK(SONY, HANDYCAM, 0x0500, 0x0500, UQ_MSC_FORCE_WIRE_CBI, 483 UQ_MSC_FORCE_PROTO_RBC, UQ_MSC_RBC_PAD_TO_12), 484 USB_QUIRK(SONY, CLIE_40_MS, 0x0000, 0xffff, UQ_MSC_FORCE_WIRE_BBB, 485 UQ_MSC_FORCE_PROTO_SCSI, UQ_MSC_NO_INQUIRY), 486 USB_QUIRK(SONY, DSC, 0x0500, 0x0500, UQ_MSC_FORCE_WIRE_CBI, 487 UQ_MSC_FORCE_PROTO_RBC, UQ_MSC_RBC_PAD_TO_12), 488 USB_QUIRK(SONY, DSC, 0x0600, 0x0600, UQ_MSC_FORCE_WIRE_CBI, 489 UQ_MSC_FORCE_PROTO_RBC, UQ_MSC_RBC_PAD_TO_12), 490 USB_QUIRK(SONY, DSC, 0x0000, 0xffff, UQ_MSC_FORCE_WIRE_CBI, 491 UQ_MSC_FORCE_PROTO_RBC), 492 USB_QUIRK(SONY, HANDYCAM, 0x0000, 0xffff, UQ_MSC_FORCE_WIRE_CBI, 493 UQ_MSC_FORCE_PROTO_RBC), 494 USB_QUIRK(SONY, MSC, 0x0000, 0xffff, UQ_MSC_FORCE_WIRE_CBI, 495 UQ_MSC_FORCE_PROTO_RBC), 496 USB_QUIRK(SONY, MS_MSC_U03, 0x0000, 0xffff, UQ_MSC_FORCE_WIRE_CBI, 497 UQ_MSC_FORCE_PROTO_UFI, UQ_MSC_NO_GETMAXLUN), 498 USB_QUIRK(SONY, MS_NW_MS7, 0x0000, 0xffff, UQ_MSC_FORCE_WIRE_BBB, 499 UQ_MSC_FORCE_PROTO_SCSI, UQ_MSC_NO_GETMAXLUN), 500 USB_QUIRK(SONY, MS_PEG_N760C, 0x0000, 0xffff, UQ_MSC_FORCE_WIRE_BBB, 501 UQ_MSC_FORCE_PROTO_SCSI, UQ_MSC_NO_INQUIRY), 502 USB_QUIRK(SONY, MSACUS1, 0x0000, 0xffff, UQ_MSC_FORCE_WIRE_BBB, 503 UQ_MSC_FORCE_PROTO_SCSI, UQ_MSC_NO_GETMAXLUN), 504 USB_QUIRK(SONY, PORTABLE_HDD_V2, 0x0000, 0xffff, UQ_MSC_FORCE_WIRE_BBB, 505 UQ_MSC_FORCE_PROTO_SCSI), 506 USB_QUIRK(STMICRO, ST72682, 0x0000, 0xffff, UQ_MSC_NO_PREVENT_ALLOW), 507 USB_QUIRK(SUPERTOP, IDE, 0x0000, 0xffff, UQ_MSC_IGNORE_RESIDUE, 508 UQ_MSC_NO_SYNC_CACHE), 509 USB_QUIRK(SUPERTOP, FLASHDRIVE, 0x0000, 0xffff, UQ_MSC_NO_TEST_UNIT_READY, 510 UQ_MSC_NO_SYNC_CACHE), 511 USB_QUIRK(TAUGA, CAMERAMATE, 0x0000, 0xffff, UQ_MSC_FORCE_PROTO_SCSI), 512 USB_QUIRK(TEAC, FD05PUB, 0x0000, 0xffff, UQ_MSC_FORCE_WIRE_CBI, 513 UQ_MSC_FORCE_PROTO_UFI), 514 USB_QUIRK(TECLAST, TLC300, 0x0000, 0xffff, UQ_MSC_NO_TEST_UNIT_READY, 515 UQ_MSC_NO_SYNC_CACHE), 516 USB_QUIRK(TREK, MEMKEY, 0x0000, 0xffff, UQ_MSC_FORCE_WIRE_BBB, 517 UQ_MSC_FORCE_PROTO_SCSI, UQ_MSC_NO_INQUIRY), 518 USB_QUIRK(TREK, THUMBDRIVE_8MB, 0x0000, 0xffff, UQ_MSC_FORCE_WIRE_BBB, 519 UQ_MSC_FORCE_PROTO_ATAPI, UQ_MSC_IGNORE_RESIDUE), 520 USB_QUIRK(TRUMPION, C3310, 0x0000, 0xffff, UQ_MSC_FORCE_WIRE_CBI, 521 UQ_MSC_FORCE_PROTO_UFI), 522 USB_QUIRK(TRUMPION, MP3, 0x0000, 0xffff, UQ_MSC_FORCE_PROTO_RBC), 523 USB_QUIRK(TRUMPION, T33520, 0x0000, 0xffff, UQ_MSC_FORCE_PROTO_SCSI), 524 USB_QUIRK(TWINMOS, MDIV, 0x0000, 0xffff, UQ_MSC_FORCE_WIRE_BBB, 525 UQ_MSC_FORCE_PROTO_SCSI), 526 USB_QUIRK(VIA, USB2IDEBRIDGE, 0x0000, 0xffff, UQ_MSC_FORCE_WIRE_BBB, 527 UQ_MSC_FORCE_PROTO_SCSI, UQ_MSC_NO_SYNC_CACHE), 528 USB_QUIRK(VIVITAR, 35XX, 0x0000, 0xffff, UQ_MSC_FORCE_WIRE_BBB, 529 UQ_MSC_FORCE_PROTO_SCSI, UQ_MSC_NO_INQUIRY), 530 USB_QUIRK(WESTERN, COMBO, 0x0000, 0xffff, UQ_MSC_FORCE_WIRE_BBB, 531 UQ_MSC_FORCE_PROTO_SCSI, UQ_MSC_FORCE_SHORT_INQ, 532 UQ_MSC_NO_START_STOP, UQ_MSC_IGNORE_RESIDUE), 533 USB_QUIRK(WESTERN, EXTHDD, 0x0000, 0xffff, UQ_MSC_FORCE_WIRE_BBB, 534 UQ_MSC_FORCE_PROTO_SCSI, UQ_MSC_FORCE_SHORT_INQ, 535 UQ_MSC_NO_START_STOP, UQ_MSC_IGNORE_RESIDUE), 536 USB_QUIRK(WESTERN, MYBOOK, 0x0000, 0xffff, UQ_MSC_FORCE_WIRE_BBB, 537 UQ_MSC_FORCE_PROTO_SCSI, UQ_MSC_NO_INQUIRY_EVPD, 538 UQ_MSC_NO_SYNC_CACHE), 539 USB_QUIRK(WESTERN, MYPASSPORT_00, 0x0000, 0xffff, UQ_MSC_FORCE_SHORT_INQ), 540 USB_QUIRK(WESTERN, MYPASSPORT_01, 0x0000, 0xffff, UQ_MSC_NO_SYNC_CACHE), 541 USB_QUIRK(WESTERN, MYPASSPORT_02, 0x0000, 0xffff, UQ_MSC_NO_SYNC_CACHE), 542 USB_QUIRK(WESTERN, MYPASSPORT_03, 0x0000, 0xffff, UQ_MSC_NO_SYNC_CACHE), 543 USB_QUIRK(WESTERN, MYPASSPORT_04, 0x0000, 0xffff, UQ_MSC_NO_SYNC_CACHE), 544 USB_QUIRK(WESTERN, MYPASSPORT_05, 0x0000, 0xffff, UQ_MSC_NO_SYNC_CACHE), 545 USB_QUIRK(WESTERN, MYPASSPORT_06, 0x0000, 0xffff, UQ_MSC_NO_SYNC_CACHE), 546 USB_QUIRK(WESTERN, MYPASSPORT_07, 0x0000, 0xffff, UQ_MSC_NO_SYNC_CACHE), 547 USB_QUIRK(WESTERN, MYPASSPORT_08, 0x0000, 0xffff, UQ_MSC_NO_SYNC_CACHE), 548 USB_QUIRK(WESTERN, MYPASSPORT_09, 0x0000, 0xffff, UQ_MSC_NO_SYNC_CACHE), 549 USB_QUIRK(WESTERN, MYPASSPORT_10, 0x0000, 0xffff, UQ_MSC_NO_SYNC_CACHE), 550 USB_QUIRK(WESTERN, MYPASSPORT_11, 0x0000, 0xffff, UQ_MSC_NO_SYNC_CACHE), 551 USB_QUIRK(WESTERN, MYPASSPORTES_00, 0x0000, 0xffff, UQ_MSC_NO_SYNC_CACHE), 552 USB_QUIRK(WESTERN, MYPASSPORTES_01, 0x0000, 0xffff, UQ_MSC_NO_SYNC_CACHE), 553 USB_QUIRK(WESTERN, MYPASSPORTES_02, 0x0000, 0xffff, UQ_MSC_NO_SYNC_CACHE), 554 USB_QUIRK(WESTERN, MYPASSPORTES_03, 0x0000, 0xffff, UQ_MSC_NO_SYNC_CACHE), 555 USB_QUIRK(WESTERN, MYPASSPORTES_04, 0x0000, 0xffff, UQ_MSC_NO_SYNC_CACHE), 556 USB_QUIRK(WESTERN, MYPASSPORTES_05, 0x0000, 0xffff, UQ_MSC_NO_SYNC_CACHE), 557 USB_QUIRK(WESTERN, MYPASSPORTES_06, 0x0000, 0xffff, UQ_MSC_NO_SYNC_CACHE), 558 USB_QUIRK(WESTERN, MYPASSPORTES_07, 0x0000, 0xffff, UQ_MSC_NO_SYNC_CACHE), 559 USB_QUIRK(WESTERN, MYPASSPORTES_08, 0x0000, 0xffff, UQ_MSC_NO_SYNC_CACHE), 560 USB_QUIRK(WESTERN, MYPASSPORTES_09, 0x0000, 0xffff, UQ_MSC_NO_SYNC_CACHE), 561 USB_QUIRK(WESTERN, MYPASSPORTUL_00, 0x0000, 0xffff, UQ_MSC_NO_TEST_UNIT_READY), 562 USB_QUIRK(WINMAXGROUP, FLASH64MC, 0x0000, 0xffff, UQ_MSC_FORCE_WIRE_BBB, 563 UQ_MSC_FORCE_PROTO_SCSI, UQ_MSC_NO_INQUIRY), 564 USB_QUIRK(YANO, FW800HD, 0x0000, 0xffff, UQ_MSC_FORCE_WIRE_BBB, 565 UQ_MSC_FORCE_PROTO_SCSI, UQ_MSC_FORCE_SHORT_INQ, 566 UQ_MSC_NO_START_STOP, UQ_MSC_IGNORE_RESIDUE), 567 USB_QUIRK(YANO, U640MO, 0x0000, 0xffff, UQ_MSC_FORCE_WIRE_CBI_I, 568 UQ_MSC_FORCE_PROTO_ATAPI, UQ_MSC_FORCE_SHORT_INQ), 569 USB_QUIRK(YEDATA, FLASHBUSTERU, 0x0000, 0x007F, UQ_MSC_FORCE_WIRE_CBI, 570 UQ_MSC_FORCE_PROTO_UFI, UQ_MSC_NO_RS_CLEAR_UA, UQ_MSC_FLOPPY_SPEED, 571 UQ_MSC_NO_TEST_UNIT_READY, UQ_MSC_NO_GETMAXLUN), 572 USB_QUIRK(YEDATA, FLASHBUSTERU, 0x0080, 0x0080, UQ_MSC_FORCE_WIRE_CBI_I, 573 UQ_MSC_FORCE_PROTO_UFI, UQ_MSC_NO_RS_CLEAR_UA, UQ_MSC_FLOPPY_SPEED, 574 UQ_MSC_NO_TEST_UNIT_READY, UQ_MSC_NO_GETMAXLUN), 575 USB_QUIRK(YEDATA, FLASHBUSTERU, 0x0081, 0xFFFF, UQ_MSC_FORCE_WIRE_CBI_I, 576 UQ_MSC_FORCE_PROTO_UFI, UQ_MSC_NO_RS_CLEAR_UA, UQ_MSC_FLOPPY_SPEED, 577 UQ_MSC_NO_GETMAXLUN), 578 USB_QUIRK(ZORAN, EX20DSC, 0x0000, 0xffff, UQ_MSC_FORCE_WIRE_CBI, 579 UQ_MSC_FORCE_PROTO_ATAPI), 580 USB_QUIRK(MEIZU, M6_SL, 0x0000, 0xffff, UQ_MSC_FORCE_WIRE_BBB, 581 UQ_MSC_FORCE_PROTO_SCSI, UQ_MSC_NO_INQUIRY, UQ_MSC_NO_SYNC_CACHE), 582 USB_QUIRK(TOSHIBA, TRANSMEMORY, 0x0000, 0xffff, UQ_MSC_NO_SYNC_CACHE, 583 UQ_MSC_NO_PREVENT_ALLOW), 584 USB_QUIRK(VIALABS, USB30SATABRIDGE, 0x0000, 0xffff, UQ_MSC_NO_SYNC_CACHE), 585 USB_QUIRK(QUALCOMMINC, ZTE_MF730M, 0x0000, 0xffff, UQ_MSC_NO_GETMAXLUN, 586 UQ_MSC_NO_INQUIRY, UQ_CFG_INDEX_0), 587 USB_QUIRK(SMART2, G2MEMKEY, 0x0000, 0xffff, UQ_MSC_NO_INQUIRY), 588 USB_QUIRK(RALINK, RT_STOR, 0x0001, 0x0001, UQ_MSC_IGNORE), 589 USB_QUIRK(REALTEK, RTW8821CU_CD, 0x0001, 0x0001, UQ_MSC_IGNORE), 590 /* Non-standard USB MIDI devices */ 591 USB_QUIRK(ROLAND, UM1, 0x0000, 0xffff, UQ_AU_VENDOR_CLASS), 592 USB_QUIRK(ROLAND, SC8850, 0x0000, 0xffff, UQ_AU_VENDOR_CLASS), 593 USB_QUIRK(ROLAND, SD90, 0x0000, 0xffff, UQ_AU_VENDOR_CLASS), 594 USB_QUIRK(ROLAND, UM880N, 0x0000, 0xffff, UQ_AU_VENDOR_CLASS), 595 USB_QUIRK(ROLAND, UA100, 0x0000, 0xffff, UQ_AU_VENDOR_CLASS), 596 USB_QUIRK(ROLAND, UM4, 0x0000, 0xffff, UQ_AU_VENDOR_CLASS), 597 USB_QUIRK(ROLAND, U8, 0x0000, 0xffff, UQ_AU_VENDOR_CLASS), 598 USB_QUIRK(ROLAND, UM2, 0x0000, 0xffff, UQ_AU_VENDOR_CLASS), 599 USB_QUIRK(ROLAND, SC8820, 0x0000, 0xffff, UQ_AU_VENDOR_CLASS), 600 USB_QUIRK(ROLAND, PC300, 0x0000, 0xffff, UQ_AU_VENDOR_CLASS), 601 USB_QUIRK(ROLAND, SK500, 0x0000, 0xffff, UQ_AU_VENDOR_CLASS), 602 USB_QUIRK(ROLAND, SCD70, 0x0000, 0xffff, UQ_AU_VENDOR_CLASS), 603 USB_QUIRK(ROLAND, UM550, 0x0000, 0xffff, UQ_AU_VENDOR_CLASS), 604 USB_QUIRK(ROLAND, SD20, 0x0000, 0xffff, UQ_AU_VENDOR_CLASS), 605 USB_QUIRK(ROLAND, SD80, 0x0000, 0xffff, UQ_AU_VENDOR_CLASS), 606 USB_QUIRK(ROLAND, UA700, 0x0000, 0xffff, UQ_AU_VENDOR_CLASS), 607 USB_QUIRK(ROLAND, PCR300, 0x0000, 0xffff, UQ_AU_VENDOR_CLASS), 608 USB_QUIRK(EGO, M4U, 0x0000, 0xffff, UQ_SINGLE_CMD_MIDI), 609 USB_QUIRK(LOGILINK, U2M, 0x0000, 0xffff, UQ_SINGLE_CMD_MIDI), 610 USB_QUIRK(MEDELI, DD305, 0x0000, 0xffff, UQ_SINGLE_CMD_MIDI, UQ_MATCH_VENDOR_ONLY), 611 USB_QUIRK(REDOCTANE, GHMIDI, 0x0000, 0xffff, UQ_SINGLE_CMD_MIDI), 612 USB_QUIRK(TEXTECH, U2M_1, 0x0000, 0xffff, UQ_SINGLE_CMD_MIDI), 613 USB_QUIRK(TEXTECH, U2M_2, 0x0000, 0xffff, UQ_SINGLE_CMD_MIDI), 614 USB_QUIRK(WCH2, U2M, 0x0000, 0xffff, UQ_SINGLE_CMD_MIDI), 615 616 /* Non-standard USB AUDIO devices */ 617 USB_QUIRK(MAUDIO, FASTTRACKULTRA, 0x0000, 0xffff, UQ_AU_VENDOR_CLASS), 618 USB_QUIRK(MAUDIO, FASTTRACKULTRA8R, 0x0000, 0xffff, UQ_AU_VENDOR_CLASS), 619 USB_QUIRK(CMEDIA, CM6206, 0x0000, 0xffff, UQ_AU_SET_SPDIF_CM6206), 620 USB_QUIRK(PLOYTEC, SPL_CRIMSON_1, 0x0000, 0xffff, UQ_CFG_INDEX_1), 621 USB_QUIRK(ROLAND, UA25EX_AD, 0x0000, 0xffff, UQ_AU_VENDOR_CLASS), 622 623 /* 624 * Quirks for manufacturers which USB devices does not respond 625 * after issuing non-supported commands: 626 */ 627 USB_QUIRK(ALCOR, DUMMY, 0x0000, 0xffff, UQ_MSC_NO_SYNC_CACHE, UQ_MSC_NO_TEST_UNIT_READY, UQ_MATCH_VENDOR_ONLY), 628 USB_QUIRK(APPLE, DUMMY, 0x0000, 0xffff, UQ_MSC_NO_SYNC_CACHE, UQ_MATCH_VENDOR_ONLY), 629 USB_QUIRK(FEIYA, DUMMY, 0x0000, 0xffff, UQ_MSC_NO_SYNC_CACHE, UQ_MATCH_VENDOR_ONLY), 630 USB_QUIRK(REALTEK, DUMMY, 0x0000, 0xffff, UQ_MSC_NO_SYNC_CACHE, UQ_MATCH_VENDOR_ONLY), 631 USB_QUIRK(INITIO, DUMMY, 0x0000, 0xffff, UQ_MSC_NO_SYNC_CACHE, UQ_MATCH_VENDOR_ONLY), 632 633 /* DYMO LabelManager Pnp */ 634 USB_QUIRK(DYMO, LABELMANAGERPNP, 0x0000, 0xffff, UQ_MSC_DYMO_EJECT), 635 636 /* Holtek USB gaming keyboard */ 637 USB_QUIRK(HOLTEK, F85, 0x0000, 0xffff, UQ_KBD_BOOTPROTO), 638 639 /* This works much better with if_cdce than if_ure */ 640 USB_QUIRK(LENOVO, TBT3LAN, 0x0000, 0xffff, UQ_CFG_INDEX_1), 641 }; 642 #undef USB_QUIRK_VP 643 #undef USB_QUIRK 644 645 static const char *usb_quirk_str[USB_QUIRK_MAX] = { 646 [UQ_NONE] = "UQ_NONE", 647 [UQ_MATCH_VENDOR_ONLY] = "UQ_MATCH_VENDOR_ONLY", 648 [UQ_AUDIO_SWAP_LR] = "UQ_AUDIO_SWAP_LR", 649 [UQ_AU_INP_ASYNC] = "UQ_AU_INP_ASYNC", 650 [UQ_AU_NO_FRAC] = "UQ_AU_NO_FRAC", 651 [UQ_AU_NO_XU] = "UQ_AU_NO_XU", 652 [UQ_BAD_ADC] = "UQ_BAD_ADC", 653 [UQ_BAD_AUDIO] = "UQ_BAD_AUDIO", 654 [UQ_BROKEN_BIDIR] = "UQ_BROKEN_BIDIR", 655 [UQ_BUS_POWERED] = "UQ_BUS_POWERED", 656 [UQ_HID_IGNORE] = "UQ_HID_IGNORE", 657 [UQ_KBD_IGNORE] = "UQ_KBD_IGNORE", 658 [UQ_KBD_BOOTPROTO] = "UQ_KBD_BOOTPROTO", 659 [UQ_UMS_IGNORE] = "UQ_UMS_IGNORE", 660 [UQ_MS_BAD_CLASS] = "UQ_MS_BAD_CLASS", 661 [UQ_MS_LEADING_BYTE] = "UQ_MS_LEADING_BYTE", 662 [UQ_MS_REVZ] = "UQ_MS_REVZ", 663 [UQ_MS_VENDOR_BTN] = "UQ_MS_VENDOR_BTN", 664 [UQ_NO_STRINGS] = "UQ_NO_STRINGS", 665 [UQ_POWER_CLAIM] = "UQ_POWER_CLAIM", 666 [UQ_SPUR_BUT_UP] = "UQ_SPUR_BUT_UP", 667 [UQ_SWAP_UNICODE] = "UQ_SWAP_UNICODE", 668 [UQ_CFG_INDEX_1] = "UQ_CFG_INDEX_1", 669 [UQ_CFG_INDEX_2] = "UQ_CFG_INDEX_2", 670 [UQ_CFG_INDEX_3] = "UQ_CFG_INDEX_3", 671 [UQ_CFG_INDEX_4] = "UQ_CFG_INDEX_4", 672 [UQ_CFG_INDEX_0] = "UQ_CFG_INDEX_0", 673 [UQ_ASSUME_CM_OVER_DATA] = "UQ_ASSUME_CM_OVER_DATA", 674 [UQ_IGNORE_CDC_CM] = "UQ_IGNORE_CDC_CM", 675 [UQ_MSC_NO_TEST_UNIT_READY] = "UQ_MSC_NO_TEST_UNIT_READY", 676 [UQ_MSC_NO_RS_CLEAR_UA] = "UQ_MSC_NO_RS_CLEAR_UA", 677 [UQ_MSC_NO_START_STOP] = "UQ_MSC_NO_START_STOP", 678 [UQ_MSC_NO_GETMAXLUN] = "UQ_MSC_NO_GETMAXLUN", 679 [UQ_MSC_NO_INQUIRY] = "UQ_MSC_NO_INQUIRY", 680 [UQ_MSC_NO_INQUIRY_EVPD] = "UQ_MSC_NO_INQUIRY_EVPD", 681 [UQ_MSC_NO_PREVENT_ALLOW] = "UQ_MSC_NO_PREVENT_ALLOW", 682 [UQ_MSC_NO_SYNC_CACHE] = "UQ_MSC_NO_SYNC_CACHE", 683 [UQ_MSC_SHUTTLE_INIT] = "UQ_MSC_SHUTTLE_INIT", 684 [UQ_MSC_ALT_IFACE_1] = "UQ_MSC_ALT_IFACE_1", 685 [UQ_MSC_FLOPPY_SPEED] = "UQ_MSC_FLOPPY_SPEED", 686 [UQ_MSC_IGNORE_RESIDUE] = "UQ_MSC_IGNORE_RESIDUE", 687 [UQ_MSC_WRONG_CSWSIG] = "UQ_MSC_WRONG_CSWSIG", 688 [UQ_MSC_RBC_PAD_TO_12] = "UQ_MSC_RBC_PAD_TO_12", 689 [UQ_MSC_READ_CAP_OFFBY1] = "UQ_MSC_READ_CAP_OFFBY1", 690 [UQ_MSC_FORCE_SHORT_INQ] = "UQ_MSC_FORCE_SHORT_INQ", 691 [UQ_MSC_FORCE_WIRE_BBB] = "UQ_MSC_FORCE_WIRE_BBB", 692 [UQ_MSC_FORCE_WIRE_CBI] = "UQ_MSC_FORCE_WIRE_CBI", 693 [UQ_MSC_FORCE_WIRE_CBI_I] = "UQ_MSC_FORCE_WIRE_CBI_I", 694 [UQ_MSC_FORCE_PROTO_SCSI] = "UQ_MSC_FORCE_PROTO_SCSI", 695 [UQ_MSC_FORCE_PROTO_ATAPI] = "UQ_MSC_FORCE_PROTO_ATAPI", 696 [UQ_MSC_FORCE_PROTO_UFI] = "UQ_MSC_FORCE_PROTO_UFI", 697 [UQ_MSC_FORCE_PROTO_RBC] = "UQ_MSC_FORCE_PROTO_RBC", 698 [UQ_MSC_IGNORE] = "UQ_MSC_IGNORE", 699 [UQ_MSC_EJECT_HUAWEI] = "UQ_MSC_EJECT_HUAWEI", 700 [UQ_MSC_EJECT_SIERRA] = "UQ_MSC_EJECT_SIERRA", 701 [UQ_MSC_EJECT_SCSIEJECT] = "UQ_MSC_EJECT_SCSIEJECT", 702 [UQ_MSC_EJECT_REZERO] = "UQ_MSC_EJECT_REZERO", 703 [UQ_MSC_EJECT_ZTESTOR] = "UQ_MSC_EJECT_ZTESTOR", 704 [UQ_MSC_EJECT_CMOTECH] = "UQ_MSC_EJECT_CMOTECH", 705 [UQ_MSC_EJECT_WAIT] = "UQ_MSC_EJECT_WAIT", 706 [UQ_MSC_EJECT_SAEL_M460] = "UQ_MSC_EJECT_SAEL_M460", 707 [UQ_MSC_EJECT_HUAWEISCSI] = "UQ_MSC_EJECT_HUAWEISCSI", 708 [UQ_MSC_EJECT_HUAWEISCSI2] = "UQ_MSC_EJECT_HUAWEISCSI2", 709 [UQ_MSC_EJECT_HUAWEISCSI3] = "UQ_MSC_EJECT_HUAWEISCSI3", 710 [UQ_MSC_EJECT_HUAWEISCSI4] = "UQ_MSC_EJECT_HUAWEISCSI4", 711 [UQ_MSC_EJECT_TCT] = "UQ_MSC_EJECT_TCT", 712 [UQ_BAD_MIDI] = "UQ_BAD_MIDI", 713 [UQ_AU_VENDOR_CLASS] = "UQ_AU_VENDOR_CLASS", 714 [UQ_SINGLE_CMD_MIDI] = "UQ_SINGLE_CMD_MIDI", 715 [UQ_MSC_DYMO_EJECT] = "UQ_MSC_DYMO_EJECT", 716 [UQ_AU_SET_SPDIF_CM6206] = "UQ_AU_SET_SPDIF_CM6206", 717 [UQ_WMT_IGNORE] = "UQ_WMT_IGNORE", 718 }; 719 720 /*------------------------------------------------------------------------* 721 * usb_quirkstr 722 * 723 * This function converts an USB quirk code into a string. 724 *------------------------------------------------------------------------*/ 725 static const char * 726 usb_quirkstr(uint16_t quirk) 727 { 728 return ((quirk < USB_QUIRK_MAX && usb_quirk_str[quirk] != NULL) ? 729 usb_quirk_str[quirk] : "UQ_UNKNOWN"); 730 } 731 732 /*------------------------------------------------------------------------* 733 * usb_strquirk 734 * 735 * This function converts a string into a USB quirk code. 736 * 737 * Returns: 738 * Less than USB_QUIRK_MAX: Quirk code 739 * Else: Quirk code not found 740 *------------------------------------------------------------------------*/ 741 static uint16_t 742 usb_strquirk(const char *str, size_t len) 743 { 744 const char *quirk; 745 uint16_t x; 746 747 for (x = 0; x != USB_QUIRK_MAX; x++) { 748 quirk = usb_quirkstr(x); 749 if (strncmp(str, quirk, len) == 0 && 750 quirk[len] == 0) 751 break; 752 } 753 return (x); 754 } 755 756 /*------------------------------------------------------------------------* 757 * usb_test_quirk_by_info 758 * 759 * Returns: 760 * 0: Quirk not found 761 * Else: Quirk found 762 *------------------------------------------------------------------------*/ 763 static uint8_t 764 usb_test_quirk_by_info(const struct usbd_lookup_info *info, uint16_t quirk) 765 { 766 uint16_t x; 767 uint16_t y; 768 769 if (quirk == UQ_NONE) 770 goto done; 771 772 USB_MTX_LOCK(&usb_quirk_mtx); 773 774 for (x = 0; x != USB_DEV_QUIRKS_MAX; x++) { 775 /* see if quirk information does not match */ 776 if ((usb_quirks[x].vid != info->idVendor) || 777 (usb_quirks[x].lo_rev > info->bcdDevice) || 778 (usb_quirks[x].hi_rev < info->bcdDevice)) { 779 continue; 780 } 781 /* see if quirk only should match vendor ID */ 782 if (usb_quirks[x].pid != info->idProduct) { 783 if (usb_quirks[x].pid != 0) 784 continue; 785 786 for (y = 0; y != USB_SUB_QUIRKS_MAX; y++) { 787 if (usb_quirks[x].quirks[y] == UQ_MATCH_VENDOR_ONLY) 788 break; 789 } 790 if (y == USB_SUB_QUIRKS_MAX) 791 continue; 792 } 793 /* lookup quirk */ 794 for (y = 0; y != USB_SUB_QUIRKS_MAX; y++) { 795 if (usb_quirks[x].quirks[y] == quirk) { 796 USB_MTX_UNLOCK(&usb_quirk_mtx); 797 DPRINTF("Found quirk '%s'.\n", usb_quirkstr(quirk)); 798 return (1); 799 } 800 } 801 } 802 USB_MTX_UNLOCK(&usb_quirk_mtx); 803 done: 804 return (0); /* no quirk match */ 805 } 806 807 static struct usb_quirk_entry * 808 usb_quirk_get_entry(uint16_t vid, uint16_t pid, 809 uint16_t lo_rev, uint16_t hi_rev, uint8_t do_alloc) 810 { 811 uint16_t x; 812 813 USB_MTX_ASSERT(&usb_quirk_mtx, MA_OWNED); 814 815 if ((vid | pid | lo_rev | hi_rev) == 0) { 816 /* all zero - special case */ 817 return (usb_quirks + USB_DEV_QUIRKS_MAX - 1); 818 } 819 /* search for an existing entry */ 820 for (x = 0; x != USB_DEV_QUIRKS_MAX; x++) { 821 /* see if quirk information does not match */ 822 if ((usb_quirks[x].vid != vid) || 823 (usb_quirks[x].pid != pid) || 824 (usb_quirks[x].lo_rev != lo_rev) || 825 (usb_quirks[x].hi_rev != hi_rev)) { 826 continue; 827 } 828 return (usb_quirks + x); 829 } 830 831 if (do_alloc == 0) { 832 /* no match */ 833 return (NULL); 834 } 835 /* search for a free entry */ 836 for (x = 0; x != USB_DEV_QUIRKS_MAX; x++) { 837 /* see if quirk information does not match */ 838 if ((usb_quirks[x].vid | 839 usb_quirks[x].pid | 840 usb_quirks[x].lo_rev | 841 usb_quirks[x].hi_rev) != 0) { 842 continue; 843 } 844 usb_quirks[x].vid = vid; 845 usb_quirks[x].pid = pid; 846 usb_quirks[x].lo_rev = lo_rev; 847 usb_quirks[x].hi_rev = hi_rev; 848 849 return (usb_quirks + x); 850 } 851 852 /* no entry found */ 853 return (NULL); 854 } 855 856 /*------------------------------------------------------------------------* 857 * usb_quirk_ioctl - handle quirk IOCTLs 858 * 859 * Returns: 860 * 0: Success 861 * Else: Failure 862 *------------------------------------------------------------------------*/ 863 static int 864 usb_quirk_ioctl(unsigned long cmd, caddr_t data, 865 int fflag, struct thread *td) 866 { 867 struct usb_gen_quirk *pgq; 868 struct usb_quirk_entry *pqe; 869 uint32_t x; 870 uint32_t y; 871 int err; 872 873 switch (cmd) { 874 case USB_DEV_QUIRK_GET: 875 pgq = (void *)data; 876 x = pgq->index % USB_SUB_QUIRKS_MAX; 877 y = pgq->index / USB_SUB_QUIRKS_MAX; 878 if (y >= USB_DEV_QUIRKS_MAX) { 879 return (EINVAL); 880 } 881 USB_MTX_LOCK(&usb_quirk_mtx); 882 /* copy out data */ 883 pgq->vid = usb_quirks[y].vid; 884 pgq->pid = usb_quirks[y].pid; 885 pgq->bcdDeviceLow = usb_quirks[y].lo_rev; 886 pgq->bcdDeviceHigh = usb_quirks[y].hi_rev; 887 strlcpy(pgq->quirkname, 888 usb_quirkstr(usb_quirks[y].quirks[x]), 889 sizeof(pgq->quirkname)); 890 USB_MTX_UNLOCK(&usb_quirk_mtx); 891 return (0); /* success */ 892 893 case USB_QUIRK_NAME_GET: 894 pgq = (void *)data; 895 x = pgq->index; 896 if (x >= USB_QUIRK_MAX) { 897 return (EINVAL); 898 } 899 strlcpy(pgq->quirkname, 900 usb_quirkstr(x), sizeof(pgq->quirkname)); 901 return (0); /* success */ 902 903 case USB_DEV_QUIRK_ADD: 904 pgq = (void *)data; 905 906 /* check privileges */ 907 err = priv_check(curthread, PRIV_DRIVER); 908 if (err) { 909 return (err); 910 } 911 /* convert quirk string into numerical */ 912 for (y = 0; y != USB_DEV_QUIRKS_MAX; y++) { 913 if (strcmp(pgq->quirkname, usb_quirkstr(y)) == 0) { 914 break; 915 } 916 } 917 if (y == USB_DEV_QUIRKS_MAX) { 918 return (EINVAL); 919 } 920 if (y == UQ_NONE) { 921 return (EINVAL); 922 } 923 USB_MTX_LOCK(&usb_quirk_mtx); 924 pqe = usb_quirk_get_entry(pgq->vid, pgq->pid, 925 pgq->bcdDeviceLow, pgq->bcdDeviceHigh, 1); 926 if (pqe == NULL) { 927 USB_MTX_UNLOCK(&usb_quirk_mtx); 928 return (EINVAL); 929 } 930 for (x = 0; x != USB_SUB_QUIRKS_MAX; x++) { 931 if (pqe->quirks[x] == UQ_NONE) { 932 pqe->quirks[x] = y; 933 break; 934 } 935 } 936 USB_MTX_UNLOCK(&usb_quirk_mtx); 937 if (x == USB_SUB_QUIRKS_MAX) { 938 return (ENOMEM); 939 } 940 return (0); /* success */ 941 942 case USB_DEV_QUIRK_REMOVE: 943 pgq = (void *)data; 944 /* check privileges */ 945 err = priv_check(curthread, PRIV_DRIVER); 946 if (err) { 947 return (err); 948 } 949 /* convert quirk string into numerical */ 950 for (y = 0; y != USB_DEV_QUIRKS_MAX; y++) { 951 if (strcmp(pgq->quirkname, usb_quirkstr(y)) == 0) { 952 break; 953 } 954 } 955 if (y == USB_DEV_QUIRKS_MAX) { 956 return (EINVAL); 957 } 958 if (y == UQ_NONE) { 959 return (EINVAL); 960 } 961 USB_MTX_LOCK(&usb_quirk_mtx); 962 pqe = usb_quirk_get_entry(pgq->vid, pgq->pid, 963 pgq->bcdDeviceLow, pgq->bcdDeviceHigh, 0); 964 if (pqe == NULL) { 965 USB_MTX_UNLOCK(&usb_quirk_mtx); 966 return (EINVAL); 967 } 968 for (x = 0; x != USB_SUB_QUIRKS_MAX; x++) { 969 if (pqe->quirks[x] == y) { 970 pqe->quirks[x] = UQ_NONE; 971 break; 972 } 973 } 974 if (x == USB_SUB_QUIRKS_MAX) { 975 USB_MTX_UNLOCK(&usb_quirk_mtx); 976 return (ENOMEM); 977 } 978 for (x = 0; x != USB_SUB_QUIRKS_MAX; x++) { 979 if (pqe->quirks[x] != UQ_NONE) { 980 break; 981 } 982 } 983 if (x == USB_SUB_QUIRKS_MAX) { 984 /* all quirk entries are unused - release */ 985 memset(pqe, 0, sizeof(*pqe)); 986 } 987 USB_MTX_UNLOCK(&usb_quirk_mtx); 988 return (0); /* success */ 989 990 default: 991 break; 992 } 993 return (ENOIOCTL); 994 } 995 996 /*------------------------------------------------------------------------* 997 * usb_quirk_strtou16 998 * 999 * Helper function to scan a 16-bit integer. 1000 *------------------------------------------------------------------------*/ 1001 static uint16_t 1002 usb_quirk_strtou16(const char **pptr, const char *name, const char *what) 1003 { 1004 unsigned long value; 1005 char *end; 1006 1007 value = strtoul(*pptr, &end, 0); 1008 if (value > 65535 || *pptr == end || (*end != ' ' && *end != '\t')) { 1009 printf("%s: %s 16-bit %s value set to zero\n", 1010 name, what, *end == 0 ? "incomplete" : "invalid"); 1011 return (0); 1012 } 1013 *pptr = end + 1; 1014 return ((uint16_t)value); 1015 } 1016 1017 /*------------------------------------------------------------------------* 1018 * usb_quirk_add_entry_from_str 1019 * 1020 * Add a USB quirk entry from string. 1021 * "VENDOR PRODUCT LO_REV HI_REV QUIRK[,QUIRK[,...]]" 1022 *------------------------------------------------------------------------*/ 1023 static void 1024 usb_quirk_add_entry_from_str(const char *name, const char *env) 1025 { 1026 struct usb_quirk_entry entry = { }; 1027 struct usb_quirk_entry *new; 1028 uint16_t quirk_idx; 1029 uint16_t quirk; 1030 const char *end; 1031 1032 /* check for invalid environment variable */ 1033 if (name == NULL || env == NULL) 1034 return; 1035 1036 if (bootverbose) 1037 printf("Adding USB QUIRK '%s' = '%s'\n", name, env); 1038 1039 /* parse device information */ 1040 entry.vid = usb_quirk_strtou16(&env, name, "Vendor ID"); 1041 entry.pid = usb_quirk_strtou16(&env, name, "Product ID"); 1042 entry.lo_rev = usb_quirk_strtou16(&env, name, "Low revision"); 1043 entry.hi_rev = usb_quirk_strtou16(&env, name, "High revision"); 1044 1045 /* parse quirk information */ 1046 quirk_idx = 0; 1047 while (*env != 0 && quirk_idx != USB_SUB_QUIRKS_MAX) { 1048 /* skip whitespace before quirks */ 1049 while (*env == ' ' || *env == '\t') 1050 env++; 1051 1052 /* look for quirk separation character */ 1053 end = strchr(env, ','); 1054 if (end == NULL) 1055 end = env + strlen(env); 1056 1057 /* lookup quirk in string table */ 1058 quirk = usb_strquirk(env, end - env); 1059 if (quirk < USB_QUIRK_MAX) { 1060 entry.quirks[quirk_idx++] = quirk; 1061 } else { 1062 printf("%s: unknown USB quirk '%.*s' (skipped)\n", 1063 name, (int)(end - env), env); 1064 } 1065 env = end; 1066 1067 /* skip quirk delimiter, if any */ 1068 if (*env != 0) 1069 env++; 1070 } 1071 1072 /* register quirk */ 1073 if (quirk_idx != 0) { 1074 if (*env != 0) { 1075 printf("%s: Too many USB quirks, only %d allowed!\n", 1076 name, USB_SUB_QUIRKS_MAX); 1077 } 1078 USB_MTX_LOCK(&usb_quirk_mtx); 1079 new = usb_quirk_get_entry(entry.vid, entry.pid, 1080 entry.lo_rev, entry.hi_rev, 1); 1081 if (new == NULL) 1082 printf("%s: USB quirks table is full!\n", name); 1083 else 1084 memcpy(new->quirks, entry.quirks, sizeof(entry.quirks)); 1085 USB_MTX_UNLOCK(&usb_quirk_mtx); 1086 } else { 1087 printf("%s: No USB quirks found!\n", name); 1088 } 1089 } 1090 1091 static void 1092 usb_quirk_init(void *arg) 1093 { 1094 char envkey[sizeof(USB_QUIRK_ENVROOT) + 2]; /* 2 digits max, 0 to 99 */ 1095 int i; 1096 1097 /* initialize mutex */ 1098 mtx_init(&usb_quirk_mtx, "USB quirk", NULL, MTX_DEF); 1099 1100 /* look for quirks defined by the environment variable */ 1101 for (i = 0; i != 100; i++) { 1102 snprintf(envkey, sizeof(envkey), USB_QUIRK_ENVROOT "%d", i); 1103 1104 /* Stop at first undefined var */ 1105 if (!testenv(envkey)) 1106 break; 1107 1108 /* parse environment variable */ 1109 usb_quirk_add_entry_from_str(envkey, kern_getenv(envkey)); 1110 } 1111 1112 /* register our function */ 1113 usb_test_quirk_p = &usb_test_quirk_by_info; 1114 usb_quirk_ioctl_p = &usb_quirk_ioctl; 1115 } 1116 1117 static void 1118 usb_quirk_uninit(void *arg) 1119 { 1120 usb_quirk_unload(arg); 1121 1122 /* destroy mutex */ 1123 mtx_destroy(&usb_quirk_mtx); 1124 } 1125 1126 SYSINIT(usb_quirk_init, SI_SUB_LOCK, SI_ORDER_FIRST, usb_quirk_init, NULL); 1127 SYSUNINIT(usb_quirk_uninit, SI_SUB_LOCK, SI_ORDER_ANY, usb_quirk_uninit, NULL); 1128