X-Git-Url: http://git.linex4red.de/pub/USBasp.git/blobdiff_plain/c20a94a4e84c89debf5e7109482ede708a694a0c..e0985b995009d71b80d214a66944e76f4e41aadb:/LUFA/Drivers/USB/LowLevel/DevChapter9.c diff --git a/LUFA/Drivers/USB/LowLevel/DevChapter9.c b/LUFA/Drivers/USB/LowLevel/DevChapter9.c index bf1cb6c8f..6ecadb00d 100644 --- a/LUFA/Drivers/USB/LowLevel/DevChapter9.c +++ b/LUFA/Drivers/USB/LowLevel/DevChapter9.c @@ -118,8 +118,6 @@ static void USB_Device_SetAddress(void) { Endpoint_ClearSETUP(); - while (!(Endpoint_IsINReady())); - Endpoint_ClearIN(); while (!(Endpoint_IsINReady())); @@ -131,7 +129,7 @@ static void USB_Device_SetAddress(void) static void USB_Device_SetConfiguration(void) { - bool AlreadyConfigured = (USB_ConfigurationNumber != 0); + bool AlreadyConfigured = (USB_ConfigurationNumber != 0); #if defined(USE_SINGLE_DEVICE_CONFIGURATION) if ((uint8_t)USB_ControlRequest.wValue > 1) @@ -165,7 +163,7 @@ static void USB_Device_SetConfiguration(void) void USB_Device_GetConfiguration(void) { - Endpoint_ClearSETUP(); + Endpoint_ClearSETUP(); Endpoint_Write_Byte(USB_ConfigurationNumber); @@ -188,7 +186,7 @@ static void USB_Device_GetDescriptor(void) #if defined(USE_RAM_DESCRIPTORS) Endpoint_Write_Control_Stream_LE(DescriptorPointer, DescriptorSize); #else - bool SendZLP; + bool SendZLP; if (USB_ControlRequest.wLength > DescriptorSize) USB_ControlRequest.wLength = DescriptorSize; @@ -274,6 +272,8 @@ static void USB_Device_ClearSetFeature(void) case REQREC_DEVICE: if ((uint8_t)USB_ControlRequest.wValue == FEATURE_REMOTE_WAKEUP) USB_RemoteWakeupEnabled = (USB_ControlRequest.bRequest == REQ_SetFeature); + else + return; break; #if !defined(CONTROL_ONLY_DEVICE) @@ -282,33 +282,35 @@ static void USB_Device_ClearSetFeature(void) { uint8_t EndpointIndex = ((uint8_t)USB_ControlRequest.wIndex & ENDPOINT_EPNUM_MASK); - if (EndpointIndex != ENDPOINT_CONTROLEP) - { - Endpoint_SelectEndpoint(EndpointIndex); - - if (Endpoint_IsEnabled()) - { - if (USB_ControlRequest.bRequest == REQ_ClearFeature) - { - Endpoint_ClearStall(); - Endpoint_ResetFIFO(EndpointIndex); - Endpoint_ResetDataToggle(); - } - else - { - Endpoint_StallTransaction(); - } + if (EndpointIndex == ENDPOINT_CONTROLEP) + return; + + Endpoint_SelectEndpoint(EndpointIndex); + + if (Endpoint_IsEnabled()) + { + if (USB_ControlRequest.bRequest == REQ_ClearFeature) + { + Endpoint_ClearStall(); + Endpoint_ResetFIFO(EndpointIndex); + Endpoint_ResetDataToggle(); + } + else + { + Endpoint_StallTransaction(); } - - Endpoint_SelectEndpoint(ENDPOINT_CONTROLEP); - Endpoint_ClearSETUP(); - Endpoint_ClearIN(); } } break; #endif } + + Endpoint_SelectEndpoint(ENDPOINT_CONTROLEP); + + Endpoint_ClearSETUP(); + + Endpoint_ClearIN(); } #endif