driver/usbhost: Support obtaining USB3.0 device descriptors

usbhost supports USB 3.0 device descriptors.

Signed-off-by: yangsong8 <yangsong8@xiaomi.com>
This commit is contained in:
yangsong8
2025-05-08 20:27:59 +08:00
committed by Matteo Golin
parent 84d99b7329
commit 7907a5b1c3
+17 -3
View File
@@ -292,7 +292,7 @@ int usbhost_enumerate(FAR struct usbhost_hubport_s *hport,
struct usbhost_id_s id;
size_t maxlen;
unsigned int cfglen;
uint8_t maxpacketsize;
uint16_t maxpacketsize;
uint8_t descsize;
uint8_t funcaddr = 0;
FAR uint8_t *buffer = NULL;
@@ -331,7 +331,14 @@ int usbhost_enumerate(FAR struct usbhost_hubport_s *hport,
* Data packets following a Setup..."
*/
if (hport->speed == USB_SPEED_HIGH)
if (hport->speed >= USB_SPEED_SUPER)
{
/* For super-speed, we must use 512 bytes */
maxpacketsize = 512;
descsize = USB_SIZEOF_DEVDESC;
}
else if (hport->speed == USB_SPEED_HIGH)
{
/* For high-speed, we must use 64 bytes */
@@ -370,7 +377,14 @@ int usbhost_enumerate(FAR struct usbhost_hubport_s *hport,
/* Extract the correct max packetsize from the device descriptor */
maxpacketsize = ((struct usb_devdesc_s *)buffer)->mxpacketsize;
uinfo("maxpacksetsize: %d\n", maxpacketsize);
if (hport->speed >= USB_SPEED_SUPER && maxpacketsize == 9)
{
/* For super-speed, we must use 512 bytes */
maxpacketsize = 512;
}
uinfo("maxpacksetsize: %d speed: %d\n", maxpacketsize, hport->speed);
/* And reconfigure EP0 with the correct maximum packet size */