Enable WCNSS LE before Bluetooth discovery
Live btmgmt/btmon showed hci0 powered with le absent from current settings; BlueZ issued only BR/EDR Inquiry, so BLE peripherals were invisible. Add a narrow doas helper to run btmgmt -i hci0 le on before each interactive scan, make bluez-btmgmt explicit, add the doas rule, host guards and docs. With real peripherals in pairing mode the plugin UI reported 5 devices and retained BT KeyBoard / LE-QC Ultra entries.
This commit is contained in:
1 parent
77127c7844
commit
e4358665f7
11 files changed
+58
-9
No files matched your search
@@ -168,6 +168,7 @@ chown 0:0 "$TARGET_ROOTFS/etc/chrony/chrony.conf" \
|
||||
"$TARGET_ROOTFS/usr/bin/bananarchy-network-event.sh" \
|
||||
"$TARGET_ROOTFS/usr/local/bin/bluetoothctl" \
|
||||
"$TARGET_ROOTFS/usr/bin/bananarchy-bt-scan.sh" \
|
||||
"$TARGET_ROOTFS/usr/bin/bananarchy-bt-le-enable.sh" \
|
||||
"$TARGET_ROOTFS/etc/init.d/bananarchy-time-sync" \
|
||||
"$TARGET_ROOTFS/etc/NetworkManager/dispatcher.d/20-bananarchy-time-sync.sh" \
|
||||
"$TARGET_ROOTFS/etc/NetworkManager/dispatcher.d/30-bananarchy-network-status.sh" \
|
||||
@@ -191,6 +192,7 @@ chmod 0755 "$TARGET_ROOTFS/usr/bin/bananarchy-idle-blank.sh" \
|
||||
"$TARGET_ROOTFS/usr/bin/bananarchy-network-event.sh" \
|
||||
"$TARGET_ROOTFS/usr/local/bin/bluetoothctl" \
|
||||
"$TARGET_ROOTFS/usr/bin/bananarchy-bt-scan.sh" \
|
||||
"$TARGET_ROOTFS/usr/bin/bananarchy-bt-le-enable.sh" \
|
||||
"$TARGET_ROOTFS/etc/init.d/bananarchy-time-sync" \
|
||||
"$TARGET_ROOTFS/etc/NetworkManager/dispatcher.d/20-bananarchy-time-sync.sh" \
|
||||
"$TARGET_ROOTFS/etc/NetworkManager/dispatcher.d/30-bananarchy-network-status.sh" \
|
||||
@@ -453,6 +455,8 @@ fi
|
||||
chmod 644 "$TARGET_ROOTFS/etc/pam.d/sshd" \
|
||||
"$TARGET_ROOTFS/etc/ssh/sshd_config.d/90-bananarchy-access.conf" \
|
||||
2>/dev/null || true
|
||||
chown 0:0 "$TARGET_ROOTFS/etc/doas.d/60-bananarchy-bluetooth.conf" 2>/dev/null || true
|
||||
chmod 0644 "$TARGET_ROOTFS/etc/doas.d/60-bananarchy-bluetooth.conf" 2>/dev/null || true
|
||||
chown 0:0 "$TARGET_ROOTFS/etc/pam.d/sshd" \
|
||||
"$TARGET_ROOTFS/etc/ssh/sshd_config.d/90-bananarchy-access.conf" \
|
||||
2>/dev/null || true
|
||||
|
||||
@@ -1235,6 +1235,20 @@ done
|
||||
if ! grep -q '^util-linux-misc$' "$PKGS_FILE"; then
|
||||
fail "rootfs package set is missing util-linux-misc (script)"
|
||||
fi
|
||||
if ! grep -q '^bluez-btmgmt$' "$PKGS_FILE"; then
|
||||
fail "rootfs package set is missing bluez-btmgmt (LE enable)"
|
||||
fi
|
||||
LE_HELPER="$BASE_DIR/overlay/rootfs/usr/bin/bananarchy-bt-le-enable.sh"
|
||||
BT_DOAS="$BASE_DIR/overlay/rootfs/etc/doas.d/60-bananarchy-bluetooth.conf"
|
||||
if [ ! -x "$LE_HELPER" ] || ! sh -n "$LE_HELPER" 2>/dev/null; then
|
||||
fail "bananarchy-bt-le-enable.sh is missing or has bad syntax"
|
||||
fi
|
||||
if ! grep -qF 'btmgmt -i hci0 le on' "$LE_HELPER" || \
|
||||
! grep -qF 'bananarchy-bt-le-enable.sh' "$BT_HELPER" || \
|
||||
[ ! -f "$BT_DOAS" ] || \
|
||||
! grep -qF 'bananarchy-bt-le-enable.sh' "$BT_DOAS"; then
|
||||
fail "live Bluetooth scan is missing the LE enable helper or doas rule"
|
||||
fi
|
||||
if ! grep -qF 'usr/local/bin/bluetoothctl' \
|
||||
"$BASE_DIR/scripts/apply-bananarchy-overlay.sh" || \
|
||||
! grep -qF 'usr/bin/bananarchy-bt-scan.sh' \
|
||||
|
||||
@@ -15,6 +15,7 @@ alpine-base
|
||||
alsa-utils
|
||||
bash
|
||||
bc
|
||||
bluez-btmgmt
|
||||
brightnessctl
|
||||
coreutils
|
||||
curl
|
||||
|
||||
@@ -18,6 +18,8 @@ WRAPPER = BASE / "overlay/rootfs/usr/local/bin/bluetoothctl"
|
||||
HELPER = BASE / "overlay/rootfs/usr/bin/bananarchy-bt-scan.sh"
|
||||
OVERLAY = BASE / "scripts/apply-bananarchy-overlay.sh"
|
||||
PACKAGES = BASE / "scripts/rootfs-packages.txt"
|
||||
LE_HELPER = BASE / "overlay/rootfs/usr/bin/bananarchy-bt-le-enable.sh"
|
||||
DOAS_RULE = BASE / "overlay/rootfs/etc/doas.d/60-bananarchy-bluetooth.conf"
|
||||
|
||||
STUB = r'''#!/usr/bin/env python3
|
||||
import sys
|
||||
@@ -52,6 +54,8 @@ def main():
|
||||
raise SystemExit("missing executable overlay/usr/local/bin/bluetoothctl")
|
||||
if not HELPER.is_file() or not os.access(HELPER, os.X_OK):
|
||||
raise SystemExit("missing executable overlay/usr/bin/bananarchy-bt-scan.sh")
|
||||
if not LE_HELPER.is_file() or not os.access(LE_HELPER, os.X_OK):
|
||||
raise SystemExit("missing executable overlay/usr/bin/bananarchy-bt-le-enable.sh")
|
||||
|
||||
wrapper = read(WRAPPER)
|
||||
helper = read(HELPER)
|
||||
@@ -63,18 +67,27 @@ def main():
|
||||
}
|
||||
if "util-linux-misc" not in packages:
|
||||
raise SystemExit("rootfs package set is missing util-linux-misc (script)")
|
||||
if "bluez-btmgmt" not in packages:
|
||||
raise SystemExit("rootfs package set is missing bluez-btmgmt (LE enable)")
|
||||
for token in ("BANANARCHY_REAL_BLUETOOTHCTL", "BANANARCHY_BT_SCAN_HELPER",
|
||||
'" scan on "', 'exec "$REAL" "$@"'):
|
||||
if token not in wrapper:
|
||||
raise SystemExit("bluetoothctl wrapper is missing %s" % token)
|
||||
for token in ("script -q -c", "menu scan", "transport auto",
|
||||
"duplicate-data on", "scan on", "devices", "scan off",
|
||||
"quit", "BANANARCHY_BT_SCAN_SECONDS"):
|
||||
"quit", "BANANARCHY_BT_SCAN_SECONDS",
|
||||
"bananarchy-bt-le-enable.sh"):
|
||||
if token not in helper:
|
||||
raise SystemExit("live scan helper is missing %s" % token)
|
||||
for token in ("usr/local/bin/bluetoothctl", "usr/bin/bananarchy-bt-scan.sh"):
|
||||
for token in ("usr/local/bin/bluetoothctl", "usr/bin/bananarchy-bt-scan.sh",
|
||||
"usr/bin/bananarchy-bt-le-enable.sh",
|
||||
"etc/doas.d/60-bananarchy-bluetooth.conf"):
|
||||
if token not in overlay:
|
||||
raise SystemExit("overlay application is not installing %s" % token)
|
||||
if not DOAS_RULE.is_file() or "bananarchy-bt-le-enable.sh" not in read(DOAS_RULE):
|
||||
raise SystemExit("doas rule is missing the LE enable helper")
|
||||
if "btmgmt -i hci0 le on" not in read(LE_HELPER):
|
||||
raise SystemExit("LE enable helper lost its btmgmt command")
|
||||
print("[ok] live Bluetooth discovery wiring")
|
||||
|
||||
with tempfile.TemporaryDirectory(prefix="bananarchy-bt-scan-") as tmp:
|
||||
|
||||
Reference in new issue
Block a user