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

John Crispin john at phrozen.org
Fri Dec 16 00:20:15 PST 2016



On 07/12/2016 18:13, Nickolay Ledovskikh wrote:
> 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)"

this needs to be moved a few lines up above between the

        [ -n "$device" ] || {
and
        [ -e "$device" ] || {

block otherwise the 2nd validation check will fail. please also verify
the other files if there are validation checks that we are skipping.
otherwise we might hit dangling symlinks

	John


>  	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"
>  
> 



More information about the Lede-dev mailing list