uqmi: do not block proto handler if SIM is uninitialized
authorFlorian Eckert <fe@dev.tdt.de>
Tue, 10 Apr 2018 13:56:24 +0000 (15:56 +0200)
committerJo-Philipp Wich <jo@mein.io>
Tue, 18 Dec 2018 16:22:06 +0000 (17:22 +0100)
QMI proto setup-handler will wait forever if SIM does not get initialized.
To fix this stop polling pin status and notify netifd. Netifd will generate
then a "ifup-failed" ACTION.

Signed-off-by: Florian Eckert <fe@dev.tdt.de>
(backported from f171a86d064ac3fcfff05d286becae87c2e26b5f)

package/network/utils/uqmi/files/lib/netifd/proto/qmi.sh

index f1a939763a141601ecc4c170ede6889363b11359..759be62a425ca6589f56109c0c628cf4e3cc74bf 100755 (executable)
@@ -72,7 +72,15 @@ proto_qmi_setup() {
        local uninitialized_timeout=0
        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" ] && {