From bd8cdb8ecd18535b0cf30df6a3333a31b7dac9eb Mon Sep 17 00:00:00 2001 From: nagumii Date: Thu, 12 Dec 2024 00:09:17 +0200 Subject: [PATCH] If meshtasticd service does not launch and wifi in meshtastic is set to off, wifi will now default to active. --- .../usr/local/bin/wifi-mesh-control.sh | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/wifi-mesh-control.sh b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/wifi-mesh-control.sh index afa9700..08da1a5 100755 --- a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/wifi-mesh-control.sh +++ b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/wifi-mesh-control.sh @@ -6,6 +6,7 @@ sleep 60 #wait 60 seconds so networking will be available during boot previous_value=2 while true; do + if systemctl is-active --quiet meshtasticd; then # Run the command to fetch the value current_value=$(cat /root/.portduino/default/prefs/config.proto | protoc --decode_raw | awk '/4 {/, /}/ {if ($1 == "1:") print $2}') @@ -39,6 +40,13 @@ while true; do ip link set wlan0 down fi - # Wait for 30 seconds before checking again - sleep 30 + else + if ip link show wlan0 | grep -q 'state DOWN'; then + ip link set wlan0 up + logger "Wifi mesh control: Meshtasticd service is offline, turning wifi on." + fi + fi + + # wait 30 secs before checking again + sleep 30 done