[LEDE-DEV] [LEDE-DEV, 2/3, v2] Add support of using device symlinks.

Nickolay Ledovskikh nledovskikh at gmail.com
Wed Dec 7 09:13:00 PST 2016


It's useful when using multiple usb devices that should be bound to
certain usb ports. Symlinks are created by hotplug handlers.

Signed-off-by: Nickolay Ledovskikh <nledovskikh at gmail.com>
---
 package/network/utils/comgt/files/directip.sh            | 1 +
 package/network/utils/comgt/files/ncm.sh                 | 2 ++
 package/network/utils/uqmi/files/lib/netifd/proto/qmi.sh | 3 +++
 3 files changed, 6 insertions(+)

diff --git a/package/network/utils/comgt/files/directip.sh b/package/network/utils/comgt/files/directip.sh
index 79b8c32..4dcbd70 100644
--- a/package/network/utils/comgt/files/directip.sh
+++ b/package/network/utils/comgt/files/directip.sh
@@ -33,6 +33,7 @@ proto_directip_setup() {
 		return 1
 	}
 
+	device="$(readlink -f $device)"
 	devname="$(basename "$device")"
 	devpath="$(readlink -f /sys/class/tty/$devname/device)"
 	ifname="$( ls "$devpath"/../../*/net )"
diff --git a/package/network/utils/comgt/files/ncm.sh b/package/network/utils/comgt/files/ncm.sh
index 14b6347..917a8c5 100644
--- a/package/network/utils/comgt/files/ncm.sh
+++ b/package/network/utils/comgt/files/ncm.sh
@@ -63,7 +63,9 @@ proto_ncm_setup() {
 		return 1
 	}
 
+	device="$(readlink -f $device)"
 	devname="$(basename "$device")"
+
 	case "$devname" in
 	'tty'*)
 		devpath="$(readlink -f /sys/class/tty/$devname/device)"
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 1235698..fb4c339 100755
--- a/package/network/utils/uqmi/files/lib/netifd/proto/qmi.sh
+++ b/package/network/utils/uqmi/files/lib/netifd/proto/qmi.sh
@@ -51,6 +51,7 @@ proto_qmi_setup() {
 		return 1
 	}
 
+	device="$(readlink -f $device)"
 	devname="$(basename "$device")"
 	devpath="$(readlink -f /sys/class/usbmisc/$devname/device/)"
 	ifname="$( ls "$devpath"/net )"
@@ -213,6 +214,8 @@ qmi_wds_stop() {
 
 	[ -n "$cid" ] || return
 
+	device="$(readlink -f $device)"
+
 	# disable previous autoconnect state using the global handle
 	uqmi -s -d "$device" --set-client-id wds,"$cid" --stop-network "0xffffffff"
 
-- 
2.7.3




More information about the Lede-dev mailing list