diff options
author | Dean Camera <dean@fourwalledcubicle.com> | 2013-05-15 18:40:25 +0200 |
---|---|---|
committer | Dean Camera <dean@fourwalledcubicle.com> | 2013-05-15 18:40:25 +0200 |
commit | e342ba8f649f779b58e2ca3bd2888477a8dcad05 (patch) | |
tree | 14a63f881e086c5c644313c1078f13c87026d2e1 /Bootloaders | |
parent | 0ad234c19464a63f6fabd8d12d2769ef9f102833 (diff) | |
download | lufa-e342ba8f649f779b58e2ca3bd2888477a8dcad05.tar.gz lufa-e342ba8f649f779b58e2ca3bd2888477a8dcad05.tar.bz2 lufa-e342ba8f649f779b58e2ca3bd2888477a8dcad05.zip |
Add symbolic names for USB Device String Descriptors within the demos, applications and bootloaders.
Diffstat (limited to 'Bootloaders')
-rw-r--r-- | Bootloaders/CDC/Descriptors.c | 10 | ||||
-rw-r--r-- | Bootloaders/CDC/Descriptors.h | 11 | ||||
-rw-r--r-- | Bootloaders/DFU/Descriptors.c | 10 | ||||
-rw-r--r-- | Bootloaders/DFU/Descriptors.h | 11 | ||||
-rw-r--r-- | Bootloaders/Printer/Descriptors.c | 10 | ||||
-rw-r--r-- | Bootloaders/Printer/Descriptors.h | 11 |
6 files changed, 48 insertions, 15 deletions
diff --git a/Bootloaders/CDC/Descriptors.c b/Bootloaders/CDC/Descriptors.c index 9c144dd64..03a4a5daf 100644 --- a/Bootloaders/CDC/Descriptors.c +++ b/Bootloaders/CDC/Descriptors.c @@ -57,8 +57,8 @@ const USB_Descriptor_Device_t DeviceDescriptor = .ProductID = 0x204A, .ReleaseNumber = VERSION_BCD(01.00), - .ManufacturerStrIndex = 0x01, - .ProductStrIndex = 0x02, + .ManufacturerStrIndex = STRING_ID_Manufacturer, + .ProductStrIndex = STRING_ID_Product, .SerialNumStrIndex = NO_DESCRIPTOR, .NumberOfConfigurations = FIXED_NUM_CONFIGURATIONS @@ -234,17 +234,17 @@ uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue, Size = sizeof(USB_Descriptor_Configuration_t); break; case DTYPE_String: - if (!(DescriptorNumber)) + if (DescriptorNumber == STRING_ID_Language) { Address = &LanguageString; Size = LanguageString.Header.Size; } - else if (DescriptorNumber == 0x01) + else if (DescriptorNumber == STRING_ID_Manufacturer) { Address = &ManufacturerString; Size = ManufacturerString.Header.Size; } - else if (DescriptorNumber == 0x02) + else if (DescriptorNumber == STRING_ID_Product) { Address = &ProductString; Size = ProductString.Header.Size; diff --git a/Bootloaders/CDC/Descriptors.h b/Bootloaders/CDC/Descriptors.h index 8c358de25..24d1a398e 100644 --- a/Bootloaders/CDC/Descriptors.h +++ b/Bootloaders/CDC/Descriptors.h @@ -127,6 +127,17 @@ USB_Descriptor_Endpoint_t CDC_DataInEndpoint; } USB_Descriptor_Configuration_t; + /** Enum for the device string descriptor IDs within the device. Each string descriptor should + * have a unique ID index associated with it, which can be used to refer to the string from + * other descriptors. + */ + enum StringDescriptors_t + { + STRING_ID_Language = 0, /**< Supported Languages string descriptor ID (must be zero) */ + STRING_ID_Manufacturer = 1, /**< Manufacturer string ID */ + STRING_ID_Product = 2, /**< Product string ID */ + }; + /* Function Prototypes: */ uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue, const uint8_t wIndex, diff --git a/Bootloaders/DFU/Descriptors.c b/Bootloaders/DFU/Descriptors.c index 3d70cf5a5..5901dad12 100644 --- a/Bootloaders/DFU/Descriptors.c +++ b/Bootloaders/DFU/Descriptors.c @@ -57,8 +57,8 @@ const USB_Descriptor_Device_t DeviceDescriptor = .ProductID = PRODUCT_ID_CODE, .ReleaseNumber = VERSION_BCD(00.00), - .ManufacturerStrIndex = 0x01, - .ProductStrIndex = 0x02, + .ManufacturerStrIndex = STRING_ID_Manufacturer, + .ProductStrIndex = STRING_ID_Product, .SerialNumStrIndex = NO_DESCRIPTOR, .NumberOfConfigurations = FIXED_NUM_CONFIGURATIONS @@ -175,17 +175,17 @@ uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue, Size = sizeof(USB_Descriptor_Configuration_t); break; case DTYPE_String: - if (!(DescriptorNumber)) + if (DescriptorNumber == STRING_ID_Language) { Address = &LanguageString; Size = LanguageString.Header.Size; } - else if (DescriptorNumber == 0x01) + else if (DescriptorNumber == STRING_ID_Manufacturer) { Address = &ManufacturerString; Size = ManufacturerString.Header.Size; } - else if (DescriptorNumber == 0x02) + else if (DescriptorNumber == STRING_ID_Product) { Address = &ProductString; Size = ProductString.Header.Size; diff --git a/Bootloaders/DFU/Descriptors.h b/Bootloaders/DFU/Descriptors.h index 71ae30a5a..c33e388c0 100644 --- a/Bootloaders/DFU/Descriptors.h +++ b/Bootloaders/DFU/Descriptors.h @@ -164,6 +164,17 @@ USB_Descriptor_DFU_Functional_t DFU_Functional; } USB_Descriptor_Configuration_t; + /** Enum for the device string descriptor IDs within the device. Each string descriptor should + * have a unique ID index associated with it, which can be used to refer to the string from + * other descriptors. + */ + enum StringDescriptors_t + { + STRING_ID_Language = 0, /**< Supported Languages string descriptor ID (must be zero) */ + STRING_ID_Manufacturer = 1, /**< Manufacturer string ID */ + STRING_ID_Product = 2, /**< Product string ID */ + }; + /* Function Prototypes: */ uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue, const uint8_t wIndex, diff --git a/Bootloaders/Printer/Descriptors.c b/Bootloaders/Printer/Descriptors.c index 0bf32c6c7..0fbb3ae7e 100644 --- a/Bootloaders/Printer/Descriptors.c +++ b/Bootloaders/Printer/Descriptors.c @@ -58,8 +58,8 @@ const USB_Descriptor_Device_t DeviceDescriptor = .ProductID = 0x206B, .ReleaseNumber = VERSION_BCD(00.01), - .ManufacturerStrIndex = 0x01, - .ProductStrIndex = 0x02, + .ManufacturerStrIndex = STRING_ID_Manufacturer, + .ProductStrIndex = STRING_ID_Product, .SerialNumStrIndex = NO_DESCRIPTOR, .NumberOfConfigurations = FIXED_NUM_CONFIGURATIONS @@ -186,15 +186,15 @@ uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue, case DTYPE_String: switch (DescriptorNumber) { - case 0x00: + case STRING_ID_Language: Address = &LanguageString; Size = LanguageString.Header.Size; break; - case 0x01: + case STRING_ID_Manufacturer: Address = &ManufacturerString; Size = ManufacturerString.Header.Size; break; - case 0x02: + case STRING_ID_Product: Address = &ProductString; Size = ProductString.Header.Size; break; diff --git a/Bootloaders/Printer/Descriptors.h b/Bootloaders/Printer/Descriptors.h index 1265f2174..fba326a93 100644 --- a/Bootloaders/Printer/Descriptors.h +++ b/Bootloaders/Printer/Descriptors.h @@ -66,6 +66,17 @@ USB_Descriptor_Endpoint_t Printer_DataOutEndpoint; } USB_Descriptor_Configuration_t; + /** Enum for the device string descriptor IDs within the device. Each string descriptor should + * have a unique ID index associated with it, which can be used to refer to the string from + * other descriptors. + */ + enum StringDescriptors_t + { + STRING_ID_Language = 0, /**< Supported Languages string descriptor ID (must be zero) */ + STRING_ID_Manufacturer = 1, /**< Manufacturer string ID */ + STRING_ID_Product = 2, /**< Product string ID */ + }; + /* Function Prototypes: */ uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue, const uint8_t wIndex, |