-
Notifications
You must be signed in to change notification settings - Fork 332
[VSC-1800] - OPENOCD_USB_ADAPTER_LOCATION not being cleared #1711
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
base: master
Are you sure you want to change the base?
Conversation
|
Download the artifacts for this pull request: |
|
The thing about this logic is only applies when user run the setTarget command. I'm wondering for the case: 1) User has connected board, 2) Run set target, 3) value is set in customExtraVars 4) Time passes user disconnect board 5) User tries to use OpenOCD Server directly and it doesn't work ? USB_ADAPTER_LOCATION is changed ? |
Fabricio-ESP
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Confirmed Working.
Thanks for the change.
brianignacio5
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some minor changes but one really required change in src/espIdf/setTarget/index.ts line 206 comment.
…ed the declaration of customExtraVars to a single location and added logic to clear OPENOCD_USB_ADAPTER_LOCATION when no board location is available or when switching to a non-connected target.
Clear the OPENOCD_USB_ADAPTER_LOCATION setting when switching to a target that doesn't have a USB location, preventing OpenOCD from using stale device addresses from previous targets. Create a plain object copy of customExtraVars to avoid proxy issues when deleting properties, and remove unnecessary configuration re-read.
Remove OPENOCD_USB_ADAPTER_LOCATION from environment during device detection so the script can scan all available devices, not just the one at the configured location.
- Added extra bool parameter for running openOCDManager.version() with default value false, for not silencing the output from it.
Parse and store USB adapter serial numbers from OpenOCD logs and use them as the primary identifier for adapter connections, with fallback to OPENOCD_USB_ADAPTER_LOCATION. Serial numbers are more reliable than USB locations which can change when devices are reconnected. - Parse serial from OpenOCD log output (format: "Info : esp_usb_jtag: serial (XX:XX:XX:XX:XX:XX)") - Store serial in workspace state for persistence - Inject 'adapter serial' command when starting OpenOCD - Clear serial/location when target changes - Auto-update serial port when switching to connected target - Remove location restriction during device detection
Remove async/Promise wrapping from storeAdapterSerial and clearAdapterSerial since they only perform synchronous workspaceState operations.
Add platform-specific USB bus/port parsing to match OpenOCD devices to serial ports.
37ad303 to
b979624
Compare
brianignacio5
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Description
This PR introduces support for identifying OpenOCD USB adapters by their serial number (MAC address), improving the reliability of multi-device setups. It also fixes device detection issues by ensuring scans aren't constrained by previous location settings and optimizes OpenOCD version checks.
OpenOCD Adapter Serial Support
adapter serial <serial>into OpenOCD commands when a specific adapter has been identified, taking precedence overOPENOCD_USB_ADAPTER_LOCATION.src/espIdf/openOcd/adapterSerial.tsto handle serial number logic.Device Detection Improvements
DevkitsCommandto temporarily unsetOPENOCD_USB_ADAPTER_LOCATIONduring device detection. This ensures the scan checks all available devices rather than just the currently configured one.setIdfTargetnow clears stored adapter serials and locations when selecting a new target to prevent stale configuration issues.Performance
OpenOCDManager.version()to support asilentmode, reducing log noise during frequent version checks in the hints provider.Type of change
Please delete options that are not relevant.
Steps to test this pull request
How has this been tested?
Same as described above
Test Configuration:
Checklist