projects
/
pub
/
lufa.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (from parent 1:
f6f4ac5
)
Oops - Bootloader optimizations to GetDescriptor() don't work, as the Configuration...
author
Dean Camera
<dean@fourwalledcubicle.com>
Fri, 18 Mar 2011 04:58:39 +0000
(
04:58
+0000)
committer
Dean Camera
<dean@fourwalledcubicle.com>
Fri, 18 Mar 2011 04:58:39 +0000
(
04:58
+0000)
Bootloaders/CDC/Descriptors.c
patch
|
blob
|
blame
|
history
Bootloaders/DFU/Descriptors.c
patch
|
blob
|
blame
|
history
Bootloaders/HID/Descriptors.c
patch
|
blob
|
blame
|
history
LUFA/ManPages/FutureChanges.txt
patch
|
blob
|
blame
|
history
diff --git
a/Bootloaders/CDC/Descriptors.c
b/Bootloaders/CDC/Descriptors.c
index
8973c4e
..
ee2b0aa
100644
(file)
--- a/
Bootloaders/CDC/Descriptors.c
+++ b/
Bootloaders/CDC/Descriptors.c
@@
-206,29
+206,38
@@
uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue,
const uint8_t wIndex,
const void** const DescriptorAddress)
{
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;
const void* Address = NULL;
+ uint16_t Size = NO_DESCRIPTOR;
switch (DescriptorType)
{
case DTYPE_Device:
Address = &DeviceDescriptor;
switch (DescriptorType)
{
case DTYPE_Device:
Address = &DeviceDescriptor;
+ Size = sizeof(USB_Descriptor_Device_t);
break;
case DTYPE_Configuration:
Address = &ConfigurationDescriptor;
break;
case DTYPE_Configuration:
Address = &ConfigurationDescriptor;
+ Size = sizeof(USB_Descriptor_Configuration_t);
break;
case DTYPE_String:
if (!(DescriptorNumber))
break;
case DTYPE_String:
if (!(DescriptorNumber))
- Address = &LanguageString;
+ {
+ Address = &LanguageString;
+ Size = LanguageString.Header.Size;
+ }
else
else
- Address = &ProductString;
+ {
+ Address = &ProductString;
+ Size = ProductString.Header.Size;
+ }
break;
}
*DescriptorAddress = Address;
break;
}
*DescriptorAddress = Address;
- return
(Address != NULL) ? ((USB_Descriptor_Header_t*)Address)->Size : NO_DESCRIPTOR
;
+ return
Size
;
}
}
diff --git
a/Bootloaders/DFU/Descriptors.c
b/Bootloaders/DFU/Descriptors.c
index
55449c6
..
b9c77aa
100644
(file)
--- 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 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;
const void* Address = NULL;
+ uint16_t Size = NO_DESCRIPTOR;
switch (DescriptorType)
{
case DTYPE_Device:
Address = &DeviceDescriptor;
switch (DescriptorType)
{
case DTYPE_Device:
Address = &DeviceDescriptor;
+ Size = sizeof(USB_Descriptor_Device_t);
break;
break;
- case DTYPE_Configuration:
+ case DTYPE_Configuration:
Address = &ConfigurationDescriptor;
Address = &ConfigurationDescriptor;
+ Size = sizeof(USB_Descriptor_Configuration_t);
break;
break;
- case DTYPE_String:
+ case DTYPE_String:
if (!(DescriptorNumber))
if (!(DescriptorNumber))
- Address = &LanguageString;
+ {
+ Address = &LanguageString;
+ Size = LanguageString.Header.Size;
+ }
else
else
- Address = &ProductString;
-
+ {
+ Address = &ProductString;
+ Size = ProductString.Header.Size;
+ }
+
break;
}
break;
}
-
+
*DescriptorAddress = Address;
*DescriptorAddress = Address;
- return
(Address != NULL) ? ((USB_Descriptor_Header_t*)Address)->Size : NO_DESCRIPTOR
;
+ return
Size
;
}
}
diff --git
a/Bootloaders/HID/Descriptors.c
b/Bootloaders/HID/Descriptors.c
index
f79d346
..
fef43ab
100644
(file)
--- a/
Bootloaders/HID/Descriptors.c
+++ b/
Bootloaders/HID/Descriptors.c
@@
-154,23
+154,33
@@
uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue,
const uint8_t wIndex,
\r
const void** const DescriptorAddress)
\r
{
\r
const uint8_t wIndex,
\r
const void** const DescriptorAddress)
\r
{
\r
- const uint8_t DescriptorType = (wValue >> 8);
\r
+ const uint8_t DescriptorType
= (wValue >> 8);
\r
\r
const void* Address = NULL;
\r
uint16_t Size = NO_DESCRIPTOR;
\r
\r
\r
const void* Address = NULL;
\r
uint16_t Size = NO_DESCRIPTOR;
\r
\r
+ /* If/Else If chain compiles slightly smaller than a switch case */
\r
if (DescriptorType == DTYPE_Device)
\r
if (DescriptorType == DTYPE_Device)
\r
- Address = &DeviceDescriptor;
\r
+ {
\r
+ Address = &DeviceDescriptor;
\r
+ Size = sizeof(USB_Descriptor_Device_t);
\r
+ }
\r
else if (DescriptorType == DTYPE_Configuration)
\r
else if (DescriptorType == DTYPE_Configuration)
\r
- Address = &ConfigurationDescriptor;
\r
+ {
\r
+ Address = &ConfigurationDescriptor;
\r
+ Size = sizeof(USB_Descriptor_Configuration_t);
\r
+ }
\r
else if (DescriptorType == HID_DTYPE_HID)
\r
else if (DescriptorType == HID_DTYPE_HID)
\r
- Address = &ConfigurationDescriptor.HID_VendorHID;
\r
+ {
\r
+ Address = &ConfigurationDescriptor.HID_VendorHID;
\r
+ Size = sizeof(USB_HID_Descriptor_HID_t);
\r
+ }
\r
else
\r
else
\r
- Address = &HIDReport;
\r
+ {
\r
+ Address = &HIDReport;
\r
+ Size = sizeof(HIDReport);
\r
+ }
\r
\r
\r
- if (Address != NULL)
\r
- Size = (Address == &HIDReport) ? sizeof(HIDReport) : ((USB_Descriptor_Header_t*)Address)->Size;
\r
-
\r
*DescriptorAddress = Address;
\r
return Size;
\r
}
\r
*DescriptorAddress = Address;
\r
return Size;
\r
}
\r
diff --git
a/LUFA/ManPages/FutureChanges.txt
b/LUFA/ManPages/FutureChanges.txt
index
2f6bd97
..
4142406
100644
(file)
--- a/
LUFA/ManPages/FutureChanges.txt
+++ b/
LUFA/ManPages/FutureChanges.txt
@@
-17,7
+17,6
@@
* -# Investigate virtual hubs when in device mode instead of composite devices
* -# Change makefiles to allow for absolute LUFA location to be used
* -# Re-add interrupt Pipe/Endpoint support
* -# Investigate virtual hubs when in device mode instead of composite devices
* -# Change makefiles to allow for absolute LUFA location to be used
* -# Re-add interrupt Pipe/Endpoint support
- * -# Investigate dynamically created device descriptors
* -# Add makefile includes to reduce boilerplate in user makefiles
* - Documentation/Support
* -# Add detailed overviews of how each demo works
* -# Add makefile includes to reduce boilerplate in user makefiles
* - Documentation/Support
* -# Add detailed overviews of how each demo works