diff options
author | Loic Poulain <loic.poulain@linaro.org> | 2020-04-09 09:23:49 +0200 |
---|---|---|
committer | Loic Poulain <loic.poulain@linaro.org> | 2020-04-09 11:00:03 +0200 |
commit | 21dfc913d563cc971069fddcd74520c0f77680aa (patch) | |
tree | b6580c7645100a8804c54ccd7384bc514cabc607 | |
parent | ef24d7c90b8b64fba09a5f3e2065872fea957925 (diff) |
Signed-off-by: Loic Poulain <loic.poulain@linaro.org>
-rwxr-xr-x | wcn36xx-monitor | 38 |
1 files changed, 29 insertions, 9 deletions
diff --git a/wcn36xx-monitor b/wcn36xx-monitor index 9fae7ac..82ff804 100755 --- a/wcn36xx-monitor +++ b/wcn36xx-monitor @@ -16,16 +16,36 @@ iface="wlan0" trigger1="*${iface}*auth*timed*out" wifi_reset() { - echo "Timeout detected, reseting ${iface}" + # is it wcn36xx ? + wcn36xx=$(grep wcn36xx /sys/class/net/${iface}/device/uevent || true) + if [ -z ${wcn36xx} ]; then + echo "${iface} is not wcn36xx" + return + fi + + echo "Resetting ${iface}" + + # Announce it in klog + echo "$0: firmware bug detected, resetting ${iface}" > /dev/kmsg + + # Stop interface ifconfig ${iface} down - sleep 1 - ifconfig ${iface} up + + # Reset remote proc to reload the wcnss firmware + echo stop > $(dirname /sys/devices/platform/soc/*.wcnss/remoteproc/remoteproc*/state)/state + echo start > $(dirname /sys/devices/platform/soc/*.wcnss/remoteproc/remoteproc*/state)/state + + # Interface should already be up, but just in case... + sleep 5 + ifconfig ${iface} up } -stdbuf -oL ${command} | -while IFS= read -r line; do - case "$line" in - ${trigger1}) wifi_reset ;; - *) - esac +while true; do + stdbuf -oL ${command} | + while IFS= read -r line; do + case "$line" in + ${trigger1}) wifi_reset ;; + *) + esac + done done |