X-Git-Url: http://git.linex4red.de/pub/USBasp.git/blobdiff_plain/431db89b00408197976d653d89d15eeef8172e1b..658234a0b0e380cf42838544515a9807a05600fa:/LUFA/Drivers/USB/Class/Host/CDC.c diff --git a/LUFA/Drivers/USB/Class/Host/CDC.c b/LUFA/Drivers/USB/Class/Host/CDC.c index 8ad37de73..227ab94f8 100644 --- a/LUFA/Drivers/USB/Class/Host/CDC.c +++ b/LUFA/Drivers/USB/Class/Host/CDC.c @@ -182,7 +182,8 @@ static uint8_t DComp_CDC_Host_NextCDCInterfaceEndpoint(void* const CurrentDescri uint8_t EndpointType = (CurrentEndpoint->Attributes & EP_TYPE_MASK); - if ((EndpointType == EP_TYPE_BULK) || (EndpointType == EP_TYPE_INTERRUPT)) + if (((EndpointType == EP_TYPE_BULK) || (EndpointType == EP_TYPE_INTERRUPT)) && + !(Pipe_IsEndpointBound(CurrentEndpoint->EndpointAddress))) { return DESCRIPTOR_SEARCH_Found; } @@ -309,13 +310,22 @@ uint16_t CDC_Host_BytesReceived(USB_ClassInfo_CDC_Host_t* const CDCInterfaceInfo Pipe_SetPipeToken(PIPE_TOKEN_IN); Pipe_Unfreeze(); - if (Pipe_IsINReceived() && !(Pipe_BytesInPipe())) - Pipe_ClearIN(); - - BytesInPipe = Pipe_BytesInPipe(); - Pipe_Freeze(); - - return BytesInPipe; + if (Pipe_IsINReceived()) + { + if (!(Pipe_BytesInPipe())) + Pipe_ClearIN(); + + BytesInPipe = Pipe_BytesInPipe(); + Pipe_Freeze(); + + return BytesInPipe; + } + else + { + Pipe_Freeze(); + + return 0; + } } uint8_t CDC_Host_ReceiveByte(USB_ClassInfo_CDC_Host_t* const CDCInterfaceInfo)