Skip to content

feat: add improv-wifi to iti toolset#300

Merged
passcod merged 29 commits into
mainfrom
feat/improv-wifi
May 23, 2026
Merged

feat: add improv-wifi to iti toolset#300
passcod merged 29 commits into
mainfrom
feat/improv-wifi

Conversation

@passcod
Copy link
Copy Markdown
Member

@passcod passcod commented May 5, 2026

No description provided.

@passcod passcod force-pushed the feat/improv-wifi branch 8 times, most recently from 2c85cd4 to 38542d8 Compare May 6, 2026 02:04
passcod added 22 commits May 22, 2026 20:59
Drops the C-FFI dbus dependency that bluer pulls in transitively. The
GATT service, characteristics, and LE advertisement are now zbus
`#[interface]` impls registered on the system bus, with BlueZ's
GattManager1 / LEAdvertisingManager1 driving the lifecycle. Adapter
discovery uses ObjectManager on `org.bluez`.

The protocol layer (RPC parser/reassembler, state machine, dispatch,
WifiConfigurator trait, NetworkManagerBackend) is unchanged. Public API:
`ImprovWifi::install` now takes a `zbus::Connection` and an adapter
`OwnedObjectPath`; new `find_adapter` / `power_on_adapter` helpers
are exported for callers.

Removes `libdbus-1` from the build graph: improv-wifi compiles cleanly
for x86_64-unknown-linux-musl with no system libs, and bestool with
`--features iti` no longer needs libdbus-1-dev or pkg-config.
All phases implemented. Manual BLE smoke testing on real Linux+BlueZ
hardware is still pending (cannot be done from this sandbox).
Per AGENTS.md, prefer the foo.rs / foo/sub.rs module style.
Adds a non-generic, cloneable handle that can signal authorization from
another task. Obtain via `ImprovWifi::auth_handle()` before calling
`run`. The run loop selects on the underlying mpsc channel alongside
its existing arms and calls `set_status(Authorized)` on a trigger.
New flags:
- --auth-stdin: any line on stdin authorizes (line content ignored).
- --auth-gpio <BCM-pin>: button press on the pin authorizes (active-low,
  internal pull-up, debounced via --auth-gpio-debounce, default 50ms).

Both imply --require-authorization. Either or both can be set; either
trigger fires authorize via the new improv-wifi AuthHandle.
Pulls `auth_timeout` from `Duration` to `Option<Duration>` in
`ImprovWifiConfig`. `None` (the default) keeps the device authorised
until provisioned or shut down — useful for benchtop bring-up and for
buttons wired to a watchdog rather than a person.

Library: the timeout task only spawns when `auth_required` and
`auth_timeout` is `Some`.

CLI: `--auth-timeout` is now `Option<humantime::Duration>`. Unset means
no timeout.

Also switches user-facing prose (docstrings, log messages, CLI help)
to NZ English.
Runs `bestool iti improv-wifi --auth-gpio 17` on boot, restarts on
failure (clean exit after successful provisioning is final). The BCM
pin must be edited to match the device's wiring.
Adds `NetworkManagerBackend::is_connected` (queries the Wi-Fi device's
NM state). The bestool iti command checks it before installing the BLE
service and exits cleanly if the device is in `Activated`. New
`--always` flag overrides the check.

Makes the boot-time systemd service a no-op once the device is
provisioned, instead of advertising forever waiting for a button press.
All phases implemented.
passcod and others added 4 commits May 22, 2026 21:19
The default mode of `bestool iti improv-wifi` is now a long-running
daemon. A fresh device (no Wi-Fi config) advertises immediately for
first-boot provisioning; once provisioned, the daemon stays idle and
the device is invisible over BLE until a long press (3s+) on
`--auth-gpio` re-enters provisioning mode. Short presses during a
session authorise the in-progress credential write.

Add `--one-shot` for the run-once-and-exit behaviour, with a
SECURITY WARNING in its help text. Add `--no-auth` (requires
`--one-shot`) to skip authorisation gating, also with a SECURITY
WARNING. `--auth-stdin` and `--always` now require `--one-shot`.

Library: NetworkManagerBackend::is_configured() — true iff any saved
802-11-wireless connection profile exists.

CLI: in daemon mode, the GPIO is configured for both edges with a
tokio task classifying each press by hold duration via
`--auth-gpio-long-press` (default 3s). Daemon mode requires
`--auth-gpio`; one-shot mode requires exactly one of
`--auth-gpio` / `--auth-stdin` / `--no-auth`.

systemd: ExecStart is `--auth-gpio 17` with Restart=always.
All phases implemented.
@passcod passcod force-pushed the feat/improv-wifi branch from 73ea2a9 to e79fa2a Compare May 22, 2026 10:22
@passcod passcod added this pull request to the merge queue May 23, 2026
Merged via the queue into main with commit ae854b5 May 23, 2026
8 checks passed
@passcod passcod deleted the feat/improv-wifi branch May 23, 2026 01:54
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.

1 participant