Renamed the the TotalHIDReports element of the HID descriptor structure in the HID...
[pub/USBasp.git] / LUFA / Drivers / USB / LowLevel / DevChapter9.c
index bf1cb6c..f02bb56 100644 (file)
@@ -131,7 +131,7 @@ static void USB_Device_SetAddress(void)
 \r
 static void USB_Device_SetConfiguration(void)\r
 {\r
-       bool    AlreadyConfigured = (USB_ConfigurationNumber != 0);\r
+       bool AlreadyConfigured = (USB_ConfigurationNumber != 0);\r
 \r
 #if defined(USE_SINGLE_DEVICE_CONFIGURATION)\r
        if ((uint8_t)USB_ControlRequest.wValue > 1)\r
@@ -165,7 +165,7 @@ static void USB_Device_SetConfiguration(void)
 \r
 void USB_Device_GetConfiguration(void)\r
 {\r
-       Endpoint_ClearSETUP();  \r
+       Endpoint_ClearSETUP();\r
 \r
        Endpoint_Write_Byte(USB_ConfigurationNumber);\r
        \r
@@ -188,7 +188,7 @@ static void USB_Device_GetDescriptor(void)
        #if defined(USE_RAM_DESCRIPTORS)\r
        Endpoint_Write_Control_Stream_LE(DescriptorPointer, DescriptorSize);\r
        #else\r
-       bool     SendZLP;\r
+       bool SendZLP;\r
        \r
        if (USB_ControlRequest.wLength > DescriptorSize)\r
          USB_ControlRequest.wLength = DescriptorSize;\r
@@ -274,6 +274,8 @@ static void USB_Device_ClearSetFeature(void)
                case REQREC_DEVICE:\r
                        if ((uint8_t)USB_ControlRequest.wValue == FEATURE_REMOTE_WAKEUP)\r
                          USB_RemoteWakeupEnabled = (USB_ControlRequest.bRequest == REQ_SetFeature);\r
+                       else\r
+                         return;\r
                        \r
                        break;                  \r
 #if !defined(CONTROL_ONLY_DEVICE)\r
@@ -282,33 +284,38 @@ static void USB_Device_ClearSetFeature(void)
                        {\r
                                uint8_t EndpointIndex = ((uint8_t)USB_ControlRequest.wIndex & ENDPOINT_EPNUM_MASK);\r
                                \r
-                               if (EndpointIndex != ENDPOINT_CONTROLEP)\r
-                               {\r
-                                       Endpoint_SelectEndpoint(EndpointIndex);\r
-\r
-                                       if (Endpoint_IsEnabled())\r
-                                       {                               \r
-                                               if (USB_ControlRequest.bRequest == REQ_ClearFeature)\r
-                                               {\r
-                                                       Endpoint_ClearStall();\r
-                                                       Endpoint_ResetFIFO(EndpointIndex);\r
-                                                       Endpoint_ResetDataToggle();\r
-                                               }\r
-                                               else\r
-                                               {\r
-                                                       Endpoint_StallTransaction();                                            \r
-                                               }\r
+                               if (EndpointIndex == ENDPOINT_CONTROLEP)\r
+                                 return;\r
+\r
+                               Endpoint_SelectEndpoint(EndpointIndex);\r
+\r
+                               if (Endpoint_IsEnabled())\r
+                               {                               \r
+                                       if (USB_ControlRequest.bRequest == REQ_ClearFeature)\r
+                                       {\r
+                                               Endpoint_ClearStall();\r
+                                               Endpoint_ResetFIFO(EndpointIndex);\r
+                                               Endpoint_ResetDataToggle();\r
+                                       }\r
+                                       else\r
+                                       {\r
+                                               Endpoint_StallTransaction();                                            \r
                                        }\r
-\r
-                                       Endpoint_SelectEndpoint(ENDPOINT_CONTROLEP);\r
-                                       Endpoint_ClearSETUP();\r
-                                       Endpoint_ClearIN();\r
                                }\r
                        }\r
                        \r
                        break;\r
 #endif\r
        }\r
+\r
+       Endpoint_SelectEndpoint(ENDPOINT_CONTROLEP);\r
+\r
+       Endpoint_ClearSETUP();\r
+\r
+       Endpoint_ClearIN();\r
+\r
+       while (!(Endpoint_IsOUTReceived()));\r
+       Endpoint_ClearOUT();\r
 }\r
 \r
 #endif\r