diff --git a/Cargo.lock b/Cargo.lock index 785c721..f567e69 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -253,6 +253,22 @@ dependencies = [ "memchr", ] +[[package]] +name = "core-foundation" +version = "0.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b2a6cd9ae233e7f62ba4e9353e81a88df7fc8a5987b8d445b4d90c879bd156f6" +dependencies = [ + "core-foundation-sys", + "libc", +] + +[[package]] +name = "core-foundation-sys" +version = "0.8.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "773648b94d0e5d620f64f280777445740e61fe701025087ec8b57f45c791888b" + [[package]] name = "crossbeam-utils" version = "0.8.21" @@ -397,7 +413,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ef033ed5e9bad94e55838ca0ca906db0e043f517adda0c8b79c7a8c66c93c1b5" dependencies = [ "cfg-if", - "rustix", + "rustix 0.38.44", "windows-sys 0.48.0", ] @@ -529,15 +545,25 @@ dependencies = [ "hashbrown 0.17.0", ] +[[package]] +name = "io-kit-sys" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "06d3a048d09fbb6597dbf7c69f40d14df4a49487db1487191618c893fc3b1c26" +dependencies = [ + "core-foundation-sys", + "mach2", +] + [[package]] name = "iqos" version = "1.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8d642c991ed9c909971bbc6e0679ae20ba5f9c063e92aa0b1227a657860db51f" +source = "git+https://github.com/okhsunrog/iqos?branch=agent%2Fusb-transport#e02a9991992eded1b4256aa3d4a06bf8ee842631" dependencies = [ "async-trait", "btleplug", "futures", + "nusb", "thiserror 2.0.12", "tokio", "uuid", @@ -651,6 +677,12 @@ version = "0.4.15" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d26c52dbd32dccf2d10cac7725f8eae5296885fb5703b261f7d0a0739ec807ab" +[[package]] +name = "linux-raw-sys" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "32a66949e030da00e8c7d4434b251670a91556f4144941d37452769c25d58a53" + [[package]] name = "lock_api" version = "0.4.12" @@ -667,6 +699,15 @@ version = "0.4.29" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5e5032e24019045c762d3c0f28f5b6b8bbf38563a65908389bf7978758920897" +[[package]] +name = "mach2" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6a1b95cd5421ec55b445b5ae102f5ea0e768de1f82bd3001e11f426c269c3aea" +dependencies = [ + "libc", +] + [[package]] name = "memchr" version = "2.7.4" @@ -704,6 +745,25 @@ dependencies = [ "libc", ] +[[package]] +name = "nusb" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "215a49c10e8cff30a0da93b258b21846c4e9242f7683748cfa8474fdc2e4d22b" +dependencies = [ + "core-foundation", + "core-foundation-sys", + "futures-core", + "io-kit-sys", + "linux-raw-sys 0.12.1", + "log", + "once_cell", + "rustix 1.1.4", + "slab", + "tokio", + "windows-sys 0.61.2", +] + [[package]] name = "objc-sys" version = "0.3.5" @@ -865,7 +925,20 @@ dependencies = [ "bitflags 2.9.0", "errno", "libc", - "linux-raw-sys", + "linux-raw-sys 0.4.15", + "windows-sys 0.59.0", +] + +[[package]] +name = "rustix" +version = "1.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6fe4565b9518b83ef4f91bb47ce29620ca828bd32cb7e408f0062e9930ba190" +dependencies = [ + "bitflags 2.9.0", + "errno", + "libc", + "linux-raw-sys 0.12.1", "windows-sys 0.59.0", ] diff --git a/Cargo.toml b/Cargo.toml index 9116578..a513e61 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -11,7 +11,7 @@ dirs = "5" btleplug = "0.11" colored = "3.0" futures = "0.3" -iqos = { version = "1.1.1", features = ["btleplug-support"] } +iqos = { git = "https://github.com/okhsunrog/iqos", branch = "agent/usb-transport", features = ["btleplug-support", "usb-support"] } rustyline = "11.0" serde = { version = "1.0", features = ["derive"] } tokio = { version = "1.0", features = ["full"] } diff --git a/README.md b/README.md index 8f7a0c2..9b63ab3 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@
-**A command-line interface for controlling IQOS devices via Bluetooth Low Energy, built on [V-VX/iqos](https://github.com/V-VX/iqos)** +**A command-line interface for controlling IQOS devices over Bluetooth Low Energy or USB, built on [V-VX/iqos](https://github.com/V-VX/iqos)** [![Rust](https://img.shields.io/badge/rust-1.92%2B-orange.svg?style=flat-square&logo=rust)](https://www.rust-lang.org/) [![License](https://img.shields.io/badge/license-GPL--3.0-blue.svg?style=flat-square)](LICENSE) @@ -32,15 +32,16 @@ ## Overview -IQOS CLI is a Rust-based command-line tool for controlling IQOS devices over Bluetooth Low Energy, built on top of [V-VX/iqos](https://github.com/V-VX/iqos). It supports both an interactive REPL and one-shot command execution, so you can either connect once and work from the `iqos>` prompt or run a single command directly from your shell. +IQOS CLI is a Rust-based command-line tool for controlling IQOS devices over Bluetooth Low Energy or USB, built on top of [V-VX/iqos](https://github.com/V-VX/iqos). It supports both an interactive REPL and one-shot command execution, so you can either connect once and work from the `iqos>` prompt or run a single command directly from your shell. ## Architecture -All device protocol logic — BLE framing, capability negotiation, command encoding, response parsing — lives in the [iqos crate (V-VX/iqos)](https://github.com/V-VX/iqos). This repository is a thin CLI layer: it handles device discovery, user interaction, and argument parsing, then delegates every device operation to the crate's high-level API. +All device protocol logic — BLE/USB framing, capability negotiation, command encoding, and response parsing — lives in the [iqos crate (V-VX/iqos)](https://github.com/V-VX/iqos). This repository is a thin CLI layer: it handles device discovery, user interaction, and argument parsing, then delegates every device operation to the crate's high-level API. ## Features - **Automatic Device Discovery** — Scans and connects to IQOS devices via Bluetooth +- **Direct USB Connection** — Select the attached IQOS with `--usb` without BLE scanning - **Interactive Console** — REPL with command history (`iqos>` prompt) - **One-Shot CLI Commands** — Run device commands directly, for example `iqos --model iluma battery` - **Saved Device Labels** — Remember a connected device and target it later with `--model