1
0
Fork 0
mirror of https://github.com/Ysurac/openmptcprouter-feeds.git synced 2025-03-09 15:40:03 +00:00

Reset modem when in failed state

This commit is contained in:
Ycarus (Yannick Chabanois) 2023-12-28 15:44:33 +01:00
parent a04b44f56b
commit 08157799fb

View file

@ -743,8 +743,14 @@ if [ "$OMR_TRACKER_STATUS" = "ERROR" ] || [ "$interface_up" != "true" ]; then
elif [ -n "$OMR_TRACKER_INTERFACE" ] && [ -n "$OMR_TRACKER_DEVICE" ] && [ "$(uci -q get network.$OMR_TRACKER_INTERFACE.proto)" = "modemmanager" ] && [ "$interface_up" = "false" ] && [ "$interface_available" = "false" ] && [ "$interface_pending" = "false" ] && [ "$interface_autostart" = "true" ]; then elif [ -n "$OMR_TRACKER_INTERFACE" ] && [ -n "$OMR_TRACKER_DEVICE" ] && [ "$(uci -q get network.$OMR_TRACKER_INTERFACE.proto)" = "modemmanager" ] && [ "$interface_up" = "false" ] && [ "$interface_available" = "false" ] && [ "$interface_pending" = "false" ] && [ "$interface_autostart" = "true" ]; then
modemfind="0" modemfind="0"
for modem in $(timeout 3 mmcli -L | awk -F/ '{ print $6}' | awk '{print $1}'); do for modem in $(timeout 3 mmcli -L | awk -F/ '{ print $6}' | awk '{print $1}'); do
if [ -n "$(timeout 2 mmcli -m $modem -K | grep $OMR_TRACKER_DEVICE)" ]; then modeminfo="$(timeout 2 mmcli -m $modem -K)"
if [ -n "$(echo $modeminfo | grep $OMR_TRACKER_DEVICE)" ]; then
modemfind="1" modemfind="1"
if [ -n "$(echo $modeminfo | grep 'modem.generic.state ' | grep failed)" ] && [ -n "$(echo $modeminfo | grep 'modem.generic.state-failed-reason' | grep 'unknown-capabilities')" ]; then
_log "Interface $OMR_TRACKER_INTERFACE in failed state in ModemManager, reset modem..."
/usr/bin/mmcli -m ${modem} -r 2>&1 >/dev/null
sleep 30
fi
fi fi
done done
if [ "$modemfind" = "0" ]; then if [ "$modemfind" = "0" ]; then