drivers: usbdev: Fix USB descriptor

This commit fixes the regression from https://github.com/apache/nuttx/pull/13190

Signed-off-by: yangsong8 <yangsong8@xiaomi.com>
This commit is contained in:
yangsong8 2024-08-30 16:03:03 +08:00 committed by Alan C. Assis
parent baf79de7e5
commit 918ae4cc84
2 changed files with 16 additions and 6 deletions

View File

@ -1764,7 +1764,7 @@ static int usbclass_setup(FAR struct usbdevclass_driver_s *driver,
case USB_DESC_TYPE_CONFIG:
{
ret = usbclass_mkcfgdesc(ctrlreq->buf,
dev->speed, ctrl->req);
dev->speed, ctrl->value[1]);
}
break;

View File

@ -347,9 +347,11 @@ static const struct usbdev_epinfo_s g_rndis_epintindesc =
.type = USB_DESC_TYPE_ENDPOINT,
#ifndef CONFIG_RNDIS_COMPOSITE
.addr = RNDIS_EPINTIN_ADDR,
#else
.addr = USB_DIR_IN,
#endif
.attr = USB_EP_ATTR_XFER_INT,
.interval = 1
.interval = 10
},
.reqnum = 1,
.fssize = CONFIG_RNDIS_EPINTIN_FSSIZE,
@ -397,6 +399,8 @@ static const struct usbdev_epinfo_s g_rndis_epbulkindesc =
.type = USB_DESC_TYPE_ENDPOINT,
#ifndef CONFIG_RNDIS_COMPOSITE
.addr = RNDIS_EPBULKIN_ADDR,
#else
.addr = USB_DIR_IN,
#endif
.attr = USB_EP_ATTR_XFER_BULK,
#ifdef CONFIG_USBDEV_DUALSPEED
@ -434,6 +438,8 @@ static const struct usbdev_epinfo_s g_rndis_epbulkoutdesc =
.type = USB_DESC_TYPE_ENDPOINT,
#ifndef CONFIG_RNDIS_COMPOSITE
.addr = RNDIS_EPBULKOUT_ADDR,
#else
.addr = USB_DIR_OUT,
#endif
.attr = USB_EP_ATTR_XFER_BULK,
#ifdef CONFIG_USBDEV_DUALSPEED
@ -1944,6 +1950,7 @@ static int16_t usbclass_mkcfgdesc(FAR uint8_t *buf,
uint8_t speed, uint8_t type)
{
uint16_t totallen = 0;
uint8_t epno;
int ret;
/* Check for switches between high and full speed */
@ -2007,8 +2014,9 @@ static int16_t usbclass_mkcfgdesc(FAR uint8_t *buf,
totallen += sizeof(struct usb_ifdesc_s);
epno = devinfo ? devinfo->epno[RNDIS_EP_INTIN_IDX] : 0;
ret = usbdev_copy_epdesc((struct usb_epdesc_s *)buf,
devinfo->epno[RNDIS_EP_INTIN_IDX],
epno,
speed,
&g_rndis_epintindesc);
@ -2032,8 +2040,9 @@ static int16_t usbclass_mkcfgdesc(FAR uint8_t *buf,
totallen += sizeof(struct usb_ifdesc_s);
epno = devinfo ? devinfo->epno[RNDIS_EP_BULKIN_IDX] : 0;
ret = usbdev_copy_epdesc((struct usb_epdesc_s *)buf,
devinfo->epno[RNDIS_EP_BULKIN_IDX],
epno,
speed,
&g_rndis_epbulkindesc);
if (buf != NULL)
@ -2043,8 +2052,9 @@ static int16_t usbclass_mkcfgdesc(FAR uint8_t *buf,
totallen += ret;
epno = devinfo ? devinfo->epno[RNDIS_EP_BULKOUT_IDX] : 0;
ret = usbdev_copy_epdesc((struct usb_epdesc_s *)buf,
devinfo->epno[RNDIS_EP_BULKOUT_IDX],
epno,
speed,
&g_rndis_epbulkoutdesc);
if (buf != NULL)
@ -2508,7 +2518,7 @@ static int usbclass_setup(FAR struct usbdevclass_driver_s *driver,
case USB_DESC_TYPE_CONFIG:
{
ret = usbclass_mkcfgdesc(ctrlreq->buf, &priv->devinfo,
dev->speed, ctrl->req);
dev->speed, ctrl->value[1]);
}
break;
#endif