diff options
author | Ryan <fauxpark@gmail.com> | 2020-12-05 21:14:19 +1100 |
---|---|---|
committer | Drashna Jael're <drashna@live.com> | 2021-01-12 22:46:06 -0800 |
commit | 3272f6ee6abd3dcfdff4de3bb11369f7e9365c54 (patch) | |
tree | 1bc9022c64bea1df230c3e3d5f19e27b5dd0e1f5 /tmk_core/protocol/vusb | |
parent | 10d4cfd8dd2fed2ecc530c95d513f12f36696b63 (diff) |
Omit serial number if not defined (#11104)
Diffstat (limited to 'tmk_core/protocol/vusb')
-rw-r--r-- | tmk_core/protocol/vusb/vusb.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/tmk_core/protocol/vusb/vusb.c b/tmk_core/protocol/vusb/vusb.c index 692e2cc290..95de1019ef 100644 --- a/tmk_core/protocol/vusb/vusb.c +++ b/tmk_core/protocol/vusb/vusb.c @@ -541,10 +541,6 @@ const PROGMEM uchar console_hid_report[] = { }; #endif -#ifndef SERIAL_NUMBER -# define SERIAL_NUMBER 0 -#endif - #ifndef USB_MAX_POWER_CONSUMPTION # define USB_MAX_POWER_CONSUMPTION 500 #endif @@ -579,6 +575,7 @@ const PROGMEM usbStringDescriptor_t usbStringDescriptorProduct = { .bString = LSTR(PRODUCT) }; +#if defined(SERIAL_NUMBER) const PROGMEM usbStringDescriptor_t usbStringDescriptorSerial = { .header = { .bLength = USB_STRING_LEN(sizeof(STR(SERIAL_NUMBER)) - 1), @@ -586,6 +583,7 @@ const PROGMEM usbStringDescriptor_t usbStringDescriptorSerial = { }, .bString = LSTR(SERIAL_NUMBER) }; +#endif /* * Device descriptor @@ -605,7 +603,11 @@ const PROGMEM usbDeviceDescriptor_t usbDeviceDescriptor = { .bcdDevice = DEVICE_VER, .iManufacturer = 0x01, .iProduct = 0x02, +#if defined(SERIAL_NUMBER) .iSerialNumber = 0x03, +#else + .iSerialNumber = 0x00, +#endif .bNumConfigurations = 1 }; @@ -831,10 +833,12 @@ USB_PUBLIC usbMsgLen_t usbFunctionDescriptor(struct usbRequest *rq) { usbMsgPtr = (usbMsgPtr_t)&usbStringDescriptorProduct; len = usbStringDescriptorProduct.header.bLength; break; +#if defined(SERIAL_NUMBER) case 3: // iSerialNumber usbMsgPtr = (usbMsgPtr_t)&usbStringDescriptorSerial; len = usbStringDescriptorSerial.header.bLength; break; +#endif } break; case USBDESCR_HID: |