The problem appeared after Wi-Fi support was introduced in LibreELEC for the Tanix TX6
, but it affects all versions of LibreELEC. Quite often, a Wi-Fi connection cannot be established on the first attempt (Invalid key), or it gets disconnected for various reasons and remains disconnected. When trying to reconnect, by default, LibreELEC Settings opens a password dialog even when the correct password has already been entered and saved. When the connection is unstable for some reason, having to re-enter the password every time using a remote control quickly becomes very annoying. I have implemented a patch that displays the password dialog only once, when no password has been saved. Subsequent connection attempts use the previously saved password. To change the password, the existing saved network entry must first be deleted. The patch is attached.
I have also added a script to monitor the Wi-Fi connection and restore it if necessary via cron. The script connects to a network that is available and has a saved password.
Cron entry:
and script /storage/.config/wifiautoconnect.sh:
#!/bin/sh
#.config/wifiautoconnect.sh
MAX_TRIES=5
DELAY=10
# Already connected?
if ip -4 addr show wlan0 | grep -q "inet "; then
exit 0
fi
i=1
while [ "$i" -le "$MAX_TRIES" ]; do
# Scan for Wi-Fi networks
connmanctl scan wifi >/dev/null 2>&1
sleep 2
# Find configured and available Wi-Fi networks
connmanctl services | awk '$1 ~ /^\*A/ && $NF ~ /^wifi_/ {print $NF}' |
while read WIFI; do
connmanctl connect "$WIFI" >/dev/null 2>&1
done
# Wait for connection and IP assignment
j=0
while [ "$j" -lt "$DELAY" ]; do
if ip -4 addr show wlan0 | grep -q "inet "; then
exit 0
fi
sleep 1
j=$((j + 1))
done
i=$((i + 1))
done
exit 1
Display More