From: James Christopher Adduono Date: Tue, 18 Jun 2019 21:52:29 +0000 (-0400) Subject: netifd: mbim.sh: only check pin1 for failure X-Git-Url: http://git.openwrt.org/feed/routing.git;lede-17.01?a=commitdiff_plain;h=29b79060695a38161c400ed596be26a167762b6b;p=openwrt%2Fstaging%2Fjow.git netifd: mbim.sh: only check pin1 for failure Sierra MC7xxx and EM7xxx series cards will always respond with 3 - pin2 required on pinstate check. We have to ignore required pins other than pin1 and proceed in order to connect. Signed-off-by: James Christopher Adduono --- diff --git a/package/network/utils/umbim/files/lib/netifd/proto/mbim.sh b/package/network/utils/umbim/files/lib/netifd/proto/mbim.sh index 17b8a2b95b..b2aad158da 100755 --- a/package/network/utils/umbim/files/lib/netifd/proto/mbim.sh +++ b/package/network/utils/umbim/files/lib/netifd/proto/mbim.sh @@ -109,14 +109,18 @@ _proto_mbim_setup() { tid=$((tid + 1)) echo "mbim[$$]" "Checking pin" - umbim $DBG -n -t $tid -d $device pinstate - [ $? -eq 2 ] && { - echo "mbim[$$]" "PIN required" - tid=$((tid + 1)) - umbim $DBG -t $tid -d "$device" disconnect - proto_notify_error "$interface" PIN_FAILED - proto_block_restart "$interface" - return 1 + local pinstate="/var/run/mbim.$$.pinstate" + umbim $DBG -n -t $tid -d $device pinstate > "$pinstate" 2>&1 || { + local pin=$(awk '$2=="pin:" {print $5}' "$pinstate") + # we only need pin1 (the SIM pin) to connect + [ "$pin" = "pin1" ] && { + echo "mbim[$$]" "PIN required" + tid=$((tid + 1)) + umbim $DBG -t $tid -d "$device" disconnect + proto_notify_error "$interface" PIN_FAILED + proto_block_restart "$interface" + return 1 + } } tid=$((tid + 1)) @@ -303,6 +307,8 @@ proto_mbim_setup() { _proto_mbim_setup $@ ret=$? + rm -f "/var/run/mbim.$$."* + [ "$ret" = 0 ] || { logger "mbim bringup failed, retry in 15s" sleep 15