Keep live BlueZ discovery client alive for real scans

The previous Bluetooth fix only proved parser behavior with a synthetic stream. Real BlueZ discovery needs one interactive client to stay alive while unpaired Device1 objects exist. Add a bluetoothctl wrapper and bananarchy-bt-scan.sh PTY session that powers on, sets auto/duplicate-data filters, queries devices during discovery, and stops discovery cleanly. Add util-linux-misc, host test, docs and rebuild guards. Deployed to the live phone; a physical peripheral in pairing mode is still needed for final confirmation.
This commit is contained in:
Luxferre committed 2026-11-10 16:04:14 +02:00
1 parent f892531df6
commit 77127c7844
10 files changed
+232 -4

No files matched your search

+39
View File
@@ -1209,6 +1209,45 @@ if command -v g++ >/dev/null 2>&1 && \
fail "host Bluetooth scan parser test failed"
fi
echo "[check] Live Bluetooth discovery wrapper..."
BT_WRAPPER="$BASE_DIR/overlay/rootfs/usr/local/bin/bluetoothctl"
BT_HELPER="$BASE_DIR/overlay/rootfs/usr/bin/bananarchy-bt-scan.sh"
for f in "$BT_WRAPPER" "$BT_HELPER"; do
if [ ! -x "$f" ]; then
fail "${f#$BASE_DIR/} is missing or not executable"
fi
if ! sh -n "$f" 2>/dev/null; then
fail "shell syntax: ${f#$BASE_DIR/}"
fi
done
for token in 'BANANARCHY_REAL_BLUETOOTHCTL' 'BANANARCHY_BT_SCAN_HELPER' \
'" scan on "' 'exec "$REAL" "$@"'; do
if ! grep -qF "$token" "$BT_WRAPPER"; then
fail "bluetoothctl wrapper is missing $token"
fi
done
for token in 'script -q -c' 'transport auto' 'duplicate-data on' \
'scan off' 'BANANARCHY_BT_SCAN_SECONDS'; do
if ! grep -qF "$token" "$BT_HELPER"; then
fail "live Bluetooth scan helper is missing $token"
fi
done
if ! grep -q '^util-linux-misc$' "$PKGS_FILE"; then
fail "rootfs package set is missing util-linux-misc (script)"
fi
if ! grep -qF 'usr/local/bin/bluetoothctl' \
"$BASE_DIR/scripts/apply-bananarchy-overlay.sh" || \
! grep -qF 'usr/bin/bananarchy-bt-scan.sh' \
"$BASE_DIR/scripts/apply-bananarchy-overlay.sh"; then
fail "apply-bananarchy-overlay.sh no longer installs the live Bluetooth scan wrapper"
fi
if [ ! -x "$BASE_DIR/scripts/test-bluetooth-live-scan.py" ]; then
fail "missing host unit test scripts/test-bluetooth-live-scan.py"
fi
if ! "$BASE_DIR/scripts/test-bluetooth-live-scan.py" >/dev/null 2>&1; then
fail "host live Bluetooth discovery test failed"
fi
echo "[check] Charger plug/unplug charge icon..."
BATTERY_RULES="$BASE_DIR/overlay/rootfs/etc/udev/rules.d/85-bananarchy-battery.rules"
CHARGE_EVENT="$BASE_DIR/overlay/rootfs/usr/bin/bananarchy-battery-charge-event.sh"