diff options
| author | Dean <Dean@d5102386-fcda-11dd-9fdb-3debd5008f28> | 2011-08-24 09:50:21 +0000 |
|---|---|---|
| committer | Dean <Dean@d5102386-fcda-11dd-9fdb-3debd5008f28> | 2011-08-24 09:50:21 +0000 |
| commit | 11732706c2c623ef90fc1c1bc5c9951707d09825 (patch) | |
| tree | 7e7c3fbfacec8914e164c1ac46a46a8fd59ba748 /LUFA/Drivers/USB/Class/Host | |
| parent | bb56a60f7a158382de0c1db4da55a12393b417a3 (diff) | |
Renamed USB_Host_ClearPipeStall() to USB_Host_ClearEndpointStall() as the function works on an endpoint address within the attached device, and not a Pipe within the host.
Updated MS_Host_ResetMSInterface() to now perform a full Mass Storage reset sequence to prevent data corruption in the event of a device lock up or timeout (thanks to David Lyons).
Add parenthesis around the library Endianness macros that do nothing on a particular architecture to prevent operator precedence issues depending on usage.
Minor documentation corrections.
git-svn-id: http://lufa-lib.googlecode.com/svn/trunk@1914 d5102386-fcda-11dd-9fdb-3debd5008f28
Diffstat (limited to 'LUFA/Drivers/USB/Class/Host')
| -rw-r--r-- | LUFA/Drivers/USB/Class/Host/MassStorage.c | 23 | ||||
| -rw-r--r-- | LUFA/Drivers/USB/Class/Host/StillImage.c | 4 |
2 files changed, 20 insertions, 7 deletions
diff --git a/LUFA/Drivers/USB/Class/Host/MassStorage.c b/LUFA/Drivers/USB/Class/Host/MassStorage.c index 60195e98..36503bf4 100644 --- a/LUFA/Drivers/USB/Class/Host/MassStorage.c +++ b/LUFA/Drivers/USB/Class/Host/MassStorage.c @@ -226,8 +226,7 @@ static uint8_t MS_Host_WaitForDataReceived(USB_ClassInfo_MS_Host_t* const MSInte if (Pipe_IsStalled()) { - USB_Host_ClearPipeStall(MSInterfaceInfo->Config.DataOUTPipeNumber); - + USB_Host_ClearEndpointStall(Pipe_GetBoundEndpointAddress()); return PIPE_RWSTREAM_PipeStalled; } @@ -237,8 +236,7 @@ static uint8_t MS_Host_WaitForDataReceived(USB_ClassInfo_MS_Host_t* const MSInte if (Pipe_IsStalled()) { - USB_Host_ClearPipeStall(MSInterfaceInfo->Config.DataINPipeNumber); - + USB_Host_ClearEndpointStall(Pipe_GetBoundEndpointAddress()); return PIPE_RWSTREAM_PipeStalled; } @@ -328,6 +326,8 @@ static uint8_t MS_Host_GetReturnedStatus(USB_ClassInfo_MS_Host_t* const MSInterf uint8_t MS_Host_ResetMSInterface(USB_ClassInfo_MS_Host_t* const MSInterfaceInfo) { + uint8_t ErrorCode; + USB_ControlRequest = (USB_Request_Header_t) { .bmRequestType = (REQDIR_HOSTTODEVICE | REQTYPE_CLASS | REQREC_INTERFACE), @@ -339,7 +339,20 @@ uint8_t MS_Host_ResetMSInterface(USB_ClassInfo_MS_Host_t* const MSInterfaceInfo) Pipe_SelectPipe(PIPE_CONTROLPIPE); - return USB_Host_SendControlRequest(NULL); + if ((ErrorCode = USB_Host_SendControlRequest(NULL)) != HOST_SENDCONTROL_Successful) + return ErrorCode; + + Pipe_SelectPipe(MSInterfaceInfo->Config.DataINPipeNumber); + + if ((ErrorCode = USB_Host_ClearEndpointStall(Pipe_GetBoundEndpointAddress())) != HOST_SENDCONTROL_Successful) + return ErrorCode; + + Pipe_SelectPipe(MSInterfaceInfo->Config.DataOUTPipeNumber); + + if ((ErrorCode = USB_Host_ClearEndpointStall(Pipe_GetBoundEndpointAddress())) != HOST_SENDCONTROL_Successful) + return ErrorCode; + + return HOST_SENDCONTROL_Successful; } uint8_t MS_Host_GetMaxLUN(USB_ClassInfo_MS_Host_t* const MSInterfaceInfo, diff --git a/LUFA/Drivers/USB/Class/Host/StillImage.c b/LUFA/Drivers/USB/Class/Host/StillImage.c index 64cae45f..48aa8643 100644 --- a/LUFA/Drivers/USB/Class/Host/StillImage.c +++ b/LUFA/Drivers/USB/Class/Host/StillImage.c @@ -254,7 +254,7 @@ uint8_t SI_Host_ReceiveBlockHeader(USB_ClassInfo_SI_Host_t* const SIInterfaceInf if (Pipe_IsStalled()) { - USB_Host_ClearPipeStall(SIInterfaceInfo->Config.DataOUTPipeNumber); + USB_Host_ClearEndpointStall(Pipe_GetBoundEndpointAddress()); return PIPE_RWSTREAM_PipeStalled; } @@ -264,7 +264,7 @@ uint8_t SI_Host_ReceiveBlockHeader(USB_ClassInfo_SI_Host_t* const SIInterfaceInf if (Pipe_IsStalled()) { - USB_Host_ClearPipeStall(SIInterfaceInfo->Config.DataINPipeNumber); + USB_Host_ClearEndpointStall(Pipe_GetBoundEndpointAddress()); return PIPE_RWSTREAM_PipeStalled; } |
