uqmi: do not block proto handler if modem is unable to registrate
authorFlorian Eckert <fe@dev.tdt.de>
Thu, 12 Apr 2018 11:20:49 +0000 (13:20 +0200)
committerKoen Vandeputte <koen.vandeputte@ncentric.com>
Thu, 11 Oct 2018 10:18:16 +0000 (12:18 +0200)
QMI proto setup-handler will wait forever if it is unable to registrate to
the mobile network. To fix this stop polling network registration status
and notify netifd. Netifd will generate then a "ifup-failed" ACTION.

Signed-off-by: Florian Eckert <fe@dev.tdt.de>
package/network/utils/uqmi/files/lib/netifd/proto/qmi.sh

index a0dcb17cde0ab4a9123bb9aa440cd13ab411348b..f3c548757419127d1ae8e7dece9faeae26a6148f 100755 (executable)
@@ -123,9 +123,18 @@ proto_qmi_setup() {
        uqmi -s -d "$device" --sync > /dev/null 2>&1
 
        echo "Waiting for network registration"
        uqmi -s -d "$device" --sync > /dev/null 2>&1
 
        echo "Waiting for network registration"
+       local registration_timeout=0
        while uqmi -s -d "$device" --get-serving-system | grep '"searching"' > /dev/null; do
                [ -e "$device" ] || return 1
        while uqmi -s -d "$device" --get-serving-system | grep '"searching"' > /dev/null; do
                [ -e "$device" ] || return 1
-               sleep 5;
+               if [ "$registration_timeout" -lt "$timeout" ]; then
+                       let registration_timeout++
+                       sleep 1;
+               else
+                       echo "Network registration failed"
+                       proto_notify_error "$interface" NETWORK_REGISTRATION_FAILED
+                       proto_block_restart "$interface"
+                       return 1
+               fi
        done
 
        [ -n "$modes" ] && uqmi -s -d "$device" --set-network-modes "$modes" > /dev/null 2>&1
        done
 
        [ -n "$modes" ] && uqmi -s -d "$device" --set-network-modes "$modes" > /dev/null 2>&1