Fixed Set/Clear Feature requests directed to a non-configured endpoint not returning...
[pub/lufa.git] / LUFA / Drivers / USB / LowLevel / DevChapter9.c
index 7d9e815..17a5fd4 100644 (file)
@@ -323,7 +323,7 @@ static void USB_Device_GetStatus(void)
 #endif\r
 #if !defined(CONTROL_ONLY_DEVICE)\r
                case (REQDIR_DEVICETOHOST | REQTYPE_STANDARD | REQREC_ENDPOINT):\r
-                       Endpoint_SelectEndpoint(USB_ControlRequest.wIndex & 0xFF);\r
+                       Endpoint_SelectEndpoint((uint8_t)USB_ControlRequest.wIndex & ENDPOINT_EPNUM_MASK);\r
 \r
                        CurrentStatus = Endpoint_IsStalled();\r
 \r
@@ -344,7 +344,7 @@ static void USB_Device_GetStatus(void)
 }\r
 \r
 static void USB_Device_ClearSetFeature(void)\r
-{      \r
+{\r
        switch (USB_ControlRequest.bmRequestType & CONTROL_REQTYPE_RECIPIENT)\r
        {\r
 #if !defined(NO_DEVICE_REMOTE_WAKEUP)                  \r
@@ -367,18 +367,18 @@ static void USB_Device_ClearSetFeature(void)
 \r
                                Endpoint_SelectEndpoint(EndpointIndex);\r
 \r
-                               if (Endpoint_IsEnabled())\r
-                               {                               \r
-                                       if (USB_ControlRequest.bRequest == REQ_SetFeature)\r
-                                       {\r
-                                               Endpoint_StallTransaction();\r
-                                       }\r
-                                       else\r
-                                       {\r
-                                               Endpoint_ClearStall();\r
-                                               Endpoint_ResetFIFO(EndpointIndex);\r
-                                               Endpoint_ResetDataToggle();\r
-                                       }                                       \r
+                               if (!(Endpoint_IsEnabled()))\r
+                                 return;\r
+\r
+                               if (USB_ControlRequest.bRequest == REQ_SetFeature)\r
+                               {\r
+                                       Endpoint_StallTransaction();\r
+                               }\r
+                               else\r
+                               {\r
+                                       Endpoint_ClearStall();\r
+                                       Endpoint_ResetFIFO(EndpointIndex);\r
+                                       Endpoint_ResetDataToggle();\r
                                }\r
                        }\r
                        \r