Skip to content

Maid BT v1.2.8

Choose a tag to compare

@visadaking visadaking released this 28 Nov 12:18
· 3 commits to main since this release

Maid BT v1.2.8

  • Plasma applet: clear busy state on action completion so mode switches (PC/phone/radio/off) don't get stuck.
  • Desktop: recognize SonicDE (XDG_CURRENT_DESKTOP=SonicDE:KDE) in applet/session diagnostics and installer checks.
  • Init systems: add OpenRC and other non-systemd init support with automatic setup during install.

BlueV Protocol (Maid Watcher)

BlueV is Maid Watcher’s Bluetooth state persistence and ownership-aware recovery layer, built to keep earbud behavior predictable across sleep/resume, startup, and phone/PC handoff scenarios.

  • MVP: BT state persistence & restore (BlueV):

    • Persist adapter power state and connected managed devices to ~/.local/state/maid-watcher/bt-state.json (atomic writes).
    • Snapshot on meaningful changes (device connect/disconnect, adapter Powered changes) and immediately before suspend via logind PrepareForSleep.
    • Restore on startup and after resume: wait for BlueZ/adapter readiness, restore saved adapter power intent, and reconnect saved managed devices with staggered, best-effort retries.
    • Respect prior intent: if the adapter was intentionally off before sleep, BlueV leaves it off on restore.
    • New audit log trail for restore/snapshot actions (BlueV: entries).
  • BlueV expansion (state, hints, policy, observability):

    • State/confidence model (maid_core.bluev): per-device state tracking with connected_to_pc, connected_to_phone, out_available, docked, and unknown, driven by PC connection state, local probe evidence, and phone hints.
    • Phone-reported hints (intent path): bt-intent-server.py accepts /phone_device hints via GET and POST (JSON), with backward-compatible mac/state and richer optional fields (reported timestamp, source/confidence, transport/profile, adapter, active/call context, etc.) stored in /run/user/<uid>/maid-bluev-phone.json for Maid Watcher consumption.
    • Policy integration: reconnect, fallback-grab, dock handling, and case rewatch consult BlueV state — e.g. defer/retry differently when the phone hint indicates connected_to_phone, avoid claiming docked without sufficient evidence, and keep unconfirmed-silent devices eligible for rechecks.
    • Probe smoothing / dock confidence: silent “in case” detection requires confirmation over multiple probe observations within a time window before declaring docked; out/advertising evidence clears docked state quickly.
    • Multi-adapter-aware persistence/restore: snapshot and restore BlueZ adapter power/connected-device state per adapter (with migration/backward compatibility for legacy single-adapter state).
    • Observability: richer BlueV state in maid-watcher status/report/porcelain (state, reason, phone hint freshness/source/confidence, dock probe context) and improved audit behavior.
    • Docs: phone intent guide documents /phone_device BlueV hint reporting (MacroDroid/Tasker/BT connect/disconnect triggers over intent path, plus KDE Connect-assisted/manual local hints).
  • Fixes/refinements in this cycle:

    • Fixed reconnect defer handling when a phone hint is active to keep retry-source tracking consistent and rate-limit repeated “deferring reconnect” audit noise.
    • Improved restore reconnect staggering for saved devices.
    • Clarified dock verdict handling for “out/available but not connected” probe results to avoid misleading logs/state transitions.

LE Audio (BAP/LC3) support

  • Opt-in LE Audio enablement: added wireplumber/54-bt-le-audio.conf (enables LE Audio roles/codecs) and installer support to choose LE Audio vs A2DP-only guard (53-bt-a2dp-only.conf), with LE_AUDIO=1 config support.
  • Runtime/profile handling: bluetooth-toggle.sh, buds-fallback.sh, and watcher/maid_core/audio.py now recognize BAP/LE Audio profiles, avoid forcing A2DP codec pinning/battery-based A2DP codec switches on BAP, and can prefer/recover BAP profiles when LE Audio is enabled.
  • Watcher behavior: profile enforcement is LE Audio-aware (treats active BAP as valid/high-quality) to avoid breaking LE Audio connections during reconnect/profile checks.
  • Config/docs: bluetooth-buds.conf.example documents LE_AUDIO; docs updated to reflect optional LE Audio support alongside the existing A2DP-only safety guard for problematic setups.

Notes / known scope

  • BlueV remains WIP: automatic “any Android” per-device reporting still depends on an Android-side reporter/automation emitting /phone_device hints; further per-device/multipoint tuning, deeper UI surfaces, and vendor-specific enhancements can be layered on.

  • LE Audio support depends on BlueZ/PipeWire/WirePlumber, adapter/controller capabilities, and earbuds firmware; keep the A2DP-only guard available for setups where LE Audio transports are unstable.

  • Gentoo support: add Gentoo (emerge) package-manager detection and dependency installation in install.sh, document Gentoo in README, and add a Gentoo ebuild template under packaging/gentoo/.

  • Watcher efficiency: cache KDE Connect reachability and Bluetooth PAN (bnep) probes in the daemon to avoid repeated subprocess calls during periodic fallback checks.

  • Nix: add shell.nix, devShells, and formatter outputs; update flake.lock and package metadata for better native Nix/NixOS development and usage.

  • bluetooth-toggle.sh --doctor: expanded diagnostics for session/compositor detection (KineticWE, GPUiShell, Horizon, instantWM, Niri, Hyprland/Sway/i3 variants) and runtime health (XDG session type/runtime dir, PipeWire/Pulse audio server, default sink and sink count, Bluetooth adapter powered/name, configured buds/fallback sink, and state file path) with clearer troubleshooting hints.