/*\r
LUFA Library\r
- Copyright (C) Dean Camera, 2009.\r
+ Copyright (C) Dean Camera, 2010.\r
\r
dean [at] fourwalledcubicle [dot] com\r
www.fourwalledcubicle.com\r
*/\r
\r
/*\r
- Copyright 2009 Dean Camera (dean [at] fourwalledcubicle [dot] com)\r
-\r
- Permission to use, copy, modify, and distribute this software\r
- and its documentation for any purpose and without fee is hereby\r
- granted, provided that the above copyright notice appear in all\r
- copies and that both that the copyright notice and this\r
- permission notice and warranty disclaimer appear in supporting\r
- documentation, and that the name of the author not be used in\r
- advertising or publicity pertaining to distribution of the\r
+ Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)\r
+\r
+ Permission to use, copy, modify, distribute, and sell this \r
+ software and its documentation for any purpose is hereby granted\r
+ without fee, provided that the above copyright notice appear in \r
+ all copies and that both that the copyright notice and this\r
+ permission notice and warranty disclaimer appear in supporting \r
+ documentation, and that the name of the author not be used in \r
+ advertising or publicity pertaining to distribution of the \r
software without specific, written prior permission.\r
\r
The author disclaim all warranties with regard to this\r
{\r
uint8_t ErrorCode = PIPE_RWSTREAM_NoError;\r
\r
- /* If an error in the command ocurred, abort */\r
+ /* If an error in the command occurred, abort */\r
if ((ErrorCode = MassStore_WaitForDataReceived()) != PIPE_RWSTREAM_NoError)\r
return ErrorCode;\r
\r
/** 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