Repository navigation
Reopen the monitor port after USB disconnects - #1104
Merged
Merged
Conversation
Member
Author
|
/hil full |
|
Triggered full HIL for PR #1104. Revision: Chips: Run: https://github.com/esp-rs/espflash/actions/runs/40852832424 Status: ❌ HIL run failed (failure). |
MabezDev
requested changes
Oct 29, 2026
MabezDev
approved these changes
Oct 29, 2026
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.
Recent full HIL runs fail intermittently on USB-Serial-JTAG targets. This PR makes the monitor survive a USB disconnect, removes a redundant reset before monitoring, and logs what the flash stub sent when its handshake fails.
Why
usb):write-bin --monitorandflash --monitorfail with× Broken piperight after the app printscpu_start: Multicore app. The USB-Serial-JTAG device disappears from the host, and the monitor exits instead of waiting for it, so the test never seesHello world!. This happened in 4 H4 runs (e.g. 40650085313). On the P4 it is tracked in ESP32-H4 and ESP32-P4: app drops off USB at startup #1101. It still happened with a 4 MB image in 40532392253, so--flash-size 4mbdoes not fully avoid it.usb): since Test flashing speed improvements #1060,board-infofails in about 4 of 14 runs withInvalid stub handshake response received(e.g. 40847569378). The error does not say what was received.Changes
monitorreopens its port after aBrokenPipeerror, which is how serialport reports a vanished device on Linux and macOS (POLLHUP). It closes the port first, so the device can re-enumerate under the same name, then retries every 100 ms. CTRL+C exits while waiting in interactive mode. On Windows, a removed device reports other errors, so the behavior there is unchanged.flashandwrite-bin(andcargo espflash flash) skip the non-interactive monitor's reset when the device was already hard-reset after flashing over USB-Serial-JTAG. The monitor receives that boot's output at any baud rate. Over UART, the monitor still resets the device, so it gets the boot output at the monitor baud rate.--ramis unchanged.This does not fix the cause of the USB drop in #1101. The monitor only survives it.
An AI tool generated a significant part of this change.
Testing
cargo +nightly fmt --all -- --check,cargo clippy --workspace -- -D warnings, the CI feature checks with-D warnings,cargo test --libandcargo test -p xtaskpass.cargo checkpasses forx86_64-pc-windows-msvcandx86_64-unknown-linux-gnu.HIL:
/hil full, since the monitor and reset paths affect every chip and both port types. The relevant jobs areesp32h4 | usb,esp32p4 | usbandesp32c5 | usb. Two jobs fail for unrelated hardware reasons:esp32 | uart(/dev/serial_ports/uartmissing on its runner since at least 2026-10-07) andesp32p4 | usb(the board does not enter download mode in "Prepare device" and the runner has no UART for recovery) will keep failing until those boards are fixed.