X-Git-Url: http://git.linex4red.de/pub/USBasp.git/blobdiff_plain/34dc7f241fe0627e21c3a218123d5d9fbc97374c..bae00a3d42f150482c973a7238f3501ccd026063:/Demos/Host/LowLevel/CDCHost/ConfigDescriptor.c diff --git a/Demos/Host/LowLevel/CDCHost/ConfigDescriptor.c b/Demos/Host/LowLevel/CDCHost/ConfigDescriptor.c index d0fc99457..42636ee56 100644 --- a/Demos/Host/LowLevel/CDCHost/ConfigDescriptor.c +++ b/Demos/Host/LowLevel/CDCHost/ConfigDescriptor.c @@ -53,7 +53,7 @@ uint8_t ProcessConfigurationDescriptor(void) uint8_t FoundEndpoints = 0; /* Retrieve the entire configuration descriptor into the allocated buffer */ - switch (USB_GetDeviceConfigDescriptor(1, &CurrConfigBytesRem, ConfigDescriptorData, sizeof(ConfigDescriptorData))) + switch (USB_Host_GetDeviceConfigDescriptor(1, &CurrConfigBytesRem, ConfigDescriptorData, sizeof(ConfigDescriptorData))) { case HOST_GETCONFIG_Successful: break; @@ -145,6 +145,10 @@ uint8_t ProcessConfigurationDescriptor(void) /* Check if the endpoint is a bulk IN or bulk OUT endpoint */ if (EndpointData->EndpointAddress & ENDPOINT_DESCRIPTOR_DIR_IN) { + /* Kill the configured OUT pipe if the data endpoints are bidirectional */ + if (Pipe_IsEndpointBound(EndpointData->EndpointAddress)) + Pipe_DisablePipe(); + /* Configure the data IN pipe */ Pipe_ConfigurePipe(CDC_DATAPIPE_IN, EP_TYPE_BULK, PIPE_TOKEN_IN, EndpointData->EndpointAddress, EndpointData->EndpointSize, PIPE_BANK_SINGLE); @@ -154,9 +158,13 @@ uint8_t ProcessConfigurationDescriptor(void) } else { - /* Configure the data OUT pipe */ - Pipe_ConfigurePipe(CDC_DATAPIPE_OUT, EP_TYPE_BULK, PIPE_TOKEN_OUT, - EndpointData->EndpointAddress, EndpointData->EndpointSize, PIPE_BANK_SINGLE); + /* Only configure the OUT data pipe if the data endpoints haev not shown to be bidirectional */ + if (!(Pipe_IsEndpointBound(EndpointData->EndpointAddress))) + { + /* Configure the data OUT pipe */ + Pipe_ConfigurePipe(CDC_DATAPIPE_OUT, EP_TYPE_BULK, PIPE_TOKEN_OUT, + EndpointData->EndpointAddress, EndpointData->EndpointSize, PIPE_BANK_SINGLE); + } /* Set the flag indicating that the data OUT pipe has been found */ FoundEndpoints |= (1 << CDC_DATAPIPE_OUT);