summaryrefslogtreecommitdiff
path: root/nuttx/drivers/usbhost/usbhost_storage.c
diff options
context:
space:
mode:
authorGregory Nutt <gnutt@nuttx.org>2013-09-09 10:00:16 -0600
committerGregory Nutt <gnutt@nuttx.org>2013-09-09 10:00:16 -0600
commit4425b0261bfdcd4cf8765917dc2b3a8b0d80c177 (patch)
treebfd39a8d3439e9bd78c11cc926b4a6b05cc75c95 /nuttx/drivers/usbhost/usbhost_storage.c
parent8b5a8f98e261f31f15cae44fe8847ada4a0654e0 (diff)
downloadnuttx-4425b0261bfdcd4cf8765917dc2b3a8b0d80c177.tar.gz
nuttx-4425b0261bfdcd4cf8765917dc2b3a8b0d80c177.tar.bz2
nuttx-4425b0261bfdcd4cf8765917dc2b3a8b0d80c177.zip
USB MSC host class driver: Don't bother retrying to initialize the FLASH if the interface is returning fatal transfer errors
Diffstat (limited to 'nuttx/drivers/usbhost/usbhost_storage.c')
-rw-r--r--nuttx/drivers/usbhost/usbhost_storage.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/nuttx/drivers/usbhost/usbhost_storage.c b/nuttx/drivers/usbhost/usbhost_storage.c
index d72203bdf..c6126131f 100644
--- a/nuttx/drivers/usbhost/usbhost_storage.c
+++ b/nuttx/drivers/usbhost/usbhost_storage.c
@@ -1248,6 +1248,19 @@ static inline int usbhost_initvolume(FAR struct usbhost_state_s *priv)
uvdbg("Request sense\n");
ret = usbhost_requestsense(priv);
}
+
+ /* It is acceptable for a mass storage device to respond to the
+ * Test Unit Ready and Request Sense commands with a stall if it is
+ * unable to respond. But other failures mean that something is
+ * wrong and a device reset is in order. The transfer functions will
+ * return -EPERM if the transfer failed due to a stall.
+ */
+
+ if (ret < 0 && ret != -EPERM)
+ {
+ udbg("ERROR: DRVR_TRANSFER returned: %d\n", ret);
+ break;
+ }
}
/* Did the unit become ready? Did an error occur? Or did we time out? */
@@ -1569,6 +1582,7 @@ static inline int usbhost_tfree(FAR struct usbhost_state_s *priv)
priv->tbuffer = NULL;
priv->tbuflen = 0;
}
+
return result;
}