aboutsummaryrefslogtreecommitdiffstats
path: root/LUFA/Drivers/USB/Class/Device/CDC.c
diff options
context:
space:
mode:
authorDean Camera <dean@fourwalledcubicle.com>2010-01-28 06:37:26 +0000
committerDean Camera <dean@fourwalledcubicle.com>2010-01-28 06:37:26 +0000
commitd26a9ed5fd6fc60a0dfa61d04f5ae2bd7163a85d (patch)
treed8eca51e0d147fa740b47d6ef1bd9eada3248e85 /LUFA/Drivers/USB/Class/Device/CDC.c
parentcec699ac591a679010e07431dfb17823a79856df (diff)
downloadlufa-d26a9ed5fd6fc60a0dfa61d04f5ae2bd7163a85d.tar.gz
lufa-d26a9ed5fd6fc60a0dfa61d04f5ae2bd7163a85d.tar.bz2
lufa-d26a9ed5fd6fc60a0dfa61d04f5ae2bd7163a85d.zip
Be doubly-certain that the incomming CDC class driver's endpoint/pipe is flushed only once when the bank is empty.
Diffstat (limited to 'LUFA/Drivers/USB/Class/Device/CDC.c')
-rw-r--r--LUFA/Drivers/USB/Class/Device/CDC.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/LUFA/Drivers/USB/Class/Device/CDC.c b/LUFA/Drivers/USB/Class/Device/CDC.c
index 16bc01549..b8a673f03 100644
--- a/LUFA/Drivers/USB/Class/Device/CDC.c
+++ b/LUFA/Drivers/USB/Class/Device/CDC.c
@@ -190,10 +190,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)