mirror of https://github.com/koreader/koreader
reMarkable: More robust Wi-Fi scripts (#11287)
Fixing a bunch of issues in the process. --------- Co-authored-by: gbyl <gbyl@users.noreply.github.com>reviewable/pr11362/r2
parent
40d27ac3e5
commit
a84ab265b8
@ -1,14 +1,24 @@
|
|||||||
#!/bin/sh
|
#!/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
|
# stop non-service wpa_supplicant cleanly
|
||||||
systemctl stop wpa_supplicant
|
if pidof wpa_supplicant; then
|
||||||
# clean stop of non-service wpa_supplicant, if running
|
wpa_cli terminate
|
||||||
wpa_cli terminate 2>/dev/null
|
fi
|
||||||
|
|
||||||
|
# stop dhcpcd if not enabled
|
||||||
|
if ! systemctl is-enabled -q dhcpcd; then
|
||||||
|
systemctl stop dhcpcd
|
||||||
|
fi
|
||||||
|
|
||||||
# power down wifi interface
|
# power down wifi interface
|
||||||
ifconfig wlan0 down 2>/dev/null
|
ifconfig wlan0 down
|
||||||
|
|
||||||
# remove module
|
# unload brcmfmac kernel module
|
||||||
modprobe -r brcmfmac 2>/dev/null
|
if grep -q "^brcmfmac " "/proc/modules"; then
|
||||||
|
modprobe -r brcmfmac
|
||||||
|
fi
|
||||||
|
@ -1,19 +1,27 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
read -r MACHINE_TYPE <"/sys/devices/soc0/machine"
|
# load brcmfmac kernel module
|
||||||
if [ "reMarkable 2.0" = "${MACHINE_TYPE}" ]; then
|
if ! grep -q "^brcmfmac " "/proc/modules"; then
|
||||||
if ! lsmod | grep -q brcmfmac; then
|
modprobe brcmfmac
|
||||||
modprobe brcmfmac
|
sleep 1
|
||||||
fi
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# clean stop (if it's running) of main wpa_supplicant service, used by xochitl
|
# stop wpa_supplicant service cleanly, used by xochitl
|
||||||
systemctl stop wpa_supplicant
|
if systemctl is-active -q wpa_supplicant; then
|
||||||
|
systemctl stop wpa_supplicant
|
||||||
# clean stop of non-service wpa_supplicant, if running
|
fi
|
||||||
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
|
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
|
||||||
|
Loading…
Reference in New Issue