From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-qt1-f174.google.com (mail-qt1-f174.google.com [209.85.160.174]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 623A63EFD10 for ; Thu, 26 Feb 2026 15:31:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.160.174 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772119886; cv=none; b=Rc3XgN6BvucFviy9yMDWeGTsKAsTQafPB1M3i5AeM3H6WtJld5jOw5us7NdYjLUA8Qy9o9xTVaFgwwzxtAVAt2cZ+Dm9iAV4R/vpk/+i1Lyw1m71WhXExFjWDZGgqBEYBMuUKH74nHJHJSCDhgEE8Upmyvo9d9wYzrZ5O8AU2eI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772119886; c=relaxed/simple; bh=tS/5+s2qy96s4nfeia8V6t/o4A6nX2pPB5PckP91eFk=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=NCmMBArKF5has/aVoRXrvF0o8GLU1fUO3PaZIiAXS0BX+jMUASCHNl3QGYQ4HgGfDejx4pkMjSgQDP+ArM89oi6cC/ySYDPz1PJUcxLSDCLIay1Y1UejRolj1d+5imiA1tJLDsbBanof8XDtnIoRNyVmj/0JQ4tsmEuzppN2BD0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=rowland.harvard.edu; spf=fail smtp.mailfrom=g.harvard.edu; dkim=pass (2048-bit key) header.d=rowland.harvard.edu header.i=@rowland.harvard.edu header.b=DL9tDrvn; arc=none smtp.client-ip=209.85.160.174 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=rowland.harvard.edu Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=g.harvard.edu Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=rowland.harvard.edu header.i=@rowland.harvard.edu header.b="DL9tDrvn" Received: by mail-qt1-f174.google.com with SMTP id d75a77b69052e-506a747448dso8504931cf.0 for ; Thu, 26 Feb 2026 07:31:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rowland.harvard.edu; s=google; t=1772119884; x=1772724684; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=N6X/gMmY66SWl2eWr1aMLFZgJdYPA0TPgB14Mg4UwHM=; b=DL9tDrvnn0gYsCmPUE64hc3Sa8yisVzNJ3oMipyD7m12k/ZP0d7hYbFxTVhCgKD56i 6sF3wex/6rRvXtY7o1pXD5LpytT+FWzLYG+1TX4C6SeO+/kcmGEb8dx/tdkqx/3055R4 LNJUGohHJnDXUOsFOTaTQNCM9jtSSTu0Kq7g2+/iKzdVDK+kHujIGVMuoptNZLqc7yZC CipfBUBJOxpt77/EVjTW324N1iPjKeVk5/PWZI17LRBHAfPcKO/rrFySN0u1kNsJ74lu eyyda2+R1i+gBL+bfcn4WsDnOqzZ+67CXAFywouDtwId0LCtOlTxE6Q4m3MB5pOarQea 3+gA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1772119884; x=1772724684; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-gg:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=N6X/gMmY66SWl2eWr1aMLFZgJdYPA0TPgB14Mg4UwHM=; b=qsUbNSVGZcS6wqq9kCbQcZplO5oSxwlw+DOpXQePPQv5E2UEYl4uXvxowJDg9E93Gh 2rjKZuePXzJRXSF8ECOdplpTRkZfAd5q+RS0BmcKqHyxPxAdz0hXjAwNtImYKKqzDwbl c4iZE9dQxTiqtIa6xGP3sAbm/Kc4mxaNbOClR68/TBzb5R4fbObepF23lLOb2o1oYTBV 3AURZvmUy8fOg4OURUaM3sKZElAbhQuWqN7cVmlJe65QbnM6bAQaaXeju0Pdx8dssywQ ob7HtZR9YhhfPObJ+0orrg+8H/jfEyswMluS71w60rUPX7HRYDTmO0FeZlzwUZTiTb6R ZAMQ== X-Forwarded-Encrypted: i=1; AJvYcCVXcstjgFDmoP3VuVpnWUsoKFUZz2aCv+NkyDhFWKa9F4UIIfUSoXrLyBxh49i7mLCV2qAn31l4UDTplsk=@vger.kernel.org X-Gm-Message-State: AOJu0YxMqmhIIRYyruutOnF14tcLGAdxoQ1JXQkd3X1vpqrIDHQpWA/K PCYChDH0W5eTnOowzF5678Q6pZ3gyaKfyLlzGykNGGqnYkns1HS0ZqudTK9ILvEXAA== X-Gm-Gg: ATEYQzxgKuXeylxAD0+IFfg8UBAD7dap2tSKNa4Hgpv12T3IVlFEq7410E4U0X8sf3r 9qXgYq5+R3HzOpwaPb6RQZhiNkIhXwo/+AHK5Pgf7x3/rKOx36LX0Iv1yVdY8Wv2cG8Kpy/wY03 C7ydWvgwyudOm95bFde/3zwEaUvw0OmQV64mqVWiyxiBF7k8xWdzAUhW0gx+DBjTlIhmHxfEA4o HxYyc8jB0tPruYOukVoQ6o29amxJbddNCk8oo3MlvqRX9frtYDIhZ955jqoUftq/S/MqPHvVYUe tQBfRGiRuv2qS/DiEFRNvLzYckhsfLN48trogx9X6LKHZA4oLSlsDD4Htq2+IWGf0Cy0MizLz3M VUwHkOwDUxt3tzi6aXIwV5stA1VNNTeI+qXp6XREmMYj12k+BDl5OgbdMI6Usebm/VI1mUvaIF6 Ju4dkWg6kvLRH/w3D9BxfOP0ETY6vwYzny/UaWkfvnPA== X-Received: by 2002:ac8:7fc9:0:b0:506:a617:175a with SMTP id d75a77b69052e-50741f2cff7mr64283101cf.22.1772119859896; Thu, 26 Feb 2026 07:30:59 -0800 (PST) Received: from rowland.harvard.edu ([140.247.181.15]) by smtp.gmail.com with ESMTPSA id d75a77b69052e-50744ab3f52sm22311771cf.22.2026.02.26.07.30.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 26 Feb 2026 07:30:59 -0800 (PST) Date: Thu, 26 Feb 2026 10:30:56 -0500 From: Alan Stern To: Jie Deng Cc: Greg Kroah-Hartman , linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] usb: core: new quirk to handle devices with zero configurations Message-ID: <69dfd06e-3745-463d-a634-c6eaf946d962@rowland.harvard.edu> References: <20260226094737.1306471-1-dengjie03@kylinos.cn> Precedence: bulk X-Mailing-List: linux-kernel@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: <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. > > 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 > --- > 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); > 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; What if a device claims to have 2 configurations but the flag is set? This will cause the kernel to ignore the second configuration. > + } esle if (ncfg < 1) { -----------^^ Clearly you never compiled this code. Alan Stern