uqmi: do not block proto handler if SIM is uninitialized
[openwrt/staging/mkresin.git] / package / network / utils / uqmi / files / lib / netifd / proto / qmi.sh
index f3c548757419127d1ae8e7dece9faeae26a6148f..f6e964fb20b24b95db68cceb9488fafa3023b46f 100755 (executable)
@@ -70,7 +70,15 @@ proto_qmi_setup() {
 
        while uqmi -s -d "$device" --get-pin-status | grep '"UIM uninitialized"' > /dev/null; do
                [ -e "$device" ] || return 1
-               sleep 1;
+               if [ "$uninitialized_timeout" -lt "$timeout" ]; then
+                       let uninitialized_timeout++
+                       sleep 1;
+               else
+                       echo "SIM not initialized"
+                       proto_notify_error "$interface" SIM_NOT_INITIALIZED
+                       proto_block_restart "$interface"
+                       return 1
+               fi
        done
 
        [ -n "$pincode" ] && {