modemmanager: improve 'simple connection' option handling
The line to generate the argument list for 'simple connect' is quite long and is not maintainable. To improve the handling a function 'append_param' was added for appending the 'simple connect' options. Signed-off-by: Florian Eckert <fe@dev.tdt.de>
This commit is contained in:
parent
7ba2c969b2
commit
89391d4213
|
@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk
|
||||||
|
|
||||||
PKG_NAME:=modemmanager
|
PKG_NAME:=modemmanager
|
||||||
PKG_SOURCE_VERSION:=1.20.6
|
PKG_SOURCE_VERSION:=1.20.6
|
||||||
PKG_RELEASE:=7
|
PKG_RELEASE:=8
|
||||||
|
|
||||||
PKG_SOURCE_PROTO:=git
|
PKG_SOURCE_PROTO:=git
|
||||||
PKG_SOURCE_URL:=https://gitlab.freedesktop.org/mobile-broadband/ModemManager.git
|
PKG_SOURCE_URL:=https://gitlab.freedesktop.org/mobile-broadband/ModemManager.git
|
||||||
|
|
|
@ -350,6 +350,15 @@ proto_modemmanager_init_config() {
|
||||||
proto_config_add_defaults
|
proto_config_add_defaults
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Append param to the global 'connectargs' variable.
|
||||||
|
append_param() {
|
||||||
|
local param="$1"
|
||||||
|
|
||||||
|
[ -z "$param" ] && return
|
||||||
|
[ -z "$connectargs" ] || connectargs="${connectargs},"
|
||||||
|
connectargs="${connectargs}${param}"
|
||||||
|
}
|
||||||
|
|
||||||
proto_modemmanager_setup() {
|
proto_modemmanager_setup() {
|
||||||
local interface="$1"
|
local interface="$1"
|
||||||
|
|
||||||
|
@ -401,7 +410,16 @@ proto_modemmanager_setup() {
|
||||||
# allowed unless a user set the opposite
|
# allowed unless a user set the opposite
|
||||||
allow_roaming="yes"
|
allow_roaming="yes"
|
||||||
fi
|
fi
|
||||||
connectargs="apn=${apn},allow-roaming=${allow_roaming}${iptype:+,ip-type=${iptype}}${plmn:+,operator-id=${plmn}}${cliauth:+,allowed-auth=${cliauth}}${username:+,user=${username}}${password:+,password=${password}}${pincode:+,pin=${pincode}}"
|
|
||||||
|
# Append options to 'connectargs' variable
|
||||||
|
append_param "apn=${apn}"
|
||||||
|
append_param "allow-roaming=${allow_roaming}"
|
||||||
|
append_param "${iptype:+ip-type=${iptype}}"
|
||||||
|
append_param "${plmn:+operator-id=${plmn}}"
|
||||||
|
append_param "${cliauth:+allowed-auth=${cliauth}}"
|
||||||
|
append_param "${username:+user=${username}}"
|
||||||
|
append_param "${password:+password=${password}}"
|
||||||
|
append_param "${pincode:+pin=${pincode}}"
|
||||||
|
|
||||||
mmcli --modem="${device}" --timeout 120 --simple-connect="${connectargs}" || {
|
mmcli --modem="${device}" --timeout 120 --simple-connect="${connectargs}" || {
|
||||||
proto_notify_error "${interface}" MM_CONNECT_FAILED
|
proto_notify_error "${interface}" MM_CONNECT_FAILED
|
||||||
|
|
Loading…
Reference in New Issue