X-Git-Url: http://git.linex4red.de/pub/USBasp.git/blobdiff_plain/71e5bcee3d1121be680990cabe8ae5dff2a78807..fc31973daffea3506051ce51a5f79383ce0867d6:/LUFA/Drivers/USB/Class/Device/CDC.c diff --git a/LUFA/Drivers/USB/Class/Device/CDC.c b/LUFA/Drivers/USB/Class/Device/CDC.c index 16bc01549..4cdea9485 100644 --- a/LUFA/Drivers/USB/Class/Device/CDC.c +++ b/LUFA/Drivers/USB/Class/Device/CDC.c @@ -28,10 +28,12 @@ this software. */ +#define __INCLUDE_FROM_USB_DRIVER #include "../../HighLevel/USBMode.h" #if defined(USB_CAN_BE_DEVICE) -#define INCLUDE_FROM_CDC_CLASS_DEVICE_C +#define __INCLUDE_FROM_CDC_CLASS_DEVICE_C +#define __INCLUDE_FROM_CDC_DRIVER #include "CDC.h" void CDC_Device_Event_Stub(void) @@ -190,10 +192,17 @@ uint16_t CDC_Device_BytesReceived(USB_ClassInfo_CDC_Device_t* const CDCInterface Endpoint_SelectEndpoint(CDCInterfaceInfo->Config.DataOUTEndpointNumber); - if (Endpoint_IsOUTReceived() && !(Endpoint_BytesInEndpoint())) - Endpoint_ClearOUT(); + if (Endpoint_IsOUTReceived()) + { + if (!(Endpoint_BytesInEndpoint())) + Endpoint_ClearOUT(); - return Endpoint_BytesInEndpoint(); + return Endpoint_BytesInEndpoint(); + } + else + { + return 0; + } } uint8_t CDC_Device_ReceiveByte(USB_ClassInfo_CDC_Device_t* CDCInterfaceInfo)