aboutsummaryrefslogtreecommitdiffstats
path: root/package/network/utils
diff options
context:
space:
mode:
authorJohn Crispin <blogic@openwrt.org>2014-10-08 08:00:07 +0000
committerJohn Crispin <blogic@openwrt.org>2014-10-08 08:00:07 +0000
commitea6820d0cc6bfb85c179efb4e1a687ccbed642f8 (patch)
tree6d169b8cfb6ededda5f6179e98fa4f53792d73f9 /package/network/utils
parentaacd95e1f540a8862bb50e982ff31f02e662cfb5 (diff)
downloadupstream-ea6820d0cc6bfb85c179efb4e1a687ccbed642f8.tar.gz
upstream-ea6820d0cc6bfb85c179efb4e1a687ccbed642f8.tar.bz2
upstream-ea6820d0cc6bfb85c179efb4e1a687ccbed642f8.zip
umbim: work out the ifname instead of relying on it being in uci
Signed-off-by: John Crispin <blogic@openwrt.org> git-svn-id: svn://svn.openwrt.org/openwrt/trunk@42832 3c298f89-4303-0410-b956-a3cf2f4a3e73
Diffstat (limited to 'package/network/utils')
-rwxr-xr-xpackage/network/utils/umbim/files/lib/netifd/proto/mbim.sh18
1 files changed, 16 insertions, 2 deletions
diff --git a/package/network/utils/umbim/files/lib/netifd/proto/mbim.sh b/package/network/utils/umbim/files/lib/netifd/proto/mbim.sh
index a777c9bd60..46802f2d3c 100755
--- a/package/network/utils/umbim/files/lib/netifd/proto/mbim.sh
+++ b/package/network/utils/umbim/files/lib/netifd/proto/mbim.sh
@@ -7,6 +7,8 @@ init_proto "$@"
#DBG=-v
proto_mbim_init_config() {
+ available=1
+ no_device=1
proto_config_add_string "device:device"
proto_config_add_string apn
proto_config_add_string pincode
@@ -36,6 +38,18 @@ proto_mbim_setup() {
proto_block_restart "$interface"
return 1
}
+
+ devname="$(basename "$device")"
+ devpath="$(readlink -f /sys/class/usbmisc/$devname/device/)"
+ ifname="$( ls "$devpath"/net )"
+
+ [ -n "$ifname" ] || {
+ logger -p daemon.err -t "mbim[$$]" "Failed to find matching interface"
+ proto_notify_error "$interface" NO_IFNAME
+ proto_set_available "$interface" 0
+ return 1
+ }
+
[ -n "$apn" ] || {
logger -p daemon.err -t "mbim[$$]" "No APN specified"
proto_notify_error "$interface" NO_APN
@@ -116,14 +130,14 @@ proto_mbim_setup() {
json_init
json_add_string name "${interface}_dhcp"
- json_add_string ifname "@$interface"
+ json_add_string ifname "$ifname"
json_add_string proto "dhcp"
json_close_object
ubus call network add_dynamic "$(json_dump)"
json_init
json_add_string name "${interface}_dhcpv6"
- json_add_string ifname "@$interface"
+ json_add_string ifname "$ifname"
json_add_string proto "dhcpv6"
ubus call network add_dynamic "$(json_dump)"
}