| 1 |
// SPDX-License-Identifier: GPL-2.0 |
| 2 |
/* |
| 3 |
* USB device quirk handling logic and table |
| 4 |
* |
| 5 |
* Copyright (c) 2007 Oliver Neukum |
| 6 |
* Copyright (c) 2007 Greg Kroah-Hartman <[email protected]> |
| 7 |
*/ |
| 8 |
|
| 9 |
#include <linux/moduleparam.h> |
| 10 |
#include <linux/usb.h> |
| 11 |
#include <linux/usb/quirks.h> |
| 12 |
#include <linux/usb/hcd.h> |
| 13 |
#include "usb.h" |
| 14 |
|
| 15 |
struct quirk_entry { |
| 16 |
u16 vid; |
| 17 |
u16 pid; |
| 18 |
u32 flags; |
| 19 |
}; |
| 20 |
|
| 21 |
static DEFINE_MUTEX(quirk_mutex); |
| 22 |
|
| 23 |
static struct quirk_entry *quirk_list; |
| 24 |
static unsigned int quirk_count; |
| 25 |
|
| 26 |
static char quirks_param[128]; |
| 27 |
|
| 28 |
static int quirks_param_set(const char *value, const struct kernel_param *kp) |
| 29 |
{ |
| 30 |
char *val, *p, *field; |
| 31 |
u16 vid, pid; |
| 32 |
u32 flags; |
| 33 |
size_t i; |
| 34 |
int err; |
| 35 |
|
| 36 |
val = kstrdup(value, GFP_KERNEL); |
| 37 |
if (!val) |
| 38 |
return -ENOMEM; |
| 39 |
|
| 40 |
err = param_set_copystring(val, kp); |
| 41 |
if (err) { |
| 42 |
kfree(val); |
| 43 |
return err; |
| 44 |
} |
| 45 |
|
| 46 |
mutex_lock(&quirk_mutex); |
| 47 |
|
| 48 |
if (!*val) { |
| 49 |
quirk_count = 0; |
| 50 |
kfree(quirk_list); |
| 51 |
quirk_list = NULL; |
| 52 |
goto unlock; |
| 53 |
} |
| 54 |
|
| 55 |
for (quirk_count = 1, i = 0; val[i]; i++) |
| 56 |
if (val[i] == ',') |
| 57 |
quirk_count++; |
| 58 |
|
| 59 |
if (quirk_list) { |
| 60 |
kfree(quirk_list); |
| 61 |
quirk_list = NULL; |
| 62 |
} |
| 63 |
|
| 64 |
quirk_list = kzalloc_objs(struct quirk_entry, quirk_count); |
| 65 |
if (!quirk_list) { |
| 66 |
quirk_count = 0; |
| 67 |
mutex_unlock(&quirk_mutex); |
| 68 |
kfree(val); |
| 69 |
return -ENOMEM; |
| 70 |
} |
| 71 |
|
| 72 |
for (i = 0, p = val; p && *p;) { |
| 73 |
/* Each entry consists of VID:PID:flags */ |
| 74 |
field = strsep(&p, ":"); |
| 75 |
if (!field) |
| 76 |
break; |
| 77 |
|
| 78 |
if (kstrtou16(field, 16, &vid)) |
| 79 |
break; |
| 80 |
|
| 81 |
field = strsep(&p, ":"); |
| 82 |
if (!field) |
| 83 |
break; |
| 84 |
|
| 85 |
if (kstrtou16(field, 16, &pid)) |
| 86 |
break; |
| 87 |
|
| 88 |
field = strsep(&p, ","); |
| 89 |
if (!field || !*field) |
| 90 |
break; |
| 91 |
|
| 92 |
/* Collect the flags */ |
| 93 |
for (flags = 0; *field; field++) { |
| 94 |
switch (*field) { |
| 95 |
case 'a': |
| 96 |
flags |= USB_QUIRK_STRING_FETCH_255; |
| 97 |
break; |
| 98 |
case 'b': |
| 99 |
flags |= USB_QUIRK_RESET_RESUME; |
| 100 |
break; |
| 101 |
case 'c': |
| 102 |
flags |= USB_QUIRK_NO_SET_INTF; |
| 103 |
break; |
| 104 |
case 'd': |
| 105 |
flags |= USB_QUIRK_CONFIG_INTF_STRINGS; |
| 106 |
break; |
| 107 |
case 'e': |
| 108 |
flags |= USB_QUIRK_RESET; |
| 109 |
break; |
| 110 |
case 'f': |
| 111 |
flags |= USB_QUIRK_HONOR_BNUMINTERFACES; |
| 112 |
break; |
| 113 |
case 'g': |
| 114 |
flags |= USB_QUIRK_DELAY_INIT; |
| 115 |
break; |
| 116 |
case 'h': |
| 117 |
flags |= USB_QUIRK_LINEAR_UFRAME_INTR_BINTERVAL; |
| 118 |
break; |
| 119 |
case 'i': |
| 120 |
flags |= USB_QUIRK_DEVICE_QUALIFIER; |
| 121 |
break; |
| 122 |
case 'j': |
| 123 |
flags |= USB_QUIRK_IGNORE_REMOTE_WAKEUP; |
| 124 |
break; |
| 125 |
case 'k': |
| 126 |
flags |= USB_QUIRK_NO_LPM; |
| 127 |
break; |
| 128 |
case 'l': |
| 129 |
flags |= USB_QUIRK_LINEAR_FRAME_INTR_BINTERVAL; |
| 130 |
break; |
| 131 |
case 'm': |
| 132 |
flags |= USB_QUIRK_DISCONNECT_SUSPEND; |
| 133 |
break; |
| 134 |
case 'n': |
| 135 |
flags |= USB_QUIRK_DELAY_CTRL_MSG; |
| 136 |
break; |
| 137 |
case 'o': |
| 138 |
flags |= USB_QUIRK_HUB_SLOW_RESET; |
| 139 |
break; |
| 140 |
case 'p': |
| 141 |
flags |= USB_QUIRK_SHORT_SET_ADDRESS_REQ_TIMEOUT; |
| 142 |
break; |
| 143 |
case 'q': |
| 144 |
flags |= USB_QUIRK_FORCE_ONE_CONFIG; |
| 145 |
/* Ignore unrecognized flag characters */ |
| 146 |
} |
| 147 |
} |
| 148 |
|
| 149 |
quirk_list[i++] = (struct quirk_entry) |
| 150 |
{ .vid = vid, .pid = pid, .flags = flags }; |
| 151 |
} |
| 152 |
|
| 153 |
if (i < quirk_count) |
| 154 |
quirk_count = i; |
| 155 |
|
| 156 |
unlock: |
| 157 |
mutex_unlock(&quirk_mutex); |
| 158 |
kfree(val); |
| 159 |
|
| 160 |
return 0; |
| 161 |
} |
| 162 |
|
| 163 |
static const struct kernel_param_ops quirks_param_ops = { |
| 164 |
.set = quirks_param_set, |
| 165 |
.get = param_get_string, |
| 166 |
}; |
| 167 |
|
| 168 |
static struct kparam_string quirks_param_string = { |
| 169 |
.maxlen = sizeof(quirks_param), |
| 170 |
.string = quirks_param, |
| 171 |
}; |
| 172 |
|
| 173 |
device_param_cb(quirks, &quirks_param_ops, &quirks_param_string, 0644); |
| 174 |
MODULE_PARM_DESC(quirks, "Add/modify USB quirks by specifying quirks=vendorID:productID:quirks"); |
| 175 |
|
| 176 |
/* Lists of quirky USB devices, split in device quirks and interface quirks. |
| 177 |
* Device quirks are applied at the very beginning of the enumeration process, |
| 178 |
* right after reading the device descriptor. They can thus only match on device |
| 179 |
* information. |
| 180 |
* |
| 181 |
* Interface quirks are applied after reading all the configuration descriptors. |
| 182 |
* They can match on both device and interface information. |
| 183 |
* |
| 184 |
* Note that the DELAY_INIT and HONOR_BNUMINTERFACES quirks do not make sense as |
| 185 |
* interface quirks, as they only influence the enumeration process which is run |
| 186 |
* before processing the interface quirks. |
| 187 |
* |
| 188 |
* Please keep the lists ordered by: |
| 189 |
* 1) Vendor ID |
| 190 |
* 2) Product ID |
| 191 |
* 3) Class ID |
| 192 |
*/ |
| 193 |
static const struct usb_device_id usb_quirk_list[] = { |
| 194 |
/* CBM - Flash disk */ |
| 195 |
{ USB_DEVICE(0x0204, 0x6025), .driver_info = USB_QUIRK_RESET_RESUME }, |
| 196 |
|
| 197 |
/* WORLDE Controller KS49 or Prodipe MIDI 49C USB controller */ |
| 198 |
{ USB_DEVICE(0x0218, 0x0201), .driver_info = |
| 199 |
USB_QUIRK_CONFIG_INTF_STRINGS }, |
| 200 |
|
| 201 |
/* WORLDE easy key (easykey.25) MIDI controller */ |
| 202 |
{ USB_DEVICE(0x0218, 0x0401), .driver_info = |
| 203 |
USB_QUIRK_CONFIG_INTF_STRINGS }, |
| 204 |
|
| 205 |
/* HP 5300/5370C scanner */ |
| 206 |
{ USB_DEVICE(0x03f0, 0x0701), .driver_info = |
| 207 |
USB_QUIRK_STRING_FETCH_255 }, |
| 208 |
|
| 209 |
/* HP v222w 16GB Mini USB Drive */ |
| 210 |
{ USB_DEVICE(0x03f0, 0x3f40), .driver_info = USB_QUIRK_DELAY_INIT }, |
| 211 |
|
| 212 |
/* Huawei 4G LTE module ME906S */ |
| 213 |
{ USB_DEVICE(0x03f0, 0xa31d), .driver_info = |
| 214 |
USB_QUIRK_DISCONNECT_SUSPEND }, |
| 215 |
|
| 216 |
/* Creative SB Audigy 2 NX */ |
| 217 |
{ USB_DEVICE(0x041e, 0x3020), .driver_info = USB_QUIRK_RESET_RESUME }, |
| 218 |
|
| 219 |
/* USB3503 */ |
| 220 |
{ USB_DEVICE(0x0424, 0x3503), .driver_info = USB_QUIRK_RESET_RESUME }, |
| 221 |
|
| 222 |
/* Microsoft Wireless Laser Mouse 6000 Receiver */ |
| 223 |
{ USB_DEVICE(0x045e, 0x00e1), .driver_info = USB_QUIRK_RESET_RESUME }, |
| 224 |
|
| 225 |
/* Microsoft LifeCam-VX700 v2.0 */ |
| 226 |
{ USB_DEVICE(0x045e, 0x0770), .driver_info = USB_QUIRK_RESET_RESUME }, |
| 227 |
|
| 228 |
/* Microsoft Surface Dock Ethernet (RTL8153 GigE) */ |
| 229 |
{ USB_DEVICE(0x045e, 0x07c6), .driver_info = USB_QUIRK_NO_LPM }, |
| 230 |
|
| 231 |
/* Cherry Stream G230 2.0 (G85-231) and 3.0 (G85-232) */ |
| 232 |
{ USB_DEVICE(0x046a, 0x0023), .driver_info = USB_QUIRK_RESET_RESUME }, |
| 233 |
|
| 234 |
/* Logitech HD Webcam C270 */ |
| 235 |
{ USB_DEVICE(0x046d, 0x0825), .driver_info = USB_QUIRK_RESET_RESUME | |
| 236 |
USB_QUIRK_NO_LPM}, |
| 237 |
|
| 238 |
/* Logitech HD Pro Webcams C920, C920-C, C922, C925e and C930e */ |
| 239 |
{ USB_DEVICE(0x046d, 0x082d), .driver_info = USB_QUIRK_DELAY_INIT }, |
| 240 |
{ USB_DEVICE(0x046d, 0x0841), .driver_info = USB_QUIRK_DELAY_INIT }, |
| 241 |
{ USB_DEVICE(0x046d, 0x0843), .driver_info = USB_QUIRK_DELAY_INIT }, |
| 242 |
{ USB_DEVICE(0x046d, 0x085b), .driver_info = USB_QUIRK_DELAY_INIT }, |
| 243 |
{ USB_DEVICE(0x046d, 0x085c), .driver_info = USB_QUIRK_DELAY_INIT }, |
| 244 |
|
| 245 |
/* Logitech ConferenceCam CC3000e */ |
| 246 |
{ USB_DEVICE(0x046d, 0x0847), .driver_info = USB_QUIRK_DELAY_INIT }, |
| 247 |
{ USB_DEVICE(0x046d, 0x0848), .driver_info = USB_QUIRK_DELAY_INIT }, |
| 248 |
|
| 249 |
/* Logitech PTZ Pro Camera */ |
| 250 |
{ USB_DEVICE(0x046d, 0x0853), .driver_info = USB_QUIRK_DELAY_INIT }, |
| 251 |
|
| 252 |
/* Logitech Screen Share */ |
| 253 |
{ USB_DEVICE(0x046d, 0x086c), .driver_info = USB_QUIRK_NO_LPM }, |
| 254 |
|
| 255 |
/* Logitech Quickcam Fusion */ |
| 256 |
{ USB_DEVICE(0x046d, 0x08c1), .driver_info = USB_QUIRK_RESET_RESUME }, |
| 257 |
|
| 258 |
/* Logitech Quickcam Orbit MP */ |
| 259 |
{ USB_DEVICE(0x046d, 0x08c2), .driver_info = USB_QUIRK_RESET_RESUME }, |
| 260 |
|
| 261 |
/* Logitech Quickcam Pro for Notebook */ |
| 262 |
{ USB_DEVICE(0x046d, 0x08c3), .driver_info = USB_QUIRK_RESET_RESUME }, |
| 263 |
|
| 264 |
/* Logitech Quickcam Pro 5000 */ |
| 265 |
{ USB_DEVICE(0x046d, 0x08c5), .driver_info = USB_QUIRK_RESET_RESUME }, |
| 266 |
|
| 267 |
/* Logitech Quickcam OEM Dell Notebook */ |
| 268 |
{ USB_DEVICE(0x046d, 0x08c6), .driver_info = USB_QUIRK_RESET_RESUME }, |
| 269 |
|
| 270 |
/* Logitech Quickcam OEM Cisco VT Camera II */ |
| 271 |
{ USB_DEVICE(0x046d, 0x08c7), .driver_info = USB_QUIRK_RESET_RESUME }, |
| 272 |
|
| 273 |
/* Logitech Harmony 700-series */ |
| 274 |
{ USB_DEVICE(0x046d, 0xc122), .driver_info = USB_QUIRK_DELAY_INIT }, |
| 275 |
|
| 276 |
/* Philips PSC805 audio device */ |
| 277 |
{ USB_DEVICE(0x0471, 0x0155), .driver_info = USB_QUIRK_RESET_RESUME }, |
| 278 |
|
| 279 |
/* Plantronic Audio 655 DSP */ |
| 280 |
{ USB_DEVICE(0x047f, 0xc008), .driver_info = USB_QUIRK_RESET_RESUME }, |
| 281 |
|
| 282 |
/* Plantronic Audio 648 USB */ |
| 283 |
{ USB_DEVICE(0x047f, 0xc013), .driver_info = USB_QUIRK_RESET_RESUME }, |
| 284 |
|
| 285 |
/* Artisman Watchdog Dongle */ |
| 286 |
{ USB_DEVICE(0x04b4, 0x0526), .driver_info = |
| 287 |
USB_QUIRK_CONFIG_INTF_STRINGS }, |
| 288 |
|
| 289 |
/* Microchip Joss Optical infrared touchboard device */ |
| 290 |
{ USB_DEVICE(0x04d8, 0x000c), .driver_info = |
| 291 |
USB_QUIRK_CONFIG_INTF_STRINGS }, |
| 292 |
|
| 293 |
/* CarrolTouch 4000U */ |
| 294 |
{ USB_DEVICE(0x04e7, 0x0009), .driver_info = USB_QUIRK_RESET_RESUME }, |
| 295 |
|
| 296 |
/* CarrolTouch 4500U */ |
| 297 |
{ USB_DEVICE(0x04e7, 0x0030), .driver_info = USB_QUIRK_RESET_RESUME }, |
| 298 |
|
| 299 |
/* Samsung Android phone modem - ID conflict with SPH-I500 */ |
| 300 |
{ USB_DEVICE(0x04e8, 0x6601), .driver_info = |
| 301 |
USB_QUIRK_CONFIG_INTF_STRINGS }, |
| 302 |
|
| 303 |
/* Elan Touchscreen */ |
| 304 |
{ USB_DEVICE(0x04f3, 0x0089), .driver_info = |
| 305 |
USB_QUIRK_DEVICE_QUALIFIER }, |
| 306 |
|
| 307 |
{ USB_DEVICE(0x04f3, 0x009b), .driver_info = |
| 308 |
USB_QUIRK_DEVICE_QUALIFIER }, |
| 309 |
|
| 310 |
{ USB_DEVICE(0x04f3, 0x010c), .driver_info = |
| 311 |
USB_QUIRK_DEVICE_QUALIFIER }, |
| 312 |
|
| 313 |
{ USB_DEVICE(0x04f3, 0x0125), .driver_info = |
| 314 |
USB_QUIRK_DEVICE_QUALIFIER }, |
| 315 |
|
| 316 |
{ USB_DEVICE(0x04f3, 0x016f), .driver_info = |
| 317 |
USB_QUIRK_DEVICE_QUALIFIER }, |
| 318 |
|
| 319 |
{ USB_DEVICE(0x04f3, 0x0381), .driver_info = |
| 320 |
USB_QUIRK_NO_LPM }, |
| 321 |
|
| 322 |
{ USB_DEVICE(0x04f3, 0x21b8), .driver_info = |
| 323 |
USB_QUIRK_DEVICE_QUALIFIER }, |
| 324 |
|
| 325 |
/* Roland SC-8820 */ |
| 326 |
{ USB_DEVICE(0x0582, 0x0007), .driver_info = USB_QUIRK_RESET_RESUME }, |
| 327 |
|
| 328 |
/* Edirol SD-20 */ |
| 329 |
{ USB_DEVICE(0x0582, 0x0027), .driver_info = USB_QUIRK_RESET_RESUME }, |
| 330 |
|
| 331 |
/* Alcor Micro Corp. Hub */ |
| 332 |
{ USB_DEVICE(0x058f, 0x9254), .driver_info = USB_QUIRK_RESET_RESUME }, |
| 333 |
|
| 334 |
/* appletouch */ |
| 335 |
{ USB_DEVICE(0x05ac, 0x021a), .driver_info = USB_QUIRK_RESET_RESUME }, |
| 336 |
|
| 337 |
/* Genesys Logic hub, internally used by KY-688 USB 3.1 Type-C Hub */ |
| 338 |
{ USB_DEVICE(0x05e3, 0x0612), .driver_info = USB_QUIRK_NO_LPM }, |
| 339 |
|
| 340 |
/* ELSA MicroLink 56K */ |
| 341 |
{ USB_DEVICE(0x05cc, 0x2267), .driver_info = USB_QUIRK_RESET_RESUME }, |
| 342 |
|
| 343 |
/* Genesys Logic hub, internally used by Moshi USB to Ethernet Adapter */ |
| 344 |
{ USB_DEVICE(0x05e3, 0x0616), .driver_info = USB_QUIRK_NO_LPM }, |
| 345 |
|
| 346 |
/* Avision AV600U */ |
| 347 |
{ USB_DEVICE(0x0638, 0x0a13), .driver_info = |
| 348 |
USB_QUIRK_STRING_FETCH_255 }, |
| 349 |
|
| 350 |
/* Prolific Single-LUN Mass Storage Card Reader */ |
| 351 |
{ USB_DEVICE(0x067b, 0x2731), .driver_info = USB_QUIRK_DELAY_INIT | |
| 352 |
USB_QUIRK_NO_LPM }, |
| 353 |
|
| 354 |
/* Saitek Cyborg Gold Joystick */ |
| 355 |
{ USB_DEVICE(0x06a3, 0x0006), .driver_info = |
| 356 |
USB_QUIRK_CONFIG_INTF_STRINGS }, |
| 357 |
|
| 358 |
/* Agfa SNAPSCAN 1212U */ |
| 359 |
{ USB_DEVICE(0x06bd, 0x0001), .driver_info = USB_QUIRK_RESET_RESUME }, |
| 360 |
|
| 361 |
/* Guillemot Webcam Hercules Dualpix Exchange (2nd ID) */ |
| 362 |
{ USB_DEVICE(0x06f8, 0x0804), .driver_info = USB_QUIRK_RESET_RESUME }, |
| 363 |
|
| 364 |
/* Guillemot Webcam Hercules Dualpix Exchange*/ |
| 365 |
{ USB_DEVICE(0x06f8, 0x3005), .driver_info = USB_QUIRK_RESET_RESUME }, |
| 366 |
|
| 367 |
/* Guillemot Hercules DJ Console audio card (BZ 208357) */ |
| 368 |
{ USB_DEVICE(0x06f8, 0xb000), .driver_info = |
| 369 |
USB_QUIRK_ENDPOINT_IGNORE }, |
| 370 |
|
| 371 |
/* Midiman M-Audio Keystation 88es */ |
| 372 |
{ USB_DEVICE(0x0763, 0x0192), .driver_info = USB_QUIRK_RESET_RESUME }, |
| 373 |
|
| 374 |
/* SanDisk Ultra Fit and Ultra Flair */ |
| 375 |
{ USB_DEVICE(0x0781, 0x5583), .driver_info = USB_QUIRK_NO_LPM }, |
| 376 |
{ USB_DEVICE(0x0781, 0x5591), .driver_info = USB_QUIRK_NO_LPM }, |
| 377 |
|
| 378 |
/* SanDisk Corp. SanDisk 3.2Gen1 */ |
| 379 |
{ USB_DEVICE(0x0781, 0x5596), .driver_info = USB_QUIRK_DELAY_INIT }, |
| 380 |
{ USB_DEVICE(0x0781, 0x55a3), .driver_info = USB_QUIRK_DELAY_INIT }, |
| 381 |
|
| 382 |
/* SanDisk Extreme 55AE */ |
| 383 |
{ USB_DEVICE(0x0781, 0x55ae), .driver_info = USB_QUIRK_NO_LPM }, |
| 384 |
|
| 385 |
/* Avermedia Live Gamer Ultra 2.1 (GC553G2) - BOS descriptor fetch hangs at SuperSpeed Plus */ |
| 386 |
{ USB_DEVICE(0x07ca, 0x2553), .driver_info = USB_QUIRK_NO_BOS }, |
| 387 |
|
| 388 |
/* Realforce 87U Keyboard */ |
| 389 |
{ USB_DEVICE(0x0853, 0x011b), .driver_info = USB_QUIRK_NO_LPM }, |
| 390 |
|
| 391 |
/* M-Systems Flash Disk Pioneers */ |
| 392 |
{ USB_DEVICE(0x08ec, 0x1000), .driver_info = USB_QUIRK_RESET_RESUME }, |
| 393 |
|
| 394 |
/* Baum Vario Ultra */ |
| 395 |
{ USB_DEVICE(0x0904, 0x6101), .driver_info = |
| 396 |
USB_QUIRK_LINEAR_FRAME_INTR_BINTERVAL }, |
| 397 |
{ USB_DEVICE(0x0904, 0x6102), .driver_info = |
| 398 |
USB_QUIRK_LINEAR_FRAME_INTR_BINTERVAL }, |
| 399 |
{ USB_DEVICE(0x0904, 0x6103), .driver_info = |
| 400 |
USB_QUIRK_LINEAR_FRAME_INTR_BINTERVAL }, |
| 401 |
|
| 402 |
/* Silicon Motion Flash Drive */ |
| 403 |
{ USB_DEVICE(0x090c, 0x1000), .driver_info = USB_QUIRK_DELAY_INIT }, |
| 404 |
{ USB_DEVICE(0x090c, 0x2000), .driver_info = USB_QUIRK_DELAY_INIT }, |
| 405 |
|
| 406 |
/* Sound Devices USBPre2 */ |
| 407 |
{ USB_DEVICE(0x0926, 0x0202), .driver_info = |
| 408 |
USB_QUIRK_ENDPOINT_IGNORE }, |
| 409 |
|
| 410 |
/* Sound Devices MixPre-D */ |
| 411 |
{ USB_DEVICE(0x0926, 0x0208), .driver_info = |
| 412 |
USB_QUIRK_ENDPOINT_IGNORE }, |
| 413 |
|
| 414 |
/* Keytouch QWERTY Panel keyboard */ |
| 415 |
{ USB_DEVICE(0x0926, 0x3333), .driver_info = |
| 416 |
USB_QUIRK_CONFIG_INTF_STRINGS }, |
| 417 |
|
| 418 |
/* Kingston DataTraveler 3.0 */ |
| 419 |
{ USB_DEVICE(0x0951, 0x1666), .driver_info = USB_QUIRK_NO_LPM }, |
| 420 |
|
| 421 |
/* TOSHIBA TransMemory-Mx */ |
| 422 |
{ USB_DEVICE(0x0930, 0x1408), .driver_info = USB_QUIRK_NO_LPM }, |
| 423 |
|
| 424 |
/* NVIDIA Jetson devices in Force Recovery mode */ |
| 425 |
{ USB_DEVICE(0x0955, 0x7018), .driver_info = USB_QUIRK_RESET_RESUME }, |
| 426 |
{ USB_DEVICE(0x0955, 0x7019), .driver_info = USB_QUIRK_RESET_RESUME }, |
| 427 |
{ USB_DEVICE(0x0955, 0x7418), .driver_info = USB_QUIRK_RESET_RESUME }, |
| 428 |
{ USB_DEVICE(0x0955, 0x7721), .driver_info = USB_QUIRK_RESET_RESUME }, |
| 429 |
{ USB_DEVICE(0x0955, 0x7c18), .driver_info = USB_QUIRK_RESET_RESUME }, |
| 430 |
{ USB_DEVICE(0x0955, 0x7e19), .driver_info = USB_QUIRK_RESET_RESUME }, |
| 431 |
{ USB_DEVICE(0x0955, 0x7f21), .driver_info = USB_QUIRK_RESET_RESUME }, |
| 432 |
|
| 433 |
/* X-Rite/Gretag-Macbeth Eye-One Pro display colorimeter */ |
| 434 |
{ USB_DEVICE(0x0971, 0x2000), .driver_info = USB_QUIRK_NO_SET_INTF }, |
| 435 |
|
| 436 |
/* ELMO L-12F document camera */ |
| 437 |
{ USB_DEVICE(0x09a1, 0x0028), .driver_info = USB_QUIRK_DELAY_CTRL_MSG }, |
| 438 |
|
| 439 |
/* Broadcom BCM92035DGROM BT dongle */ |
| 440 |
{ USB_DEVICE(0x0a5c, 0x2021), .driver_info = USB_QUIRK_RESET_RESUME }, |
| 441 |
|
| 442 |
/* MAYA44USB sound device */ |
| 443 |
{ USB_DEVICE(0x0a92, 0x0091), .driver_info = USB_QUIRK_RESET_RESUME }, |
| 444 |
|
| 445 |
/* ASUS Base Station(T100) */ |
| 446 |
{ USB_DEVICE(0x0b05, 0x17e0), .driver_info = |
| 447 |
USB_QUIRK_IGNORE_REMOTE_WAKEUP }, |
| 448 |
|
| 449 |
/* ASUS TUF 4K PRO - BOS descriptor fetch hangs at SuperSpeed Plus */ |
| 450 |
{ USB_DEVICE(0x0b05, 0x1ab9), .driver_info = USB_QUIRK_NO_BOS }, |
| 451 |
|
| 452 |
/* Realtek Semiconductor Corp. Mass Storage Device (Multicard Reader)*/ |
| 453 |
{ USB_DEVICE(0x0bda, 0x0151), .driver_info = USB_QUIRK_CONFIG_INTF_STRINGS }, |
| 454 |
|
| 455 |
/* Realtek hub in Dell WD19 (Type-C) */ |
| 456 |
{ USB_DEVICE(0x0bda, 0x0487), .driver_info = USB_QUIRK_NO_LPM }, |
| 457 |
|
| 458 |
/* Generic RTL8153 based ethernet adapters */ |
| 459 |
{ USB_DEVICE(0x0bda, 0x8153), .driver_info = USB_QUIRK_NO_LPM }, |
| 460 |
|
| 461 |
/* SONiX USB DEVICE Touchpad */ |
| 462 |
{ USB_DEVICE(0x0c45, 0x7056), .driver_info = |
| 463 |
USB_QUIRK_IGNORE_REMOTE_WAKEUP }, |
| 464 |
|
| 465 |
/* Elgato 4K X - BOS descriptor fetch hangs at SuperSpeed Plus */ |
| 466 |
{ USB_DEVICE(0x0fd9, 0x009b), .driver_info = USB_QUIRK_NO_BOS }, |
| 467 |
|
| 468 |
/* Sony Xperia XZ1 Compact (lilac) smartphone in fastboot mode */ |
| 469 |
{ USB_DEVICE(0x0fce, 0x0dde), .driver_info = USB_QUIRK_NO_LPM }, |
| 470 |
|
| 471 |
/* Action Semiconductor flash disk */ |
| 472 |
{ USB_DEVICE(0x10d6, 0x2200), .driver_info = |
| 473 |
USB_QUIRK_STRING_FETCH_255 }, |
| 474 |
|
| 475 |
/* novation SoundControl XL */ |
| 476 |
{ USB_DEVICE(0x1235, 0x0061), .driver_info = USB_QUIRK_RESET_RESUME }, |
| 477 |
|
| 478 |
/* Focusrite Scarlett Solo USB */ |
| 479 |
{ USB_DEVICE(0x1235, 0x8211), .driver_info = |
| 480 |
USB_QUIRK_DISCONNECT_SUSPEND }, |
| 481 |
|
| 482 |
/* Huawei 4G LTE module */ |
| 483 |
{ USB_DEVICE(0x12d1, 0x15bb), .driver_info = |
| 484 |
USB_QUIRK_DISCONNECT_SUSPEND }, |
| 485 |
{ USB_DEVICE(0x12d1, 0x15c1), .driver_info = |
| 486 |
USB_QUIRK_DISCONNECT_SUSPEND }, |
| 487 |
{ USB_DEVICE(0x12d1, 0x15c3), .driver_info = |
| 488 |
USB_QUIRK_DISCONNECT_SUSPEND }, |
| 489 |
|
| 490 |
/* SKYMEDI USB_DRIVE */ |
| 491 |
{ USB_DEVICE(0x1516, 0x8628), .driver_info = USB_QUIRK_RESET_RESUME }, |
| 492 |
|
| 493 |
/* Razer - Razer Blade Keyboard */ |
| 494 |
{ USB_DEVICE(0x1532, 0x0116), .driver_info = |
| 495 |
USB_QUIRK_LINEAR_UFRAME_INTR_BINTERVAL }, |
| 496 |
/* Razer - Razer Kiyo Pro Webcam */ |
| 497 |
{ USB_DEVICE(0x1532, 0x0e05), .driver_info = USB_QUIRK_NO_LPM }, |
| 498 |
|
| 499 |
/* Lenovo ThinkPad OneLink+ Dock twin hub controllers (VIA Labs VL812) */ |
| 500 |
{ USB_DEVICE(0x17ef, 0x1018), .driver_info = USB_QUIRK_RESET_RESUME }, |
| 501 |
{ USB_DEVICE(0x17ef, 0x1019), .driver_info = USB_QUIRK_RESET_RESUME }, |
| 502 |
|
| 503 |
/* Lenovo USB-C to Ethernet Adapter RTL8153-04 */ |
| 504 |
{ USB_DEVICE(0x17ef, 0x720c), .driver_info = USB_QUIRK_NO_LPM }, |
| 505 |
|
| 506 |
/* Lenovo Powered USB-C Travel Hub (4X90S92381, RTL8153 GigE) */ |
| 507 |
{ USB_DEVICE(0x17ef, 0x721e), .driver_info = USB_QUIRK_NO_LPM }, |
| 508 |
|
| 509 |
/* Lenovo ThinkCenter A630Z TI024Gen3 usb-audio */ |
| 510 |
{ USB_DEVICE(0x17ef, 0xa012), .driver_info = |
| 511 |
USB_QUIRK_DISCONNECT_SUSPEND }, |
| 512 |
|
| 513 |
/* Lenovo ThinkPad USB-C Dock Gen2 Ethernet (RTL8153 GigE) */ |
| 514 |
{ USB_DEVICE(0x17ef, 0xa387), .driver_info = USB_QUIRK_NO_LPM }, |
| 515 |
|
| 516 |
/* Lenovo ThinkPad USB-C Dock Gen2 USB 3.1 and USB 2.0 hub controllers */ |
| 517 |
{ USB_DEVICE(0x17ef, 0xa391), .driver_info = USB_QUIRK_NO_LPM }, |
| 518 |
{ USB_DEVICE(0x17ef, 0xa392), .driver_info = USB_QUIRK_NO_LPM }, |
| 519 |
|
| 520 |
/* BUILDWIN Photo Frame */ |
| 521 |
{ USB_DEVICE(0x1908, 0x1315), .driver_info = |
| 522 |
USB_QUIRK_HONOR_BNUMINTERFACES }, |
| 523 |
|
| 524 |
/* Protocol and OTG Electrical Test Device */ |
| 525 |
{ USB_DEVICE(0x1a0a, 0x0200), .driver_info = |
| 526 |
USB_QUIRK_LINEAR_UFRAME_INTR_BINTERVAL }, |
| 527 |
|
| 528 |
/* Terminus Technology Inc. Hub */ |
| 529 |
{ USB_DEVICE(0x1a40, 0x0101), .driver_info = USB_QUIRK_HUB_SLOW_RESET }, |
| 530 |
|
| 531 |
/* Corsair K70 RGB */ |
| 532 |
{ USB_DEVICE(0x1b1c, 0x1b13), .driver_info = USB_QUIRK_DELAY_INIT | |
| 533 |
USB_QUIRK_DELAY_CTRL_MSG }, |
| 534 |
|
| 535 |
/* Corsair Strafe */ |
| 536 |
{ USB_DEVICE(0x1b1c, 0x1b15), .driver_info = USB_QUIRK_DELAY_INIT | |
| 537 |
USB_QUIRK_DELAY_CTRL_MSG }, |
| 538 |
|
| 539 |
/* Corsair Strafe RGB */ |
| 540 |
{ USB_DEVICE(0x1b1c, 0x1b20), .driver_info = USB_QUIRK_DELAY_INIT | |
| 541 |
USB_QUIRK_DELAY_CTRL_MSG }, |
| 542 |
|
| 543 |
/* Corsair K70 LUX RGB */ |
| 544 |
{ USB_DEVICE(0x1b1c, 0x1b33), .driver_info = USB_QUIRK_DELAY_INIT }, |
| 545 |
|
| 546 |
/* Corsair K70 LUX */ |
| 547 |
{ USB_DEVICE(0x1b1c, 0x1b36), .driver_info = USB_QUIRK_DELAY_INIT }, |
| 548 |
|
| 549 |
/* Corsair K70 RGB RAPDIFIRE */ |
| 550 |
{ USB_DEVICE(0x1b1c, 0x1b38), .driver_info = USB_QUIRK_DELAY_INIT | |
| 551 |
USB_QUIRK_DELAY_CTRL_MSG }, |
| 552 |
|
| 553 |
/* START BP-850k Printer */ |
| 554 |
{ USB_DEVICE(0x1bc3, 0x0003), .driver_info = USB_QUIRK_NO_SET_INTF }, |
| 555 |
|
| 556 |
/* MIDI keyboard WORLDE MINI */ |
| 557 |
{ USB_DEVICE(0x1c75, 0x0204), .driver_info = |
| 558 |
USB_QUIRK_CONFIG_INTF_STRINGS }, |
| 559 |
|
| 560 |
/* Acer C120 LED Projector */ |
| 561 |
{ USB_DEVICE(0x1de1, 0xc102), .driver_info = USB_QUIRK_NO_LPM }, |
| 562 |
|
| 563 |
/* Blackmagic Design Intensity Shuttle */ |
| 564 |
{ USB_DEVICE(0x1edb, 0xbd3b), .driver_info = USB_QUIRK_NO_LPM }, |
| 565 |
|
| 566 |
/* Blackmagic Design UltraStudio SDI */ |
| 567 |
{ USB_DEVICE(0x1edb, 0xbd4f), .driver_info = USB_QUIRK_NO_LPM }, |
| 568 |
|
| 569 |
/* Teclast disk */ |
| 570 |
{ USB_DEVICE(0x1f75, 0x0917), .driver_info = USB_QUIRK_NO_LPM }, |
| 571 |
|
| 572 |
/* Hauppauge HVR-950q */ |
| 573 |
{ USB_DEVICE(0x2040, 0x7200), .driver_info = |
| 574 |
USB_QUIRK_CONFIG_INTF_STRINGS }, |
| 575 |
|
| 576 |
/* VLI disk */ |
| 577 |
{ USB_DEVICE(0x2109, 0x0711), .driver_info = USB_QUIRK_NO_LPM }, |
| 578 |
|
| 579 |
/* Raydium Touchscreen */ |
| 580 |
{ USB_DEVICE(0x2386, 0x3114), .driver_info = USB_QUIRK_NO_LPM }, |
| 581 |
|
| 582 |
{ USB_DEVICE(0x2386, 0x3119), .driver_info = USB_QUIRK_NO_LPM }, |
| 583 |
|
| 584 |
{ USB_DEVICE(0x2386, 0x350e), .driver_info = USB_QUIRK_NO_LPM }, |
| 585 |
|
| 586 |
/* UGREEN 35871 - BOS descriptor fetch hangs at SuperSpeed Plus */ |
| 587 |
{ USB_DEVICE(0x2b89, 0x5871), .driver_info = USB_QUIRK_NO_BOS }, |
| 588 |
|
| 589 |
/* APTIV AUTOMOTIVE HUB */ |
| 590 |
{ USB_DEVICE(0x2c48, 0x0132), .driver_info = |
| 591 |
USB_QUIRK_SHORT_SET_ADDRESS_REQ_TIMEOUT }, |
| 592 |
|
| 593 |
/* DJI CineSSD */ |
| 594 |
{ USB_DEVICE(0x2ca3, 0x0031), .driver_info = USB_QUIRK_NO_LPM }, |
| 595 |
|
| 596 |
/* Alcor Link AK9563 SC Reader used in 2022 Lenovo ThinkPads */ |
| 597 |
{ USB_DEVICE(0x2ce3, 0x9563), .driver_info = USB_QUIRK_NO_LPM }, |
| 598 |
|
| 599 |
/* ezcap401 - BOS descriptor fetch hangs at SuperSpeed Plus */ |
| 600 |
{ USB_DEVICE(0x32ed, 0x0401), .driver_info = USB_QUIRK_NO_BOS }, |
| 601 |
|
| 602 |
/* DELL USB GEN2 */ |
| 603 |
{ USB_DEVICE(0x413c, 0xb062), .driver_info = USB_QUIRK_NO_LPM | USB_QUIRK_RESET_RESUME }, |
| 604 |
|
| 605 |
/* VCOM device */ |
| 606 |
{ USB_DEVICE(0x4296, 0x7570), .driver_info = USB_QUIRK_CONFIG_INTF_STRINGS }, |
| 607 |
|
| 608 |
/* Noji-MCS SmartCard Reader */ |
| 609 |
{ USB_DEVICE(0x5131, 0x2007), .driver_info = USB_QUIRK_FORCE_ONE_CONFIG }, |
| 610 |
|
| 611 |
/* INTEL VALUE SSD */ |
| 612 |
{ USB_DEVICE(0x8086, 0xf1a5), .driver_info = USB_QUIRK_RESET_RESUME }, |
| 613 |
|
| 614 |
{ } /* terminating entry must be last */ |
| 615 |
}; |
| 616 |
|
| 617 |
static const struct usb_device_id usb_interface_quirk_list[] = { |
| 618 |
/* Logitech UVC Cameras */ |
| 619 |
{ USB_VENDOR_AND_INTERFACE_INFO(0x046d, USB_CLASS_VIDEO, 1, 0), |
| 620 |
.driver_info = USB_QUIRK_RESET_RESUME }, |
| 621 |
|
| 622 |
{ } /* terminating entry must be last */ |
| 623 |
}; |
| 624 |
|
| 625 |
static const struct usb_device_id usb_amd_resume_quirk_list[] = { |
| 626 |
/* Lenovo Mouse with Pixart controller */ |
| 627 |
{ USB_DEVICE(0x17ef, 0x602e), .driver_info = USB_QUIRK_RESET_RESUME }, |
| 628 |
|
| 629 |
/* Pixart Mouse */ |
| 630 |
{ USB_DEVICE(0x093a, 0x2500), .driver_info = USB_QUIRK_RESET_RESUME }, |
| 631 |
{ USB_DEVICE(0x093a, 0x2510), .driver_info = USB_QUIRK_RESET_RESUME }, |
| 632 |
{ USB_DEVICE(0x093a, 0x2521), .driver_info = USB_QUIRK_RESET_RESUME }, |
| 633 |
{ USB_DEVICE(0x03f0, 0x2b4a), .driver_info = USB_QUIRK_RESET_RESUME }, |
| 634 |
|
| 635 |
/* Logitech Optical Mouse M90/M100 */ |
| 636 |
{ USB_DEVICE(0x046d, 0xc05a), .driver_info = USB_QUIRK_RESET_RESUME }, |
| 637 |
|
| 638 |
{ } /* terminating entry must be last */ |
| 639 |
}; |
| 640 |
|
| 641 |
/* |
| 642 |
* Entries for endpoints that should be ignored when parsing configuration |
| 643 |
* descriptors. |
| 644 |
* |
| 645 |
* Matched for devices with USB_QUIRK_ENDPOINT_IGNORE. |
| 646 |
*/ |
| 647 |
static const struct usb_device_id usb_endpoint_ignore[] = { |
| 648 |
{ USB_DEVICE_INTERFACE_NUMBER(0x06f8, 0xb000, 5), .driver_info = 0x01 }, |
| 649 |
{ USB_DEVICE_INTERFACE_NUMBER(0x06f8, 0xb000, 5), .driver_info = 0x81 }, |
| 650 |
{ USB_DEVICE_INTERFACE_NUMBER(0x0926, 0x0202, 1), .driver_info = 0x85 }, |
| 651 |
{ USB_DEVICE_INTERFACE_NUMBER(0x0926, 0x0208, 1), .driver_info = 0x85 }, |
| 652 |
{ } |
| 653 |
}; |
| 654 |
|
| 655 |
bool usb_endpoint_is_ignored(struct usb_device *udev, |
| 656 |
struct usb_host_interface *intf, |
| 657 |
struct usb_endpoint_descriptor *epd) |
| 658 |
{ |
| 659 |
const struct usb_device_id *id; |
| 660 |
unsigned int address; |
| 661 |
|
| 662 |
for (id = usb_endpoint_ignore; id->match_flags; ++id) { |
| 663 |
if (!usb_match_device(udev, id)) |
| 664 |
continue; |
| 665 |
|
| 666 |
if (!usb_match_one_id_intf(udev, intf, id)) |
| 667 |
continue; |
| 668 |
|
| 669 |
address = id->driver_info; |
| 670 |
if (address == epd->bEndpointAddress) |
| 671 |
return true; |
| 672 |
} |
| 673 |
|
| 674 |
return false; |
| 675 |
} |
| 676 |
|
| 677 |
static bool usb_match_any_interface(struct usb_device *udev, |
| 678 |
const struct usb_device_id *id) |
| 679 |
{ |
| 680 |
unsigned int i; |
| 681 |
|
| 682 |
for (i = 0; i < udev->descriptor.bNumConfigurations; ++i) { |
| 683 |
struct usb_host_config *cfg = &udev->config[i]; |
| 684 |
unsigned int j; |
| 685 |
|
| 686 |
for (j = 0; j < cfg->desc.bNumInterfaces; ++j) { |
| 687 |
struct usb_interface_cache *cache; |
| 688 |
struct usb_host_interface *intf; |
| 689 |
|
| 690 |
cache = cfg->intf_cache[j]; |
| 691 |
if (cache->num_altsetting == 0) |
| 692 |
continue; |
| 693 |
|
| 694 |
intf = &cache->altsetting[0]; |
| 695 |
if (usb_match_one_id_intf(udev, intf, id)) |
| 696 |
return true; |
| 697 |
} |
| 698 |
} |
| 699 |
|
| 700 |
return false; |
| 701 |
} |
| 702 |
|
| 703 |
static int usb_amd_resume_quirk(struct usb_device *udev) |
| 704 |
{ |
| 705 |
struct usb_hcd *hcd; |
| 706 |
|
| 707 |
hcd = bus_to_hcd(udev->bus); |
| 708 |
/* The device should be attached directly to root hub */ |
| 709 |
if (udev->level == 1 && hcd->amd_resume_bug == 1) |
| 710 |
return 1; |
| 711 |
|
| 712 |
return 0; |
| 713 |
} |
| 714 |
|
| 715 |
static u32 usb_detect_static_quirks(struct usb_device *udev, |
| 716 |
const struct usb_device_id *id) |
| 717 |
{ |
| 718 |
u32 quirks = 0; |
| 719 |
|
| 720 |
for (; id->match_flags; id++) { |
| 721 |
if (!usb_match_device(udev, id)) |
| 722 |
continue; |
| 723 |
|
| 724 |
if ((id->match_flags & USB_DEVICE_ID_MATCH_INT_INFO) && |
| 725 |
!usb_match_any_interface(udev, id)) |
| 726 |
continue; |
| 727 |
|
| 728 |
quirks |= (u32)(id->driver_info); |
| 729 |
} |
| 730 |
|
| 731 |
return quirks; |
| 732 |
} |
| 733 |
|
| 734 |
static u32 usb_detect_dynamic_quirks(struct usb_device *udev) |
| 735 |
{ |
| 736 |
u16 vid = le16_to_cpu(udev->descriptor.idVendor); |
| 737 |
u16 pid = le16_to_cpu(udev->descriptor.idProduct); |
| 738 |
int i, flags = 0; |
| 739 |
|
| 740 |
mutex_lock(&quirk_mutex); |
| 741 |
|
| 742 |
for (i = 0; i < quirk_count; i++) { |
| 743 |
if (vid == quirk_list[i].vid && pid == quirk_list[i].pid) { |
| 744 |
flags = quirk_list[i].flags; |
| 745 |
break; |
| 746 |
} |
| 747 |
} |
| 748 |
|
| 749 |
mutex_unlock(&quirk_mutex); |
| 750 |
|
| 751 |
return flags; |
| 752 |
} |
| 753 |
|
| 754 |
/* |
| 755 |
* Detect any quirks the device has, and do any housekeeping for it if needed. |
| 756 |
*/ |
| 757 |
void usb_detect_quirks(struct usb_device *udev) |
| 758 |
{ |
| 759 |
udev->quirks = usb_detect_static_quirks(udev, usb_quirk_list); |
| 760 |
|
| 761 |
/* |
| 762 |
* Pixart-based mice would trigger remote wakeup issue on AMD |
| 763 |
* Yangtze chipset, so set them as RESET_RESUME flag. |
| 764 |
*/ |
| 765 |
if (usb_amd_resume_quirk(udev)) |
| 766 |
udev->quirks |= usb_detect_static_quirks(udev, |
| 767 |
usb_amd_resume_quirk_list); |
| 768 |
|
| 769 |
udev->quirks ^= usb_detect_dynamic_quirks(udev); |
| 770 |
|
| 771 |
if (udev->quirks) |
| 772 |
dev_dbg(&udev->dev, "USB quirks for this device: 0x%x\n", |
| 773 |
udev->quirks); |
| 774 |
|
| 775 |
#ifdef CONFIG_USB_DEFAULT_PERSIST |
| 776 |
if (!(udev->quirks & USB_QUIRK_RESET)) |
| 777 |
udev->persist_enabled = 1; |
| 778 |
#else |
| 779 |
/* Hubs are automatically enabled for USB-PERSIST */ |
| 780 |
if (udev->descriptor.bDeviceClass == USB_CLASS_HUB) |
| 781 |
udev->persist_enabled = 1; |
| 782 |
#endif /* CONFIG_USB_DEFAULT_PERSIST */ |
| 783 |
} |
| 784 |
|
| 785 |
void usb_detect_interface_quirks(struct usb_device *udev) |
| 786 |
{ |
| 787 |
u32 quirks; |
| 788 |
|
| 789 |
quirks = usb_detect_static_quirks(udev, usb_interface_quirk_list); |
| 790 |
if (quirks == 0) |
| 791 |
return; |
| 792 |
|
| 793 |
dev_dbg(&udev->dev, "USB interface quirks for this device: %x\n", |
| 794 |
quirks); |
| 795 |
udev->quirks |= quirks; |
| 796 |
} |
| 797 |
|
| 798 |
void usb_release_quirk_list(void) |
| 799 |
{ |
| 800 |
mutex_lock(&quirk_mutex); |
| 801 |
kfree(quirk_list); |
| 802 |
quirk_list = NULL; |
| 803 |
mutex_unlock(&quirk_mutex); |
| 804 |
} |