diff options
author | Dean Camera <dean@fourwalledcubicle.com> | 2010-09-30 07:56:47 +0000 |
---|---|---|
committer | Dean Camera <dean@fourwalledcubicle.com> | 2010-09-30 07:56:47 +0000 |
commit | 7166c7ba3e27f3458b83360302c8af8a866f7a34 (patch) | |
tree | dd3d7d307c56cbcef53911bcd42f93e5ba908ecb /Demos/Host/LowLevel | |
parent | 158afe910947739b1df00000628c1e758bdf0812 (diff) | |
download | lufa-7166c7ba3e27f3458b83360302c8af8a866f7a34.tar.gz lufa-7166c7ba3e27f3458b83360302c8af8a866f7a34.tar.bz2 lufa-7166c7ba3e27f3458b83360302c8af8a866f7a34.zip |
Fix low level host mode demos not correctly fetching the next endpoint when an invalid interface is discarded.
Update the pipe configuration routines in the host mode class drivers so that they use the same new code to enumerate compatible devices to increase reliability. Add support to the host mode class drivers for non-sequential (but non-overlapping with other interface) pipe numbers.
Diffstat (limited to 'Demos/Host/LowLevel')
12 files changed, 45 insertions, 9 deletions
diff --git a/Demos/Host/LowLevel/GenericHIDHost/ConfigDescriptor.c b/Demos/Host/LowLevel/GenericHIDHost/ConfigDescriptor.c index 40bc98e2d..2de7b722b 100644 --- a/Demos/Host/LowLevel/GenericHIDHost/ConfigDescriptor.c +++ b/Demos/Host/LowLevel/GenericHIDHost/ConfigDescriptor.c @@ -96,6 +96,9 @@ uint8_t ProcessConfigurationDescriptor(void) /* Descriptor not found, error out */ return NoCompatibleInterfaceFound; } + + /* Skip the remainder of the loop as we have not found an endpoint yet */ + continue; } /* Retrieve the endpoint address from the endpoint descriptor */ diff --git a/Demos/Host/LowLevel/JoystickHostWithParser/ConfigDescriptor.c b/Demos/Host/LowLevel/JoystickHostWithParser/ConfigDescriptor.c index dfca7b407..1d8265043 100644 --- a/Demos/Host/LowLevel/JoystickHostWithParser/ConfigDescriptor.c +++ b/Demos/Host/LowLevel/JoystickHostWithParser/ConfigDescriptor.c @@ -87,6 +87,9 @@ uint8_t ProcessConfigurationDescriptor(void) /* Descriptor not found, error out */ return NoCompatibleInterfaceFound; } + + /* Skip the remainder of the loop as we have not found an endpoint yet */ + continue; } /* Retrieve the endpoint address from the endpoint descriptor */ diff --git a/Demos/Host/LowLevel/KeyboardHost/ConfigDescriptor.c b/Demos/Host/LowLevel/KeyboardHost/ConfigDescriptor.c index dbdfac9c6..988579ce7 100644 --- a/Demos/Host/LowLevel/KeyboardHost/ConfigDescriptor.c +++ b/Demos/Host/LowLevel/KeyboardHost/ConfigDescriptor.c @@ -87,6 +87,9 @@ uint8_t ProcessConfigurationDescriptor(void) /* Descriptor not found, error out */ return NoCompatibleInterfaceFound; } + + /* Skip the remainder of the loop as we have not found an endpoint yet */ + continue; } /* Retrieve the endpoint address from the endpoint descriptor */ diff --git a/Demos/Host/LowLevel/KeyboardHostWithParser/ConfigDescriptor.c b/Demos/Host/LowLevel/KeyboardHostWithParser/ConfigDescriptor.c index d397ca7ad..bf2c4e051 100644 --- a/Demos/Host/LowLevel/KeyboardHostWithParser/ConfigDescriptor.c +++ b/Demos/Host/LowLevel/KeyboardHostWithParser/ConfigDescriptor.c @@ -83,7 +83,7 @@ uint8_t ProcessConfigurationDescriptor(void) } /* Save the HID report size for later use */ - HIDReportSize = DESCRIPTOR_CAST(CurrConfigLocation, USB_Descriptor_HID_t).HIDReportLength; + HIDReportSize = DESCRIPTOR_PCAST(CurrConfigLocation, USB_Descriptor_HID_t)->HIDReportLength; while (!(DataINEndpoint)) { @@ -108,7 +108,10 @@ uint8_t ProcessConfigurationDescriptor(void) } /* Save the HID report size for later use */ - HIDReportSize = DESCRIPTOR_CAST(CurrConfigLocation, USB_Descriptor_HID_t).HIDReportLength; + HIDReportSize = DESCRIPTOR_PCAST(CurrConfigLocation, USB_Descriptor_HID_t)->HIDReportLength; + + /* Skip the remainder of the loop as we have not found an endpoint yet */ + continue; } /* Retrieve the endpoint address from the endpoint descriptor */ diff --git a/Demos/Host/LowLevel/MIDIHost/ConfigDescriptor.c b/Demos/Host/LowLevel/MIDIHost/ConfigDescriptor.c index 3ede45778..7dda634cc 100644 --- a/Demos/Host/LowLevel/MIDIHost/ConfigDescriptor.c +++ b/Demos/Host/LowLevel/MIDIHost/ConfigDescriptor.c @@ -92,6 +92,9 @@ uint8_t ProcessConfigurationDescriptor(void) /* Descriptor not found, error out */ return NoCompatibleInterfaceFound; } + + /* Skip the remainder of the loop as we have not found an endpoint yet */ + continue; } /* Retrieve the endpoint address from the endpoint descriptor */ diff --git a/Demos/Host/LowLevel/MassStorageHost/ConfigDescriptor.c b/Demos/Host/LowLevel/MassStorageHost/ConfigDescriptor.c index 64565ac6d..a91d61ac0 100644 --- a/Demos/Host/LowLevel/MassStorageHost/ConfigDescriptor.c +++ b/Demos/Host/LowLevel/MassStorageHost/ConfigDescriptor.c @@ -92,6 +92,9 @@ uint8_t ProcessConfigurationDescriptor(void) /* Descriptor not found, error out */ return NoCompatibleInterfaceFound; } + + /* Skip the remainder of the loop as we have not found an endpoint yet */ + continue; } /* Retrieve the endpoint address from the endpoint descriptor */ diff --git a/Demos/Host/LowLevel/MouseHost/ConfigDescriptor.c b/Demos/Host/LowLevel/MouseHost/ConfigDescriptor.c index 02c4cd46d..4ea8aefe9 100644 --- a/Demos/Host/LowLevel/MouseHost/ConfigDescriptor.c +++ b/Demos/Host/LowLevel/MouseHost/ConfigDescriptor.c @@ -87,6 +87,9 @@ uint8_t ProcessConfigurationDescriptor(void) /* Descriptor not found, error out */ return NoCompatibleInterfaceFound; } + + /* Skip the remainder of the loop as we have not found an endpoint yet */ + continue; } /* Retrieve the endpoint address from the endpoint descriptor */ diff --git a/Demos/Host/LowLevel/MouseHostWithParser/ConfigDescriptor.c b/Demos/Host/LowLevel/MouseHostWithParser/ConfigDescriptor.c index f285f5a02..c5afbe476 100644 --- a/Demos/Host/LowLevel/MouseHostWithParser/ConfigDescriptor.c +++ b/Demos/Host/LowLevel/MouseHostWithParser/ConfigDescriptor.c @@ -83,7 +83,7 @@ uint8_t ProcessConfigurationDescriptor(void) } /* Save the HID report size for later use */ - HIDReportSize = DESCRIPTOR_CAST(CurrConfigLocation, USB_Descriptor_HID_t).HIDReportLength; + HIDReportSize = DESCRIPTOR_PCAST(CurrConfigLocation, USB_Descriptor_HID_t)->HIDReportLength; while (!(DataINEndpoint)) { @@ -108,7 +108,10 @@ uint8_t ProcessConfigurationDescriptor(void) } /* Save the HID report size for later use */ - HIDReportSize = DESCRIPTOR_CAST(CurrConfigLocation, USB_Descriptor_HID_t).HIDReportLength; + HIDReportSize = DESCRIPTOR_PCAST(CurrConfigLocation, USB_Descriptor_HID_t)->HIDReportLength; + + /* Skip the remainder of the loop as we have not found an endpoint yet */ + continue; } /* Retrieve the endpoint address from the endpoint descriptor */ diff --git a/Demos/Host/LowLevel/PrinterHost/ConfigDescriptor.c b/Demos/Host/LowLevel/PrinterHost/ConfigDescriptor.c index 0591aaca2..b16ac668c 100644 --- a/Demos/Host/LowLevel/PrinterHost/ConfigDescriptor.c +++ b/Demos/Host/LowLevel/PrinterHost/ConfigDescriptor.c @@ -75,8 +75,8 @@ uint8_t ProcessConfigurationDescriptor(void) } /* Save Printer interface details for later use */ - PrinterInterfaceNumber = DESCRIPTOR_CAST(CurrConfigLocation, USB_Descriptor_Interface_t).InterfaceNumber; - PrinterAltSetting = DESCRIPTOR_CAST(CurrConfigLocation, USB_Descriptor_Interface_t).AlternateSetting; + PrinterInterfaceNumber = DESCRIPTOR_PCAST(CurrConfigLocation, USB_Descriptor_Interface_t)->InterfaceNumber; + PrinterAltSetting = DESCRIPTOR_PCAST(CurrConfigLocation, USB_Descriptor_Interface_t)->AlternateSetting; while (!(DataINEndpoint) || !(DataOUTEndpoint)) { @@ -97,8 +97,11 @@ uint8_t ProcessConfigurationDescriptor(void) } /* Save Printer interface details for later use */ - PrinterInterfaceNumber = DESCRIPTOR_CAST(CurrConfigLocation, USB_Descriptor_Interface_t).InterfaceNumber; - PrinterAltSetting = DESCRIPTOR_CAST(CurrConfigLocation, USB_Descriptor_Interface_t).AlternateSetting; + PrinterInterfaceNumber = DESCRIPTOR_PCAST(CurrConfigLocation, USB_Descriptor_Interface_t)->InterfaceNumber; + PrinterAltSetting = DESCRIPTOR_PCAST(CurrConfigLocation, USB_Descriptor_Interface_t)->AlternateSetting; + + /* Skip the remainder of the loop as we have not found an endpoint yet */ + continue; } /* Retrieve the endpoint address from the endpoint descriptor */ @@ -106,7 +109,7 @@ uint8_t ProcessConfigurationDescriptor(void) /* If the endpoint is a IN type endpoint */ if (EndpointData->EndpointAddress & ENDPOINT_DESCRIPTOR_DIR_IN) - DataINEndpoint = EndpointData; + DataINEndpoint = EndpointData; else DataOUTEndpoint = EndpointData; } diff --git a/Demos/Host/LowLevel/RNDISEthernetHost/ConfigDescriptor.c b/Demos/Host/LowLevel/RNDISEthernetHost/ConfigDescriptor.c index 0db576f72..aa75dd174 100644 --- a/Demos/Host/LowLevel/RNDISEthernetHost/ConfigDescriptor.c +++ b/Demos/Host/LowLevel/RNDISEthernetHost/ConfigDescriptor.c @@ -110,6 +110,9 @@ uint8_t ProcessConfigurationDescriptor(void) /* Clear any found endpoints */ NotificationEndpoint = NULL; } + + /* Skip the remainder of the loop as we have not found an endpoint yet */ + continue; } /* Retrieve the endpoint address from the endpoint descriptor */ diff --git a/Demos/Host/LowLevel/StillImageHost/ConfigDescriptor.c b/Demos/Host/LowLevel/StillImageHost/ConfigDescriptor.c index 583df3bcc..78bca7f94 100644 --- a/Demos/Host/LowLevel/StillImageHost/ConfigDescriptor.c +++ b/Demos/Host/LowLevel/StillImageHost/ConfigDescriptor.c @@ -94,6 +94,9 @@ uint8_t ProcessConfigurationDescriptor(void) /* Descriptor not found, error out */ return NoCompatibleInterfaceFound; } + + /* Skip the remainder of the loop as we have not found an endpoint yet */ + continue; } /* Retrieve the endpoint address from the endpoint descriptor */ diff --git a/Demos/Host/LowLevel/VirtualSerialHost/ConfigDescriptor.c b/Demos/Host/LowLevel/VirtualSerialHost/ConfigDescriptor.c index c35a606cc..a26fa5cce 100644 --- a/Demos/Host/LowLevel/VirtualSerialHost/ConfigDescriptor.c +++ b/Demos/Host/LowLevel/VirtualSerialHost/ConfigDescriptor.c @@ -110,6 +110,9 @@ uint8_t ProcessConfigurationDescriptor(void) /* Clear any found endpoints */ NotificationEndpoint = NULL; } + + /* Skip the remainder of the loop as we have not found an endpoint yet */ + continue; } /* Retrieve the endpoint address from the endpoint descriptor */ |