From 33d1478f8937e471cf82fad305246453ade7c849 Mon Sep 17 00:00:00 2001 From: Maximilian Gerhardt Date: Mon, 30 Sep 2024 18:32:15 +0200 Subject: [PATCH] Update PIO USB docs, fixup used VID/PID macros --- docs/platformio.rst | 12 ++++++++++++ tools/platformio-build.py | 8 ++++++-- 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/docs/platformio.rst b/docs/platformio.rst index 611e02012..c839cde7c 100644 --- a/docs/platformio.rst +++ b/docs/platformio.rst @@ -262,6 +262,18 @@ default Pico SDK USB stack. To change it, add Note that the special "No USB" setting is also supported, through the shortcut-define ``PIO_FRAMEWORK_ARDUINO_NO_USB``. +USB Customization +----------------- + +If you want to change the USB VID, PID, product or manufacturer name that the device will appear under, configure them as follows: + +.. code:: ini + + board_build.arduino.earlephilhower.usb_manufacturer = Custom Manufacturer + board_build.arduino.earlephilhower.usb_product = Ultra Cool Product + board_build.arduino.earlephilhower.usb_vid = 0xABCD + board_build.arduino.earlephilhower.usb_pid = 0x1337 + IP Stack -------- diff --git a/tools/platformio-build.py b/tools/platformio-build.py index 3adbaf022..4345b35ca 100755 --- a/tools/platformio-build.py +++ b/tools/platformio-build.py @@ -337,11 +337,15 @@ def configure_usb_flags(cpp_defines): env.Append(CPPDEFINES=[ ("CFG_TUSB_MCU", "OPT_MCU_RP2040"), + # used by TinyUSB stack ("USB_VID", usb_vid), ("USB_PID", usb_pid), + # Used by native USB stack + ("USBD_VID", usb_vid), + ("USBD_PID", usb_pid), + # Used by both stacks ("USB_MANUFACTURER", '\\"%s\\"' % usb_manufacturer), - ("USB_PRODUCT", '\\"%s\\"' % usb_product), - ("SERIALUSB_PID", usb_pid) + ("USB_PRODUCT", '\\"%s\\"' % usb_product) ]) if "USBD_MAX_POWER_MA" not in env.Flatten(env.get("CPPDEFINES", [])):