diff options
author | QMK Bot <hello@qmk.fm> | 2020-12-05 10:14:47 +0000 |
---|---|---|
committer | QMK Bot <hello@qmk.fm> | 2020-12-05 10:14:47 +0000 |
commit | 15200bd8f55a17e5dab0475c024d41c650494e8f (patch) | |
tree | 068a4f0e47b821b665d64bfbdd3c56186d52c325 /tmk_core/protocol/usb_descriptor.c | |
parent | f1fef16e4dfce9c7659f23ce727d8564a5e420ce (diff) | |
parent | 15faffacf49240ea95a0f0121511e6b2fb4c914c (diff) |
Merge remote-tracking branch 'origin/master' into develop
Diffstat (limited to 'tmk_core/protocol/usb_descriptor.c')
-rw-r--r-- | tmk_core/protocol/usb_descriptor.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/tmk_core/protocol/usb_descriptor.c b/tmk_core/protocol/usb_descriptor.c index a0c0d4cdc8..7ea4b2e37c 100644 --- a/tmk_core/protocol/usb_descriptor.c +++ b/tmk_core/protocol/usb_descriptor.c @@ -374,7 +374,11 @@ const USB_Descriptor_Device_t PROGMEM DeviceDescriptor = { .ReleaseNumber = DEVICE_VER, .ManufacturerStrIndex = 0x01, .ProductStrIndex = 0x02, +#if defined(SERIAL_NUMBER) .SerialNumStrIndex = 0x03, +#else + .SerialNumStrIndex = 0x00, +#endif .NumberOfConfigurations = FIXED_NUM_CONFIGURATIONS }; @@ -950,10 +954,7 @@ const USB_Descriptor_String_t PROGMEM ProductString = { .UnicodeString = LSTR(PRODUCT) }; -#ifndef SERIAL_NUMBER -# define SERIAL_NUMBER 0 -#endif - +#if defined(SERIAL_NUMBER) const USB_Descriptor_String_t PROGMEM SerialNumberString = { .Header = { .Size = USB_STRING_LEN(sizeof(STR(SERIAL_NUMBER)) - 1), // Subtract 1 for null terminator @@ -961,6 +962,7 @@ const USB_Descriptor_String_t PROGMEM SerialNumberString = { }, .UnicodeString = LSTR(SERIAL_NUMBER) }; +#endif // clang-format on @@ -1005,11 +1007,13 @@ uint16_t get_usb_descriptor(const uint16_t wValue, const uint16_t wIndex, const Size = pgm_read_byte(&ProductString.Header.Size); break; +#if defined(SERIAL_NUMBER) case 0x03: Address = &SerialNumberString; Size = pgm_read_byte(&SerialNumberString.Header.Size); break; +#endif } break; |