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
|
||||
|
||||
# disable wifi and remove modules
|
||||
|
||||
# clean stop (if it's running) of main wpa_supplicant service, used by xochitl
|
||||
# stop wpa_supplicant service cleanly, used by xochitl
|
||||
if systemctl is-active -q wpa_supplicant; then
|
||||
systemctl stop wpa_supplicant
|
||||
# clean stop of non-service wpa_supplicant, if running
|
||||
wpa_cli terminate 2>/dev/null
|
||||
fi
|
||||
|
||||
# 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
|
||||
|
@ -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
|
||||
# load brcmfmac kernel module
|
||||
if ! grep -q "^brcmfmac " "/proc/modules"; then
|
||||
modprobe brcmfmac
|
||||
fi
|
||||
sleep 1
|
||||
fi
|
||||
|
||||
# clean stop (if it's running) of main wpa_supplicant service, used by xochitl
|
||||
# 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
|
||||
|
Loading…
Reference in New Issue