X-Git-Url: http://git.linex4red.de/pub/USBasp.git/blobdiff_plain/cff190b8f47416698f3783e1e7711f0864713f73..a233109909f0e8d3cf578733f088a20474b3c43f:/LUFA/Drivers/USB/Class/Host/MassStorage.c?ds=inline diff --git a/LUFA/Drivers/USB/Class/Host/MassStorage.c b/LUFA/Drivers/USB/Class/Host/MassStorage.c index 60195e987..36503bf45 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,