1
0
Fork 0
mirror of https://github.com/Ysurac/openmptcprouter-feeds.git synced 2025-03-09 15:40:03 +00:00

Update ModemManager

This commit is contained in:
Ycarus (Yannick Chabanois) 2023-07-27 13:21:27 +02:00
parent 3959237a3d
commit d31ae36737
3 changed files with 47 additions and 14 deletions

View file

@ -8,25 +8,25 @@
include $(TOPDIR)/rules.mk include $(TOPDIR)/rules.mk
PKG_NAME:=modemmanager PKG_NAME:=modemmanager
PKG_SOURCE_VERSION:=1.20.4 PKG_SOURCE_VERSION:=1.20.6
PKG_RELEASE:=1 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
#PKG_MIRROR_HASH:=f138effc693456c5040ec22e17c0a8b41143c3b17b62437462995c297a9150dc PKG_MIRROR_HASH:=e90103e2e42bb826bbbac83937a9a69f50348cd6ce0d8da655a12b65494ce7c9
PKG_MAINTAINER:=Nicholas Smith <nicholas@nbembedded.com> PKG_MAINTAINER:=Nicholas Smith <nicholas@nbembedded.com>
PKG_LICENSE:=GPL-2.0-or-later PKG_LICENSE:=GPL-2.0-or-later
PKG_LICENSE_FILES:=COPYING PKG_LICENSE_FILES:=COPYING
PKG_BUILD_DEPENDS:=glib2/host libxslt/host PKG_BUILD_DEPENDS:=glib2/host libxslt/host
PKG_BUILD_FLAGS:=gc-sections
include $(INCLUDE_DIR)/package.mk include $(INCLUDE_DIR)/package.mk
include $(INCLUDE_DIR)/nls.mk include $(INCLUDE_DIR)/nls.mk
include $(INCLUDE_DIR)/meson.mk include $(INCLUDE_DIR)/meson.mk
TARGET_CFLAGS += -ffunction-sections -fdata-sections -fno-merge-all-constants -fmerge-constants TARGET_CFLAGS += -fno-merge-all-constants -fmerge-constants
TARGET_LDFLAGS += -Wl,--gc-sections
define Package/modemmanager/config define Package/modemmanager/config
source "$(SOURCE)/Config.in" source "$(SOURCE)/Config.in"

View file

@ -272,6 +272,14 @@ mm_report_event() {
local subsystem="$3" local subsystem="$3"
local sysfspath="$4" local sysfspath="$4"
# Do not save virtual devices
local virtual
virtual="$(echo "$sysfspath" | cut -d'/' -f4)"
[ "$virtual" = "virtual" ] && {
mm_log "debug" "sysfspath is a virtual device ($sysfspath)"
return
}
# Track/untrack events in cache # Track/untrack events in cache
case "${action}" in case "${action}" in
"add") "add")

View file

@ -343,11 +343,22 @@ proto_modemmanager_init_config() {
proto_config_add_string password proto_config_add_string password
proto_config_add_string pincode proto_config_add_string pincode
proto_config_add_string iptype proto_config_add_string iptype
proto_config_add_string plmn
proto_config_add_int signalrate proto_config_add_int signalrate
proto_config_add_boolean lowpower proto_config_add_boolean lowpower
proto_config_add_boolean allow_roaming
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"
@ -355,11 +366,11 @@ proto_modemmanager_setup() {
local bearermethod_ipv4 bearermethod_ipv6 auth cliauth local bearermethod_ipv4 bearermethod_ipv6 auth cliauth
local operatorname operatorid registration accesstech signalquality local operatorname operatorid registration accesstech signalquality
local device apn allowedauth username password pincode iptype metric signalrate local device apn allowedauth username password pincode iptype plmn metric signalrate allow_roaming
local address prefix gateway mtu dns1 dns2 local address prefix gateway mtu dns1 dns2
json_get_vars device apn allowedauth username password pincode iptype metric signalrate json_get_vars device apn allowedauth username password pincode iptype plmn metric signalrate allow_roaming
# validate sysfs path given in config # validate sysfs path given in config
[ -n "${device}" ] || { [ -n "${device}" ] || {
@ -368,11 +379,6 @@ proto_modemmanager_setup() {
proto_set_available "${interface}" 0 proto_set_available "${interface}" 0
return 1 return 1
} }
[ -e "${device}" ] || {
echo "Device not found in sysfs"
proto_set_available "${interface}" 0
return 1
}
# validate that ModemManager is handling the modem at the sysfs path # validate that ModemManager is handling the modem at the sysfs path
modemstatus=$(mmcli --modem="${device}" --output-keyvalue) modemstatus=$(mmcli --modem="${device}" --output-keyvalue)
@ -397,7 +403,24 @@ proto_modemmanager_setup() {
echo "starting connection with apn '${apn}'..." echo "starting connection with apn '${apn}'..."
proto_notify_error "${interface}" MM_CONNECT_IN_PROGRESS proto_notify_error "${interface}" MM_CONNECT_IN_PROGRESS
connectargs="apn=${apn}${iptype:+,ip-type=${iptype}}${cliauth:+,allowed-auth=${cliauth}}${username:+,user=${username}}${password:+,password=${password}}${pincode:+,pin=${pincode}}" # setup allow-roaming parameter
if [ -n "${allow_roaming}" ] && [ "${allow_roaming}" -eq 0 ];then
allow_roaming="no"
else
# allowed unless a user set the opposite
allow_roaming="yes"
fi
# 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
proto_block_restart "${interface}" proto_block_restart "${interface}"
@ -509,7 +532,6 @@ proto_modemmanager_teardown() {
json_get_vars device lowpower iptype json_get_vars device lowpower iptype
echo "stopping network" echo "stopping network"
proto_notify_error "${interface}" MM_TEARDOWN_IN_PROGRESS
# load connected bearer information, just the first one should be ok # load connected bearer information, just the first one should be ok
modemstatus=$(mmcli --modem="${device}" --output-keyvalue) modemstatus=$(mmcli --modem="${device}" --output-keyvalue)
@ -544,6 +566,9 @@ proto_modemmanager_teardown() {
# low power, only if requested # low power, only if requested
[ "${lowpower:-0}" -lt 1 ] || [ "${lowpower:-0}" -lt 1 ] ||
mmcli --modem="${device}" --set-power-state-low mmcli --modem="${device}" --set-power-state-low
proto_init_update "*" 0
proto_send_update "$interface"
} }
[ -n "$INCLUDE_ONLY" ] || { [ -n "$INCLUDE_ONLY" ] || {