diff options
author | Dean Camera <dean@fourwalledcubicle.com> | 2011-03-18 04:58:39 +0000 |
---|---|---|
committer | Dean Camera <dean@fourwalledcubicle.com> | 2011-03-18 04:58:39 +0000 |
commit | c7f4752d6bacf15aaea13a111c1d9bb8576f186d (patch) | |
tree | afb928c49f72a334bd301f0d451d7fbcade7393d /Bootloaders/DFU | |
parent | f6f4ac588cec25ad7f9baa67fc3c22c9306f962e (diff) | |
download | lufa-c7f4752d6bacf15aaea13a111c1d9bb8576f186d.tar.gz lufa-c7f4752d6bacf15aaea13a111c1d9bb8576f186d.tar.bz2 lufa-c7f4752d6bacf15aaea13a111c1d9bb8576f186d.zip |
Oops - Bootloader optimizations to GetDescriptor() don't work, as the Configuration Descriptor's header does not contain the full length of the descriptor, breaking full enumeration.
Diffstat (limited to 'Bootloaders/DFU')
-rw-r--r-- | Bootloaders/DFU/Descriptors.c | 27 |
1 files changed, 18 insertions, 9 deletions
diff --git a/Bootloaders/DFU/Descriptors.c b/Bootloaders/DFU/Descriptors.c index 55449c606..b9c77aa9a 100644 --- a/Bootloaders/DFU/Descriptors.c +++ b/Bootloaders/DFU/Descriptors.c @@ -147,29 +147,38 @@ uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue, const uint8_t wIndex, const void** const DescriptorAddress) { - const uint8_t DescriptorType = (wValue >> 8); - const uint8_t DescriptorNumber = (wValue & 0xFF); + const uint8_t DescriptorType = (wValue >> 8); + const uint8_t DescriptorNumber = (wValue & 0xFF); const void* Address = NULL; + uint16_t Size = NO_DESCRIPTOR; switch (DescriptorType) { case DTYPE_Device: Address = &DeviceDescriptor; + Size = sizeof(USB_Descriptor_Device_t); break; - case DTYPE_Configuration: + case DTYPE_Configuration: Address = &ConfigurationDescriptor; + Size = sizeof(USB_Descriptor_Configuration_t); break; - case DTYPE_String: + case DTYPE_String: if (!(DescriptorNumber)) - Address = &LanguageString; + { + Address = &LanguageString; + Size = LanguageString.Header.Size; + } else - Address = &ProductString; - + { + Address = &ProductString; + Size = ProductString.Header.Size; + } + break; } - + *DescriptorAddress = Address; - return (Address != NULL) ? ((USB_Descriptor_Header_t*)Address)->Size : NO_DESCRIPTOR; + return Size; } |