X-Git-Url: http://git.linex4red.de/pub/lufa.git/blobdiff_plain/44aea22949c40e76b8be6cb56acbd2b155043e6b..c93259fbdbfec154b37fd4c3a4e1b43f5b7265e5:/LUFA/Drivers/USB/Core/USBTask.c diff --git a/LUFA/Drivers/USB/Core/USBTask.c b/LUFA/Drivers/USB/Core/USBTask.c index 71ae47d02..be14611aa 100644 --- a/LUFA/Drivers/USB/Core/USBTask.c +++ b/LUFA/Drivers/USB/Core/USBTask.c @@ -60,17 +60,17 @@ void USB_USBTask(void) #if defined(USB_CAN_BE_DEVICE) static void USB_DeviceTask(void) { - if (USB_DeviceState != DEVICE_STATE_Unattached) - { - uint8_t PrevEndpoint = Endpoint_GetCurrentEndpoint(); + if (USB_DeviceState == DEVICE_STATE_Unattached) + return; - Endpoint_SelectEndpoint(ENDPOINT_CONTROLEP); + uint8_t PrevEndpoint = Endpoint_GetCurrentEndpoint(); - if (Endpoint_IsSETUPReceived()) - USB_Device_ProcessControlRequest(); + Endpoint_SelectEndpoint(ENDPOINT_CONTROLEP); - Endpoint_SelectEndpoint(PrevEndpoint); - } + if (Endpoint_IsSETUPReceived()) + USB_Device_ProcessControlRequest(); + + Endpoint_SelectEndpoint(PrevEndpoint); } #endif