Skip to content

feat(transport): add native Windows support#75

Draft
aadhi1014 wants to merge 2 commits into
256foundation:mainfrom
aadhi1014:feat/windows-transport
Draft

feat(transport): add native Windows support#75
aadhi1014 wants to merge 2 commits into
256foundation:mainfrom
aadhi1014:feat/windows-transport

Conversation

@aadhi1014

Copy link
Copy Markdown

Summary

  • Windows USB discovery: polls COM ports every 2s via tokio_serial::available_ports(), groups by VID:PID:serial, emits the same UsbDeviceConnected/UsbDeviceDisconnected events as the Linux udev path
  • Windows serial I/O: serial_windows.rs wraps tokio-serial with async read/write, runtime baud rate changes, split reader/writer/control handles — identical API surface to the Unix implementation
  • Signal handling: replaces SIGINT/SIGTERM with tokio::signal::ctrl_c() on Windows
  • Board matching: switched from manufacturer/product string matching to VID:PID (c0de:cafe) — Windows reports "Microsoft" as manufacturer for CDC ACM devices instead of "OSMU"/"Bitaxe"
  • Async init: BitaxeBoard::new() is now async to avoid "runtime within runtime" panics when opening the data port on Windows
  • Docs: WINDOWS.md covers setup, architecture, troubleshooting, and known limitations

Platform notes

Tested on Windows 11 with a BitAxe Gamma running bitaxe-raw firmware. No WSL2 or Docker required — runs as a native .exe.

Detection latency is ~2s on Windows (polling) vs near-instant on Linux (udev netlink). This is acceptable for mining use.

Test plan

  • Build on Windows: cargo build --release
  • Plug in a BitAxe Gamma (bitaxe-raw firmware, VID:PID c0de:cafe) and confirm it appears in logs within 2s
  • Unplug and confirm disconnect event is logged
  • Confirm Linux build is unaffected (cargo build on Linux)
  • Confirm cargo check --target x86_64-unknown-linux-gnu passes from Windows (cross-check)

Files changed

File Change
transport/usb/windows.rs NEW — COM port polling discovery
transport/serial_windows.rs NEW — async serial I/O via tokio-serial
transport/mod.rs conditional compilation for Windows serial
transport/usb.rs Clone impl, Windows platform wiring
daemon.rs Windows Ctrl+C signal handling
board/bitaxe.rs VID:PID matching, async new(), fan diagnostics
WINDOWS.md setup and architecture docs

🤖 Generated with Claude Code

aadhi1014 and others added 2 commits June 15, 2026 14:00
Implements native Windows support for mujina-miner without requiring WSL2 or Docker:

- transport/usb/windows.rs: COM port polling-based USB device discovery using
  tokio_serial::available_ports(). Groups ports by VID:PID:serial, emits
  UsbDeviceConnected/Disconnected events every 2s to match Linux udev behavior.
- transport/serial_windows.rs: Windows SerialStream wrapping tokio-serial with
  async I/O, runtime baud rate reconfiguration, split reader/writer/control
  handles, and lock-free stats via atomics.
- transport/mod.rs: Conditional compilation to select serial_windows.rs on
  Windows vs serial.rs on Unix.
- transport/usb.rs: Add Clone impl for UsbDeviceInfo and wire up Windows
  platform in serial_ports() and create_discovery().
- daemon.rs: Replace SIGINT/SIGTERM handlers with tokio::signal::ctrl_c() on
  Windows.
- WINDOWS.md: Setup instructions, architecture notes, and troubleshooting guide.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Match BitAxe by VID:PID (c0de:cafe) instead of manufacturer/product strings,
  since Windows reports "Microsoft" for CDC ACM devices instead of "OSMU"/"Bitaxe"
- Make BitaxeBoard::new() async to use SerialStream::open().await, avoiding
  "runtime within runtime" panics when opening the data serial port on Windows
- Read back fan RPM 1s after init and warn if outside 500-10000 RPM range
- Clarify ASIC_RESET_PIN comment and port-opening log messages

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@rkuester rkuester linked an issue Jun 15, 2026 that may be closed by this pull request
@rkuester

Copy link
Copy Markdown
Collaborator

This is a great start, @aadhi1014. Thank you!

@rkuester rkuester marked this pull request as draft June 15, 2026 19:52
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.

feat(transport): add USB hotplug support on Windows

2 participants