diff options
author | Dean Camera <dean@fourwalledcubicle.com> | 2010-05-06 11:13:24 +0000 |
---|---|---|
committer | Dean Camera <dean@fourwalledcubicle.com> | 2010-05-06 11:13:24 +0000 |
commit | cde2afc50e25054a0ba21c4454e7101d7ac02a35 (patch) | |
tree | 6cccd0f8fc206054b4dbc412491c4937b02571c1 /LUFA/Drivers/USB/Class/Host/CDC.c | |
parent | c3db72afdc9928afbf2a8986f6970aa85dd9902a (diff) | |
download | lufa-cde2afc50e25054a0ba21c4454e7101d7ac02a35.tar.gz lufa-cde2afc50e25054a0ba21c4454e7101d7ac02a35.tar.bz2 lufa-cde2afc50e25054a0ba21c4454e7101d7ac02a35.zip |
Ensure that the CDC class drivers return 0 if the number of unread bytes is queried and the bank has become empty.
Diffstat (limited to 'LUFA/Drivers/USB/Class/Host/CDC.c')
-rw-r--r-- | LUFA/Drivers/USB/Class/Host/CDC.c | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/LUFA/Drivers/USB/Class/Host/CDC.c b/LUFA/Drivers/USB/Class/Host/CDC.c index cc1ff8a0b..bc8e089a8 100644 --- a/LUFA/Drivers/USB/Class/Host/CDC.c +++ b/LUFA/Drivers/USB/Class/Host/CDC.c @@ -315,12 +315,16 @@ uint16_t CDC_Host_BytesReceived(USB_ClassInfo_CDC_Host_t* const CDCInterfaceInfo if (Pipe_IsINReceived())
{
if (!(Pipe_BytesInPipe()))
- Pipe_ClearIN();
-
- BytesInPipe = Pipe_BytesInPipe();
- Pipe_Freeze();
-
- return BytesInPipe;
+ {
+ Pipe_ClearIN();
+ Pipe_Freeze();
+ return 0;
+ }
+ else
+ {
+ Pipe_Freeze();
+ return Pipe_BytesInPipe();
+ }
}
else
{
|