projects
/
pub
/
USBasp.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Added new USB_DeviceState variable to keep track of the current Device mode USB state.
[pub/USBasp.git]
/
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
7ee7de1
..
d0518df
100644
(file)
--- 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)
}
\r
\r
/* Check to see if the device was disconnected, if so exit function */
\r
}
\r
\r
/* Check to see if the device was disconnected, if so exit function */
\r
- if (
!(USB_IsConnected)
)
\r
+ if (
USB_HostState == HOST_STATE_Unattached
)
\r
return PIPE_RWSTREAM_DeviceDisconnected;
\r
};
\r
\r
return PIPE_RWSTREAM_DeviceDisconnected;
\r
};
\r
\r
@@
-206,7
+206,11
@@
static uint8_t MassStore_SendReceiveData(void* BufferPtr)
/* Acknowledge the packet */
\r
Pipe_ClearOUT();
\r
\r
/* Acknowledge the packet */
\r
Pipe_ClearOUT();
\r
\r
- while (!(Pipe_IsOUTReady()));
\r
+ while (!(Pipe_IsOUTReady()))
\r
+ {
\r
+ if (USB_HostState == HOST_STATE_Unattached)
\r
+ return PIPE_RWSTREAM_DeviceDisconnected;
\r
+ }
\r
}
\r
\r
/* Freeze used pipe after use */
\r
}
\r
\r
/* Freeze used pipe after use */
\r