Fix Bluetooth HID connections in dual-mode BlueZ

ControllerMode=bredr made BlueZ 5.87 reject the LE-only HOGP profile, so discovered BLE keyboards and mice never created input devices. Use dual mode, power/LE preflight, LE bearer selection for HID-over-GATT devices, automatic pairing on Connect Device and a pkill-free daemon stop path. Add scripts/test-bluetooth-hid.py and check-rebuild guards, synchronize docs, and rebuild the 2720 image (09226459...).
This commit is contained in:
Luxferre committed 2026-11-10 17:45:52 +02:00
1 parent ba2f25aa36
commit 20603893e7
9 files changed
+225 -11

No files matched your search

+40 -1
View File
@@ -74,6 +74,10 @@ for path in paths:
print(" %d Python file(s) parsed" % len(paths))
PYEOF
if [ -n "$(find "$BASE_DIR/overlay/rootfs" -type d -name __pycache__ -print -quit 2>/dev/null)" ]; then
fail "overlay/rootfs contains Python bytecode caches"
fi
echo "[check] Rootfs package list..."
PKGS_FILE="$BASE_DIR/scripts/rootfs-packages.txt"
PRUNE_FILE="$BASE_DIR/scripts/rootfs-prune-packages.txt"
@@ -369,7 +373,7 @@ fi
echo "[check] Known-good flashable image set..."
for pair in \
"69a44f60eb123ebddf600be927155dc4a599ec35b7a0cf80060f4ba01f599f08 images/bananarchy-nokia-argon.img" \
"546e5c5f3904384c33a65f3045d862de36ad0c2c254c8dbb984525da55bb73f4 images/bananarchy-nokia-beatles.img" \
"09226459db06615ea97256e4d07573e522c4b40a9f37a6b1fda911f608194225 images/bananarchy-nokia-beatles.img" \
"2b5c61aba307dbbda61f3b19a2ad5770f9854f41cba4e2c97e24efb7e20879f3 images/boot-bananarchy-nokia-beatles.img" \
"b5549698c20f4de7603fc746d32bb5baa96ec377e41e74407823c98506fc185d images/boot-lk2nd-nokia-beatles-display.img"; do
set -- $pair
@@ -1262,6 +1266,41 @@ if ! "$BASE_DIR/scripts/test-bluetooth-live-scan.py" >/dev/null 2>&1; then
fail "host live Bluetooth discovery test failed"
fi
echo "[check] Bluetooth HID connections..."
BT_MAIN_CONF="$BASE_DIR/overlay/rootfs/etc/bluetooth/main.conf"
BT_INPUT_CONF="$BASE_DIR/overlay/rootfs/etc/bluetooth/input.conf"
BT_OBEX="$BASE_DIR/overlay/rootfs/usr/bin/bananarchy-bt-obex"
BT_HID_TEST="$BASE_DIR/scripts/test-bluetooth-hid.py"
if [ ! -f "$BT_MAIN_CONF" ] || \
! grep -q '^ControllerMode = dual$' "$BT_MAIN_CONF" || \
grep -q '^ControllerMode = bredr$' "$BT_MAIN_CONF"; then
fail "BlueZ main.conf must use dual mode so the HOGP profile can register"
fi
for token in 'UserspaceHID=true' 'LEAutoSecurity=true' \
'ClassicBondedOnly=false' 'IdleTimeout=0'; do
if ! grep -qF "$token" "$BT_INPUT_CONF"; then
fail "BlueZ input.conf is missing the HOGP setting $token"
fi
done
if [ ! -x "$BT_OBEX" ]; then
fail "bananarchy-bt-obex is missing or not executable"
fi
for token in 'prepare_bt_controller()' 'set_hog_preferred_bearer' \
'PreferredBearer' 'if not do_pair and orig_unbonded'; do
if ! grep -qF "$token" "$BT_OBEX"; then
fail "bananarchy-bt-obex is missing the connection fix: $token"
fi
done
if grep -qF '["pkill", "-f"' "$BT_OBEX"; then
fail "bananarchy-bt-obex stop path depends on the missing process killer"
fi
if [ ! -x "$BT_HID_TEST" ]; then
fail "missing host unit test scripts/test-bluetooth-hid.py"
fi
if ! "$BT_HID_TEST" >/dev/null 2>&1; then
fail "host Bluetooth HID connection 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"