mirror of
https://github.com/apache/nuttx.git
synced 2025-01-13 09:49:21 +08:00
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:
parent
baf79de7e5
commit
918ae4cc84
2 changed files with 16 additions and 6 deletions
|
@ -1764,7 +1764,7 @@ static int usbclass_setup(FAR struct usbdevclass_driver_s *driver,
|
||||||
case USB_DESC_TYPE_CONFIG:
|
case USB_DESC_TYPE_CONFIG:
|
||||||
{
|
{
|
||||||
ret = usbclass_mkcfgdesc(ctrlreq->buf,
|
ret = usbclass_mkcfgdesc(ctrlreq->buf,
|
||||||
dev->speed, ctrl->req);
|
dev->speed, ctrl->value[1]);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
|
@ -347,9 +347,11 @@ static const struct usbdev_epinfo_s g_rndis_epintindesc =
|
||||||
.type = USB_DESC_TYPE_ENDPOINT,
|
.type = USB_DESC_TYPE_ENDPOINT,
|
||||||
#ifndef CONFIG_RNDIS_COMPOSITE
|
#ifndef CONFIG_RNDIS_COMPOSITE
|
||||||
.addr = RNDIS_EPINTIN_ADDR,
|
.addr = RNDIS_EPINTIN_ADDR,
|
||||||
|
#else
|
||||||
|
.addr = USB_DIR_IN,
|
||||||
#endif
|
#endif
|
||||||
.attr = USB_EP_ATTR_XFER_INT,
|
.attr = USB_EP_ATTR_XFER_INT,
|
||||||
.interval = 1
|
.interval = 10
|
||||||
},
|
},
|
||||||
.reqnum = 1,
|
.reqnum = 1,
|
||||||
.fssize = CONFIG_RNDIS_EPINTIN_FSSIZE,
|
.fssize = CONFIG_RNDIS_EPINTIN_FSSIZE,
|
||||||
|
@ -397,6 +399,8 @@ static const struct usbdev_epinfo_s g_rndis_epbulkindesc =
|
||||||
.type = USB_DESC_TYPE_ENDPOINT,
|
.type = USB_DESC_TYPE_ENDPOINT,
|
||||||
#ifndef CONFIG_RNDIS_COMPOSITE
|
#ifndef CONFIG_RNDIS_COMPOSITE
|
||||||
.addr = RNDIS_EPBULKIN_ADDR,
|
.addr = RNDIS_EPBULKIN_ADDR,
|
||||||
|
#else
|
||||||
|
.addr = USB_DIR_IN,
|
||||||
#endif
|
#endif
|
||||||
.attr = USB_EP_ATTR_XFER_BULK,
|
.attr = USB_EP_ATTR_XFER_BULK,
|
||||||
#ifdef CONFIG_USBDEV_DUALSPEED
|
#ifdef CONFIG_USBDEV_DUALSPEED
|
||||||
|
@ -434,6 +438,8 @@ static const struct usbdev_epinfo_s g_rndis_epbulkoutdesc =
|
||||||
.type = USB_DESC_TYPE_ENDPOINT,
|
.type = USB_DESC_TYPE_ENDPOINT,
|
||||||
#ifndef CONFIG_RNDIS_COMPOSITE
|
#ifndef CONFIG_RNDIS_COMPOSITE
|
||||||
.addr = RNDIS_EPBULKOUT_ADDR,
|
.addr = RNDIS_EPBULKOUT_ADDR,
|
||||||
|
#else
|
||||||
|
.addr = USB_DIR_OUT,
|
||||||
#endif
|
#endif
|
||||||
.attr = USB_EP_ATTR_XFER_BULK,
|
.attr = USB_EP_ATTR_XFER_BULK,
|
||||||
#ifdef CONFIG_USBDEV_DUALSPEED
|
#ifdef CONFIG_USBDEV_DUALSPEED
|
||||||
|
@ -1944,6 +1950,7 @@ static int16_t usbclass_mkcfgdesc(FAR uint8_t *buf,
|
||||||
uint8_t speed, uint8_t type)
|
uint8_t speed, uint8_t type)
|
||||||
{
|
{
|
||||||
uint16_t totallen = 0;
|
uint16_t totallen = 0;
|
||||||
|
uint8_t epno;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
/* Check for switches between high and full speed */
|
/* 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);
|
totallen += sizeof(struct usb_ifdesc_s);
|
||||||
|
|
||||||
|
epno = devinfo ? devinfo->epno[RNDIS_EP_INTIN_IDX] : 0;
|
||||||
ret = usbdev_copy_epdesc((struct usb_epdesc_s *)buf,
|
ret = usbdev_copy_epdesc((struct usb_epdesc_s *)buf,
|
||||||
devinfo->epno[RNDIS_EP_INTIN_IDX],
|
epno,
|
||||||
speed,
|
speed,
|
||||||
&g_rndis_epintindesc);
|
&g_rndis_epintindesc);
|
||||||
|
|
||||||
|
@ -2032,8 +2040,9 @@ static int16_t usbclass_mkcfgdesc(FAR uint8_t *buf,
|
||||||
|
|
||||||
totallen += sizeof(struct usb_ifdesc_s);
|
totallen += sizeof(struct usb_ifdesc_s);
|
||||||
|
|
||||||
|
epno = devinfo ? devinfo->epno[RNDIS_EP_BULKIN_IDX] : 0;
|
||||||
ret = usbdev_copy_epdesc((struct usb_epdesc_s *)buf,
|
ret = usbdev_copy_epdesc((struct usb_epdesc_s *)buf,
|
||||||
devinfo->epno[RNDIS_EP_BULKIN_IDX],
|
epno,
|
||||||
speed,
|
speed,
|
||||||
&g_rndis_epbulkindesc);
|
&g_rndis_epbulkindesc);
|
||||||
if (buf != NULL)
|
if (buf != NULL)
|
||||||
|
@ -2043,8 +2052,9 @@ static int16_t usbclass_mkcfgdesc(FAR uint8_t *buf,
|
||||||
|
|
||||||
totallen += ret;
|
totallen += ret;
|
||||||
|
|
||||||
|
epno = devinfo ? devinfo->epno[RNDIS_EP_BULKOUT_IDX] : 0;
|
||||||
ret = usbdev_copy_epdesc((struct usb_epdesc_s *)buf,
|
ret = usbdev_copy_epdesc((struct usb_epdesc_s *)buf,
|
||||||
devinfo->epno[RNDIS_EP_BULKOUT_IDX],
|
epno,
|
||||||
speed,
|
speed,
|
||||||
&g_rndis_epbulkoutdesc);
|
&g_rndis_epbulkoutdesc);
|
||||||
if (buf != NULL)
|
if (buf != NULL)
|
||||||
|
@ -2508,7 +2518,7 @@ static int usbclass_setup(FAR struct usbdevclass_driver_s *driver,
|
||||||
case USB_DESC_TYPE_CONFIG:
|
case USB_DESC_TYPE_CONFIG:
|
||||||
{
|
{
|
||||||
ret = usbclass_mkcfgdesc(ctrlreq->buf, &priv->devinfo,
|
ret = usbclass_mkcfgdesc(ctrlreq->buf, &priv->devinfo,
|
||||||
dev->speed, ctrl->req);
|
dev->speed, ctrl->value[1]);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in a new issue