aboutsummaryrefslogtreecommitdiffstats
path: root/package/network
diff options
context:
space:
mode:
authorDaniel Golle <daniel@makrotopia.org>2022-03-24 18:40:14 +0000
committerDaniel Golle <daniel@makrotopia.org>2022-03-24 18:45:19 +0000
commitee7cb5e885118b78fb5f692d8ed6c93bb7e35853 (patch)
treea691c0c7104511b70881654aecef56c01dcc5518 /package/network
parentdc23df8a8ca728871d84f0a140f4b52c36b03f1d (diff)
downloadupstream-ee7cb5e885118b78fb5f692d8ed6c93bb7e35853.tar.gz
upstream-ee7cb5e885118b78fb5f692d8ed6c93bb7e35853.tar.bz2
upstream-ee7cb5e885118b78fb5f692d8ed6c93bb7e35853.zip
uqmi: fix acquiring PIN status
Evaluating the return value of 'json_load' didn't work in the intended way resulting in PIN status no longer being read on modems where --get-pin-status doesn't fail. Fix this by trying --get-pin-status first and checking if pin1_status field exists in JSON, and if it doesn't try again with --uim-get-sim-state. Fixes: #9501 Signed-off-by: Daniel Golle <daniel@makrotopia.org>
Diffstat (limited to 'package/network')
-rwxr-xr-xpackage/network/utils/uqmi/files/lib/netifd/proto/qmi.sh12
1 files changed, 8 insertions, 4 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 ad577ea317..c2c5fc1eca 100755
--- a/package/network/utils/uqmi/files/lib/netifd/proto/qmi.sh
+++ b/package/network/utils/uqmi/files/lib/netifd/proto/qmi.sh
@@ -105,10 +105,12 @@ proto_qmi_setup() {
}
}
else
- . /usr/share/libubox/jshn.sh
- json_load "$(uqmi -s -d "$device" --get-pin-status)" 2>&1 | grep -q Failed &&
- json_load "$(uqmi -s -d "$device" --uim-get-sim-state)"
+ json_load "$(uqmi -s -d "$device" --get-pin-status)"
json_get_var pin1_status pin1_status
+ if [ -z "$pin1_status" ]; then
+ json_load "$(uqmi -s -d "$device" --uim-get-sim-state)"
+ json_get_var pin1_status pin1_status
+ fi
json_get_var pin1_verify_tries pin1_verify_tries
case "$pin1_status" in
@@ -152,6 +154,7 @@ proto_qmi_setup() {
return 1
;;
esac
+ json_cleanup
fi
if [ -n "$plmn" ]; then
@@ -247,7 +250,8 @@ proto_qmi_setup() {
echo "Starting network $interface"
- pdptype=$(echo "$pdptype" | awk '{print tolower($0)}')
+ pdptype="$(echo "$pdptype" | awk '{print tolower($0)}')"
+
[ "$pdptype" = "ip" -o "$pdptype" = "ipv6" -o "$pdptype" = "ipv4v6" ] || pdptype="ip"
if [ "$pdptype" = "ip" ]; then