diff options
author | Dean Camera <dean@fourwalledcubicle.com> | 2014-01-27 22:28:53 +1100 |
---|---|---|
committer | Dean Camera <dean@fourwalledcubicle.com> | 2014-01-27 22:28:53 +1100 |
commit | b095177e2051cdc47620d770ce854c6e9ce3f912 (patch) | |
tree | ddc98c86bc666f26051d03c5e2553b5577212f1a | |
parent | c5282637edde46f2d5ecec62d987ede0f543e889 (diff) | |
download | lufa-b095177e2051cdc47620d770ce854c6e9ce3f912.tar.gz lufa-b095177e2051cdc47620d770ce854c6e9ce3f912.tar.bz2 lufa-b095177e2051cdc47620d770ce854c6e9ce3f912.zip |
Fix incorrect descriptor length when using USB_STRING_DESCRIPTOR macros.
-rw-r--r-- | LUFA/Drivers/USB/Core/StdDescriptors.h | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/LUFA/Drivers/USB/Core/StdDescriptors.h b/LUFA/Drivers/USB/Core/StdDescriptors.h index d611bf37f..e0a1a37f4 100644 --- a/LUFA/Drivers/USB/Core/StdDescriptors.h +++ b/LUFA/Drivers/USB/Core/StdDescriptors.h @@ -91,13 +91,13 @@ * * \param[in] String String to initialize a USB String Descriptor structure with. */ - #define USB_STRING_DESCRIPTOR(String) { .Header = {.Size = (sizeof(String) - 2), .Type = DTYPE_String}, .UnicodeString = String } + #define USB_STRING_DESCRIPTOR(String) { .Header = {.Size = sizeof(USB_Descriptor_Header_t) + (sizeof(String) - 2), .Type = DTYPE_String}, .UnicodeString = String } /** Convenience macro to easily create \ref USB_Descriptor_String_t instances from an array of characters. * * \param[in] ... Characters to initialize a USB String Descriptor structure with. */ - #define USB_STRING_DESCRIPTOR_ARRAY(...) { .Header = {.Size = sizeof((uint16_t){__VA_ARGS__}), .Type = DTYPE_String}, .UnicodeString = {__VA_ARGS__} } + #define USB_STRING_DESCRIPTOR_ARRAY(...) { .Header = {.Size = sizeof(USB_Descriptor_Header_t) + sizeof((uint16_t){__VA_ARGS__}), .Type = DTYPE_String}, .UnicodeString = {__VA_ARGS__} } /** Macro to encode a given major/minor/revision version number into Binary Coded Decimal format for descriptor * fields requiring BCD encoding, such as the USB version number in the standard device descriptor. |