X-Git-Url: http://git.linex4red.de/pub/USBasp.git/blobdiff_plain/73d9fafc0fe42741ad8f609dd4762e2bc14cbd01..2a0c28e6e47c8a173f32fc99cd8666a2633c5c12:/LUFA/Drivers/USB/LowLevel/Template/Template_Endpoint_Control_R.c diff --git a/LUFA/Drivers/USB/LowLevel/Template/Template_Endpoint_Control_R.c b/LUFA/Drivers/USB/LowLevel/Template/Template_Endpoint_Control_R.c index d66edafd6..b85705c22 100644 --- a/LUFA/Drivers/USB/LowLevel/Template/Template_Endpoint_Control_R.c +++ b/LUFA/Drivers/USB/LowLevel/Template/Template_Endpoint_Control_R.c @@ -14,9 +14,16 @@ uint8_t TEMPLATE_FUNC_NAME (void* Buffer, uint16_t Length) Endpoint_ClearOUT(); } + + if (USB_DeviceState == DEVICE_STATE_Unattached) + return ENDPOINT_RWCSTREAM_DeviceDisconnected; } - while (!(Endpoint_IsINReady())); + while (!(Endpoint_IsINReady())) + { + if (USB_DeviceState == DEVICE_STATE_Unattached) + return ENDPOINT_RWCSTREAM_DeviceDisconnected; + } return ENDPOINT_RWCSTREAM_NoError; }