Guard the Bluetooth power check and cover it

Every other bluetoothctl call in the script is silenced and time-boxed;
the new power check was neither, so a wedged D-Bus could hang pair before
it reached its own timeout and spill dbus assertions onto stderr.

Cover both paths with a stubbed bluetoothctl: the power-on sequence is
skipped when the adapter reports Powered: yes, and still runs when it
does not.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
David Heinemeier Hansson
2026-07-29 10:41:22 -07:00
co-authored by Claude Opus 5
parent 79a75d7159
commit 9939a00d17
2 changed files with 43 additions and 1 deletions
+1 -1
View File
@@ -19,7 +19,7 @@ address=${2:-}
[[ $address =~ ^([0-9A-Fa-f]{2}:){5}[0-9A-Fa-f]{2}$ ]] || usage
power_on() {
bluetoothctl show | grep -Fq "Powered: yes" && return
[[ $(timeout 2s bluetoothctl show 2>/dev/null) == *"Powered: yes"* ]] && return
bluetoothctl power on >/dev/null 2>&1 || true
sleep 0.5
}