aboutsummaryrefslogtreecommitdiffstats
path: root/Demos/Host/LowLevel/MassStorageHost/Lib/MassStoreCommands.c
diff options
context:
space:
mode:
Diffstat (limited to 'Demos/Host/LowLevel/MassStorageHost/Lib/MassStoreCommands.c')
-rw-r--r--Demos/Host/LowLevel/MassStorageHost/Lib/MassStoreCommands.c8
1 files changed, 6 insertions, 2 deletions
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 */