Skip to content

Commit a2164a5

Browse files
authored
Update PIO USB docs, fixup used VID/PID macros (#2505)
1 parent 2550195 commit a2164a5

File tree

2 files changed

+18
-2
lines changed

2 files changed

+18
-2
lines changed

docs/platformio.rst

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -262,6 +262,18 @@ default Pico SDK USB stack. To change it, add
262262
Note that the special "No USB" setting is also supported, through the
263263
shortcut-define ``PIO_FRAMEWORK_ARDUINO_NO_USB``.
264264

265+
USB Customization
266+
-----------------
267+
268+
If you want to change the USB VID, PID, product or manufacturer name that the device will appear under, configure them as follows:
269+
270+
.. code:: ini
271+
272+
board_build.arduino.earlephilhower.usb_manufacturer = Custom Manufacturer
273+
board_build.arduino.earlephilhower.usb_product = Ultra Cool Product
274+
board_build.arduino.earlephilhower.usb_vid = 0xABCD
275+
board_build.arduino.earlephilhower.usb_pid = 0x1337
276+
265277
IP Stack
266278
--------
267279

tools/platformio-build.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -337,11 +337,15 @@ def configure_usb_flags(cpp_defines):
337337

338338
env.Append(CPPDEFINES=[
339339
("CFG_TUSB_MCU", "OPT_MCU_RP2040"),
340+
# used by TinyUSB stack
340341
("USB_VID", usb_vid),
341342
("USB_PID", usb_pid),
343+
# Used by native USB stack
344+
("USBD_VID", usb_vid),
345+
("USBD_PID", usb_pid),
346+
# Used by both stacks
342347
("USB_MANUFACTURER", '\\"%s\\"' % usb_manufacturer),
343-
("USB_PRODUCT", '\\"%s\\"' % usb_product),
344-
("SERIALUSB_PID", usb_pid)
348+
("USB_PRODUCT", '\\"%s\\"' % usb_product)
345349
])
346350

347351
if "USBD_MAX_POWER_MA" not in env.Flatten(env.get("CPPDEFINES", [])):

0 commit comments

Comments
 (0)