Linux USB
 help / color / mirror / Atom feed
* [PATCH 1/1] USB: core: also treat eUSB2V2 as eUSB2 regarding ISO transfers
@ 2025-10-06 16:44 Oliver Neukum
  2025-10-06 18:06 ` Thinh Nguyen
  0 siblings, 1 reply; 5+ messages in thread
From: Oliver Neukum @ 2025-10-06 16:44 UTC (permalink / raw)
  To: amardeep.rai, r.kannappan, mathias.nyman, sakari.ailus, stern,
	gregkh, linux-usb
  Cc: Oliver Neukum

eUSB2V2 devices use a bcdUSB of 0x0230, not 0x0220
to identify as eUSB2 devices, yet their endpoint companion
descriptors must also be parsed.

Fixes: c749f058b4371 ("USB: core: Add eUSB2 descriptor and parsing in USB core")
Signed-off-by: Oliver Neukum <oneukum@suse.com>
---
 drivers/usb/core/config.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/usb/core/config.c b/drivers/usb/core/config.c
index baf5bc844b6f..c96ef5e9b74d 100644
--- a/drivers/usb/core/config.c
+++ b/drivers/usb/core/config.c
@@ -455,7 +455,7 @@ static int usb_parse_endpoint(struct device *ddev, int cfgno,
 	 */
 	maxp = le16_to_cpu(endpoint->desc.wMaxPacketSize);
 
-	if (maxp == 0 && bcdUSB != 0x0220 &&
+	if (maxp == 0 && bcdUSB != 0x0220 && bcdUSB != 0x0230 &&
 	    !(usb_endpoint_xfer_isoc(d) && asnum == 0))
 		dev_notice(ddev, "config %d interface %d altsetting %d endpoint 0x%X has invalid wMaxPacketSize 0\n",
 		    cfgno, inum, asnum, d->bEndpointAddress);
@@ -507,7 +507,7 @@ static int usb_parse_endpoint(struct device *ddev, int cfgno,
 	}
 
 	/* Parse a possible eUSB2 periodic endpoint companion descriptor */
-	if (udev->speed == USB_SPEED_HIGH && bcdUSB == 0x0220 &&
+	if (udev->speed == USB_SPEED_HIGH && (bcdUSB == 0x0220 || bcdUSB == 0x0230) &&
 	    !le16_to_cpu(d->wMaxPacketSize) && usb_endpoint_is_isoc_in(d))
 		usb_parse_eusb2_isoc_endpoint_companion(ddev, cfgno, inum, asnum,
 							endpoint, buffer, size);
-- 
2.51.0


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH 1/1] USB: core: also treat eUSB2V2 as eUSB2 regarding ISO transfers
  2025-10-06 16:44 [PATCH 1/1] USB: core: also treat eUSB2V2 as eUSB2 regarding ISO transfers Oliver Neukum
@ 2025-10-06 18:06 ` Thinh Nguyen
  2025-10-06 18:14   ` Oliver Neukum
  0 siblings, 1 reply; 5+ messages in thread
From: Thinh Nguyen @ 2025-10-06 18:06 UTC (permalink / raw)
  To: Oliver Neukum
  Cc: amardeep.rai@intel.com, r.kannappan@intel.com,
	mathias.nyman@linux.intel.com, sakari.ailus@linux.intel.com,
	stern@rowland.harvard.edu, gregkh@linuxfoundation.org,
	linux-usb@vger.kernel.org

On Mon, Oct 06, 2025, Oliver Neukum wrote:
> eUSB2V2 devices use a bcdUSB of 0x0230, not 0x0220
> to identify as eUSB2 devices, yet their endpoint companion
> descriptors must also be parsed.
> 
> Fixes: c749f058b4371 ("USB: core: Add eUSB2 descriptor and parsing in USB core")

This is not a fix.

> Signed-off-by: Oliver Neukum <oneukum@suse.com>
> ---
>  drivers/usb/core/config.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/usb/core/config.c b/drivers/usb/core/config.c
> index baf5bc844b6f..c96ef5e9b74d 100644
> --- a/drivers/usb/core/config.c
> +++ b/drivers/usb/core/config.c
> @@ -455,7 +455,7 @@ static int usb_parse_endpoint(struct device *ddev, int cfgno,
>  	 */
>  	maxp = le16_to_cpu(endpoint->desc.wMaxPacketSize);
>  
> -	if (maxp == 0 && bcdUSB != 0x0220 &&
> +	if (maxp == 0 && bcdUSB != 0x0220 && bcdUSB != 0x0230 &&
>  	    !(usb_endpoint_xfer_isoc(d) && asnum == 0))
>  		dev_notice(ddev, "config %d interface %d altsetting %d endpoint 0x%X has invalid wMaxPacketSize 0\n",
>  		    cfgno, inum, asnum, d->bEndpointAddress);
> @@ -507,7 +507,7 @@ static int usb_parse_endpoint(struct device *ddev, int cfgno,
>  	}
>  
>  	/* Parse a possible eUSB2 periodic endpoint companion descriptor */
> -	if (udev->speed == USB_SPEED_HIGH && bcdUSB == 0x0220 &&
> +	if (udev->speed == USB_SPEED_HIGH && (bcdUSB == 0x0220 || bcdUSB == 0x0230) &&
>  	    !le16_to_cpu(d->wMaxPacketSize) && usb_endpoint_is_isoc_in(d))

eUSB2v2 supports isoc OUT also.

>  		usb_parse_eusb2_isoc_endpoint_companion(ddev, cfgno, inum, asnum,
>  							endpoint, buffer, size);
> -- 
> 2.51.0
> 
> 

We haven't added supported for eUSB2v2, we shouldn't accept 0x0230 yet.
There are some differences in eUSB2v2 more than just the companion
descriptor. (e.g. HSX speed check, bulk MPS feature, adding an
equivalent of usb_endpoint_is_hs_isoc_double check for eUSB2v2, etc).

When adding the support for eUSB2v2, this change is trivial enough
that it can be added then.

Thanks,
Thinh

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH 1/1] USB: core: also treat eUSB2V2 as eUSB2 regarding ISO transfers
  2025-10-06 18:06 ` Thinh Nguyen
