feat: M3 complete — WiFi, BT keyboard and mouse
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)
This commit is contained in:
45
br2_external/board/x6200/rootfs-overlay/etc/init.d/S35wifi-bt
Executable file
45
br2_external/board/x6200/rootfs-overlay/etc/init.d/S35wifi-bt
Executable file
@@ -0,0 +1,45 @@
|
||||
#!/bin/sh
|
||||
# S45wifi-bt — aktiverar WiFi/BT-chipet (RTL8723D) via GPIO
|
||||
#
|
||||
# X6200:s WiFi/BT-chip är avstängt vid boot och måste aktiveras
|
||||
# via GPIO pin 357 (active low) innan kernel-drivern kan använda det.
|
||||
#
|
||||
# Måste köras innan S40bluetoothd startar.
|
||||
|
||||
case "$1" in
|
||||
start)
|
||||
echo "Starting WiFi/BT hardware"
|
||||
python3 - << 'PYEOF'
|
||||
import ctypes
|
||||
lib = ctypes.CDLL("libaether_x6200_control.so")
|
||||
lib.x6200_gpio_init.restype = ctypes.c_bool
|
||||
lib.x6200_gpio_set.argtypes = [ctypes.c_int, ctypes.c_int]
|
||||
lib.x6200_gpio_init()
|
||||
lib.x6200_gpio_set(357, 0) # active low — 0 = ON
|
||||
PYEOF
|
||||
sleep 1
|
||||
modprobe btusb
|
||||
modprobe uhid
|
||||
modprobe hidp
|
||||
sleep 3
|
||||
echo "OK"
|
||||
;;
|
||||
stop)
|
||||
python3 - << 'PYEOF'
|
||||
import ctypes
|
||||
lib = ctypes.CDLL("libaether_x6200_control.so")
|
||||
lib.x6200_gpio_init.restype = ctypes.c_bool
|
||||
lib.x6200_gpio_set.argtypes = [ctypes.c_int, ctypes.c_int]
|
||||
lib.x6200_gpio_init()
|
||||
lib.x6200_gpio_set(357, 1) # 1 = OFF
|
||||
PYEOF
|
||||
echo "WiFi/BT hardware stopped"
|
||||
;;
|
||||
restart)
|
||||
$0 stop; sleep 1; $0 start
|
||||
;;
|
||||
*)
|
||||
echo "Usage: $0 {start|stop|restart}" >&2
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
44
br2_external/board/x6200/rootfs-overlay/etc/init.d/S46wifi
Executable file
44
br2_external/board/x6200/rootfs-overlay/etc/init.d/S46wifi
Executable file
@@ -0,0 +1,44 @@
|
||||
#!/bin/sh
|
||||
# S46wifi — ansluter till WiFi via wpa_supplicant
|
||||
#
|
||||
# Körs efter S45wifi-bt (GPIO aktivering av chipet).
|
||||
# Använder /etc/wpa_supplicant.conf för nätverkslista.
|
||||
|
||||
IFACE="wlan0"
|
||||
PIDFILE="/var/run/wpa_supplicant.pid"
|
||||
LOG="/var/log/wifi.log"
|
||||
|
||||
case "$1" in
|
||||
start)
|
||||
echo "Starting WiFi"
|
||||
ip link set "$IFACE" up
|
||||
sleep 2
|
||||
|
||||
wpa_supplicant -B \
|
||||
-i "$IFACE" \
|
||||
-c /etc/wpa_supplicant.conf \
|
||||
-P "$PIDFILE" \
|
||||
>> "$LOG" 2>&1
|
||||
|
||||
# Hämta IP via DHCP
|
||||
sleep 3
|
||||
dhclient "$IFACE" >> "$LOG" 2>&1 || \
|
||||
udhcpc -i "$IFACE" -b -p /var/run/udhcpc.pid >> "$LOG" 2>&1
|
||||
|
||||
echo "OK"
|
||||
;;
|
||||
stop)
|
||||
echo "Stopping WiFi"
|
||||
[ -f "$PIDFILE" ] && kill $(cat "$PIDFILE") 2>/dev/null
|
||||
rm -f "$PIDFILE"
|
||||
ip link set "$IFACE" down
|
||||
echo "OK"
|
||||
;;
|
||||
restart)
|
||||
$0 stop; sleep 1; $0 start
|
||||
;;
|
||||
*)
|
||||
echo "Usage: $0 {start|stop|restart}" >&2
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
58
br2_external/board/x6200/rootfs-overlay/etc/init.d/S85bt-keyboard
Executable file
58
br2_external/board/x6200/rootfs-overlay/etc/init.d/S85bt-keyboard
Executable file
@@ -0,0 +1,58 @@
|
||||
#!/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
|
||||
Reference in New Issue
Block a user