Skip to content

feat: add improv-wifi to iti toolset#300

Open
passcod wants to merge 26 commits intomainfrom
feat/improv-wifi
Open

feat: add improv-wifi to iti toolset#300
passcod wants to merge 26 commits intomainfrom
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 from 96ad9c7 to 19051b9 Compare May 5, 2026 22:34
passcod added 6 commits May 6, 2026 12:05
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.
@passcod passcod force-pushed the feat/improv-wifi branch from 19051b9 to 1805501 Compare May 6, 2026 00:14
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.
@passcod passcod force-pushed the feat/improv-wifi branch 3 times, most recently from ff4a28b to 509baf9 Compare May 6, 2026 00:59
passcod added 3 commits May 6, 2026 13:02
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.
@passcod passcod force-pushed the feat/improv-wifi branch from 509baf9 to 6cf7502 Compare May 6, 2026 01:03
@passcod passcod force-pushed the feat/improv-wifi branch from 6cf7502 to 2c85cd4 Compare May 6, 2026 01:33
passcod added 2 commits May 6, 2026 14:04
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 2c85cd4 to 38542d8 Compare May 6, 2026 02:04
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