Repository navigation
WSL2: replug must auto-recover — CYD should resume exactly as before without manual steps #10
Copy link
Copy link
Open
Description
Problem
Under WSL2, physically unplugging and replugging the CYD breaks the hub and it does not recover on its own — the display falls back to hub offline and stays there until the user manually intervenes.
Observed chain on replug:
- The usbipd-win attachment is lost →
/dev/ttyUSB0disappears from WSL. serial_bridgeis left polling a dead port (/dev/ttyUSB0 unavailable; retrying...).- On replug, even after re-attaching, the new device node comes back as
root:dialout— so withoutdialoutmembership it's permission-denied again. - Net result: firmware shows
hub offline; user must manually re-attach + restartserial_bridge.
Desired behavior: plug the CYD back in → within a few seconds the session list is back exactly as before, zero manual steps.
Solution proposals
Three pieces are needed; each addresses one link in the chain.
1. Auto re-attach the USB device (Windows/usbipd side)
usbipd can keep re-attaching across replugs:
usbipd.exe attach --wsl --hardware-id 1a86:7523 --auto-attachThis is a long-running foreground process that re-attaches the device the moment it reappears, so /dev/ttyUSB0 comes back automatically. Run it as a supervised background process (see #3).
2. Stable, permission-correct device node (WSL side)
- Add the user to
dialoutonce (sudo usermod -aG dialout $USER) so the freshly-created node is accessible withoutchmodafter every replug (see docs: list Linux prerequisites (build-essential, pkg-config, libudev-dev, dialout group) #8). - Optional: a udev rule to pin a stable symlink + group, e.g.
and point
SUBSYSTEM=="tty", ATTRS{idVendor}=="1a86", ATTRS{idProduct}=="7523", SYMLINK+="cyd", GROUP="dialout", MODE="0660"serial_bridgeat/dev/cydso it's independent ofttyUSB0/ttyUSB1numbering.
3. Self-healing bring-up (supervisor)
- Verify/strengthen
serial_bridge's auto-reconnect so it survives the node disappearing and reappearing (README claims it reconnects on unplug/replug — confirm it doesn't exit on a vanished port). - Provide a supervised setup so all three survive crashes and reboots. Options:
- systemd user services (WSL has systemd):
usbipd-attach.service(runs the--auto-attach),vibe-bridge.service,serial-bridge.servicewithRestart=always. - Or extend
scripts/wsl-cyd-up.sh(feature: one-command WSL2 bring-up helper script (attach + bridge + serial_bridge) #9) to launch--auto-attachin the background and runserial_bridgein awhilerestart loop.
- systemd user services (WSL has systemd):
Acceptance criteria
- Unplug + replug the CYD → session list returns automatically within ~10 s, no commands run.
- Survives
ttyUSBrenumbering (ttyUSB0→ttyUSB1). - No
chmodneeded after replug. - Documented in the WSL2 section (WSL2 support (umbrella): usbipd-win passthrough — bridge in WSL, COM ports invisible #4).
Related
- WSL2 support (umbrella): usbipd-win passthrough — bridge in WSL, COM ports invisible #4 (WSL2 umbrella), docs: list Linux prerequisites (build-essential, pkg-config, libudev-dev, dialout group) #8 (dialout/prereqs), feature: one-command WSL2 bring-up helper script (attach + bridge + serial_bridge) #9 (bring-up helper script)
Environment
Windows 11 + WSL2, CYD USB-SERIAL CH340 (1a86:7523).
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels
Activity
fix(bridge): sanitize federation node ids, bound serial ack id length
feat: harden bridge auth/CI, wire up WiFi ack, trim docs for v0.3.0 (#19