Re: [PATCH] usb: core: new quirk to handle devices with zero configurations
From: Jie Deng
Date: Thu Feb 26 2026 - 22:02:19 EST
在 2026/2/26 22:28, Greg Kroah-Hartman 写道:
On Thu, Feb 26, 2026 at 05:47:37PM +0800, Jie Deng wrote:These devices do not comply with the USB spec in terms
Some USB devices incorrectly report bNumConfigurations as 0 in theirReally? Don't devices like this violate the USB spec?
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.
of uploading the device descriptors.
diff --git a/drivers/usb/core/config.c b/drivers/usb/core/config.cBut is the configuration descriptor actually present? This feels odd to
index 1cd5fa61dc76..f60fed224cbb 100644
--- a/drivers/usb/core/config.c
+++ b/drivers/usb/core/config.c
@@ -927,7 +927,12 @@ int usb_get_configuration(struct usb_device *dev)
dev->descriptor.bNumConfigurations = ncfg = USB_MAXCONFIG;
}
- if (ncfg < 1) {
+ if (dev->quirks & USB_QUIRK_FORCE_ONE_CONFIG) {
+ dev_info(ddev, "Device claims zero configurations,
+ forcing to 1\n");
+ dev->descriptor.bNumConfigurations = 1;
+ ncfg = 1;
me.
thanks,
greg k-h
The configuration descriptor exists. I connected this device to the Windows system,
and the device worked normally. By capturing the data packets during the enumeration
process of this device on both the Windows and Linux systems, it was found that when
the bNumConfigurations value was 0 on the Windows system, it would default to using
a single configuration to continue the enumeration. However, on the Linux system,
the enumeration would be terminated.
Jie Deng