mirror of
https://github.com/apache/nuttx.git
synced 2026-05-26 02:36:11 +08:00
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:
@@ -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 */
|
||||
|
||||
|
||||
Reference in New Issue
Block a user