Fix bluetoothd CPU busy-loops, cache BT state, and refresh a1120 images

- Add /etc/conf.d/bluetooth (supervise-daemon, retry=TERM/3/KILL/1, --noplugin=hfp,bap,bass,mcp,vcp,micp,csip,ccp,tmap,gmap,asha,midi,neard) and drop gateway UUIDs (111f/1112/110a) from main.conf ReconnectUUIDs so Experimental = true keeps PreferredBearer without BlueZ hfp-hf/ATT EOF GMainLoop spins.

- Set duplicate-data off in bananarchy-bt-scan.sh and update sxmo_bluetoothtoggle.sh to disconnect, btmgmt power off, and clean state files on disable so adapter_stop() never busy-loops on dual-bearer links.

- Add single-shot BlueZ ObjectManager state caching (bt_state.tsv, dump-state, CTRL_READY_FILE, EPHEMERAL_DEV_PROPS filter) in bananarchy-bt-obex and consume it in networks.so instead of per-device bluetoothctl refresh storms.

- Extend Bluetooth host tests and check-rebuild.sh, update docs, and rebuild/pin a1120 (cocojamboo) images and release archives for nokia-argon, nokia-beatles, nokia-coconut, and nokia-sparkler.
This commit is contained in:
Luxferre committed 2026-11-18 06:34:13 +02:00
1 parent 1e1fe7c317
commit 1e7077e314
15 files changed
+924 -282

No files matched your search

