X-Git-Url: http://git.linex4red.de/pub/USBasp.git/blobdiff_plain/fabfdd454a11440a5789a70f6476889b02928438..76d5e99bb8765030a7f99e7b5adf9bae7f92e0ba:/Demos/Host/CDCHost/ConfigDescriptor.c diff --git a/Demos/Host/CDCHost/ConfigDescriptor.c b/Demos/Host/CDCHost/ConfigDescriptor.c index 29afbfaa1..faad3ccd2 100644 --- a/Demos/Host/CDCHost/ConfigDescriptor.c +++ b/Demos/Host/CDCHost/ConfigDescriptor.c @@ -70,7 +70,8 @@ uint8_t ProcessConfigurationDescriptor(void) return InvalidConfigDataReturned; /* Get the CDC control interface from the configuration descriptor */ - if (USB_GetNextDescriptorComp(&ConfigDescriptorSize, &ConfigDescriptorData, NextCDCControlInterface)) + if (USB_GetNextDescriptorComp(&ConfigDescriptorSize, &ConfigDescriptorData, + NextCDCControlInterface) != DESCRIPTOR_SEARCH_COMP_Found) { /* Descriptor not found, error out */ return NoCDCInterfaceFound; @@ -81,13 +82,14 @@ uint8_t ProcessConfigurationDescriptor(void) { /* Fetch the next bulk or interrupt endpoint from the current CDC interface */ if (USB_GetNextDescriptorComp(&ConfigDescriptorSize, &ConfigDescriptorData, - NextInterfaceCDCDataEndpoint)) + NextInterfaceCDCDataEndpoint) != DESCRIPTOR_SEARCH_COMP_Found) { /* Check to see if the control interface's notification pipe has been found, if so search for the data interface */ if (FoundEndpoints & (1 << CDC_NOTIFICATIONPIPE)) { /* Get the next CDC data interface from the configuration descriptor (CDC class has two CDC interfaces) */ - if (USB_GetNextDescriptorComp(&ConfigDescriptorSize, &ConfigDescriptorData, NextCDCDataInterface)) + if (USB_GetNextDescriptorComp(&ConfigDescriptorSize, &ConfigDescriptorData, + NextCDCDataInterface) != DESCRIPTOR_SEARCH_COMP_Found) { /* Descriptor not found, error out */ return NoCDCInterfaceFound; @@ -98,13 +100,17 @@ uint8_t ProcessConfigurationDescriptor(void) /* Clear the found endpoints mask, since any already processed endpoints aren't in the CDC interface we need */ FoundEndpoints = 0; - /* Disable any already configured endpoints from the invalid CDC interfaces */ - Endpoint_DisableEndpoint(CDC_NOTIFICATIONPIPE); - Endpoint_DisableEndpoint(CDC_DATAPIPE_IN); - Endpoint_DisableEndpoint(CDC_DATAPIPE_OUT); + /* Disable any already configured pipes from the invalid CDC interfaces */ + Pipe_SelectPipe(CDC_NOTIFICATIONPIPE); + Pipe_DisablePipe(); + Pipe_SelectPipe(CDC_DATAPIPE_IN); + Pipe_DisablePipe(); + Pipe_SelectPipe(CDC_DATAPIPE_OUT); + Pipe_DisablePipe(); /* Get the next CDC control interface from the configuration descriptor (CDC class has two CDC interfaces) */ - if (USB_GetNextDescriptorComp(&ConfigDescriptorSize, &ConfigDescriptorData, NextCDCControlInterface)) + if (USB_GetNextDescriptorComp(&ConfigDescriptorSize, &ConfigDescriptorData, + NextCDCControlInterface) != DESCRIPTOR_SEARCH_COMP_Found) { /* Descriptor not found, error out */ return NoCDCInterfaceFound; @@ -113,7 +119,7 @@ uint8_t ProcessConfigurationDescriptor(void) /* Fetch the next bulk or interrupt endpoint from the current CDC interface */ if (USB_GetNextDescriptorComp(&ConfigDescriptorSize, &ConfigDescriptorData, - NextInterfaceCDCDataEndpoint)) + NextInterfaceCDCDataEndpoint) != DESCRIPTOR_SEARCH_COMP_Found) { /* Descriptor not found, error out */ return NoEndpointFound;