From ecacc3ae8a6a44810d3727b159b5bcf73da6ebe2 Mon Sep 17 00:00:00 2001 From: Maxim Karasev Date: Mon, 22 Mar 2021 22:16:06 +0300 Subject: [PATCH] autodetect modem ifname Signed-off-by: Maarten van Gompel --- scripts/core/sxmo_networks.sh | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/scripts/core/sxmo_networks.sh b/scripts/core/sxmo_networks.sh index f60cc9f..2de9d82 100755 --- a/scripts/core/sxmo_networks.sh +++ b/scripts/core/sxmo_networks.sh @@ -35,6 +35,13 @@ deletenetworkmenu() { fi } +getifname() { + IFTYPE="$1" + IFNAME="$(nmcli d | grep -m 1 "$IFTYPE" | cut -d' ' -f1)" + [ -z "$IFNAME" ] && notify-send "No interface with type $IFTYPE found" && IFNAME=lo + echo "$IFNAME" +} + addnetworkgsmmenu() { CONNNAME="$( echo "Close Menu" | @@ -51,7 +58,7 @@ addnetworkgsmmenu() { # TODO: Support gsm bearer username & password nmcli c add \ type gsm \ - ifname cdc-wdm0 \ + ifname "$(getifname gsm)" \ con-name "$CONNNAME" \ apn "$APN" }