diff options
author | Ryan <fauxpark@gmail.com> | 2021-07-16 19:43:18 +1000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-07-16 19:43:18 +1000 |
commit | 7ed5ac4a6026939898810f9a9c706fb7a09db171 (patch) | |
tree | 4af7673c046148a340e11679f7a1c7aae1b53e41 | |
parent | f0198ad15eb1b9d1f1ae0a8725c478e171f16d1b (diff) | |
download | qmk_firmware-7ed5ac4a6026939898810f9a9c706fb7a09db171.tar.gz qmk_firmware-7ed5ac4a6026939898810f9a9c706fb7a09db171.zip |
Use string literals for `SERIAL_NUMBER` (#13403)
-rw-r--r-- | tmk_core/protocol/usb_descriptor.c | 4 | ||||
-rw-r--r-- | tmk_core/protocol/usb_descriptor_common.h | 4 | ||||
-rw-r--r-- | tmk_core/protocol/vusb/vusb.c | 4 |
3 files changed, 8 insertions, 4 deletions
diff --git a/tmk_core/protocol/usb_descriptor.c b/tmk_core/protocol/usb_descriptor.c index c88aceb6ed..7a4a790315 100644 --- a/tmk_core/protocol/usb_descriptor.c +++ b/tmk_core/protocol/usb_descriptor.c @@ -953,10 +953,10 @@ const USB_Descriptor_String_t PROGMEM ProductString = { #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 + .Size = USB_STRING_LEN(sizeof(SERIAL_NUMBER) - 1), // Subtract 1 for null terminator .Type = DTYPE_String }, - .UnicodeString = LSTR(SERIAL_NUMBER) + .UnicodeString = USBSTR(SERIAL_NUMBER) }; #endif diff --git a/tmk_core/protocol/usb_descriptor_common.h b/tmk_core/protocol/usb_descriptor_common.h index b1f602c82e..ce0cf09763 100644 --- a/tmk_core/protocol/usb_descriptor_common.h +++ b/tmk_core/protocol/usb_descriptor_common.h @@ -16,6 +16,10 @@ #pragma once +// Prefix string literal with L for descriptors +#define USBCONCAT(a, b) a##b +#define USBSTR(s) USBCONCAT(L, s) + ///////////////////// // RAW Usage page and ID configuration diff --git a/tmk_core/protocol/vusb/vusb.c b/tmk_core/protocol/vusb/vusb.c index 876a313786..98cebf6012 100644 --- a/tmk_core/protocol/vusb/vusb.c +++ b/tmk_core/protocol/vusb/vusb.c @@ -599,10 +599,10 @@ const PROGMEM usbStringDescriptor_t usbStringDescriptorProduct = { #if defined(SERIAL_NUMBER) const PROGMEM usbStringDescriptor_t usbStringDescriptorSerial = { .header = { - .bLength = USB_STRING_LEN(sizeof(STR(SERIAL_NUMBER)) - 1), + .bLength = USB_STRING_LEN(sizeof(SERIAL_NUMBER) - 1), .bDescriptorType = USBDESCR_STRING }, - .bString = LSTR(SERIAL_NUMBER) + .bString = USBSTR(SERIAL_NUMBER) }; #endif |