diff options
Diffstat (limited to 'package/network/utils')
-rw-r--r-- | package/network/utils/uqmi/Makefile | 2 | ||||
-rwxr-xr-x | package/network/utils/uqmi/files/lib/netifd/proto/qmi.sh | 35 |
2 files changed, 27 insertions, 10 deletions
diff --git a/package/network/utils/uqmi/Makefile b/package/network/utils/uqmi/Makefile index 68958a3729..da54ba0f46 100644 --- a/package/network/utils/uqmi/Makefile +++ b/package/network/utils/uqmi/Makefile @@ -1,7 +1,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=uqmi -PKG_RELEASE:=2 +PKG_RELEASE:=3 PKG_SOURCE_PROTO:=git PKG_SOURCE_URL=$(PROJECT_GIT)/project/uqmi.git 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 a6c785eb56..c0134f44dd 100755 --- a/package/network/utils/uqmi/files/lib/netifd/proto/qmi.sh +++ b/package/network/utils/uqmi/files/lib/netifd/proto/qmi.sh @@ -209,19 +209,36 @@ proto_qmi_setup() { uqmi -s -d "$device" --sync > /dev/null 2>&1 + uqmi -s -d "$device" --network-register > /dev/null 2>&1 + echo "Waiting for network registration" + sleep 1 local registration_timeout=0 - while uqmi -s -d "$device" --get-serving-system | grep '"searching"' > /dev/null; do - [ -e "$device" ] || return 1 - if [ "$registration_timeout" -lt "$timeout" -o "$timeout" = "0" ]; then - let registration_timeout++ - sleep 1; + local registration_state="" + while true; do + registration_state=$(uqmi -s -d "$device" --get-serving-system 2>/dev/null | jsonfilter -e "@.registration" 2>/dev/null) + + [ "$registration_state" = "registered" ] && break + + if [ "$registration_state" = "searching" ] || [ "$registration_state" = "not_registered" ]; then + if [ "$registration_timeout" -lt "$timeout" ] || [ "$timeout" = "0" ]; then + [ "$registration_state" = "searching" ] || { + echo "Device stopped network registration. Restart network registration" + uqmi -s -d "$device" --network-register > /dev/null 2>&1 + } + let registration_timeout++ + sleep 1 + continue + fi + echo "Network registration failed, registration timeout reached" else - echo "Network registration failed" - proto_notify_error "$interface" NETWORK_REGISTRATION_FAILED - proto_block_restart "$interface" - return 1 + # registration_state is 'registration_denied' or 'unknown' or '' + echo "Network registration failed (reason: '$registration_state')" fi + + proto_notify_error "$interface" NETWORK_REGISTRATION_FAILED + proto_block_restart "$interface" + return 1 done [ -n "$modes" ] && uqmi -s -d "$device" --set-network-modes "$modes" > /dev/null 2>&1 |