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 <jc@adduono.com>
tid=$((tid + 1))
echo "mbim[$$]" "Checking pin"
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
+ }
_proto_mbim_setup $@
ret=$?
_proto_mbim_setup $@
ret=$?
+ rm -f "/var/run/mbim.$$."*
+
[ "$ret" = 0 ] || {
logger "mbim bringup failed, retry in 15s"
sleep 15
[ "$ret" = 0 ] || {
logger "mbim bringup failed, retry in 15s"
sleep 15