X-Git-Url: http://git.openwrt.org/?p=openwrt%2Fopenwrt.git;a=blobdiff_plain;f=package%2Fnetwork%2Futils%2Fuqmi%2Ffiles%2Flib%2Fnetifd%2Fproto%2Fqmi.sh;h=a611878fb69b541e680104022304385242275b48;hp=0e5e2e03f2b8394ec15c52ee6eb3706059c4ea2d;hb=bb64826bdb9f76301f6df6de06a0f8c63a9834f7;hpb=4955a2cd10c6ce6e43af4ae1ac15977cdfe2df06 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 0e5e2e03f2..a611878fb6 100755 --- a/package/network/utils/uqmi/files/lib/netifd/proto/qmi.sh +++ b/package/network/utils/uqmi/files/lib/netifd/proto/qmi.sh @@ -25,6 +25,13 @@ qmi_disconnect() { --autoconnect > /dev/null } +qmi_wds_release() { + [ -n "$cid" ] || return 0 + + uqmi -s -d "$device" --set-client-id wds,"$cid" --release-client-id wds + uci_revert_state network $interface cid +} + proto_qmi_setup() { local interface="$1" @@ -34,13 +41,13 @@ proto_qmi_setup() { [ -n "$device" ] || { echo "No control device specified" proto_notify_error "$interface" NO_DEVICE - proto_block_restart "$interface" + proto_set_available "$interface" 0 return 1 } [ -c "$device" ] || { echo "The specified control device does not exist" proto_notify_error "$interface" NO_DEVICE - proto_block_restart "$interface" + proto_set_available "$interface" 0 return 1 } @@ -50,7 +57,7 @@ proto_qmi_setup() { [ -n "$ifname" ] || { echo "The interface could not be found." proto_notify_error "$interface" NO_IFACE - proto_block_restart "$interface" + proto_set_available "$interface" 0 return 1 } @@ -72,12 +79,13 @@ proto_qmi_setup() { [ -n "$apn" ] || { echo "No APN specified" proto_notify_error "$interface" NO_APN - proto_block_restart "$interface" return 1 } qmi_disconnect + uqmi -s -d "$device" --set-data-format 802.3 + echo "Waiting for network registration" while uqmi -s -d "$device" --get-serving-system | grep '"searching"' > /dev/null; do sleep 5; @@ -90,7 +98,6 @@ proto_qmi_setup() { [ $? -ne 0 ] && { echo "Unable to obtain client ID" proto_notify_error "$interface" NO_CID - proto_block_restart "$interface" return 1 } @@ -101,13 +108,7 @@ proto_qmi_setup() { ${password:+--password $password} \ --autoconnect > /dev/null - if ! uqmi -s -d "$device" --get-data-status | grep '"connected"' > /dev/null; then - echo "Connection lost" - proto_notify_error "$interface" NOT_CONNECTED - return 1 - fi - - echo "Connected, starting DHCP" + echo "Starting DHCP" proto_init_update "$ifname" 1 proto_send_update "$interface" @@ -135,10 +136,7 @@ proto_qmi_teardown() { echo "Stopping network" qmi_disconnect - [ -n "$cid" ] && { - uqmi -s -d "$device" --set-client-id wds,"$cid" --release-client-id wds - uci_revert_state network $interface cid - } + qmi_wds_release proto_init_update "*" 0 proto_send_update "$interface"