Bluetooth (RTL8723D USB combo chip): - GPIO pin 357 (active low) enables WiFi/BT hardware via x6200_gpio_set() - bluez5_utils 5.64 (downgraded from 5.79 — HID input plugin broken in 5.79) - rtl8723d_config.bin added to overlay (missing from linux-firmware package) - S45wifi-bt: GPIO enable + modprobe btusb/uhid/hidp at boot - S85bt-keyboard: auto-connect loop with scan+connect every 20s WiFi (RTL8723DU): - out-of-tree lwfinger/rtw88 driver (RTW88_8723DU not in kernel 6.1 mainline) - linux-firmware RTL_RTW88 for rtw88/rtw8723d_fw.bin - regulatory.db for cfg80211 - wpa_supplicant with multi-network config in /etc/wpa_supplicant.conf - S46wifi: wpa_supplicant + udhcpc at boot Key findings: - RTL8723D USB WiFi (0bda:d723) requires out-of-tree rtw88 on kernel 6.1 - BT and WiFi share same USB device, both need GPIO 357 = 0 to power on - bluez5 5.79 HID input plugin not linked into bluetoothd (build system bug)
59 lines
1.6 KiB
Bash
Executable File
59 lines
1.6 KiB
Bash
Executable File
#!/bin/sh
|
|
# S85bt-keyboard — auto-connect Linocell BTK16 BT-tangentbord
|
|
#
|
|
# Försöker ansluta tangentbordet vid boot och startar en bakgrundsprocess
|
|
# som reconnectar automatiskt när tangentbordet kommer inom räckhåll.
|
|
#
|
|
# Tangentbordet måste vara parat och trustat sedan tidigare.
|
|
# Para manuellt med: bluetoothctl pair ED:96:00:23:E2:02
|
|
# bluetoothctl trust ED:96:00:23:E2:02
|
|
|
|
KEYBOARD_ADDR="ED:96:00:23:E2:02"
|
|
PIDFILE="/var/run/bt-keyboard.pid"
|
|
LOG="/var/log/bt-keyboard.log"
|
|
|
|
connect_keyboard() {
|
|
bluetoothctl power on > /dev/null 2>&1
|
|
bluetoothctl connect "$KEYBOARD_ADDR" > /dev/null 2>&1
|
|
}
|
|
|
|
watch_loop() {
|
|
while true; do
|
|
# Kolla om tangentbordet är anslutet
|
|
if ! bluetoothctl info "$KEYBOARD_ADDR" 2>/dev/null | grep -q "Connected: yes"; then
|
|
connect_keyboard
|
|
fi
|
|
sleep 10
|
|
done
|
|
}
|
|
|
|
case "$1" in
|
|
start)
|
|
echo "Starting BT keyboard auto-connect"
|
|
|
|
# Försök första anslutning i bakgrunden (tangentbordet kanske inte är i närheten)
|
|
(sleep 5 && connect_keyboard) &
|
|
|
|
# Starta watch-loop som reconnectar när tgb dyker upp
|
|
watch_loop >> "$LOG" 2>&1 &
|
|
echo $! > "$PIDFILE"
|
|
echo "OK"
|
|
;;
|
|
stop)
|
|
echo "Stopping BT keyboard auto-connect"
|
|
if [ -f "$PIDFILE" ]; then
|
|
kill $(cat "$PIDFILE") 2>/dev/null
|
|
rm -f "$PIDFILE"
|
|
fi
|
|
bluetoothctl disconnect "$KEYBOARD_ADDR" > /dev/null 2>&1
|
|
echo "OK"
|
|
;;
|
|
restart)
|
|
$0 stop; sleep 1; $0 start
|
|
;;
|
|
*)
|
|
echo "Usage: $0 {start|stop|restart}" >&2
|
|
exit 1
|
|
;;
|
|
esac
|