@ 2025-10-06 18:14   ` Oliver Neukum
  2025-10-06 18:33     ` Thinh Nguyen
  2025-10-06 18:38     ` Michal Pecio
  0 siblings, 2 replies; 5+ messages in thread
From: Oliver Neukum @ 2025-10-06 18:14 UTC (permalink / raw)
  To: Thinh Nguyen, Oliver Neukum
  Cc: amardeep.rai@intel.com, r.kannappan@intel.com,
	mathias.nyman@linux.intel.com, sakari.ailus@linux.intel.com,
	stern@rowland.harvard.edu, gregkh@linuxfoundation.org,
	linux-usb@vger.kernel.org

On 06.10.25 20:06, Thinh Nguyen wrote:
> On Mon, Oct 06, 2025, Oliver Neukum wrote:
>> eUSB2V2 devices use a bcdUSB of 0x0230, not 0x0220
>> to identify as eUSB2 devices, yet their endpoint companion
>> descriptors must also be parsed.
>>
>> Fixes: c749f058b4371 ("USB: core: Add eUSB2 descriptor and parsing in USB core")
> 
> This is not a fix.

It is backwards compatible to eUSB2V1, isn't it?
So we are failing to treat an eUSB2V2 devices as
an eUSB2V1 device when we should do so.
>> Signed-off-by: Oliver Neukum <oneukum@suse.com>
>> ---
>>   drivers/usb/core/config.c | 4 ++--
>>   1 file changed, 2 insertions(+), 2 deletions(-)
>>
>> diff --git a/drivers/usb/core/config.c b/drivers/usb/core/config.c
>> index baf5bc844b6f..c96ef5e9b74d 100644
>> --- a/drivers/usb/core/config.c
>> +++ b/drivers/usb/core/config.c
>> @@ -455,7 +455,7 @@ static int usb_parse_endpoint(struct device *ddev, int cfgno,
>>   	 */
>>   	maxp = le16_to_cpu(endpoint->desc.wMaxPacketSize);
>>   
>> -	if (maxp == 0 && bcdUSB != 0x0220 &&
>> +	if (maxp == 0 && bcdUSB != 0x0220 && bcdUSB != 0x0230 &&
>>   	    !(usb_endpoint_xfer_isoc(d) && asnum == 0))
>>   		dev_notice(ddev, "config %d interface %d altsetting %d endpoint 0x%X has invalid wMaxPacketSize 0\n",
>>   		    cfgno, inum, asnum, d->bEndpointAddress);
>> @@ -507,7 +507,7 @@ static int usb_parse_endpoint(struct device *ddev, int cfgno,
>>   	}
>>   
>>   	/* Parse a possible eUSB2 periodic endpoint companion descriptor */
>> -	if (udev->speed == USB_SPEED_HIGH && bcdUSB == 0x0220 &&
>> +	if (udev->speed == USB_SPEED_HIGH && (bcdUSB == 0x0220 || bcdUSB == 0x0230) &&
>>   	    !le16_to_cpu(d->wMaxPacketSize) && usb_endpoint_is_isoc_in(d))
> 
> eUSB2v2 supports isoc OUT also.

Noted 
	Regards
		Oliver


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH 1/1] USB: core: also treat eUSB2V2 as eUSB2 regarding ISO transfers
  2025-10-06 18:14   ` Oliver Neukum
