diff options
Diffstat (limited to 'nuttx/drivers')
-rw-r--r-- | nuttx/drivers/usbhost/usbhost_enumerate.c | 15 | ||||
-rw-r--r-- | nuttx/drivers/usbhost/usbhost_storage.c | 12 |
2 files changed, 16 insertions, 11 deletions
diff --git a/nuttx/drivers/usbhost/usbhost_enumerate.c b/nuttx/drivers/usbhost/usbhost_enumerate.c index 36bfa20d1..26b93bf36 100644 --- a/nuttx/drivers/usbhost/usbhost_enumerate.c +++ b/nuttx/drivers/usbhost/usbhost_enumerate.c @@ -42,6 +42,7 @@ #include <sys/types.h> #include <stdint.h> #include <string.h> +#include <unistd.h> #include <errno.h> #include <assert.h> #include <debug.h> @@ -317,7 +318,7 @@ int usbhost_enumerate(FAR struct usbhost_driver_s *drvr, uint8_t funcaddr, DEBUGASSERT(drvr && class); - /* Allocate TD buffers for use in this function. We will need two: + /* Allocate descriptor buffers for use in this function. We will need two: * One for the request and one for the data buffer. */ @@ -400,7 +401,7 @@ int usbhost_enumerate(FAR struct usbhost_driver_s *drvr, uint8_t funcaddr, udbg("ERROR: SETADDRESS DRVR_CTRLOUT returned %d\n", ret); goto errout; } - up_mdelay(2); + usleep(2*1000); /* Modify control pipe with the provided USB device address */ @@ -461,9 +462,9 @@ int usbhost_enumerate(FAR struct usbhost_driver_s *drvr, uint8_t funcaddr, goto errout; } - /* Free the TD that we were using for the request buffer. It is not needed - * further here but it may be needed by the class driver during its connection - * operations. + /* Free the descriptor buffer that we were using for the request buffer. + * It is not needed further here but it may be needed by the class driver + * during its connection operations. */ DRVR_FREE(drvr, (uint8_t*)ctrlreq); @@ -488,9 +489,9 @@ int usbhost_enumerate(FAR struct usbhost_driver_s *drvr, uint8_t funcaddr, } } - /* Some devices may require this delay before initialization */ + /* Some devices may require some delay before initialization */ - up_mdelay(100); + usleep(100*1000); /* Parse the configuration descriptor and bind to the class instance for the * device. This needs to be the last thing done because the class driver diff --git a/nuttx/drivers/usbhost/usbhost_storage.c b/nuttx/drivers/usbhost/usbhost_storage.c index 853287371..2e3136b33 100644 --- a/nuttx/drivers/usbhost/usbhost_storage.c +++ b/nuttx/drivers/usbhost/usbhost_storage.c @@ -42,6 +42,7 @@ #include <stdio.h> #include <stdlib.h> #include <string.h> +#include <unistd.h> #include <semaphore.h> #include <assert.h> #include <errno.h> @@ -724,6 +725,7 @@ static inline int usbhost_testunitready(FAR struct usbhost_state_s *priv) usbhost_dumpcsw((FAR struct usbmsc_csw_s *)priv->tbuffer); } } + return result; } @@ -1195,13 +1197,15 @@ static inline int usbhost_initvolume(FAR struct usbhost_state_s *priv) uvdbg("Get max LUN\n"); ret = usbhost_maxlunreq(priv); - /* Wait for the unit to be ready */ - - for (retries = 0; retries < USBHOST_MAX_RETRIES && ret == OK; retries++) + for (retries = 0; retries < USBHOST_MAX_RETRIES /* && ret == OK */; retries++) { uvdbg("Test unit ready, retries=%d\n", retries); - /* Send TESTUNITREADY to see the unit is ready */ + /* Wait just a bit */ + + usleep(50*1000); + + /* Send TESTUNITREADY to see if the unit is ready */ ret = usbhost_testunitready(priv); if (ret == OK) |