Fix to previous patch (make CDCHost demo deallocate pipes when an invalid CDC interface is skipped).
Remove the saving of the USB_GetNextDescriptorComp() return value in all host demos, since it went unused anyway; replaced with a simple check against the success error code for clarity.
This commit is contained in:
parent
fabfdd454a
commit
76d5e99bb8
9 changed files with 46 additions and 34 deletions
|
@ -49,7 +49,6 @@ uint8_t ProcessConfigurationDescriptor(void)
|
|||
{
|
||||
uint8_t* ConfigDescriptorData;
|
||||
uint16_t ConfigDescriptorSize;
|
||||
uint8_t ErrorCode;
|
||||
|
||||
/* Get Configuration Descriptor size from the device */
|
||||
if (USB_GetDeviceConfigDescriptor(&ConfigDescriptorSize, NULL) != HOST_SENDCONTROL_Successful)
|
||||
|
@ -70,14 +69,16 @@ uint8_t ProcessConfigurationDescriptor(void)
|
|||
return InvalidConfigDataReturned;
|
||||
|
||||
/* Get the keyboard interface from the configuration descriptor */
|
||||
if ((ErrorCode = USB_GetNextDescriptorComp(&ConfigDescriptorSize, &ConfigDescriptorData, NextKeyboardInterface)))
|
||||
if (USB_GetNextDescriptorComp(&ConfigDescriptorSize, &ConfigDescriptorData,
|
||||
NextKeyboardInterface) != DESCRIPTOR_SEARCH_COMP_Found)
|
||||
{
|
||||
/* Descriptor not found, error out */
|
||||
return NoHIDInterfaceFound;
|
||||
}
|
||||
|
||||
/* Get the keyboard interface's HID descriptor */
|
||||
if ((ErrorCode = USB_GetNextDescriptorComp(&ConfigDescriptorSize, &ConfigDescriptorData, NextHID)))
|
||||
if (USB_GetNextDescriptorComp(&ConfigDescriptorSize, &ConfigDescriptorData,
|
||||
NextHID) != DESCRIPTOR_SEARCH_COMP_Found)
|
||||
{
|
||||
/* Descriptor not found, error out */
|
||||
return NoHIDDescriptorFound;
|
||||
|
@ -87,8 +88,8 @@ uint8_t ProcessConfigurationDescriptor(void)
|
|||
HIDReportSize = DESCRIPTOR_CAST(ConfigDescriptorData, USB_Descriptor_HID_t).HIDReportLength;
|
||||
|
||||
/* Get the keyboard interface's data endpoint descriptor */
|
||||
if ((ErrorCode = USB_GetNextDescriptorComp(&ConfigDescriptorSize, &ConfigDescriptorData,
|
||||
NextInterfaceKeyboardDataEndpoint)))
|
||||
if (USB_GetNextDescriptorComp(&ConfigDescriptorSize, &ConfigDescriptorData,
|
||||
NextInterfaceKeyboardDataEndpoint) != DESCRIPTOR_SEARCH_COMP_Found)
|
||||
{
|
||||
/* Descriptor not found, error out */
|
||||
return NoEndpointFound;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue