diff options
| author | jamie <git@skilet.ro> | 2026-08-16 21:20:57 +0100 |
|---|---|---|
| committer | jamie <git@skilet.ro> | 2026-08-29 22:06:00 +0100 |
| commit | be625dc771273289d2d9681c02e8e767c3ffbc2f (patch) | |
| tree | fefe0acaa9c5a8307d5a2ad91dcfa507cc54e969 /src/main.rs | |
chore: init
Diffstat (limited to 'src/main.rs')
| -rw-r--r-- | src/main.rs | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/src/main.rs b/src/main.rs new file mode 100644 index 0000000..4648631 --- /dev/null +++ b/src/main.rs @@ -0,0 +1,46 @@ +//! mmx150 — battery and connection monitoring for the beyerdynamic MMX 150 +//! wireless dongle. + +use std::process::ExitCode; + +fn main() -> ExitCode { + let args: Vec<String> = std::env::args().skip(1).collect(); + match args.first().map(String::as_str) { + Some("status") => cmd_status(), + Some("daemon") => cmd_daemon(), + Some("probe") => cmd_probe(), + _ => { + eprintln!("usage: mmx150 <status|daemon|probe>"); + ExitCode::FAILURE + } + } +} + +fn cmd_status() -> ExitCode { + match mmx150::hid::find_mmx150() { + Ok(Some(dev)) => { + println!("dongle: {} ({}:{:04x})", dev.name, dev.vid, dev.pid); + println!("connection: unknown (protocol reverse-engineering in progress)"); + println!("battery: unknown"); + ExitCode::SUCCESS + } + Ok(None) => { + eprintln!("dongle not found"); + ExitCode::FAILURE + } + Err(e) => { + eprintln!("error: {e}"); + ExitCode::FAILURE + } + } +} + +fn cmd_daemon() -> ExitCode { + eprintln!("daemon not implemented yet"); + ExitCode::FAILURE +} + +fn cmd_probe() -> ExitCode { + eprintln!("use `mmx150-probe` binary instead"); + ExitCode::FAILURE +} |
