X-Git-Url: http://git.linex4red.de/pub/USBasp.git/blobdiff_plain/f3c061d5c8ef95a0bd2ec829cc1d7461af94a845..5acf23b25465b82e5516510ee45aa9ed15178ad5:/LUFA/Drivers/USB/LowLevel/Pipe.c?ds=sidebyside diff --git a/LUFA/Drivers/USB/LowLevel/Pipe.c b/LUFA/Drivers/USB/LowLevel/Pipe.c index 3fb30a2f7..9c6a53e78 100644 --- a/LUFA/Drivers/USB/LowLevel/Pipe.c +++ b/LUFA/Drivers/USB/LowLevel/Pipe.c @@ -70,6 +70,22 @@ void Pipe_ClearPipes(void) } } +bool Pipe_IsEndpointBound(uint8_t EndpointAddress) +{ + uint8_t PrevPipeNumber = Pipe_GetCurrentPipe(); + + for (uint8_t PNum = 0; PNum < PIPE_TOTAL_PIPES; PNum++) + { + Pipe_SelectPipe(PNum); + + if (Pipe_IsConfigured() && (Pipe_BoundEndpointNumber() == EndpointAddress)) + return true; + } + + Pipe_SelectPipe(PrevPipeNumber); + return false; +} + uint8_t Pipe_WaitUntilReady(void) { #if (USB_STREAM_TIMEOUT_MS < 0xFF) @@ -93,7 +109,7 @@ uint8_t Pipe_WaitUntilReady(void) if (Pipe_IsStalled()) return PIPE_READYWAIT_PipeStalled; - else if (!(USB_IsConnected)) + else if (USB_HostState == HOST_STATE_Unattached) return PIPE_READYWAIT_DeviceDisconnected; if (USB_INT_HasOccurred(USB_INT_HSOFI))