From 2bb3ad2e98af137b9ef031ad95003940658956f5 Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Thu, 20 Jul 2017 10:07:53 -0600 Subject: [PATCH] USB MSC: Add missing logic to define endpoints. The composite changes broke the the non-composite, USB MSC only case because it omitted the critical setup when USB MSC was not part of the composite. --- drivers/usbdev/usbmsc.c | 31 +++++++++++++++++++++++++++---- 1 file changed, 27 insertions(+), 4 deletions(-) diff --git a/drivers/usbdev/usbmsc.c b/drivers/usbdev/usbmsc.c index a16ad86b415..d7558819181 100644 --- a/drivers/usbdev/usbmsc.c +++ b/drivers/usbdev/usbmsc.c @@ -617,10 +617,10 @@ static int usbmsc_setup(FAR struct usbdevclass_driver_s *driver, case USB_DESC_TYPE_CONFIG: { #ifdef CONFIG_USBDEV_DUALSPEED - ret = usbmsc_mkcfgdesc(ctrlreq->buf, dev->speed, - ctrl->value[1]); + ret = usbmsc_mkcfgdesc(ctrlreq->buf, &priv->devinfo, + dev->speed, ctrl->value[1]); #else - ret = usbmsc_mkcfgdesc(ctrlreq->buf); + ret = usbmsc_mkcfgdesc(ctrlreq->buf, &priv->devinfo); #endif } break; @@ -1396,6 +1396,29 @@ int usbmsc_configure(unsigned int nluns, void **handle) drvr->drvr.ops = &g_driverops; drvr->dev = priv; + /* Initialize the device information if we are not part of a composite. + * If we are part of a composite, the device information will be + * initialized through coordinated actions of usbmsc_get_composite_devdesc() + * and board-specific logic. + */ + +#ifndef CONFIG_USBMSC_COMPOSITE + /* minor - not used */ + /* Interfaces (ifnobase == 0) */ + + priv->devinfo.ninterfaces = USBMSC_NINTERFACES; /* Number of interfaces in the configuration */ + + /* Strings (strbase == 0) */ + + priv->devinfo.nstrings = USBMSC_NSTRIDS; /* Number of Strings */ + + /* Endpoints */ + + priv->devinfo.nendpoints = USBMSC_NENDPOINTS; + priv->devinfo.epno[USBMSC_EP_BULKIN_IDX] = CONFIG_USBMSC_EPBULKIN; + priv->devinfo.epno[USBMSC_EP_BULKOUT_IDX] = CONFIG_USBMSC_EPBULKOUT; +#endif + /* Return the handle and success */ *handle = (FAR void *)alloc; @@ -1903,7 +1926,7 @@ void usbmsc_get_composite_devdesc(FAR struct composite_devdesc_s *dev) /* The callback functions for the CDC/ACM class. * - * classobject() and uninitializ() must be provided by board-specific + * classobject() and uninitialize() must be provided by board-specific * logic */