aboutsummaryrefslogtreecommitdiffstats
path: root/package/network/utils
diff options
context:
space:
mode:
authorFelix Fietkau <nbd@openwrt.org>2014-10-02 12:18:58 +0000
committerFelix Fietkau <nbd@openwrt.org>2014-10-02 12:18:58 +0000
commit700e098ab3d666d7e2ef5e3644779cd8dae72ef2 (patch)
tree75cfe6dcd2f8e72ff32d69910cd31ad7243527be /package/network/utils
parentd2b5f93d8cc3cfa02a9cc277f429ed2687c65efe (diff)
downloadupstream-700e098ab3d666d7e2ef5e3644779cd8dae72ef2.tar.gz
upstream-700e098ab3d666d7e2ef5e3644779cd8dae72ef2.tar.bz2
upstream-700e098ab3d666d7e2ef5e3644779cd8dae72ef2.zip
uqmi: use the autoconnect feature
Instead of connecting once and saving the packet data handle, let the firmware handle connecting/reconnecting automatically. This is more reliable and reduces reliance on potentially stale data. Use the global packet data handle to attempt to disable autoconnect before restarting the connection. This ensures that the firmware will take the new APN/auth settings. Signed-off-by: Felix Fietkau <nbd@openwrt.org> git-svn-id: svn://svn.openwrt.org/openwrt/trunk@42721 3c298f89-4303-0410-b956-a3cf2f4a3e73
Diffstat (limited to 'package/network/utils')
-rwxr-xr-xpackage/network/utils/uqmi/files/lib/netifd/proto/qmi.sh35
1 files changed, 17 insertions, 18 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 6f61281f68..0e5e2e03f2 100755
--- a/package/network/utils/uqmi/files/lib/netifd/proto/qmi.sh
+++ b/package/network/utils/uqmi/files/lib/netifd/proto/qmi.sh
@@ -17,6 +17,14 @@ proto_qmi_init_config() {
proto_config_add_string modes
}
+qmi_disconnect() {
+ # disable previous autoconnect state using the global handle
+ # do not reuse previous wds client id to prevent hangs caused by stale data
+ uqmi -s -d "$device" \
+ --stop-network 0xffffffff \
+ --autoconnect > /dev/null
+}
+
proto_qmi_setup() {
local interface="$1"
@@ -68,6 +76,8 @@ proto_qmi_setup() {
return 1
}
+ qmi_disconnect
+
echo "Waiting for network registration"
while uqmi -s -d "$device" --get-serving-system | grep '"searching"' > /dev/null; do
sleep 5;
@@ -83,24 +93,17 @@ proto_qmi_setup() {
proto_block_restart "$interface"
return 1
}
- uci_set_state network $interface cid "$cid"
- pdh=`uqmi -s -d "$device" --set-client-id wds,"$cid" --start-network "$apn" \
- ${auth:+--auth-type $auth} \
- ${username:+--username $username} \
- ${password:+--password $password}`
- [ $? -ne 0 ] && {
- echo "Unable to connect, check APN and authentication"
- proto_notify_error "$interface" NO_PDH
- proto_block_restart "$interface"
- return 1
- }
- uci_set_state network $interface pdh "$pdh"
+ uqmi -s -d "$device" --set-client-id wds,"$cid" \
+ --start-network "$apn" \
+ ${auth:+--auth-type $auth} \
+ ${username:+--username $username} \
+ ${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
- proto_block_restart "$interface"
return 1
fi
@@ -129,14 +132,10 @@ proto_qmi_teardown() {
local device
json_get_vars device
local cid=$(uci_get_state network $interface cid)
- local pdh=$(uci_get_state network $interface pdh)
echo "Stopping network"
+ qmi_disconnect
[ -n "$cid" ] && {
- [ -n "$pdh" ] && {
- uqmi -s -d "$device" --set-client-id wds,"$cid" --stop-network "$pdh"
- uci_revert_state network $interface pdh
- }
uqmi -s -d "$device" --set-client-id wds,"$cid" --release-client-id wds
uci_revert_state network $interface cid
}