comgt: ncm: try to detect interface for ttyACM ports
authorLech Perczak <lech.perczak@gmail.com>
Thu, 31 Mar 2022 19:16:34 +0000 (21:16 +0200)
committerHauke Mehrtens <hauke@hauke-m.de>
Sat, 16 Apr 2022 12:02:11 +0000 (14:02 +0200)
Some modems expose ttyACM as their control ports, which have the
"device" symlink pointing one level down in sysfs tree. Try to find
network interfaces for them as well, this is commonly used for modems
exposing ACM + RNDIS or ACM + ECM interface combinations.

Co-developed-by: Cezary Jackiewicz <cezary@eko.one.pl>
Signed-off-by: Cezary Jackiewicz <cezary@eko.one.pl>
Signed-off-by: Lech Perczak <lech.perczak@gmail.com>
package/network/utils/comgt/files/ncm.sh

index c3a06165efc7da1583e624cc0d0d71add36cb34b..a2c913ea1d6f216be4ca010b0692eeadb23f29de 100644 (file)
@@ -57,6 +57,10 @@ proto_ncm_setup() {
        [ -z "$ifname" ] && {
                devname="$(basename "$device")"
                case "$devname" in
+               'ttyACM'*)
+                       devpath="$(readlink -f /sys/class/tty/$devname/device)"
+                       ifpath="$devpath/../*/net"
+                       ;;
                'tty'*)
                        devpath="$(readlink -f /sys/class/tty/$devname/device)"
                        ifpath="$devpath/../../*/net"