Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

usb: core: new quirk to handle devices with zero configurations

Some USB devices incorrectly report bNumConfigurations as 0 in their
device descriptor, which causes the USB core to reject them during
enumeration.
logs:
usb 1-2: device descriptor read/64, error -71
usb 1-2: no configurations
usb 1-2: can't read configurations, error -22

However, these devices actually work correctly when
treated as having a single configuration.

Add a new quirk USB_QUIRK_FORCE_ONE_CONFIG to handle such devices.
When this quirk is set, assume the device has 1 configuration instead
of failing with -EINVAL.

This quirk is applied to the device with VID:PID 5131:2007 which
exhibits this behavior.

Signed-off-by: Jie Deng <dengjie03@kylinos.cn>
Link: https://patch.msgid.link/20260227084931.1527461-1-dengjie03@kylinos.cn
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Jie Deng and committed by
Greg Kroah-Hartman
9f6a983c 45dba801

+16 -1
+3
Documentation/admin-guide/kernel-parameters.txt
··· 8183 8183 p = USB_QUIRK_SHORT_SET_ADDRESS_REQ_TIMEOUT 8184 8184 (Reduce timeout of the SET_ADDRESS 8185 8185 request from 5000 ms to 500 ms); 8186 + q = USB_QUIRK_FORCE_ONE_CONFIG (Device 8187 + claims zero configurations, 8188 + forcing to 1); 8186 8189 Example: quirks=0781:5580:bk,0a5c:5834:gij 8187 8190 8188 8191 usbhid.mousepoll=
+5 -1
drivers/usb/core/config.c
··· 927 927 dev->descriptor.bNumConfigurations = ncfg = USB_MAXCONFIG; 928 928 } 929 929 930 - if (ncfg < 1) { 930 + if (ncfg < 1 && dev->quirks & USB_QUIRK_FORCE_ONE_CONFIG) { 931 + dev_info(ddev, "Device claims zero configurations, forcing to 1\n"); 932 + dev->descriptor.bNumConfigurations = 1; 933 + ncfg = 1; 934 + } else if (ncfg < 1) { 931 935 dev_err(ddev, "no configurations\n"); 932 936 return -EINVAL; 933 937 }
+5
drivers/usb/core/quirks.c
··· 140 140 case 'p': 141 141 flags |= USB_QUIRK_SHORT_SET_ADDRESS_REQ_TIMEOUT; 142 142 break; 143 + case 'q': 144 + flags |= USB_QUIRK_FORCE_ONE_CONFIG; 143 145 /* Ignore unrecognized flag characters */ 144 146 } 145 147 } ··· 590 588 591 589 /* VCOM device */ 592 590 { USB_DEVICE(0x4296, 0x7570), .driver_info = USB_QUIRK_CONFIG_INTF_STRINGS }, 591 + 592 + /* Noji-MCS SmartCard Reader */ 593 + { USB_DEVICE(0x5131, 0x2007), .driver_info = USB_QUIRK_FORCE_ONE_CONFIG }, 593 594 594 595 /* INTEL VALUE SSD */ 595 596 { USB_DEVICE(0x8086, 0xf1a5), .driver_info = USB_QUIRK_RESET_RESUME },
+3
include/linux/usb/quirks.h
··· 78 78 /* skip BOS descriptor request */ 79 79 #define USB_QUIRK_NO_BOS BIT(17) 80 80 81 + /* Device claims zero configurations, forcing to 1 */ 82 + #define USB_QUIRK_FORCE_ONE_CONFIG BIT(18) 83 + 81 84 #endif /* __LINUX_USB_QUIRKS_H */