diff options
| author | Ryan <fauxpark@gmail.com> | 2020-12-05 21:14:19 +1100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-12-05 21:14:19 +1100 |
| commit | 15faffacf49240ea95a0f0121511e6b2fb4c914c (patch) | |
| tree | dc207b03cd4d374d8e2d066b335774ab121aa8bd /tmk_core/protocol/vusb/vusb.c | |
| parent | e3888281f49d566cb9cf3efdebb105014f0957d2 (diff) | |
| download | qmk_firmware-15faffacf49240ea95a0f0121511e6b2fb4c914c.tar.gz qmk_firmware-15faffacf49240ea95a0f0121511e6b2fb4c914c.zip | |
Omit serial number if not defined (#11104)
Diffstat (limited to 'tmk_core/protocol/vusb/vusb.c')
| -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 77bbbd7bd..9b65ba9ac 100644 --- a/tmk_core/protocol/vusb/vusb.c +++ b/tmk_core/protocol/vusb/vusb.c | |||
| @@ -531,10 +531,6 @@ const PROGMEM uchar console_hid_report[] = { | |||
| 531 | }; | 531 | }; |
| 532 | #endif | 532 | #endif |
| 533 | 533 | ||
| 534 | #ifndef SERIAL_NUMBER | ||
| 535 | # define SERIAL_NUMBER 0 | ||
| 536 | #endif | ||
| 537 | |||
| 538 | #ifndef USB_MAX_POWER_CONSUMPTION | 534 | #ifndef USB_MAX_POWER_CONSUMPTION |
| 539 | # define USB_MAX_POWER_CONSUMPTION 500 | 535 | # define USB_MAX_POWER_CONSUMPTION 500 |
| 540 | #endif | 536 | #endif |
| @@ -569,6 +565,7 @@ const PROGMEM usbStringDescriptor_t usbStringDescriptorProduct = { | |||
| 569 | .bString = LSTR(PRODUCT) | 565 | .bString = LSTR(PRODUCT) |
| 570 | }; | 566 | }; |
| 571 | 567 | ||
| 568 | #if defined(SERIAL_NUMBER) | ||
| 572 | const PROGMEM usbStringDescriptor_t usbStringDescriptorSerial = { | 569 | const PROGMEM usbStringDescriptor_t usbStringDescriptorSerial = { |
| 573 | .header = { | 570 | .header = { |
| 574 | .bLength = USB_STRING_LEN(sizeof(STR(SERIAL_NUMBER)) - 1), | 571 | .bLength = USB_STRING_LEN(sizeof(STR(SERIAL_NUMBER)) - 1), |
| @@ -576,6 +573,7 @@ const PROGMEM usbStringDescriptor_t usbStringDescriptorSerial = { | |||
| 576 | }, | 573 | }, |
| 577 | .bString = LSTR(SERIAL_NUMBER) | 574 | .bString = LSTR(SERIAL_NUMBER) |
| 578 | }; | 575 | }; |
| 576 | #endif | ||
| 579 | 577 | ||
| 580 | /* | 578 | /* |
| 581 | * Device descriptor | 579 | * Device descriptor |
| @@ -595,7 +593,11 @@ const PROGMEM usbDeviceDescriptor_t usbDeviceDescriptor = { | |||
| 595 | .bcdDevice = DEVICE_VER, | 593 | .bcdDevice = DEVICE_VER, |
| 596 | .iManufacturer = 0x01, | 594 | .iManufacturer = 0x01, |
| 597 | .iProduct = 0x02, | 595 | .iProduct = 0x02, |
| 596 | #if defined(SERIAL_NUMBER) | ||
| 598 | .iSerialNumber = 0x03, | 597 | .iSerialNumber = 0x03, |
| 598 | #else | ||
| 599 | .iSerialNumber = 0x00, | ||
| 600 | #endif | ||
| 599 | .bNumConfigurations = 1 | 601 | .bNumConfigurations = 1 |
| 600 | }; | 602 | }; |
| 601 | 603 | ||
| @@ -821,10 +823,12 @@ USB_PUBLIC usbMsgLen_t usbFunctionDescriptor(struct usbRequest *rq) { | |||
| 821 | usbMsgPtr = (usbMsgPtr_t)&usbStringDescriptorProduct; | 823 | usbMsgPtr = (usbMsgPtr_t)&usbStringDescriptorProduct; |
| 822 | len = usbStringDescriptorProduct.header.bLength; | 824 | len = usbStringDescriptorProduct.header.bLength; |
| 823 | break; | 825 | break; |
| 826 | #if defined(SERIAL_NUMBER) | ||
| 824 | case 3: // iSerialNumber | 827 | case 3: // iSerialNumber |
| 825 | usbMsgPtr = (usbMsgPtr_t)&usbStringDescriptorSerial; | 828 | usbMsgPtr = (usbMsgPtr_t)&usbStringDescriptorSerial; |
| 826 | len = usbStringDescriptorSerial.header.bLength; | 829 | len = usbStringDescriptorSerial.header.bLength; |
| 827 | break; | 830 | break; |
| 831 | #endif | ||
| 828 | } | 832 | } |
| 829 | break; | 833 | break; |
| 830 | case USBDESCR_HID: | 834 | case USBDESCR_HID: |
