}\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
/* 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