diff options
author | Dean Camera <dean@fourwalledcubicle.com> | 2009-12-04 09:08:48 +0000 |
---|---|---|
committer | Dean Camera <dean@fourwalledcubicle.com> | 2009-12-04 09:08:48 +0000 |
commit | c49bdcb7c930f2d0e0cf6887b3326f9e8f7f37b3 (patch) | |
tree | 43858ac2a66d50dd0385f1c4de1eea4d685976b5 /Demos | |
parent | 478d9dc04f477c63db990a52a3866f29093b38dc (diff) | |
download | lufa-c49bdcb7c930f2d0e0cf6887b3326f9e8f7f37b3.tar.gz lufa-c49bdcb7c930f2d0e0cf6887b3326f9e8f7f37b3.tar.bz2 lufa-c49bdcb7c930f2d0e0cf6887b3326f9e8f7f37b3.zip |
Fixed Mass Storage Host Class driver and Low Level demo not clearing the error condition if an attached device returns a STALL to a GET MAX LUN request (thanks to Martin Luxen).
Diffstat (limited to 'Demos')
-rw-r--r-- | Demos/Host/LowLevel/MassStorageHost/Lib/MassStoreCommands.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/Demos/Host/LowLevel/MassStorageHost/Lib/MassStoreCommands.c b/Demos/Host/LowLevel/MassStorageHost/Lib/MassStoreCommands.c index ff01dc0f2..edd142525 100644 --- a/Demos/Host/LowLevel/MassStorageHost/Lib/MassStoreCommands.c +++ b/Demos/Host/LowLevel/MassStorageHost/Lib/MassStoreCommands.c @@ -287,13 +287,17 @@ uint8_t MassStore_MassStorageReset(void) /** Issues a Mass Storage class specific request to determine the index of the highest numbered Logical
* Unit in the attached device.
*
+ * \note Some devices do not support this request, and will STALL it when issued. To get around this,
+ * on unsupported devices the max LUN index will be reported as zero and no error will be returned
+ * if the device STALLs the request.
+ *
* \param[out] MaxLUNIndex Pointer to the location that the maximum LUN index value should be stored
*
* \return A value from the USB_Host_SendControlErrorCodes_t enum, or MASS_STORE_SCSI_COMMAND_FAILED if the SCSI command fails
*/
uint8_t MassStore_GetMaxLUN(uint8_t* const MaxLUNIndex)
{
- uint8_t ErrorCode;
+ uint8_t ErrorCode = HOST_SENDCONTROL_Successful;
USB_ControlRequest = (USB_Request_Header_t)
{
@@ -313,7 +317,10 @@ uint8_t MassStore_GetMaxLUN(uint8_t* const MaxLUNIndex) Pipe_ClearStall();
/* Some faulty Mass Storage devices don't implement the GET_MAX_LUN request, so assume a single LUN */
- *MaxLUNIndex = 0;
+ *MaxLUNIndex = 0;
+
+ /* Clear the error, and pretend the request executed correctly if the device STALLed it */
+ ErrorCode = HOST_SENDCONTROL_Successful;
}
return ErrorCode;
|