Skip to content

refactor(autoresearch): replace raw pyserial DTR reset with SerialInterface.reset_device() #2264

Closed

Description

@zackees

Summary

Replace the raw pyserial DTR workaround in ci/autoresearch/gpio.py with the proper SerialInterface.reset_device() method, once FastLED/fbuild#50 lands.

Current state

gpio.py bypasses fbuild entirely to toggle DTR:

import serial as pyserial
s = pyserial.Serial(port, 115200)
s.dtr = True; sleep(0.1); s.dtr = False

This fights with the daemon for the serial port and is fragile.

Required changes

  1. Add reset_device(board) to SerialInterface protocol in ci/util/serial_interface.py
  2. Implement in FbuildSerialAdapter (delegates to SerialMonitor.reset_device())
  3. Implement in PySerialAdapter (direct DTR toggle fallback)
  4. Replace workaround in ci/autoresearch/gpio.py

Depends on

Related

Activity

  1. added 2 commits that reference this issue on Apr 17, 2026
    2bd00c3
    0a53600
  2. zackees commented on Apr 19, 2026

    @zackees
    MemberAuthor

    Closing — all four work items are done in tree.

    1. ✅ SerialInterface.reset_device(board) added — ci/util/serial_interface.py:80:
      async def reset_device(self, board: str | None) -> bool: ...
    2. ✅ FbuildSerialAdapter implements it.
    3. ✅ PySerialAdapter direct-DTR fallback — ci/util/serial_interface.py:125 delegates to _pyserial_dtr_reset().
    4. ✅ ci/autoresearch/gpio.py now calls serial_interface.reset_device() at both reset sites (lines 80 and 278), with _pyserial_dtr_reset(port) as a pure fallback only when the fbuild-backed adapter is unavailable.

    The original raw-pyserial DTR bypass is gone from gpio.py's happy path. Reopen if the fallback path becomes the primary path again or if the daemon ↔ pyserial port contention returns.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions