From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id F06D0361DBB; Fri, 27 Feb 2026 06:07:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772172425; cv=none; b=tB7Ed+m5bk36Mffsa9GYQmfacbT7IuxLBy8PMwuI6vOKtwGmYHuB8Z7housbK6xZUtJQ+N7gk38Xn2rE1t6XaQ93c4j0j4t4keox3fE0ey9K+4vrVm/P4BXoWwhZHYamboVX/hS/2rLVEaIAzrmtLgvB0F1kCNAcuWZ1QnqorRU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772172425; c=relaxed/simple; bh=GIu75fxn2gITTgLlJDiazqpWbQhvH+iRh5dVBHubTOA=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=C9vhs7DT9CgMnyR35OwayVaYcBysUVoyeo1xpYiXWlRzFpgdl3OHZtmfkaMVGGUInpLUHVAYIqJpImLH/mbGOv+C02aEoTAftn71KT8Dk2z8Sg4XS7gpAkat6ZMte3JjqXVPGLbwntZ7RuLR6j7o9s5iaEz3ev5OtjAuCHw5kD4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=q+cNVch/; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="q+cNVch/" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 78E1BC116C6; Fri, 27 Feb 2026 06:07:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1772172424; bh=GIu75fxn2gITTgLlJDiazqpWbQhvH+iRh5dVBHubTOA=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=q+cNVch/M4M9gcpY+VBBHOPT/p+9K8ARcEVZsl8aalkhDSdx2Wonj4qZ17hfJ+8IB xVG+AaWWqhFkQfnYBi4/PErSKeewBHEh/M0df+v/GR5kQ76pqe8HUzD+Z/GesKE98J j5m8vCViUp9b768WoXi2MzCbM4a7XEEnrorF9mc0= Date: Thu, 26 Feb 2026 22:06:56 -0800 From: Greg Kroah-Hartman To: Jie Deng Cc: Alan Stern , linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v2] usb: core: new quirk to handle devices with zero configurations Message-ID: <2026022652-padding-backlight-ae49@gregkh> References: <20260227060400.1480039-1-dengjie03@kylinos.cn> Precedence: bulk X-Mailing-List: linux-usb@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20260227060400.1480039-1-dengjie03@kylinos.cn> On Fri, Feb 27, 2026 at 02:04:00PM +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. > > 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 > --- > > Changes in v2: > - Modify the sequence number of the quirks parameter > - Add the judgment condition of ncfg < 1 > Link to v1: https://lore.kernel.org/linux-usb/ > f7999b43-b6e2-44f4-b8e1-c2b5f5d04a5c@kylinos.cn/T/#mb5246d3b3e3bbb334c046bfa9a69b988f2d0688a > --- > 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..7d907efe9f49 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); > + q = USB_QUIRK_FORCE_ONE_CONFIG (Device > + claims zero configurations, > + forcing to 1); > 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..832717549515 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 (ncfg < 1 && dev->quirks & USB_QUIRK_FORCE_ONE_CONFIG) { > + dev_info(ddev, "Device claims zero configurations, " > + "forcing to 1\n"); Do not break a string like this, make it all one line please. checkpatch should have warned you about this? thanks, greg k-h