@ 2025-10-06 18:33     ` Thinh Nguyen
  2025-10-06 18:38     ` Michal Pecio
  1 sibling, 0 replies; 5+ messages in thread
From: Thinh Nguyen @ 2025-10-06 18:33 UTC (permalink / raw)
  To: Oliver Neukum
  Cc: Thinh Nguyen, amardeep.rai@intel.com, r.kannappan@intel.com,
	mathias.nyman@linux.intel.com, sakari.ailus@linux.intel.com,
	stern@rowland.harvard.edu, gregkh@linuxfoundation.org,
	linux-usb@vger.kernel.org

On Mon, Oct 06, 2025, Oliver Neukum wrote:
> On 06.10.25 20:06, Thinh Nguyen wrote:
> > On Mon, Oct 06, 2025, Oliver Neukum wrote:
> > > eUSB2V2 devices use a bcdUSB of 0x0230, not 0x0220
> > > to identify as eUSB2 devices, yet their endpoint companion
> > > descriptors must also be parsed.
> > > 
> > > Fixes: c749f058b4371 ("USB: core: Add eUSB2 descriptor and parsing in USB core")
> > 
> > This is not a fix.
> 
> It is backwards compatible to eUSB2V1, isn't it?
> So we are failing to treat an eUSB2V2 devices as
> an eUSB2V1 device when we should do so.

Based on my understanding, the Fixes tag should reference a commit that
introduced a bug which this patch resolves. We're adding a check for a
new feature here. If backporting is needed, we can use Cc: stable
instead.

BR,
Thinh

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH 1/1] USB: core: also treat eUSB2V2 as eUSB2 regarding ISO transfers
  2025-10-06 18:14   ` Oliver Neukum
  2025-10-06 18:33     ` Thinh Nguyen
@ 2025-10-06 18:38     ` Michal Pecio
  1 sibling, 0 replies; 5+ messages in thread
From: Michal Pecio @ 2025-10-06 18:38 UTC (permalink / raw)
  To: Oliver Neukum
  Cc: Thinh Nguyen, amardeep.rai@intel.com, r.kannappan@intel.com,
	mathias.nyman@linux.intel.com, sakari.ailus@linux.intel.com,
	stern@rowland.harvard.edu, gregkh@linuxfoundation.org,
	linux-usb@vger.kernel.org

On Mon, 6 Oct 2025 20:14:46 +0200, Oliver Neukum wrote:
> On 06.10.25 20:06, Thinh Nguyen wrote:
> > On Mon, Oct 06, 2025, Oliver Neukum wrote:  
> >> eUSB2V2 devices use a bcdUSB of 0x0230, not 0x0220
> >> to identify as eUSB2 devices, yet their endpoint companion
> >> descriptors must also be parsed.
> >>
> >> Fixes: c749f058b4371 ("USB: core: Add eUSB2 descriptor and parsing in USB core")  
> > 
> > This is not a fix.  
> 
> It is backwards compatible to eUSB2V1, isn't it?
> So we are failing to treat an eUSB2V2 devices as
> an eUSB2V1 device when we should do so.

Hi,

What is the actual problem you are trying to solve?

This descriptor is a v2 extension which is simply not supported
by xhci_hcd and uvcvideo (nor any other in-tree driver AFAIK).

Parsing it will hopefully have no effect at this time, and it could
only have bad effects, if some parts are ready but not others.

Removing the warning alone seems safe, if somebody is complaining.

A device which has this descriptor will hopefully also have alts
which don't have this descriptor, and then it will work as a v1 device
with those alts, whether we parse the v2 descriptor or not.

Any driver with a clue should avoid alts with wMaxPacketSize == 0.

Regards,
Michal

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2025-10-06 18:38 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-10-06 16:44 [PATCH 1/1] USB: core: also treat eUSB2V2 as eUSB2 regarding ISO transfers Oliver Neukum
2025-10-06 18:06 ` Thinh Nguyen
2025-10-06 18:14   ` Oliver Neukum
2025-10-06 18:33     ` Thinh Nguyen
2025-10-06 18:38     ` Michal Pecio

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox