diff options
author | Florian Eckert <fe@dev.tdt.de> | 2018-04-10 12:55:11 +0200 |
---|---|---|
committer | Jo-Philipp Wich <jo@mein.io> | 2018-12-18 17:22:06 +0100 |
commit | 4f02bee9bbc77f65920f0a96afe429dc2e973b1d (patch) | |
tree | a031990c22a2c028c2051e16533f0260d2ab710e /package/network/utils/uqmi/files/lib/netifd | |
parent | 5a3810b386040a6424ba2f16c7805eb492002fb8 (diff) | |
download | upstream-4f02bee9bbc77f65920f0a96afe429dc2e973b1d.tar.gz upstream-4f02bee9bbc77f65920f0a96afe429dc2e973b1d.tar.bz2 upstream-4f02bee9bbc77f65920f0a96afe429dc2e973b1d.zip |
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>
(backported from 4b80bd878d0fcb520f4811097900ebb5478a74fd)
Diffstat (limited to 'package/network/utils/uqmi/files/lib/netifd')
-rwxr-xr-x | package/network/utils/uqmi/files/lib/netifd/proto/qmi.sh | 56 |
1 files changed, 49 insertions, 7 deletions
diff --git a/package/network/utils/uqmi/files/lib/netifd/proto/qmi.sh b/package/network/utils/uqmi/files/lib/netifd/proto/qmi.sh index 759be62a42..422d00525e 100755 --- a/package/network/utils/uqmi/files/lib/netifd/proto/qmi.sh +++ b/package/network/utils/uqmi/files/lib/netifd/proto/qmi.sh @@ -83,14 +83,56 @@ proto_qmi_setup() { fi done - [ -n "$pincode" ] && { - uqmi -s -d "$device" --verify-pin1 "$pincode" > /dev/null || uqmi -s -d "$device" --uim-verify-pin1 "$pincode" > /dev/null || { - echo "Unable to verify PIN" - proto_notify_error "$interface" PIN_FAILED - proto_block_restart "$interface" - return 1 + if uqmi -s -d "$device" --get-pin-status | grep '"Not supported"' > /dev/null; then + [ -n "$pincode" ] && { + uqmi -s -d "$device" --verify-pin1 "$pincode" > /dev/null || uqmi -s -d "$device" --uim-verify-pin1 "$pincode" > /dev/null || { + echo "Unable to verify PIN" + proto_notify_error "$interface" PIN_FAILED + 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" ] && { local mcc mnc |