USB: core: also treat eUSB2V2 as eUSB2 regarding ISO transfers
PATCH 1/1 USB: core: also treat eUSB2V2 as eUSB2 regarding ISO transfers
eUSB2V2 devices use a bcdUSB of 0x0230, not 0x0220 to identify as eUSB2 devices, yet their endpoint companion descriptors must also be parsed.
--- drivers/usb/core/config.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/usb/core/config.c +2 -2
@@ -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);
Signature · 1 line
2.51.0
Quoted 5 lines · Oliver Neukum
eUSB2V2 devices use a bcdUSB of
0x0230, not0x0220to 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.
Quoted 19 lines
Signed-off-by Oliver Neukum <[email protected]>--- drivers/usb/core/config.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)drivers/usb/core/config.c +1
-1@@ -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);
drivers/usb/core/config.c static int usb_parse_endpoint(struct device *ddev, int cfgno, · line 511
Quoted 6 lines
drivers/usb/core/config.c +1
-1@@ -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.
Quoted 6 lines
drivers/usb/core/config.c +0
-0usb_parse_eusb2_isoc_endpoint_companion (ddev, cfgno, inum, asnum, endpoint, buffer, size);Signature · 1 line
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
Quoted 8 lines · Thinh Nguyen
Quoted 5 lines · Oliver Neukum
eUSB2V2 devices use a bcdUSB of
0x0230, not0x0220to 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.
Quoted 21 lines
Quoted 21 lines
Signed-off-by Oliver Neukum <[email protected]>--- drivers/usb/core/config.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)drivers/usb/core/config.c +1
-1@@ -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, }
Quoted 6 lines
drivers/usb/core/config.c static int usb_parse_endpoint(struct device *ddev, int cfgno, · line 511
Quoted 4 lines
drivers/usb/core/config.c +1
-1/* 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
Quoted 6 lines · Oliver Neukum
Quoted 5 lines · Thinh Nguyen
Quoted 4 lines · Oliver Neukum
eUSB2V2 devices use a bcdUSB of
0x0230, not0x0220to identify as eUSB2 devices, yet their endpoint companion descriptors must also be parsed.
Quoted 7 lines
Quoted 3 lines
Quoted 1 line
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
Quoted 6 lines · Oliver Neukum
Quoted 5 lines · Thinh Nguyen
Quoted 4 lines · Oliver Neukum
eUSB2V2 devices use a bcdUSB of
0x0230, not0x0220to identify as eUSB2 devices, yet their endpoint companion descriptors must also be parsed.
Quoted 7 lines
Quoted 3 lines
Quoted 1 line
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