option lowpower '1'
option signalrate '30'
option allow_roaming '1'
+ option init_epsbearer '<none|default|custom>'
Only 'device' and 'proto' are mandatory options, the remaining ones are all
optional.
The 'signalrate' option set's the signal refresh rate (in seconds) for the device.
You can call signal info with command: mmcli -m 0 --signal-get
+
+If there is no Circuit switch network available, then an initial EPS
+bearer must be set, so this could be used during the network registration
+process in 4G and 5G network. For this resaon a new configuration option
+'init_epsbearer' was added, which could have the following values.
+* none: Do not set an initial EPS bearer (default)
+* default: Use the configuration option 'apn', 'iptype', 'allowedauth',
+ 'username' and 'password' for setting the initial EPS bearer.
+ These are the same options as when establishing a connection.
+* custom: This could be used to use diffrent options when establishing a
+ connection. The options are prefixed with an 'init'. So we have
+ the following options 'init_apn', 'init_iptype',
+ 'init_allowedauth', 'init_username' and 'init_password' for
+ setting the initial EPS bearer.
proto_config_add_int signalrate
proto_config_add_boolean lowpower
proto_config_add_boolean allow_roaming
+ proto_config_add_string init_epsbearer
+ proto_config_add_string init_iptype
+ proto_config_add_string 'init_allowedauth:list(string)'
+ proto_config_add_string init_password
+ proto_config_add_string init_user
+ proto_config_add_string init_apn
proto_config_add_defaults
}
}
}
+modemmanager_init_epsbearer() {
+ local eps="$1"
+ local device="$2"
+ local connectargs="$3"
+ local apn="$4"
+
+ [ "$eps" != 'none' ] && [ -z "${apn}" ] && {
+ echo "No '$eps' init eps bearer apn configured"
+ proto_notify_error "${interface}" MM_INIT_EPS_BEARER_APN_NOT_CONFIGURED
+ proto_block_restart "${interface}"
+ return 1
+ }
+
+ if [ "$eps" = "none" ]; then
+ echo "Deleting inital EPS bearer..."
+ else
+ echo "Setting '$eps' inital EPS bearer apn to '$apn'..."
+ fi
+
+ mmcli --modem="${device}" \
+ --timeout 120 \
+ --3gpp-set-initial-eps-bearer-settings="${connectargs}" || {
+ proto_notify_error "${interface}" MM_INIT_EPS_BEARER_SET_FAILED
+ proto_block_restart "${interface}"
+ return 1
+ }
+
+ # Wait here so that the modem can set the init EPS bearer
+ # for registration
+ sleep 2
+}
+
proto_modemmanager_setup() {
local interface="$1"
local device apn allowedauth username password pincode
local iptype plmn metric signalrate allow_roaming
+ local init_epsbearer
+ local init_iptype init_allowedauth
+ local init_password init_user init_apn
+
local address prefix gateway mtu dns1 dns2
json_get_vars device apn allowedauth username password
json_get_vars pincode iptype plmn metric signalrate allow_roaming
json_get_vars allowedmode preferredmode
+ json_get_vars init_epsbearer
+ json_get_vars init_iptype init_allowedauth
+ json_get_vars init_password init_user init_apn
+
# validate sysfs path given in config
[ -n "${device}" ] || {
echo "No device specified"
# always cleanup before attempting a new connection, just in case
modemmanager_cleanup_connection "${modemstatus}"
- # if allowedauth list given, build option string
- for auth in $allowedauth; do
- cliauth="${cliauth}${cliauth:+|}$auth"
- done
+ mmcli --modem="${device}" --timeout 120 --enable || {
+ proto_notify_error "${interface}" MM_MODEM_DISABLED
+ 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
+ }
# setup connect args; APN mandatory (even if it may be empty)
echo "starting connection with apn '${apn}'..."
allow_roaming="yes"
fi
+ cliauth=""
+ for auth in $allowedauth; do
+ cliauth="${cliauth}${cliauth:+|}$auth"
+ done
# Append options to 'connectargs' variable
+ connectargs=""
append_param "apn=${apn}"
append_param "allow-roaming=${allow_roaming}"
append_param "${iptype:+ip-type=${iptype}}"