Fixed incorrect comparison in the descriptor callback routine of the TeensyHID bootlo...
[pub/USBasp.git] / LUFA / Drivers / USB / LowLevel / Template / Template_Endpoint_Control_R.c
index e64f0ed..92b5396 100644 (file)
@@ -2,6 +2,9 @@ uint8_t TEMPLATE_FUNC_NAME (void* Buffer, uint16_t Length)
 {\r
        uint8_t* DataStream = ((uint8_t*)Buffer + TEMPLATE_BUFFER_OFFSET(Length));\r
        \r
+       if (!(Length))\r
+         Endpoint_ClearOUT();\r
+       \r
        while (Length)\r
        {\r
                if (Endpoint_IsSETUPReceived())\r
@@ -9,6 +12,8 @@ uint8_t TEMPLATE_FUNC_NAME (void* Buffer, uint16_t Length)
 \r
                if (USB_DeviceState == DEVICE_STATE_Unattached)\r
                  return ENDPOINT_RWCSTREAM_DeviceDisconnected;\r
+               else if (USB_DeviceState == DEVICE_STATE_Suspended)\r
+                 return ENDPOINT_RWCSTREAM_BusSuspended;\r
                  \r
                if (Endpoint_IsOUTReceived())\r
                {\r
@@ -26,6 +31,8 @@ uint8_t TEMPLATE_FUNC_NAME (void* Buffer, uint16_t Length)
        {\r
                if (USB_DeviceState == DEVICE_STATE_Unattached)\r
                  return ENDPOINT_RWCSTREAM_DeviceDisconnected;\r
+               else if (USB_DeviceState == DEVICE_STATE_Suspended)\r
+                 return ENDPOINT_RWCSTREAM_BusSuspended;\r
        }\r
        \r
        return ENDPOINT_RWCSTREAM_NoError;\r