reMarkable: More robust Wi-Fi scripts (#11287)

Fixing a bunch of issues in the process.

---------

Co-authored-by: gbyl <gbyl@users.noreply.github.com>
This commit is contained in:
gbylandgbyl authored and GitHub committed 2024-01-15 04:38:30 +01:00
1 parent 40d27ac3e5
commit a84ab265b8
2 files changed
+38 -20

No files matched your search

+18 -8
View File
@@ -1,14 +1,24 @@
#!/bin/sh
# disable wifi and remove modules
# stop wpa_supplicant service cleanly, used by xochitl
if systemctl is-active -q wpa_supplicant; then
systemctl stop wpa_supplicant
fi
# clean stop (if it's running) of main wpa_supplicant service, used by xochitl
systemctl stop wpa_supplicant
# clean stop of non-service wpa_supplicant, if running
wpa_cli terminate 2>/dev/null
# stop non-service wpa_supplicant cleanly
if pidof wpa_supplicant; then
wpa_cli terminate
fi
# stop dhcpcd if not enabled
if ! systemctl is-enabled -q dhcpcd; then
systemctl stop dhcpcd
fi
# power down wifi interface
ifconfig wlan0 down 2>/dev/null
ifconfig wlan0 down
# remove module
modprobe -r brcmfmac 2>/dev/null
# unload brcmfmac kernel module
if grep -q "^brcmfmac " "/proc/modules"; then
modprobe -r brcmfmac
fi
+20 -12
View File
@@ -1,19 +1,27 @@
#!/bin/sh
read -r MACHINE_TYPE <"/sys/devices/soc0/machine"
if [ "reMarkable 2.0" = "${MACHINE_TYPE}" ]; then
if ! lsmod | grep -q brcmfmac; then
modprobe brcmfmac
fi
# load brcmfmac kernel module
if ! grep -q "^brcmfmac " "/proc/modules"; then
modprobe brcmfmac
sleep 1
fi
# clean stop (if it's running) of main wpa_supplicant service, used by xochitl
systemctl stop wpa_supplicant
# stop wpa_supplicant service cleanly, used by xochitl
if systemctl is-active -q wpa_supplicant; then
systemctl stop wpa_supplicant
fi
# clean stop of non-service wpa_supplicant, if running
wpa_cli terminate 2>/dev/null
sleep 1
# stop non-service wpa_supplicant cleanly
if pidof wpa_supplicant; then
wpa_cli terminate
fi
# power up wifi interface
ifconfig wlan0 up
wpa_supplicant -i wlan0 -C /var/run/wpa_supplicant -B 2>/dev/null
# make sure dhcpcd is running
if ! systemctl is-active -q dhcpcd; then
systemctl start dhcpcd
fi
wpa_supplicant -i wlan0 -C /var/run/wpa_supplicant -B