mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: Jie Deng <dengjie03@kylinos.cn>
Cc: linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] usb: core: new quirk to handle devices with zero configurations
Date: Thu, 26 Feb 2026 06:28:12 -0800	[thread overview]
Message-ID: <2026022600-employee-unjustly-3db4@gregkh> (raw)
In-Reply-To: <20260226094737.1306471-1-dengjie03@kylinos.cn>

On Thu, Feb 26, 2026 at 05:47:37PM +0800, Jie Deng wrote:
> 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.

Really?  Don't devices like this violate the USB spec?

> 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>
> ---
>  Documentation/admin-guide/kernel-parameters.txt | 3 +++
>  drivers/usb/core/config.c                       | 7 ++++++-
>  drivers/usb/core/quirks.c                       | 5 +++++
>  include/linux/usb/quirks.h                      | 3 +++
>  4 files changed, 17 insertions(+), 1 deletion(-)
> 
> diff --git a/Documentation/admin-guide/kernel-parameters.txt b/Documentation/admin-guide/kernel-parameters.txt
> index cb850e5290c2..63e6d3ebbd7a 100644
> --- a/Documentation/admin-guide/kernel-parameters.txt
> +++ b/Documentation/admin-guide/kernel-parameters.txt
> @@ -8183,6 +8183,9 @@ Kernel parameters
>  				p = USB_QUIRK_SHORT_SET_ADDRESS_REQ_TIMEOUT
>  					(Reduce timeout of the SET_ADDRESS
>  					request from 5000 ms to 500 ms);
> +				r = USB_QUIRK_FORCE_ONE_CONFIG (Device
> +					claims zero configurations,
> +					forcing to 1);

Why "r"?

>  			Example: quirks=0781:5580:bk,0a5c:5834:gij
>  
>  	usbhid.mousepoll=
> diff --git a/drivers/usb/core/config.c b/drivers/usb/core/config.c
> 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;

But is the configuration descriptor actually present?  This feels odd to
me.

thanks,

greg k-h

  parent reply	other threads:[~2026-02-26 14:28 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-02-26  9:47 Jie Deng
2026-02-26 12:21 ` kernel test robot
2026-02-26 14:28 ` Greg Kroah-Hartman [this message]
2026-02-27  3:00   ` Jie Deng
2026-02-26 15:30 ` Alan Stern
2026-02-27  1:47   ` Jie Deng

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=2026022600-employee-unjustly-3db4@gregkh \
    --to=gregkh@linuxfoundation.org \
    --cc=dengjie03@kylinos.cn \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®