aboutsummaryrefslogtreecommitdiff
path: root/tmk_core
diff options
context:
space:
mode:
authorRyan <fauxpark@gmail.com>2021-07-16 19:43:18 +1000
committerGitHub <noreply@github.com>2021-07-16 19:43:18 +1000
commit7ed5ac4a6026939898810f9a9c706fb7a09db171 (patch)
tree4af7673c046148a340e11679f7a1c7aae1b53e41 /tmk_core
parentf0198ad15eb1b9d1f1ae0a8725c478e171f16d1b (diff)
downloadqmk_firmware-7ed5ac4a6026939898810f9a9c706fb7a09db171.tar.gz
qmk_firmware-7ed5ac4a6026939898810f9a9c706fb7a09db171.zip
Use string literals for `SERIAL_NUMBER` (#13403)
Diffstat (limited to 'tmk_core')
-rw-r--r--tmk_core/protocol/usb_descriptor.c4
-rw-r--r--tmk_core/protocol/usb_descriptor_common.h4
-rw-r--r--tmk_core/protocol/vusb/vusb.c4
3 files changed, 8 insertions, 4 deletions
diff --git a/tmk_core/protocol/usb_descriptor.c b/tmk_core/protocol/usb_descriptor.c
index c88aceb6e..7a4a79031 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 = {
953#if defined(SERIAL_NUMBER) 953#if defined(SERIAL_NUMBER)
954const USB_Descriptor_String_t PROGMEM SerialNumberString = { 954const USB_Descriptor_String_t PROGMEM SerialNumberString = {
955 .Header = { 955 .Header = {
956 .Size = USB_STRING_LEN(sizeof(STR(SERIAL_NUMBER)) - 1), // Subtract 1 for null terminator 956 .Size = USB_STRING_LEN(sizeof(SERIAL_NUMBER) - 1), // Subtract 1 for null terminator
957 .Type = DTYPE_String 957 .Type = DTYPE_String
958 }, 958 },
959 .UnicodeString = LSTR(SERIAL_NUMBER) 959 .UnicodeString = USBSTR(SERIAL_NUMBER)
960}; 960};
961#endif 961#endif
962 962
diff --git a/tmk_core/protocol/usb_descriptor_common.h b/tmk_core/protocol/usb_descriptor_common.h
index b1f602c82..ce0cf0976 100644
--- a/tmk_core/protocol/usb_descriptor_common.h
+++ b/tmk_core/protocol/usb_descriptor_common.h
@@ -16,6 +16,10 @@
16 16
17#pragma once 17#pragma once
18 18
19// Prefix string literal with L for descriptors
20#define USBCONCAT(a, b) a##b
21#define USBSTR(s) USBCONCAT(L, s)
22
19///////////////////// 23/////////////////////
20// RAW Usage page and ID configuration 24// RAW Usage page and ID configuration
21 25
diff --git a/tmk_core/protocol/vusb/vusb.c b/tmk_core/protocol/vusb/vusb.c
index 876a31378..98cebf601 100644
--- a/tmk_core/protocol/vusb/vusb.c
+++ b/tmk_core/protocol/vusb/vusb.c
@@ -599,10 +599,10 @@ const PROGMEM usbStringDescriptor_t usbStringDescriptorProduct = {
599#if defined(SERIAL_NUMBER) 599#if defined(SERIAL_NUMBER)
600const PROGMEM usbStringDescriptor_t usbStringDescriptorSerial = { 600const PROGMEM usbStringDescriptor_t usbStringDescriptorSerial = {
601 .header = { 601 .header = {
602 .bLength = USB_STRING_LEN(sizeof(STR(SERIAL_NUMBER)) - 1), 602 .bLength = USB_STRING_LEN(sizeof(SERIAL_NUMBER) - 1),
603 .bDescriptorType = USBDESCR_STRING 603 .bDescriptorType = USBDESCR_STRING
604 }, 604 },
605 .bString = LSTR(SERIAL_NUMBER) 605 .bString = USBSTR(SERIAL_NUMBER)
606}; 606};
607#endif 607#endif
608 608