Fixed incorrect comparison in the descriptor callback routine of the TeensyHID bootlo...
[pub/USBasp.git] / LUFA / Drivers / USB / Class / Device / CDC.c
index 16bc015..4cdea94 100644 (file)
   this software.\r
 */\r
 \r
+#define  __INCLUDE_FROM_USB_DRIVER\r
 #include "../../HighLevel/USBMode.h"\r
 #if defined(USB_CAN_BE_DEVICE)\r
 \r
-#define  INCLUDE_FROM_CDC_CLASS_DEVICE_C\r
+#define  __INCLUDE_FROM_CDC_CLASS_DEVICE_C\r
+#define  __INCLUDE_FROM_CDC_DRIVER\r
 #include "CDC.h"\r
 \r
 void CDC_Device_Event_Stub(void)\r
@@ -190,10 +192,17 @@ uint16_t CDC_Device_BytesReceived(USB_ClassInfo_CDC_Device_t* const CDCInterface
 \r
        Endpoint_SelectEndpoint(CDCInterfaceInfo->Config.DataOUTEndpointNumber);\r
 \r
-       if (Endpoint_IsOUTReceived() && !(Endpoint_BytesInEndpoint()))\r
-         Endpoint_ClearOUT();\r
+       if (Endpoint_IsOUTReceived())\r
+       {\r
+               if (!(Endpoint_BytesInEndpoint()))\r
+                 Endpoint_ClearOUT();\r
 \r
-       return Endpoint_BytesInEndpoint();\r
+               return Endpoint_BytesInEndpoint();\r
+       }\r
+       else\r
+       {\r
+               return 0;\r
+       }\r
 }\r
 \r
 uint8_t CDC_Device_ReceiveByte(USB_ClassInfo_CDC_Device_t* CDCInterfaceInfo)\r