Skip to content

Conversation

@misaka19465
Copy link

Some devices may pick ready to use rp2040 boards, but need an custom product name, to make configuring easier for example. This patch added customizable manufacturer and product name through build_flags (this is my present solution. better solution could be found in the future).

Copy link
Owner

@earlephilhower earlephilhower left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These values already are defined by the user during the build process on the command line or the P.IO boards.json file. Make a custom board file and you can define them any way you like, without needing to add anything.

@maxgerhardt
Copy link
Contributor

maxgerhardt commented Sep 22, 2024

It already is customizible.

# in any case, add standard flags
# preferably use USB information from arduino.earlephilhower section,
# but fallback to sensible values derived from other parts otherwise.
usb_pid = board.get("build.arduino.earlephilhower.usb_pid",
board.get("build.hwids", [[0, 0]])[0][1])
usb_vid = board.get("build.arduino.earlephilhower.usb_vid",
board.get("build.hwids", [[0, 0]])[0][0])
usb_manufacturer = board.get(
"build.arduino.earlephilhower.usb_manufacturer", board.get("vendor", "Raspberry Pi"))
usb_product = board.get(
"build.arduino.earlephilhower.usb_product", board.get("name", "Pico"))

Allows you to set this in the platformio.ini, e.g.

[env:pico]
platform = https://github.com/maxgerhardt/platform-raspberrypi.git
board = rpipico
framework = arduino
; Set custom manufacturer and product
board_build.arduino.earlephilhower.usb_manufacturer = Custom Manufacturer
board_build.arduino.earlephilhower.usb_product = Ultra Cool Product

grafik

We need a documentation update here for PlatformIO, not a code change.

@maxgerhardt
Copy link
Contributor

maxgerhardt commented Sep 22, 2024

Well, mostly.. Found out that for changing USB VID and PID, the PlatformIO build defines the macros USB_PID, USB_VID, but these only seem to be used in Adafruit TinyUSB.. The regular USB stack uses USBD_PID, USBD_VID. Also defining those makes the VID+PID freely redifinable, too.

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

grafik

I will file a PR shortly for docs + builder script update.

@misaka19465
Copy link
Author

Thanks for your works. I'll close this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants