/** Issues a Mass Storage class specific request to determine the index of the highest numbered Logical\r
* Unit in the attached device.\r
*\r
+ * \note Some devices do not support this request, and will STALL it when issued. To get around this,\r
+ * on unsupported devices the max LUN index will be reported as zero and no error will be returned\r
+ * if the device STALLs the request.\r
+ *\r
* \param[out] MaxLUNIndex Pointer to the location that the maximum LUN index value should be stored\r
*\r
* \return A value from the USB_Host_SendControlErrorCodes_t enum, or MASS_STORE_SCSI_COMMAND_FAILED if the SCSI command fails\r
*/\r
uint8_t MassStore_GetMaxLUN(uint8_t* const MaxLUNIndex)\r
{\r
- uint8_t ErrorCode;\r
+ uint8_t ErrorCode = HOST_SENDCONTROL_Successful;\r
\r
USB_ControlRequest = (USB_Request_Header_t)\r
{\r
Pipe_ClearStall();\r
\r
/* Some faulty Mass Storage devices don't implement the GET_MAX_LUN request, so assume a single LUN */\r
- *MaxLUNIndex = 0; \r
+ *MaxLUNIndex = 0;\r
+ \r
+ /* Clear the error, and pretend the request executed correctly if the device STALLed it */\r
+ ErrorCode = HOST_SENDCONTROL_Successful;\r
}\r
\r
return ErrorCode;\r
\r
uint8_t MS_Host_GetMaxLUN(USB_ClassInfo_MS_Host_t* const MSInterfaceInfo, uint8_t* const MaxLUNIndex)\r
{\r
- uint8_t ErrorCode;\r
+ uint8_t ErrorCode = HOST_SENDCONTROL_Successful;\r
\r
USB_ControlRequest = (USB_Request_Header_t)\r
{\r
Pipe_SelectPipe(PIPE_CONTROLPIPE);\r
\r
if ((ErrorCode = USB_Host_SendControlRequest(MaxLUNIndex)) != HOST_SENDCONTROL_Successful)\r
- *MaxLUNIndex = 0;\r
+ {\r
+ *MaxLUNIndex = 0;\r
+ ErrorCode = HOST_SENDCONTROL_Successful;\r
+ }\r
\r
return ErrorCode;\r
}\r
* UNit, a logical drive) in the device. This value can then be used in the other functions of the Mass Storage\r
* Host mode Class driver to address a specific LUN within the device.\r
*\r
+ * \note Some devices do not support this request, and will STALL it when issued. To get around this,\r
+ * on unsupported devices the max LUN index will be reported as zero and no error will be returned\r
+ * if the device STALLs the request.\r
+ *\r
* \param[in,out] MSInterfaceInfo Pointer to a structure containing a MS Class host configuration and state\r
* \param[out] MaxLUNIndex Pointer to a location where the highest LUN index value should be stored\r
*\r
* - Fixed CDCHost failing on devices with bidirectional endpoints\r
* - Fixed USB driver failing to define the PLL prescaler mask for the ATMEGA8U2 and ATMEGA16U2\r
* - Fixed HID Parser not distributing the Usage Min and Usage Max values across an array of report items\r
+ * - Fixed Mass Storage Host Class driver and Low Level demo not clearing the error condition if an attached device returns a\r
+ * STALL to a GET MAX LUN request (thanks to Martin Luxen)\r
*\r
* \section Sec_ChangeLog091122 Version 091122\r
*\r