From 56594e75af1d357f77ae75b6b10f4b2a264f0c86 Mon Sep 17 00:00:00 2001 From: Stargirl Flowers Date: Sat, 3 Dec 2022 00:39:01 -0500 Subject: [PATCH] Allow changing the USB VID, PID, manufacturer, and product via CMake (#1130) --- .../pico_stdio_usb/stdio_usb_descriptors.c | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/src/rp2_common/pico_stdio_usb/stdio_usb_descriptors.c b/src/rp2_common/pico_stdio_usb/stdio_usb_descriptors.c index b3cfed0..e1babf8 100644 --- a/src/rp2_common/pico_stdio_usb/stdio_usb_descriptors.c +++ b/src/rp2_common/pico_stdio_usb/stdio_usb_descriptors.c @@ -32,8 +32,21 @@ #include "pico/stdio_usb/reset_interface.h" #include "pico/unique_id.h" +#ifndef USBD_VID #define USBD_VID (0x2E8A) // Raspberry Pi +#endif + +#ifndef USBD_PID #define USBD_PID (0x000a) // Raspberry Pi Pico SDK CDC +#endif + +#ifndef USBD_MANUFACTURER +#define USBD_MANUFACTURER "Raspberry Pi" +#endif + +#ifndef USBD_PRODUCT +#define USBD_PRODUCT "Pico" +#endif #define TUD_RPI_RESET_DESC_LEN 9 #if !PICO_STDIO_USB_ENABLE_RESET_VIA_VENDOR_INTERFACE @@ -102,8 +115,8 @@ static const uint8_t usbd_desc_cfg[USBD_DESC_LEN] = { static char usbd_serial_str[PICO_UNIQUE_BOARD_ID_SIZE_BYTES * 2 + 1]; static const char *const usbd_desc_str[] = { - [USBD_STR_MANUF] = "Raspberry Pi", - [USBD_STR_PRODUCT] = "Pico", + [USBD_STR_MANUF] = USBD_MANUFACTURER, + [USBD_STR_PRODUCT] = USBD_PRODUCT, [USBD_STR_SERIAL] = usbd_serial_str, [USBD_STR_CDC] = "Board CDC", #if PICO_STDIO_USB_ENABLE_RESET_VIA_VENDOR_INTERFACE