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.
return InvalidConfigDataReturned;\r
\r
/* Get the CDC control interface from the configuration descriptor */\r
- if (USB_GetNextDescriptorComp(&ConfigDescriptorSize, &ConfigDescriptorData, NextCDCControlInterface))\r
+ if (USB_GetNextDescriptorComp(&ConfigDescriptorSize, &ConfigDescriptorData,\r
+ NextCDCControlInterface) != DESCRIPTOR_SEARCH_COMP_Found)\r
{\r
/* Descriptor not found, error out */\r
return NoCDCInterfaceFound;\r
{\r
/* Fetch the next bulk or interrupt endpoint from the current CDC interface */\r
if (USB_GetNextDescriptorComp(&ConfigDescriptorSize, &ConfigDescriptorData,\r
- NextInterfaceCDCDataEndpoint))\r
+ NextInterfaceCDCDataEndpoint) != DESCRIPTOR_SEARCH_COMP_Found)\r
{\r
/* Check to see if the control interface's notification pipe has been found, if so search for the data interface */\r
if (FoundEndpoints & (1 << CDC_NOTIFICATIONPIPE))\r
{\r
/* Get the next CDC data interface from the configuration descriptor (CDC class has two CDC interfaces) */\r
- if (USB_GetNextDescriptorComp(&ConfigDescriptorSize, &ConfigDescriptorData, NextCDCDataInterface))\r
+ if (USB_GetNextDescriptorComp(&ConfigDescriptorSize, &ConfigDescriptorData, \r
+ NextCDCDataInterface) != DESCRIPTOR_SEARCH_COMP_Found)\r
{\r
/* Descriptor not found, error out */\r
return NoCDCInterfaceFound;\r
/* Clear the found endpoints mask, since any already processed endpoints aren't in the CDC interface we need */\r
FoundEndpoints = 0;\r
\r
- /* Disable any already configured endpoints from the invalid CDC interfaces */\r
- Endpoint_DisableEndpoint(CDC_NOTIFICATIONPIPE);\r
- Endpoint_DisableEndpoint(CDC_DATAPIPE_IN);\r
- Endpoint_DisableEndpoint(CDC_DATAPIPE_OUT);\r
+ /* Disable any already configured pipes from the invalid CDC interfaces */\r
+ Pipe_SelectPipe(CDC_NOTIFICATIONPIPE);\r
+ Pipe_DisablePipe();\r
+ Pipe_SelectPipe(CDC_DATAPIPE_IN);\r
+ Pipe_DisablePipe();\r
+ Pipe_SelectPipe(CDC_DATAPIPE_OUT);\r
+ Pipe_DisablePipe();\r
\r
/* Get the next CDC control interface from the configuration descriptor (CDC class has two CDC interfaces) */\r
- if (USB_GetNextDescriptorComp(&ConfigDescriptorSize, &ConfigDescriptorData, NextCDCControlInterface))\r
+ if (USB_GetNextDescriptorComp(&ConfigDescriptorSize, &ConfigDescriptorData,\r
+ NextCDCControlInterface) != DESCRIPTOR_SEARCH_COMP_Found)\r
{\r
/* Descriptor not found, error out */\r
return NoCDCInterfaceFound;\r
\r
/* Fetch the next bulk or interrupt endpoint from the current CDC interface */\r
if (USB_GetNextDescriptorComp(&ConfigDescriptorSize, &ConfigDescriptorData,\r
- NextInterfaceCDCDataEndpoint))\r
+ NextInterfaceCDCDataEndpoint) != DESCRIPTOR_SEARCH_COMP_Found)\r
{\r
/* Descriptor not found, error out */\r
return NoEndpointFound;\r
return InvalidConfigDataReturned;\r
\r
/* Get the HID interface from the configuration descriptor */\r
- if (USB_GetNextDescriptorComp(&ConfigDescriptorSize, &ConfigDescriptorData, NextHIDInterface))\r
+ if (USB_GetNextDescriptorComp(&ConfigDescriptorSize, &ConfigDescriptorData,\r
+ NextHIDInterface) != DESCRIPTOR_SEARCH_COMP_Found)\r
{\r
/* Descriptor not found, error out */\r
return NoHIDInterfaceFound;\r
while (FoundEndpoints != ((1 << HID_DATA_IN_PIPE) | (1 << HID_DATA_OUT_PIPE)))\r
{\r
/* Get the next HID interface's data endpoint descriptor */\r
- if (USB_GetNextDescriptorComp(&ConfigDescriptorSize, &ConfigDescriptorData, NextInterfaceHIDDataEndpoint))\r
+ if (USB_GetNextDescriptorComp(&ConfigDescriptorSize, &ConfigDescriptorData,\r
+ NextInterfaceHIDDataEndpoint) != DESCRIPTOR_SEARCH_COMP_Found)\r
{\r
/* Not all HID devices have an OUT endpoint - if we've reached the end of the HID descriptor\r
* but only found the mandatory IN endpoint, it's safe to continue with the device enumeration */\r
return InvalidConfigDataReturned;\r
\r
/* Get the keyboard interface from the configuration descriptor */\r
- if (USB_GetNextDescriptorComp(&ConfigDescriptorSize, &ConfigDescriptorData, NextKeyboardInterface))\r
+ if (USB_GetNextDescriptorComp(&ConfigDescriptorSize, &ConfigDescriptorData,\r
+ NextKeyboardInterface) != DESCRIPTOR_SEARCH_COMP_Found)\r
{\r
/* Descriptor not found, error out */\r
return NoHIDInterfaceFound;\r
\r
/* Get the keyboard interface's data endpoint descriptor */\r
if (USB_GetNextDescriptorComp(&ConfigDescriptorSize, &ConfigDescriptorData,\r
- NextInterfaceKeyboardDataEndpoint))\r
+ NextInterfaceKeyboardDataEndpoint) != DESCRIPTOR_SEARCH_COMP_Found)\r
{\r
/* Descriptor not found, error out */\r
return NoEndpointFound;\r
{\r
uint8_t* ConfigDescriptorData;\r
uint16_t ConfigDescriptorSize;\r
- uint8_t ErrorCode;\r
\r
/* Get Configuration Descriptor size from the device */\r
if (USB_GetDeviceConfigDescriptor(&ConfigDescriptorSize, NULL) != HOST_SENDCONTROL_Successful)\r
return InvalidConfigDataReturned;\r
\r
/* Get the keyboard interface from the configuration descriptor */\r
- if ((ErrorCode = USB_GetNextDescriptorComp(&ConfigDescriptorSize, &ConfigDescriptorData, NextKeyboardInterface)))\r
+ if (USB_GetNextDescriptorComp(&ConfigDescriptorSize, &ConfigDescriptorData,\r
+ NextKeyboardInterface) != DESCRIPTOR_SEARCH_COMP_Found)\r
{\r
/* Descriptor not found, error out */\r
return NoHIDInterfaceFound;\r
}\r
\r
/* Get the keyboard interface's HID descriptor */\r
- if ((ErrorCode = USB_GetNextDescriptorComp(&ConfigDescriptorSize, &ConfigDescriptorData, NextHID)))\r
+ if (USB_GetNextDescriptorComp(&ConfigDescriptorSize, &ConfigDescriptorData,\r
+ NextHID) != DESCRIPTOR_SEARCH_COMP_Found)\r
{\r
/* Descriptor not found, error out */\r
return NoHIDDescriptorFound;\r
HIDReportSize = DESCRIPTOR_CAST(ConfigDescriptorData, USB_Descriptor_HID_t).HIDReportLength;\r
\r
/* Get the keyboard interface's data endpoint descriptor */\r
- if ((ErrorCode = USB_GetNextDescriptorComp(&ConfigDescriptorSize, &ConfigDescriptorData,\r
- NextInterfaceKeyboardDataEndpoint)))\r
+ if (USB_GetNextDescriptorComp(&ConfigDescriptorSize, &ConfigDescriptorData,\r
+ NextInterfaceKeyboardDataEndpoint) != DESCRIPTOR_SEARCH_COMP_Found)\r
{\r
/* Descriptor not found, error out */\r
return NoEndpointFound;\r
{\r
uint8_t* ConfigDescriptorData;\r
uint16_t ConfigDescriptorSize;\r
- uint8_t ErrorCode;\r
uint8_t FoundEndpoints = 0;\r
\r
/* Get Configuration Descriptor size from the device */\r
return InvalidConfigDataReturned;\r
\r
/* Get the mass storage interface from the configuration descriptor */\r
- if ((ErrorCode = USB_GetNextDescriptorComp(&ConfigDescriptorSize, &ConfigDescriptorData,\r
- NextMassStorageInterface)))\r
+ if (USB_GetNextDescriptorComp(&ConfigDescriptorSize, &ConfigDescriptorData,\r
+ NextMassStorageInterface) != DESCRIPTOR_SEARCH_COMP_Found)\r
{\r
/* Descriptor not found, error out */\r
return NoInterfaceFound;\r
while (FoundEndpoints != ((1 << MASS_STORE_DATA_IN_PIPE) | (1 << MASS_STORE_DATA_OUT_PIPE)))\r
{\r
/* Fetch the next bulk endpoint from the current mass storage interface */\r
- if ((ErrorCode = USB_GetNextDescriptorComp(&ConfigDescriptorSize, &ConfigDescriptorData,\r
- NextInterfaceBulkDataEndpoint)))\r
+ if (USB_GetNextDescriptorComp(&ConfigDescriptorSize, &ConfigDescriptorData,\r
+ NextInterfaceBulkDataEndpoint) != DESCRIPTOR_SEARCH_COMP_Found)\r
{\r
/* Descriptor not found, error out */\r
return NoEndpointFound;\r
return InvalidConfigDataReturned;\r
\r
/* Get the mouse interface from the configuration descriptor */\r
- if (USB_GetNextDescriptorComp(&ConfigDescriptorSize, &ConfigDescriptorData, NextMouseInterface))\r
+ if (USB_GetNextDescriptorComp(&ConfigDescriptorSize, &ConfigDescriptorData,\r
+ NextMouseInterface) != DESCRIPTOR_SEARCH_COMP_Found)\r
{\r
/* Descriptor not found, error out */\r
return NoHIDInterfaceFound;\r
\r
/* Get the mouse interface's data endpoint descriptor */\r
if (USB_GetNextDescriptorComp(&ConfigDescriptorSize, &ConfigDescriptorData,\r
- NextInterfaceMouseDataEndpoint))\r
+ NextInterfaceMouseDataEndpoint) != DESCRIPTOR_SEARCH_COMP_Found)\r
{\r
/* Descriptor not found, error out */\r
return NoEndpointFound;\r
{\r
uint8_t* ConfigDescriptorData;\r
uint16_t ConfigDescriptorSize;\r
- uint8_t ErrorCode;\r
\r
/* Get Configuration Descriptor size from the device */\r
if (USB_GetDeviceConfigDescriptor(&ConfigDescriptorSize, NULL) != HOST_SENDCONTROL_Successful)\r
return InvalidConfigDataReturned;\r
\r
/* Get the mouse interface from the configuration descriptor */\r
- if ((ErrorCode = USB_GetNextDescriptorComp(&ConfigDescriptorSize, &ConfigDescriptorData, NextMouseInterface)))\r
+ if (USB_GetNextDescriptorComp(&ConfigDescriptorSize, &ConfigDescriptorData,\r
+ NextMouseInterface) != DESCRIPTOR_SEARCH_COMP_Found)\r
{\r
/* Descriptor not found, error out */\r
return NoHIDInterfaceFound;\r
}\r
\r
/* Get the mouse interface's HID descriptor */\r
- if ((ErrorCode = USB_GetNextDescriptorComp(&ConfigDescriptorSize, &ConfigDescriptorData, NextHID)))\r
+ if (USB_GetNextDescriptorComp(&ConfigDescriptorSize, &ConfigDescriptorData,\r
+ NextHID) != DESCRIPTOR_SEARCH_COMP_Found)\r
{\r
/* Descriptor not found, error out */\r
return NoHIDDescriptorFound;\r
HIDReportSize = DESCRIPTOR_CAST(ConfigDescriptorData, USB_Descriptor_HID_t).HIDReportLength;\r
\r
/* Get the mouse interface's data endpoint descriptor */\r
- if ((ErrorCode = USB_GetNextDescriptorComp(&ConfigDescriptorSize, &ConfigDescriptorData,\r
- NextInterfaceMouseDataEndpoint)))\r
+ if (USB_GetNextDescriptorComp(&ConfigDescriptorSize, &ConfigDescriptorData,\r
+ NextInterfaceMouseDataEndpoint) != DESCRIPTOR_SEARCH_COMP_Found)\r
{\r
/* Descriptor not found, error out */\r
return NoEndpointFound;\r
return InvalidConfigDataReturned;\r
\r
/* Get the Still Image interface from the configuration descriptor */\r
- if (USB_GetNextDescriptorComp(&ConfigDescriptorSize, &ConfigDescriptorData, NextStillImageInterface))\r
+ if (USB_GetNextDescriptorComp(&ConfigDescriptorSize, &ConfigDescriptorData,\r
+ NextStillImageInterface) != DESCRIPTOR_SEARCH_COMP_Found)\r
{\r
/* Descriptor not found, error out */\r
return NoInterfaceFound;\r
{\r
/* Fetch the next endpoint from the current Still Image interface */\r
if (USB_GetNextDescriptorComp(&ConfigDescriptorSize, &ConfigDescriptorData,\r
- NextSImageInterfaceDataEndpoint))\r
+ NextSImageInterfaceDataEndpoint) != DESCRIPTOR_SEARCH_COMP_Found)\r
{\r
/* Descriptor not found, error out */\r
return NoEndpointFound;\r
*\r
* - Fixed bug in RNDISEthernet and DualCDC demos not using the correct USB_ControlRequest structure for control request data\r
* - Fixed documentation showing incorrect USB mode support on the supported AVRs list\r
- * - Fixed RNDISEthernet not working under Linux due to Linux requiring an "optional" request which was unhandled\r
+ * - Fixed RNDISEthernet not working under Linux due to Linux requiring an "optional" RNDIS request which was unhandled\r
* - Fixed Mouse and Keyboard device demos not acting in accordance with the HID specification for idle periods (thanks to Brian Dickman)\r
* - Removed support for endpoint/pipe non-control interrupts; these did not act in the way users expected, and had many subtle issues\r
* - Fixed Device Mode not handling Set Feature and Clear Feature Chapter 9 requests that are addressed to the device (thanks to Brian Dickman)\r
* - Moved control endpoint interrupt handling into the library itself, enable via the new INTERRUPT_CONTROL_ENDPOINT token\r
- * - Fixed CDCHost not clearing configured endpoints and resetting configured endpoints mask when a partially enumerated invalid CDC\r
+ * - Fixed CDCHost not clearing configured pipes and resetting configured pipes mask when a partially enumerated invalid CDC\r
* interface is skipped\r
*\r
*\r