Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature: Target devices by it's unique ID #54

Closed
ggsubs opened this issue Jul 30, 2022 · 5 comments
Closed

Feature: Target devices by it's unique ID #54

ggsubs opened this issue Jul 30, 2022 · 5 comments
Milestone

Comments

@ggsubs
Copy link

ggsubs commented Jul 30, 2022

Feature request: Target devices by their unique ID, so that I can work with multiple devices connected at the same time, while allowing the USB port connections to change.

The unique id is available on the SDK (pico_get_unique_board_id), the same string is exposed on the device descriptor.

@ggsubs
Copy link
Author

ggsubs commented Jul 30, 2022

Example: lsusb -v output shows iSerial value:

Bus 002 Device 004: ID 2e8a:000a  
Device Descriptor:
  bLength                18
  bDescriptorType         1
  bcdUSB               2.00
  bDeviceClass          239 Miscellaneous Device
  bDeviceSubClass         2 
  bDeviceProtocol         1 Interface Association
  bMaxPacketSize0        64
  idVendor           0x2e8a 
  idProduct          0x000a 
  bcdDevice            1.00
  iManufacturer           1 Raspberry Pi
  iProduct                2 Pico
  iSerial                 3 E66038B713249237
  bNumConfigurations      1

The following snippet shows how to get the unique ID:
libusb_get_string_descriptor_ascii( deviceHandle, deviceDescriptor.iSerialNumber, stringBuff, stringBuffLen)

@neilenns
Copy link

Yes, this would be excellent. I opened similar issues a while back (#48) and despite how I closed that issue I actually never solved my problem. I couldn't find any way to programmatically reference an RP2040 device and flash it using picotool.

@lurch
Copy link
Contributor

lurch commented Mar 5, 2023

I guess this ties up closely with #12 (since the ID returned by pico_get_unique_board_id is the flash-chip's unique ID.

@Ferdi265
Copy link
Contributor

I have created a very experimental branch here that provides a --serial option for selecting devices, as well as --multiple for e.g., rebooting multiple devices into BOOTSEL mode at once.

The branch is pretty experimental, but it simplifies the workflow for working with multiple picos by a lot.

For example:

picotool load server.uf2 --serial $SERVER_SERIAL -f
picotool load client.uf2 --serial $CLIENT_SERIAL -f

will correctly reboot two specific picos into BOOTSEL mode, flash them, and reboot them back into application mode.
I'm still cleaning up the branch, but I hope I will have something quite usable in a week or two.

@will-v-pi
Copy link
Contributor

This has been added with picotool 2.0.0 as the --ser option

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

No branches or pull requests

5 participants