You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
feat: reset_device() wait_for_output option — poll for boot output instead of returning immediately #68
SerialMonitor.reset_device() currently sends POST /api/reset and returns immediately. Add a wait_for_output option that watches for serial output after reset and returns as soon as the device starts producing data (= rebooted and running).
Current behavior
mon.reset_device(board="esp32s3") # Returns True immediately after DTR toggletime.sleep(3.0) # Caller has to guess how long to wait
Proposed behavior
mon.reset_device(board="esp32s3", wait_for_output=True, timeout=5.0)
# Returns True as soon as any serial output is detected (device rebooted)# Returns False if timeout expires with no output# Typical ESP32-S3 USB-CDC: returns in <500ms instead of fixed 3s
Implementation
In crates/fbuild-python/src/lib.rs, after the HTTP reset call succeeds:
If wait_for_output is false (default): return immediately (current behavior)
If wait_for_output is true:
Attach a serial monitor to the port
Poll read_lines() in a tight loop (100ms intervals)
Return true as soon as any line is received
Return false if timeout expires
This is generic — no application-specific signatures needed. Any serial output = device booted.
Looks like this is already implemented in the current tree. The SerialMonitor.reset_device method at crates/fbuild-python/src/lib.rs already carries the exact signature and semantics proposed:
WebSocket fast path: when __enter__ has been called, polls read_lines_inner(0.2s) in a tight loop (reset_device lines 524–535) and returns true on the first non-empty batch.
HTTP fallback: when no WebSocket session exists, polls /api/serial/output?port=...&limit=1 at 100ms intervals (reset_device lines 537–559).
Honors timeout as a deadline and returns false if no output arrives in time.
300ms pause for USB re-enumeration after the DTR toggle (line 520), matching the proposed flow.
Activity
zackees commentedon Apr 17, 2026
Looks like this is already implemented in the current tree. The
SerialMonitor.reset_devicemethod atcrates/fbuild-python/src/lib.rsalready carries the exact signature and semantics proposed:#[pyo3(signature = (board=None, wait_for_output=false, timeout=5.0))]__enter__has been called, pollsread_lines_inner(0.2s)in a tight loop (reset_devicelines 524–535) and returnstrueon the first non-empty batch./api/serial/output?port=...&limit=1at 100ms intervals (reset_devicelines 537–559).timeoutas a deadline and returnsfalseif no output arrives in time.Closing.
feat(python): reset_device(wait_for_output=True, timeout=5.0) polls f…
feat(python): add wait_for_output option to reset_device()
feat(python): add wait_for_output to reset_device() (#69)