summaryrefslogtreecommitdiff
path: root/tmk_core/protocol
diff options
context:
space:
mode:
authorRyan <fauxpark@gmail.com>2022-08-29 02:59:40 +1000
committerGitHub <noreply@github.com>2022-08-28 09:59:40 -0700
commitd983251c10c4bb152c746dc4e94bc954b1b82c8c (patch)
tree3a4832d82b2d68a9eb3ff1ca2e804a16c1aca152 /tmk_core/protocol
parent6a28ceefcda58ec530469ac98c38b970ba4780ab (diff)
Switch over MANUFACTURER and PRODUCT to string literals (#18183)
Diffstat (limited to 'tmk_core/protocol')
-rw-r--r--tmk_core/protocol/usb_descriptor.c12
-rw-r--r--tmk_core/protocol/vusb/vusb.c12
-rw-r--r--tmk_core/protocol/vusb/vusb.h2
3 files changed, 12 insertions, 14 deletions
diff --git a/tmk_core/protocol/usb_descriptor.c b/tmk_core/protocol/usb_descriptor.c
index 52e3276d35..635e4c6cd7 100644
--- a/tmk_core/protocol/usb_descriptor.c
+++ b/tmk_core/protocol/usb_descriptor.c
@@ -1043,7 +1043,7 @@ const USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor = {
*/
const USB_Descriptor_String_t PROGMEM LanguageString = {
.Header = {
- .Size = USB_STRING_LEN(1),
+ .Size = 4,
.Type = DTYPE_String
},
.UnicodeString = {LANGUAGE_ID_ENG}
@@ -1051,24 +1051,24 @@ const USB_Descriptor_String_t PROGMEM LanguageString = {
const USB_Descriptor_String_t PROGMEM ManufacturerString = {
.Header = {
- .Size = USB_STRING_LEN(sizeof(STR(MANUFACTURER)) - 1), // Subtract 1 for null terminator
+ .Size = sizeof(USBSTR(MANUFACTURER)),
.Type = DTYPE_String
},
- .UnicodeString = LSTR(MANUFACTURER)
+ .UnicodeString = USBSTR(MANUFACTURER)
};
const USB_Descriptor_String_t PROGMEM ProductString = {
.Header = {
- .Size = USB_STRING_LEN(sizeof(STR(PRODUCT)) - 1), // Subtract 1 for null terminator
+ .Size = sizeof(USBSTR(PRODUCT)),
.Type = DTYPE_String
},
- .UnicodeString = LSTR(PRODUCT)
+ .UnicodeString = USBSTR(PRODUCT)
};
#if defined(SERIAL_NUMBER)
const USB_Descriptor_String_t PROGMEM SerialNumberString = {
.Header = {
- .Size = USB_STRING_LEN(sizeof(SERIAL_NUMBER) - 1), // Subtract 1 for null terminator
+ .Size = sizeof(USBSTR(SERIAL_NUMBER)),
.Type = DTYPE_String
},
.UnicodeString = USBSTR(SERIAL_NUMBER)
diff --git a/tmk_core/protocol/vusb/vusb.c b/tmk_core/protocol/vusb/vusb.c
index d07cc0d27e..65f5027574 100644
--- a/tmk_core/protocol/vusb/vusb.c
+++ b/tmk_core/protocol/vusb/vusb.c
@@ -672,7 +672,7 @@ const PROGMEM uchar console_hid_report[] = {
// clang-format off
const PROGMEM usbStringDescriptor_t usbStringDescriptorZero = {
.header = {
- .bLength = USB_STRING_LEN(1),
+ .bLength = 4,
.bDescriptorType = USBDESCR_STRING
},
.bString = {0x0409} // US English
@@ -680,24 +680,24 @@ const PROGMEM usbStringDescriptor_t usbStringDescriptorZero = {
const PROGMEM usbStringDescriptor_t usbStringDescriptorManufacturer = {
.header = {
- .bLength = USB_STRING_LEN(sizeof(STR(MANUFACTURER)) - 1),
+ .bLength = sizeof(USBSTR(MANUFACTURER)),
.bDescriptorType = USBDESCR_STRING
},
- .bString = LSTR(MANUFACTURER)
+ .bString = USBSTR(MANUFACTURER)
};
const PROGMEM usbStringDescriptor_t usbStringDescriptorProduct = {
.header = {
- .bLength = USB_STRING_LEN(sizeof(STR(PRODUCT)) - 1),
+ .bLength = sizeof(USBSTR(PRODUCT)),
.bDescriptorType = USBDESCR_STRING
},
- .bString = LSTR(PRODUCT)
+ .bString = USBSTR(PRODUCT)
};
#if defined(SERIAL_NUMBER)
const PROGMEM usbStringDescriptor_t usbStringDescriptorSerial = {
.header = {
- .bLength = USB_STRING_LEN(sizeof(SERIAL_NUMBER) - 1),
+ .bLength = sizeof(USBSTR(SERIAL_NUMBER)),
.bDescriptorType = USBDESCR_STRING
},
.bString = USBSTR(SERIAL_NUMBER)
diff --git a/tmk_core/protocol/vusb/vusb.h b/tmk_core/protocol/vusb/vusb.h
index b1ecc98f37..c5cb27ded6 100644
--- a/tmk_core/protocol/vusb/vusb.h
+++ b/tmk_core/protocol/vusb/vusb.h
@@ -118,8 +118,6 @@ typedef struct usbConfigurationDescriptor {
#endif
} __attribute__((packed)) usbConfigurationDescriptor_t;
-#define USB_STRING_LEN(s) (sizeof(usbDescriptorHeader_t) + ((s) << 1))
-
extern bool vusb_suspended;
host_driver_t *vusb_driver(void);