Skip to content

fix(system): the System Console releases the device before it resets into the bootloader - #920

Merged
finger563 merged 1 commit into
mainfrom
fix/system-console-release-before-reset
Nov 22, 2026
Merged

finger563 merged 1 commit into
mainfrom
fix/system-console-release-before-reset

Conversation

@finger563

Copy link
Copy Markdown
Contributor

Description

Rebooting a USB device into the ROM bootloader from a browser console can look like a hang: the device never shows up as the ROM's USB device until it is unplugged and plugged back in.

The cause is the host keeping the device open and claimed while the chip resets: a WebUSB interface with an IN transfer pending, here. The host (macOS, in particular) is then left holding a stale record of it, and the ROM's device, which has different ids, does not enumerate. It was seen with a console that asked for the reset 250 ms out and kept the device open. A command-line client that closed its handle before the reset fired worked every time.

  • system_console.html: a bootloader reboot now asks for a delay of at least 1000 ms. As soon as the OK arrives, the page disconnects: it stops the monitor stream, releases the interface and closes the device. A plain reboot is unchanged, since it comes back with the same ids and auto-reconnect picks it up.
  • Docs: the rule is written down for anyone implementing a host:
    • a "Host side: release the device before it resets" section in the component README
    • a note in system.rst
    • a pointer next to REBOOT_TO_BOOTLOADER in detail/system_protocol.hpp

How has this been tested?

  • The same change, made in another product's WebUSB console, was tested on an ESP32-S3 (T-Dongle-S3) from macOS. Before it, the reboot into the bootloader hung until a replug. After it, the ROM device (303a:0009) came up and a full flash over Web Serial succeeded.
  • This page:
    • loads in headless Chrome without errors
    • node components/dispatcher/web/test/resolve_module_id_test.js passes (the shared blocks are untouched)
    • system_host_test passes

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation Update
  • Hardware (schematic, board, system design) change
  • Software change

Checklist:

  • My change requires a change to the documentation.
  • I have added tests to cover my changes.
  • I have updated the documentation accordingly.
  • I have updated the .github/workflows/build.yml file to add my new test to the automated cloud build github action.
  • All new and existing tests passed.
  • My code follows the code style of this project.

🤖 Generated with Claude Code

https://claude.ai/code/session_01DFjjnq3XCTRAXENSxsCxJU

…into the bootloader

A host that keeps a USB device open and claimed while the chip resets into
the ROM bootloader (a WebUSB interface with an IN transfer pending) can leave
the host -- macOS in particular -- holding a stale record of it, so the ROM's
USB device never enumerates until the board is replugged: the reboot looks
like a hang. Seen with a WebUSB console that asked for the reset 250 ms out
and kept the device open.

- system_console.html: a bootloader reboot asks for at least 1000 ms and
  closes the device (monitor stream stopped, interface released) as soon as
  the OK arrives.
- README ("Host side: release the device before it resets"), system.rst and
  the protocol header document the rule for anyone implementing a host.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DFjjnq3XCTRAXENSxsCxJU
@github-actions

Copy link
Copy Markdown

✅Static analysis result - no issues found! ✅

@finger563
finger563 merged commit da452d0 into main Nov 22, 2026
184 checks passed
@finger563
finger563 deleted the fix/system-console-release-before-reset branch November 22, 2026 16:01
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.

1 participant