X-Git-Url: http://git.linex4red.de/pub/USBasp.git/blobdiff_plain/44179abcf85acb14fb3aff72ce50ae84281c0f2e..e071f3897a0946c6be1e1b5e1f78eda8dcbf6fc7:/Demos/Host/LowLevel/MassStorageHost/Lib/MassStoreCommands.c diff --git a/Demos/Host/LowLevel/MassStorageHost/Lib/MassStoreCommands.c b/Demos/Host/LowLevel/MassStorageHost/Lib/MassStoreCommands.c index 7ee7de138..d0518df1f 100644 --- a/Demos/Host/LowLevel/MassStorageHost/Lib/MassStoreCommands.c +++ b/Demos/Host/LowLevel/MassStorageHost/Lib/MassStoreCommands.c @@ -154,7 +154,7 @@ static uint8_t MassStore_WaitForDataReceived(void) } /* Check to see if the device was disconnected, if so exit function */ - if (!(USB_IsConnected)) + if (USB_HostState == HOST_STATE_Unattached) return PIPE_RWSTREAM_DeviceDisconnected; }; @@ -206,7 +206,11 @@ static uint8_t MassStore_SendReceiveData(void* BufferPtr) /* Acknowledge the packet */ Pipe_ClearOUT(); - while (!(Pipe_IsOUTReady())); + while (!(Pipe_IsOUTReady())) + { + if (USB_HostState == HOST_STATE_Unattached) + return PIPE_RWSTREAM_DeviceDisconnected; + } } /* Freeze used pipe after use */