esp_usb_jtag: support multiple boards (--busdev-num, --esp-serial)#665
Merged
Conversation
0f2106a to
2c86870
Compare
…-serial-num libusb_open_device_with_vid_pid() returns the first VID:PID match, so with two ESP32-S3 cables connected, every invocation programmed the same board. Replace it with a libusb_get_device_list() iteration that also honours cable.bus_addr/device_addr (already exposed as --busdev-num) and --usb-serial-num flag that matches the device iSerialNumber by substring (useful with MAC-derived serials). The -d /dev/ttyACM* path could not help: that's the CDC-ACM interface (iface 0), while JTAG is on the vendor iface 2 reached via libusb; ttyACM numbering and libusb enumeration order are independent. Constraint: must keep existing single-board invocations working without flag changes Confidence: high Scope-risk: narrow Directive: arguments struct uses positional aggregate init at main.cpp:120; new fields must add a matching slot Not-tested: simultaneous two-board programming on real hardware (single-board path verified to build) Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Owner
|
Hi @r4d10n
Could you check/verify the code please? |
Contributor
Author
|
Looks good 👍 |
Owner
|
Applied. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
libusb_open_device_with_vid_pid()returns the first VID:PID match, so with two ESP32-S3 cables connected, every invocation programmed the same board. Replace it withlibusb_get_device_list()iteration that honourscable.bus_addr/cable.device_addr(already exposed via--busdev-num) and a new--esp-serialflag that matches the deviceiSerialNumberby substring.-d /dev/ttyACM*path cannot help: that's the CDC-ACM interface (iface 0), while JTAG is the vendor iface 2 reached via libusb; the two enumeration orderings are independent.--ftdi-serialsemantics are unchanged (FTDI cables only); the new--esp-serialis gated toMODE_ESP.Test plan
-c esp32s3 --detectwith one board)--busdev-num <bus>:<dev>selects each of two connected boards--esp-serial <substring>selects each of two connected boards (verified with the last byte of the MAC-derived serial::84vs:94)🤖 Generated with Claude Code