Changed the parameters and behaviour of the USB_GetDeviceConfigDescriptor() function so that it now performs size checks and data validations internally, to simplify user code.

This commit is contained in:
Dean Camera 2009-08-31 07:48:32 +00:00
parent 813e6f0318
commit 7fbb759287
19 changed files with 232 additions and 254 deletions

View file

@ -72,9 +72,8 @@ int main(void)
uint16_t ConfigDescriptorSize;
uint8_t ConfigDescriptorData[512];
if ((USB_GetDeviceConfigDescriptor(1, &ConfigDescriptorSize, NULL) != HOST_SENDCONTROL_Successful) ||
(ConfigDescriptorSize > sizeof(ConfigDescriptorData)) ||
(USB_GetDeviceConfigDescriptor(1, &ConfigDescriptorSize, ConfigDescriptorData)))
if (USB_GetDeviceConfigDescriptor(1, &ConfigDescriptorSize, ConfigDescriptorData,
sizeof(ConfigDescriptorData)) != HOST_GETCONFIG_Successful)
{
printf("Error Retrieving Configuration Descriptor.\r\n");
LEDs_SetAllLEDs(LEDMASK_USB_ERROR);