diff --git a/Demos/Host/CDCHost/ConfigDescriptor.c b/Demos/Host/CDCHost/ConfigDescriptor.c index 29afbfaa16..faad3ccd2b 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; diff --git a/Demos/Host/GenericHIDHost/ConfigDescriptor.c b/Demos/Host/GenericHIDHost/ConfigDescriptor.c index ef99359a9e..1c0a6b291b 100644 --- a/Demos/Host/GenericHIDHost/ConfigDescriptor.c +++ b/Demos/Host/GenericHIDHost/ConfigDescriptor.c @@ -71,7 +71,8 @@ uint8_t ProcessConfigurationDescriptor(void) return InvalidConfigDataReturned; /* Get the HID interface from the configuration descriptor */ - if (USB_GetNextDescriptorComp(&ConfigDescriptorSize, &ConfigDescriptorData, NextHIDInterface)) + if (USB_GetNextDescriptorComp(&ConfigDescriptorSize, &ConfigDescriptorData, + NextHIDInterface) != DESCRIPTOR_SEARCH_COMP_Found) { /* Descriptor not found, error out */ return NoHIDInterfaceFound; @@ -80,7 +81,8 @@ uint8_t ProcessConfigurationDescriptor(void) while (FoundEndpoints != ((1 << HID_DATA_IN_PIPE) | (1 << HID_DATA_OUT_PIPE))) { /* Get the next HID interface's data endpoint descriptor */ - if (USB_GetNextDescriptorComp(&ConfigDescriptorSize, &ConfigDescriptorData, NextInterfaceHIDDataEndpoint)) + if (USB_GetNextDescriptorComp(&ConfigDescriptorSize, &ConfigDescriptorData, + NextInterfaceHIDDataEndpoint) != DESCRIPTOR_SEARCH_COMP_Found) { /* Not all HID devices have an OUT endpoint - if we've reached the end of the HID descriptor * but only found the mandatory IN endpoint, it's safe to continue with the device enumeration */ diff --git a/Demos/Host/KeyboardHost/ConfigDescriptor.c b/Demos/Host/KeyboardHost/ConfigDescriptor.c index 303f06dc17..b0233d98c8 100644 --- a/Demos/Host/KeyboardHost/ConfigDescriptor.c +++ b/Demos/Host/KeyboardHost/ConfigDescriptor.c @@ -69,7 +69,8 @@ uint8_t ProcessConfigurationDescriptor(void) return InvalidConfigDataReturned; /* Get the keyboard interface from the configuration descriptor */ - if (USB_GetNextDescriptorComp(&ConfigDescriptorSize, &ConfigDescriptorData, NextKeyboardInterface)) + if (USB_GetNextDescriptorComp(&ConfigDescriptorSize, &ConfigDescriptorData, + NextKeyboardInterface) != DESCRIPTOR_SEARCH_COMP_Found) { /* Descriptor not found, error out */ return NoHIDInterfaceFound; @@ -77,7 +78,7 @@ uint8_t ProcessConfigurationDescriptor(void) /* Get the keyboard interface's data endpoint descriptor */ if (USB_GetNextDescriptorComp(&ConfigDescriptorSize, &ConfigDescriptorData, - NextInterfaceKeyboardDataEndpoint)) + NextInterfaceKeyboardDataEndpoint) != DESCRIPTOR_SEARCH_COMP_Found) { /* Descriptor not found, error out */ return NoEndpointFound; diff --git a/Demos/Host/KeyboardHostWithParser/ConfigDescriptor.c b/Demos/Host/KeyboardHostWithParser/ConfigDescriptor.c index 9b56823eff..9cdf6f88a1 100644 --- a/Demos/Host/KeyboardHostWithParser/ConfigDescriptor.c +++ b/Demos/Host/KeyboardHostWithParser/ConfigDescriptor.c @@ -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; diff --git a/Demos/Host/MassStorageHost/ConfigDescriptor.c b/Demos/Host/MassStorageHost/ConfigDescriptor.c index 6642e1c5c5..c02f3b0de1 100644 --- a/Demos/Host/MassStorageHost/ConfigDescriptor.c +++ b/Demos/Host/MassStorageHost/ConfigDescriptor.c @@ -49,7 +49,6 @@ uint8_t ProcessConfigurationDescriptor(void) { uint8_t* ConfigDescriptorData; uint16_t ConfigDescriptorSize; - uint8_t ErrorCode; uint8_t FoundEndpoints = 0; /* Get Configuration Descriptor size from the device */ @@ -71,8 +70,8 @@ uint8_t ProcessConfigurationDescriptor(void) return InvalidConfigDataReturned; /* Get the mass storage interface from the configuration descriptor */ - if ((ErrorCode = USB_GetNextDescriptorComp(&ConfigDescriptorSize, &ConfigDescriptorData, - NextMassStorageInterface))) + if (USB_GetNextDescriptorComp(&ConfigDescriptorSize, &ConfigDescriptorData, + NextMassStorageInterface) != DESCRIPTOR_SEARCH_COMP_Found) { /* Descriptor not found, error out */ return NoInterfaceFound; @@ -82,8 +81,8 @@ uint8_t ProcessConfigurationDescriptor(void) while (FoundEndpoints != ((1 << MASS_STORE_DATA_IN_PIPE) | (1 << MASS_STORE_DATA_OUT_PIPE))) { /* Fetch the next bulk endpoint from the current mass storage interface */ - if ((ErrorCode = USB_GetNextDescriptorComp(&ConfigDescriptorSize, &ConfigDescriptorData, - NextInterfaceBulkDataEndpoint))) + if (USB_GetNextDescriptorComp(&ConfigDescriptorSize, &ConfigDescriptorData, + NextInterfaceBulkDataEndpoint) != DESCRIPTOR_SEARCH_COMP_Found) { /* Descriptor not found, error out */ return NoEndpointFound; diff --git a/Demos/Host/MouseHost/ConfigDescriptor.c b/Demos/Host/MouseHost/ConfigDescriptor.c index f29eda16ec..435a4f90c8 100644 --- a/Demos/Host/MouseHost/ConfigDescriptor.c +++ b/Demos/Host/MouseHost/ConfigDescriptor.c @@ -69,7 +69,8 @@ uint8_t ProcessConfigurationDescriptor(void) return InvalidConfigDataReturned; /* Get the mouse interface from the configuration descriptor */ - if (USB_GetNextDescriptorComp(&ConfigDescriptorSize, &ConfigDescriptorData, NextMouseInterface)) + if (USB_GetNextDescriptorComp(&ConfigDescriptorSize, &ConfigDescriptorData, + NextMouseInterface) != DESCRIPTOR_SEARCH_COMP_Found) { /* Descriptor not found, error out */ return NoHIDInterfaceFound; @@ -77,7 +78,7 @@ uint8_t ProcessConfigurationDescriptor(void) /* Get the mouse interface's data endpoint descriptor */ if (USB_GetNextDescriptorComp(&ConfigDescriptorSize, &ConfigDescriptorData, - NextInterfaceMouseDataEndpoint)) + NextInterfaceMouseDataEndpoint) != DESCRIPTOR_SEARCH_COMP_Found) { /* Descriptor not found, error out */ return NoEndpointFound; diff --git a/Demos/Host/MouseHostWithParser/ConfigDescriptor.c b/Demos/Host/MouseHostWithParser/ConfigDescriptor.c index 486a0c7fba..c008523728 100644 --- a/Demos/Host/MouseHostWithParser/ConfigDescriptor.c +++ b/Demos/Host/MouseHostWithParser/ConfigDescriptor.c @@ -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 mouse interface from the configuration descriptor */ - if ((ErrorCode = USB_GetNextDescriptorComp(&ConfigDescriptorSize, &ConfigDescriptorData, NextMouseInterface))) + if (USB_GetNextDescriptorComp(&ConfigDescriptorSize, &ConfigDescriptorData, + NextMouseInterface) != DESCRIPTOR_SEARCH_COMP_Found) { /* Descriptor not found, error out */ return NoHIDInterfaceFound; } /* Get the mouse 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 mouse interface's data endpoint descriptor */ - if ((ErrorCode = USB_GetNextDescriptorComp(&ConfigDescriptorSize, &ConfigDescriptorData, - NextInterfaceMouseDataEndpoint))) + if (USB_GetNextDescriptorComp(&ConfigDescriptorSize, &ConfigDescriptorData, + NextInterfaceMouseDataEndpoint) != DESCRIPTOR_SEARCH_COMP_Found) { /* Descriptor not found, error out */ return NoEndpointFound; diff --git a/Demos/Host/StillImageHost/ConfigDescriptor.c b/Demos/Host/StillImageHost/ConfigDescriptor.c index 5e2916ba2a..b58dfb8bdb 100644 --- a/Demos/Host/StillImageHost/ConfigDescriptor.c +++ b/Demos/Host/StillImageHost/ConfigDescriptor.c @@ -70,7 +70,8 @@ uint8_t ProcessConfigurationDescriptor(void) return InvalidConfigDataReturned; /* Get the Still Image interface from the configuration descriptor */ - if (USB_GetNextDescriptorComp(&ConfigDescriptorSize, &ConfigDescriptorData, NextStillImageInterface)) + if (USB_GetNextDescriptorComp(&ConfigDescriptorSize, &ConfigDescriptorData, + NextStillImageInterface) != DESCRIPTOR_SEARCH_COMP_Found) { /* Descriptor not found, error out */ return NoInterfaceFound; @@ -81,7 +82,7 @@ uint8_t ProcessConfigurationDescriptor(void) { /* Fetch the next endpoint from the current Still Image interface */ if (USB_GetNextDescriptorComp(&ConfigDescriptorSize, &ConfigDescriptorData, - NextSImageInterfaceDataEndpoint)) + NextSImageInterfaceDataEndpoint) != DESCRIPTOR_SEARCH_COMP_Found) { /* Descriptor not found, error out */ return NoEndpointFound; diff --git a/LUFA/ChangeLog.txt b/LUFA/ChangeLog.txt index 69a60f1437..d17c758e1f 100644 --- a/LUFA/ChangeLog.txt +++ b/LUFA/ChangeLog.txt @@ -10,12 +10,12 @@ * * - Fixed bug in RNDISEthernet and DualCDC demos not using the correct USB_ControlRequest structure for control request data * - Fixed documentation showing incorrect USB mode support on the supported AVRs list - * - Fixed RNDISEthernet not working under Linux due to Linux requiring an "optional" request which was unhandled + * - Fixed RNDISEthernet not working under Linux due to Linux requiring an "optional" RNDIS request which was unhandled * - Fixed Mouse and Keyboard device demos not acting in accordance with the HID specification for idle periods (thanks to Brian Dickman) * - Removed support for endpoint/pipe non-control interrupts; these did not act in the way users expected, and had many subtle issues * - Fixed Device Mode not handling Set Feature and Clear Feature Chapter 9 requests that are addressed to the device (thanks to Brian Dickman) * - Moved control endpoint interrupt handling into the library itself, enable via the new INTERRUPT_CONTROL_ENDPOINT token - * - Fixed CDCHost not clearing configured endpoints and resetting configured endpoints mask when a partially enumerated invalid CDC + * - Fixed CDCHost not clearing configured pipes and resetting configured pipes mask when a partially enumerated invalid CDC * interface is skipped * *