autodetect modem ifname

Signed-off-by: Maarten van Gompel <proycon@anaproy.nl>
master
Maxim Karasev 4 years ago committed by Maarten van Gompel
parent c043c50175
commit ecacc3ae8a
  1. 9
      scripts/core/sxmo_networks.sh

@ -35,6 +35,13 @@ deletenetworkmenu() {
fi 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() { addnetworkgsmmenu() {
CONNNAME="$( CONNNAME="$(
echo "Close Menu" | echo "Close Menu" |
@ -51,7 +58,7 @@ addnetworkgsmmenu() {
# TODO: Support gsm bearer username & password # TODO: Support gsm bearer username & password
nmcli c add \ nmcli c add \
type gsm \ type gsm \
ifname cdc-wdm0 \ ifname "$(getifname gsm)" \
con-name "$CONNNAME" \ con-name "$CONNNAME" \
apn "$APN" apn "$APN"
} }

Loading…
Cancel
Save