From 9f351736391aedd090faab2da947b880f5710ca3 Mon Sep 17 00:00:00 2001 From: Florian Eckert Date: Wed, 16 Oct 2024 16:47:43 +0200 Subject: [PATCH] modemmanager: move initial eps settings after modem enable This settings are needed before any other mmcli command is executed. Signed-off-by: Florian Eckert --- .../files/lib/netifd/proto/modemmanager.sh | 83 ++++++++++--------- 1 file changed, 42 insertions(+), 41 deletions(-) diff --git a/net/modemmanager/files/lib/netifd/proto/modemmanager.sh b/net/modemmanager/files/lib/netifd/proto/modemmanager.sh index 669acb38e0..f20236411e 100644 --- a/net/modemmanager/files/lib/netifd/proto/modemmanager.sh +++ b/net/modemmanager/files/lib/netifd/proto/modemmanager.sh @@ -583,6 +583,48 @@ proto_modemmanager_setup() { return 1 } + # set initial eps bearer settings + [ -z "${init_epsbearer}" ] || { + case "$init_epsbearer" in + "none") + connectargs="" + modemmanager_init_epsbearer "none" \ + "$device" "${connectargs}" "$apn" + ;; + "default") + cliauth="" + for auth in $allowedauth; do + cliauth="${cliauth}${cliauth:+|}$auth" + done + connectargs="" + append_param "apn=${apn}" + append_param "${iptype:+ip-type=${iptype}}" + append_param "${cliauth:+allowed-auth=${cliauth}}" + append_param "${username:+user=${username}}" + append_param "${password:+password=${password}}" + modemmanager_init_epsbearer "default" \ + "$device" "${connectargs}" "$apn" + ;; + "custom") + cliauth="" + for auth in $init_allowedauth; do + cliauth="${cliauth}${cliauth:+|}$auth" + done + connectargs="" + append_param "apn=${init_apn}" + append_param "${init_iptype:+ip-type=${init_iptype}}" + append_param "${cliauth:+allowed-auth=${cliauth}}" + append_param "${init_username:+user=${init_username}}" + append_param "${init_password:+password=${init_password}}" + modemmanager_init_epsbearer "custom" \ + "$device" "${connectargs}" "$init_apn" + ;; + esac + # check error for init_epsbearer function call + [ "$?" -ne "0" ] && return 1 + } + + [ -z "${plmn}" ] || { echo "starting network registraion with plmn '${plmn}'..." mmcli --modem="${device}" \ @@ -629,47 +671,6 @@ proto_modemmanager_setup() { [ "$?" -ne "0" ] && return 1 fi - # set initial eps bearer settings - [ -z "${init_epsbearer}" ] || { - case "$init_epsbearer" in - "none") - connectargs="" - modemmanager_init_epsbearer "none" \ - "$device" "${connectargs}" "$apn" - ;; - "default") - cliauth="" - for auth in $allowedauth; do - cliauth="${cliauth}${cliauth:+|}$auth" - done - connectargs="" - append_param "apn=${apn}" - append_param "${iptype:+ip-type=${iptype}}" - append_param "${cliauth:+allowed-auth=${cliauth}}" - append_param "${username:+user=${username}}" - append_param "${password:+password=${password}}" - modemmanager_init_epsbearer "default" \ - "$device" "${connectargs}" "$apn" - ;; - "custom") - cliauth="" - for auth in $init_allowedauth; do - cliauth="${cliauth}${cliauth:+|}$auth" - done - connectargs="" - append_param "apn=${init_apn}" - append_param "${init_iptype:+ip-type=${init_iptype}}" - append_param "${cliauth:+allowed-auth=${cliauth}}" - append_param "${init_username:+user=${init_username}}" - append_param "${init_password:+password=${init_password}}" - modemmanager_init_epsbearer "custom" \ - "$device" "${connectargs}" "$init_apn" - ;; - esac - # check error for init_epsbearer function call - [ "$?" -ne "0" ] && return 1 - } - # setup connect args; APN mandatory (even if it may be empty) echo "starting connection with apn '${apn}'..." -- 2.30.2