Ensure that the CDC class drivers return 0 if the number of unread bytes is queried and the bank has become empty.

This commit is contained in:
Dean Camera 2010-05-06 11:13:24 +00:00
parent c3db72afdc
commit cde2afc50e
3 changed files with 19 additions and 10 deletions

View file

@ -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
{