summaryrefslogtreecommitdiff
path: root/package/network/utils/comgt/files
diff options
context:
space:
mode:
authorFelix Fietkau <nbd@openwrt.org>2014-09-26 13:44:21 +0000
committerFelix Fietkau <nbd@openwrt.org>2014-09-26 13:44:21 +0000
commit45bd5ebfef97fb1d33d30118ae2f5e69f921912d (patch)
treeae5299db82aeaa337a986c88f9e21a601c6da7e9 /package/network/utils/comgt/files
parentdd948b7990b2a240f46ca562b27e1d0deb7f852a (diff)
downloadmtk-20170518-45bd5ebfef97fb1d33d30118ae2f5e69f921912d.zip
mtk-20170518-45bd5ebfef97fb1d33d30118ae2f5e69f921912d.tar.gz
mtk-20170518-45bd5ebfef97fb1d33d30118ae2f5e69f921912d.tar.bz2
comgt: in directip, derive the wwan ifname automatically instead of specifying it in the config
Signed-off-by: Felix Fietkau <nbd@openwrt.org> SVN-Revision: 42669
Diffstat (limited to 'package/network/utils/comgt/files')
-rw-r--r--package/network/utils/comgt/files/directip.sh9
1 files changed, 6 insertions, 3 deletions
diff --git a/package/network/utils/comgt/files/directip.sh b/package/network/utils/comgt/files/directip.sh
index f09d938..6b9326d 100644
--- a/package/network/utils/comgt/files/directip.sh
+++ b/package/network/utils/comgt/files/directip.sh
@@ -8,7 +8,6 @@ proto_directip_init_config() {
available=1
no_device=1
proto_config_add_string "device:device"
- proto_config_add_string "ifname"
proto_config_add_string "apn"
proto_config_add_string "pincode"
proto_config_add_string "auth"
@@ -18,10 +17,10 @@ proto_directip_init_config() {
proto_directip_setup() {
local interface="$1"
- local chat
+ local chat devpath devname
local device apn pincode ifname auth username password
- json_get_vars device apn pincode ifname auth username password
+ json_get_vars device apn pincode auth username password
[ -e "$device" ] || {
proto_notify_error "$interface" NO_DEVICE
@@ -29,6 +28,10 @@ proto_directip_setup() {
return 1
}
+ devname="$(basename "$device")"
+ devpath="$(readlink -f /sys/class/tty/$devname/device)"
+ ifname="$( ls "$devpath"/../../*/net )"
+
[ -n "$ifname" ] || {
proto_notify_error "$interface" NO_IFNAME
proto_set_available "$interface" 0