uqmi: evaluate pin-status output in qmi_setup function
Load the json output from uqmi --get-pin-status command and evaluate the "pin1_status" value. The following uqmi "pin1_status" values are evaluated: - disabled Do not verify PIN because SIM verification is disabled on this SIM - blocked Stop qmi_setup because SIM is locked and a PUK is required - not_verified SIM is not yet verified. Do a uqmi --verify-pin1 command if a SIM is specified - verified: Do not verify the PIN because this was already done before Signed-off-by: Florian Eckert <fe@dev.tdt.de>
This commit is contained in:
parent
f171a86d06
commit
4b80bd878d
1 changed files with 49 additions and 7 deletions
|
@ -81,14 +81,56 @@ proto_qmi_setup() {
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
[ -n "$pincode" ] && {
|
if uqmi -s -d "$device" --get-pin-status | grep '"Not supported"' > /dev/null; then
|
||||||
uqmi -s -d "$device" --verify-pin1 "$pincode" > /dev/null || uqmi -s -d "$device" --uim-verify-pin1 "$pincode" > /dev/null || {
|
[ -n "$pincode" ] && {
|
||||||
echo "Unable to verify PIN"
|
uqmi -s -d "$device" --verify-pin1 "$pincode" > /dev/null || uqmi -s -d "$device" --uim-verify-pin1 "$pincode" > /dev/null || {
|
||||||
proto_notify_error "$interface" PIN_FAILED
|
echo "Unable to verify PIN"
|
||||||
proto_block_restart "$interface"
|
proto_notify_error "$interface" PIN_FAILED
|
||||||
return 1
|
proto_block_restart "$interface"
|
||||||
|
return 1
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
else
|
||||||
|
. /usr/share/libubox/jshn.sh
|
||||||
|
json_load "$(uqmi -s -d "$device" --get-pin-status)"
|
||||||
|
json_get_var pin1_status pin1_status
|
||||||
|
|
||||||
|
case "$pin1_status" in
|
||||||
|
disabled)
|
||||||
|
echo "PIN verification is disabled"
|
||||||
|
;;
|
||||||
|
blocked)
|
||||||
|
echo "SIM locked PUK required"
|
||||||
|
proto_notify_error "$interface" PUK_NEEDED
|
||||||
|
proto_block_restart "$interface"
|
||||||
|
return 1
|
||||||
|
;;
|
||||||
|
not_verified)
|
||||||
|
if [ -n "$pincode" ]; then
|
||||||
|
uqmi -s -d "$device" --verify-pin1 "$pincode" > /dev/null 2>&1 || uqmi -s -d "$device" --uim-verify-pin1 "$pincode" > /dev/null 2>&1 || {
|
||||||
|
echo "Unable to verify PIN"
|
||||||
|
proto_notify_error "$interface" PIN_FAILED
|
||||||
|
proto_block_restart "$interface"
|
||||||
|
return 1
|
||||||
|
}
|
||||||
|
else
|
||||||
|
echo "PIN not specified but required"
|
||||||
|
proto_notify_error "$interface" PIN_NOT_SPECIFIED
|
||||||
|
proto_block_restart "$interface"
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
verified)
|
||||||
|
echo "PIN already verified"
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
echo "PIN status failed ($pin1_status)"
|
||||||
|
proto_notify_error "$interface" PIN_STATUS_FAILED
|
||||||
|
proto_block_restart "$interface"
|
||||||
|
return 1
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
fi
|
||||||
|
|
||||||
[ -n "$plmn" ] && {
|
[ -n "$plmn" ] && {
|
||||||
local mcc mnc
|
local mcc mnc
|
||||||
|
|
Loading…
Reference in a new issue