X-Git-Url: http://git.linex4red.de/pub/USBasp.git/blobdiff_plain/05fa6e0c43e542459000c7ebe0b10cbe24c7f5d9..ab2ae13d81427ddddbd24e8ba6bdfbd2f05ff958:/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 fda47faf5..9c59b5c2d 100644 --- a/LUFA/Drivers/USB/Class/Host/CDC.c +++ b/LUFA/Drivers/USB/Class/Host/CDC.c @@ -34,24 +34,15 @@ #define INCLUDE_FROM_CDC_CLASS_HOST_C #include "CDC.h" -uint8_t CDC_Host_ConfigurePipes(USB_ClassInfo_CDC_Host_t* CDCInterfaceInfo, uint16_t MaxConfigBufferSize) +uint8_t CDC_Host_ConfigurePipes(USB_ClassInfo_CDC_Host_t* CDCInterfaceInfo, uint16_t ConfigDescriptorSize, + uint8_t* ConfigDescriptorData) { - uint8_t* ConfigDescriptorData; - uint16_t ConfigDescriptorSize; uint8_t FoundEndpoints = 0; - if (USB_GetDeviceConfigDescriptor(1, &ConfigDescriptorSize, NULL) != HOST_SENDCONTROL_Successful) - return CDC_ENUMERROR_ControlError; - - if (ConfigDescriptorSize > MaxConfigBufferSize) - return CDC_ENUMERROR_DescriptorTooLarge; - - ConfigDescriptorData = alloca(ConfigDescriptorSize); + memset(&CDCInterfaceInfo->State, 0x00, sizeof(CDCInterfaceInfo->State)); - USB_GetDeviceConfigDescriptor(1, &ConfigDescriptorSize, ConfigDescriptorData); - if (DESCRIPTOR_TYPE(ConfigDescriptorData) != DTYPE_Configuration) - return CDC_ENUMERROR_InvalidConfigDataReturned; + return CDC_ENUMERROR_InvalidConfigDescriptor; if (USB_GetNextDescriptorComp(&ConfigDescriptorSize, &ConfigDescriptorData, DComp_CDC_Host_NextCDCControlInterface) != DESCRIPTOR_SEARCH_COMP_Found) @@ -93,7 +84,7 @@ uint8_t CDC_Host_ConfigurePipes(USB_ClassInfo_CDC_Host_t* CDCInterfaceInfo, uint if (USB_GetNextDescriptorComp(&ConfigDescriptorSize, &ConfigDescriptorData, DComp_CDC_Host_NextInterfaceCDCDataEndpoint) != DESCRIPTOR_SEARCH_COMP_Found) { - return CDC_ENUMERROR_NoEndpointFound; + return CDC_ENUMERROR_EndpointsNotFound; } }