+4 -2
View File
@@ -552,8 +552,10 @@ 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/doas.d/60-bananarchy-bluetooth.conf" \
"$TARGET_ROOTFS/etc/conf.d/bluetooth" 2>/dev/null || true
chmod 0644 "$TARGET_ROOTFS/etc/doas.d/60-bananarchy-bluetooth.conf" \
"$TARGET_ROOTFS/etc/conf.d/bluetooth" 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
+28 -8
View File
@@ -557,15 +557,15 @@ fi
echo "[check] Known-good flashable image set..."
for pair in \
"09c46d21b140b486e21ebed39740b57808f8f1f0045f1801af2a7f8eba72bb4d images/bananarchy-nokia-argon.img" \
"5d8c50f89e257dbadd9050479d56c46b1902cb38707f6f692e3508b44aa4fd10 images/bananarchy-nokia-beatles.img" \
"f6c897f8e5fac17df38ac3d3222279f229b84c53ea73c323d06de5c40b26ccc0 images/boot-bananarchy-nokia-beatles.img" \
"0a6760f8ff4a4d2baa6af88ce080898a1e3aff206e15b8474efa3ea4274d6dee images/bananarchy-nokia-argon.img" \
"7bb47f4e938d412e2e5fed5eb5b766bbbe36c71fa6e7b77d2cda346b48a82e17 images/bananarchy-nokia-beatles.img" \
"496890063eda83adafaf5e7796a801100795b825064cf6f7fd967e6565dca325 images/boot-bananarchy-nokia-beatles.img" \
"b5549698c20f4de7603fc746d32bb5baa96ec377e41e74407823c98506fc185d images/boot-lk2nd-nokia-beatles-display.img" \
"836331fb3034d0527f8c03eb90aae25bc8c87a84cc56baf24459d2e81e7a28d1 images/bananarchy-nokia-coconut.img" \
"6e2fefec812594dc7b4dc322c68b1ab4c10b1c93abee4a0fbd11dfbf2dc59a0b images/boot-bananarchy-nokia-coconut.img" \
"d3b385a84c6546d35edca03eac684f3d7ee6de0faab25172b9af5252137c6815 images/bananarchy-nokia-coconut.img" \
"0a91c165e370b35a1604d08ddb6b08c46823455e5aee9701807f78221059e26c images/boot-bananarchy-nokia-coconut.img" \
"e876424b38b0782f589756b4107337b24f27f7c37d624cc7d3907a5331df050a images/boot-lk2nd-nokia-coconut-display.img" \
"61a068ca432f064812a96356b0dc49f1a38102a717c8dccd31768f0cbd1d7639 images/bananarchy-nokia-sparkler.img" \
"4357d48ac069104495629f1f35e220a01cde3412950e73e3e47e5372649fb6a2 images/boot-bananarchy-nokia-sparkler.img" \
"a262cb31ddb38e222e5f4bd14d82c82bb7941839a34bb48fa120b74189d319ae images/bananarchy-nokia-sparkler.img" \
"affc62ff400c082c29b0d0c11a06bdd2eefdd06e09f1d2e93e7eae6a47a5a7b1 images/boot-bananarchy-nokia-sparkler.img" \
"bc41c2ddd1079246a7e91a40222fcafb82b0b52965c8ee8081872767d006748f images/boot-lk2nd-nokia-sparkler-display.img"; do
set -- $pair
want=$1
@@ -1963,12 +1963,15 @@ for token in 'BANANARCHY_REAL_BLUETOOTHCTL' 'BANANARCHY_BT_SCAN_HELPER' \
fail "bluetoothctl wrapper is missing $token"
fi
done
for token in 'script -q -c' 'transport auto' 'duplicate-data on' \
for token in 'script -q -c' 'transport auto' 'duplicate-data off' \
'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 -qF 'duplicate-data on' "$BT_HELPER"; then
fail "live Bluetooth scan helper must keep duplicate-data off to avoid bluetoothd floods"
fi
if ! grep -q '^util-linux-misc$' "$PKGS_FILE"; then
fail "rootfs package set is missing util-linux-misc (script)"
fi
@@ -2059,6 +2062,23 @@ fi
if ! "$BT_OBEX_TEST" >/dev/null 2>&1; then
fail "host Bluetooth OBEX verification failed"
fi
BT_CONFD="$BASE_DIR/overlay/rootfs/etc/conf.d/bluetooth"
NETWORKS_SO="$BASE_DIR/prebuilt/sxmo-x11/usr/lib/dwm/plugins/networks.so"
if [ ! -f "$BT_CONFD" ] || \
! grep -qF 'supervisor=supervise-daemon' "$BT_CONFD" || \
! grep -qF -- '--noplugin=hfp,bap,bass,mcp,vcp,micp,csip,ccp,tmap,gmap,asha,midi,neard' "$BT_CONFD"; then
fail "overlay/rootfs/etc/conf.d/bluetooth is missing supervise-daemon or --noplugin CPU busy-loop guard"
fi
if grep -qE '^ReconnectUUIDs=.*(0000111f-|00001112-|0000110a-)' "$BT_MAIN_CONF"; then
fail "main.conf ReconnectUUIDs must exclude gateway UUIDs (111f/1112/110a)"
fi
if ! grep -qF 'format_managed_objects_tsv' "$BT_OBEX" || \
! grep -qF 'dump-state' "$BT_OBEX" || \
[ ! -f "$NETWORKS_SO" ] || \
! grep -aqF 'bt_state.tsv' "$NETWORKS_SO" || \
! grep -aqF 'dump-state' "$NETWORKS_SO"; then
fail "Bluetooth ObjectManager bt_state.tsv / dump-state cache is missing from daemon or networks.so"
fi
echo "[check] Charger plug/unplug charge icon..."
BATTERY_RULES="$BASE_DIR/overlay/rootfs/etc/udev/rules.d/85-bananarchy-battery.rules"
+29 -1
View File
@@ -193,7 +193,35 @@ def test_discoverability_and_power():
require("discoverable-timeout 0" not in net_src and
"discoverable-timeout 60" in net_src,
"networks_plugin.cpp must use 60s discoverable timeout")
print("[ok] Bounded 60s discoverability and hidden-by-default battery safeguard")
confd_bt = BASE / "overlay/rootfs/etc/conf.d/bluetooth"
require(confd_bt.is_file(), "missing overlay/rootfs/etc/conf.d/bluetooth")
confd_src = read(confd_bt)
for tok in (
"supervisor=supervise-daemon",
"--noplugin=hfp,bap,bass,mcp,vcp,micp,csip,ccp,tmap,gmap,asha,midi,neard",
'retry="TERM/3/KILL/1"',
):
require(tok in confd_src, f"etc/conf.d/bluetooth missing {tok}")
rec_lines = [ln for ln in main_src.splitlines() if ln.startswith("ReconnectUUIDs=")]
require(len(rec_lines) == 1, "main.conf must define ReconnectUUIDs")
rec_line = rec_lines[0]
for forbidden in ("0000111f-", "00001112-", "0000110a-"):
require(forbidden not in rec_line,
f"main.conf ReconnectUUIDs must exclude gateway UUID {forbidden}")
for keep in ("0000110b-", "00001108-", "0000111e-", "00001124-", "00001812-"):
require(keep in rec_line, f"main.conf ReconnectUUIDs missing {keep}")
for tok in (
"bluetoothctl disconnect",
"btmgmt -i hci0 power off",
"kill -KILL",
"/run/bananarchy/bt-obex/ctrl_ready",
"/run/bananarchy/bt-obex/bt_state.tsv",
):
require(tok in toggle_src, f"sxmo_bluetoothtoggle.sh missing clean stop step {tok}")
print("[ok] Bounded 60s discoverability, BlueZ --noplugin guard, and clean power-off")
def test_sco_audio_call_and_haptics():
+3 -1
View File
@@ -74,11 +74,13 @@ def main():
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",
"duplicate-data off", "scan on", "devices", "scan off",
"quit", "BANANARCHY_BT_SCAN_SECONDS",
"bananarchy-bt-le-enable.sh"):
if token not in helper:
raise SystemExit("live scan helper is missing %s" % token)
if "duplicate-data on" in helper:
raise SystemExit("live scan helper must keep duplicate-data off to avoid bluetoothd flood")
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"):
+55
View File
@@ -480,6 +480,9 @@ def test_networks_ui_wiring():
"openObexDirPicker",
"tryPresentObexPrompt",
"tryPresentPairPrompt",
"bt_state.tsv",
"dump-state",
"parseBtStateTsv",
):
require(tok in src, f"networks_plugin.cpp missing OBEX/Pairing UI element {tok}")
obex_src = read(BT_OBEX)
@@ -490,12 +493,64 @@ def test_networks_ui_wiring():
print("[ok] networks_plugin.cpp OBEX & KeyboardDisplay pairing UI wiring")
def test_managed_objects_state_cache(mod):
require("RSSI" in mod.EPHEMERAL_DEV_PROPS and
"ManufacturerData" in mod.EPHEMERAL_DEV_PROPS,
"EPHEMERAL_DEV_PROPS must suppress RSSI/advertising cache rewrites")
objs = {
"/org/bluez/hci0": {
"org.bluez.Adapter1": {
"Powered": ("b", True),
"Discoverable": ("b", False),
"Alias": ("s", "Bananarchy"),
},
},
"/org/bluez/hci0/dev_AA_BB_CC_DD_EE_FF": {
"org.bluez.Device1": {
"Address": ("s", "AA:BB:CC:DD:EE:FF"),
"Alias": ("s", "Audio Headset"),
"Paired": ("b", True),
"Connected": ("b", True),
"Icon": ("s", "audio-headset"),
"Class": ("u", 0x240404),
"UUIDs": ("as", [
"0000110B-0000-1000-8000-00805F9B34FB",
"0000111e-0000-1000-8000-00805f9b34fb",
]),
},
"org.bluez.Battery1": {
"Percentage": ("y", 85),
},
},
"/org/bluez/hci0/dev_11_22_33_44_55_66": {
"org.bluez.Device1": {
"Address": ("s", "11:22:33:44:55:66"),
"Name": ("s", "Pixel Phone"),
"Paired": ("b", True),
"Connected": ("b", False),
"Icon": ("s", "phone"),
"Class": ("u", 0x5a020c),
"UUIDs": ("as", ["00001105-0000-1000-8000-00805f9b34fb"]),
},
},
}
lines = mod.format_managed_objects_tsv(objs).splitlines()
expected = [
"CTRL\t1\t0\tBananarchy",
"DEV\t11:22:33:44:55:66\tPixel Phone\t1\t0\tphone\t0x5a020c\t-1\t00001105-0000-1000-8000-00805f9b34fb",
"DEV\tAA:BB:CC:DD:EE:FF\tAudio Headset\t1\t1\taudio-headset\t0x240404\t85\t0000110b-0000-1000-8000-00805f9b34fb;0000111e-0000-1000-8000-00805f9b34fb",
]
require(lines == expected, f"unexpected format_managed_objects_tsv output: {lines!r}")
print("[ok] BlueZ ObjectManager bt_state.tsv snapshot formatter & ephemeral property filter")
def main():
mod = load_obex_module()
test_class_and_roles()
test_seqpacket_and_stream_reader(mod)
test_accept_and_reject_sessions(mod)
test_keyboard_display_agent(mod)
test_managed_objects_state_cache(mod)
test_networks_ui_wiring()
print("bluetooth obex verification: all checks passed")