feat(transport): add native Windows support#75
Draft
aadhi1014 wants to merge 2 commits into
Draft
Conversation
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>
Collaborator
|
This is a great start, @aadhi1014. Thank you! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
tokio_serial::available_ports(), groups by VID:PID:serial, emits the sameUsbDeviceConnected/UsbDeviceDisconnectedevents as the Linux udev pathserial_windows.rswrapstokio-serialwith async read/write, runtime baud rate changes, split reader/writer/control handles — identical API surface to the Unix implementationSIGINT/SIGTERMwithtokio::signal::ctrl_c()on Windowsc0de:cafe) — Windows reports "Microsoft" as manufacturer for CDC ACM devices instead of "OSMU"/"Bitaxe"BitaxeBoard::new()is nowasyncto avoid "runtime within runtime" panics when opening the data port on WindowsWINDOWS.mdcovers setup, architecture, troubleshooting, and known limitationsPlatform 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
cargo build --releasec0de:cafe) and confirm it appears in logs within 2scargo buildon Linux)cargo check --target x86_64-unknown-linux-gnupasses from Windows (cross-check)Files changed
transport/usb/windows.rstransport/serial_windows.rstransport/mod.rstransport/usb.rsdaemon.rsboard/bitaxe.rsWINDOWS.md🤖 Generated with Claude Code