Commit Graph
155 Commits
Author SHA1 Message Date
Michael Pfeifroth f094afbed0 modemmanager: suppress hotplug noise without breaking QMAP/QMI/MBIM mux
Commit 7885dff933 ("modemmanager: skip virtual net devices in hotplug
script") exited 25-modemmanager-net for every device under
/devices/virtual/* to stop the per-device "event processed" line from
spamming daemon.info on every boot and hotplug replay.

That blanket exit also dropped the QMAP/QMI/MBIM multiplexing netdevices
(qmapmux*, qmimux*, mbimmux*).  Those live under /devices/virtual too,
but they are real modem data ports and mm_report_event() deliberately
keeps them (ModemManager then resolves their lower_* link back to the
physical modem).  Skipping them in the hotplug script broke multiplexed
data connections.

Rather than duplicating that qmapmux/qmimux/mbimmux allow-list in the
hotplug script -- where it would drift out of sync with the copy in
mm_report_event() -- keep the filter in one place.  mm_report_event()
now returns non-zero when it drops a virtual device, and the hotplug
scripts only emit their "event processed" info log when the event was
actually reported.  The noisy log lines are gone for the dropped
devices, and the mux ports still reach ModemManager.

Fixes: 7885dff933 ("modemmanager: skip virtual net devices in hotplug script")
Signed-off-by: Michael Pfeifroth <micpf@westermo.com>
2026-09-22 08:37:11 +02:00
Michael Pfeifroth f601e632e7 modemmanager: fix custom initial EPS bearer username
The custom initial EPS bearer code uses init_username, which agrees
with the documented UCI option. However, the option was registered
and read as init_user, so init_username was discarded before the
custom EPS bearer settings were passed to mmcli.

Register and read the option consistently as init_username.

Signed-off-by: Michael Pfeifroth <micpf@westermo.com>
2026-09-17 16:54:35 +02:00
Florian Eckert 76756aad2e modemmanager: bump PKG_RELEASE
Update PKG_RELEASE by one.

Signed-off-by: Florian Eckert <fe@dev.tdt.de>
2026-09-07 12:46:19 +02:00
Florian Eckert de35eab441 modemmanager: make command timeout configurable
Make the timeout for command execution configurable, as not all modems and
mobile networks behave in the same way.

Signed-off-by: Florian Eckert <fe@dev.tdt.de>
2026-09-07 12:46:19 +02:00
Florian Eckert 3e61169ebf modemmanager: update logging messages
Remove the trailing '...' from the log messages to bring them into line
with the other log messages in this file.

Signed-off-by: Florian Eckert <fe@dev.tdt.de>
2026-09-07 12:46:19 +02:00
Florian Eckert ad08185652 modemmanager: cleanup vars in proto_modemmanager_setup
Group variables into blocks to improve readability.

Signed-off-by: Florian Eckert <fe@dev.tdt.de>
2026-09-07 12:46:19 +02:00
Michael Pfeifroth 7885dff933 modemmanager: skip virtual net devices in hotplug script
Every net uevent - eth ports, USB hubs, bridges, taps, SQM IFB,
GRE tunnels, veth, tun/tap - is handed to mmcli via
25-modemmanager-net's mm_report_event call, so ModemManager logs a
'not supported by any plugin' notice per device on every boot and
hotplug replay:

  ModemManager[15132]: <msg> [base-manager] couldn't check support
    for device '.../fsl-ehci.0/usb1/1-1/1-1.1':
    not supported by any plugin

mm_report_event() already discards virtual devices internally, but
only after mm_log "info" has written a "hotplug: add network
interface XXX: event processed" line to daemon.info for every one
of them.

Mirror the same guard in the hotplug script by exiting early when
DEVPATH points under /devices/virtual/*, which covers SQM IFB, GRE,
bridges, veth, tun/tap.  This never rejects a physical modem port
(kernel wwan, MHI, USB CDC/RNDIS/QMI/MBIM are all under real bus
subtrees).

Signed-off-by: Michael Pfeifroth <micpf@westermo.com>
2026-08-03 13:03:31 +02:00
Michael Pfeifroth 187382d9d1 modemmanager: skip live report when the service isn't up yet
At boot procd replays every previously-seen uevent before
/etc/init.d/modemmanager starts.  Each replay walks the hotplug.d/
tree, which calls mm_report_event() in modemmanager.common.  That
helper does two independent things:

  1) appends the event to ${MODEMMANAGER_EVENTS_CACHE}, and
  2) runs 'mmcli --report-kernel-event=...' to notify a live MM.

Step 1 is what matters for boot; step 2 exists so events fired
after MM is running get reported without waiting for the next
cache replay.  The cache path is intentional: ModemManager-wrapper
starts MM, then mm_report_events_from_cache() polls 'mmcli -L'
until the bus is available and replays every cached event.

At boot the modemmanager service instance hasn't been spawned by
procd yet, so step 2 always fails with:

  daemon.err ModemManager[NNN]: hotplug: Couldn't report kernel
    event: error: couldn't get bus: Could not connect: No such
    file or directory

That's one daemon.err line per hotplug script per port, per boot.
On a dual-modem board that's a dozen spurious errors before the
service even starts.  Nothing is lost -- the wrapper's cache
replay picks them all up seconds later -- but the log noise makes
real ModemManager errors harder to spot.

Guard the live call with a cheap pidfile-based liveness check.
The pidfile is procd's, so it proves the service instance has
been spawned, not that MM is already reachable on the bus; the
brief wrapper-startup window (procd spawns the wrapper -> wrapper
execs MM -> MM reaches the bus) is not covered.  In practice no
fresh uevents fire in that window on the boards this was tested
on, and events that do arrive there are still cached.  If the
service hasn't been spawned yet, the event is silently cached and
the wrapper handles it.  If it has, behavior is unchanged.

Signed-off-by: Michael Pfeifroth <micpf@westermo.com>
2026-08-03 13:03:31 +02:00
Christian Korber ebb7c18a5d modemmanager: bump PKG_RELEASE
Bump PKG_RELEASE number. This is due because of earlier changes.

Signed-off-by: Christian Korber <ckorber@tdt.de>
2026-07-15 10:16:54 +02:00
Christian Korber 753e6d8c54 modemmanager: add configurable plugins
This adds the feature to choose which plugins to include or not.
Additionally, the needed shared plugins are added automatically.

Signed-off-by: Christian Korber <ckorber@tdt.de>
2026-07-15 10:16:54 +02:00
Christian Korber b71338b5a7 modemmanager: make building builtin options optional
This commit enables to choose whether to compile the plugins into the
binary or not. If not included, it moves the plugins to
`/usr/lib/ModemManager/`.

Signed-off-by: Christian Korber <ckorber@tdt.de>
2026-07-15 10:16:54 +02:00
Etienne Champetier d3a7f9af1e modemmanager: fix dependency and ci
lua-cjson depends on liblua, so add missing lua dependency.
modemmanager-rpcd has no version, so add a simple test, and skip version check.

Signed-off-by: Etienne Champetier <champetier.etienne@gmail.com>
2026-07-05 13:24:51 +03:00
micpf e1d680d19a modemmanager: fix netifd proto sim path
Use specific SIM path instead of 'any' when unlocking with PIN
code. This fixes PIN unlock issues on devices with multiple modems
where 'any' could select the wrong modem.

Bump modemmanager PKG_RELEASE

Signed-off-by: micpf <micpf@westermo.com>
2026-02-10 13:59:28 +01:00
Simonas Tamošaitis 83f3e116b1 modemmanager: allow empty initial EPS bearer APN
This commit removes the non-empty APN requirement for initial EPS
bearer. An empty APN value is valid and means that the modem will use a
network provided APN offered by the operator.

Signed-off-by: Simonas Tamošaitis <simsasss@gmail.com>
2025-12-09 15:45:10 +01:00
Florian Eckert fd4eafd956 modemmanager: bump PKG_RELEASE
Bump PKG_RELEASE number.

Signed-off-by: Florian Eckert <fe@dev.tdt.de>
2025-09-04 08:35:09 +02:00
Florian Eckert 246506690f modemmanager: always reset the init_eps if not configured
The initial EPS is stored on the modem side. When establishing a connection,
it must therefore be deleted if no EPS has been configured. This is because
the system does not know whether one was configured previously.

Signed-off-by: Florian Eckert <fe@dev.tdt.de>
2025-09-04 08:35:09 +02:00
Florian Eckert f49138b564 modemmanager: add missing ppp ifname option value
The pppd supports the option to configure the name of the network interface
at startup using the ifname option.

The pppd can overwrite the name of the network interface at startup using
the 'ifname' configuration option. If this option is not specified, the new
network interface is created according to the following scheme:
ppp<number>, e.g. ppp0, ppp1 and so on. This can therefore change with
every start if the number has been already assigned to another ppp connection.

In order to always get the same interface name with the modemmanger proto via
ppp, it is created according to the new scheme by setting the 'ifname':
ppp-<uci network interface name>, e.g. ppp-wwan.

Signed-off-by: Florian Eckert <fe@dev.tdt.de>
2025-09-04 08:35:09 +02:00
John Audia 35209ac249 modemmanager: change permissions on dbus file
/etc/dbus-1/system.d/org.freedesktop.ModemManager1.conf needs to be 644
so that it can be read to prevent the following since dbus runs as an
unprivileged user:

dbus-daemon[12465]: Encountered error 'Failed to open "/etc/dbus-1/system.d/org.freedesktop.ModemManager1.conf": Permission denied' while parsing '/etc/dbus-1/system.d/org.freedesktop.ModemManager1.conf

Build system: x86/64
Build-tested: x86/64-glibc
Run-tested: x86/64-glibc

Signed-off-by: John Audia <therealgraysky@proton.me>
2025-08-02 14:26:21 +02:00
Christian Korber a6b332f4e9 modemmanager: change to configuration option disable_modem
This commit sets default of `disable_modem` to 1 and disconnects modem.
If set otherwise it keeps the modem connected.

Signed-off-by: Christian Korber <ck@dev.tdt.de>
2025-07-08 07:55:17 +02:00
Ryan Press 7efed7ff9f modemmanager: add sourcefilter option support
This make source based IPv6 routing option available for
modemmanager when using modem SLAAC.

Signed-off-by: Ryan Press <ryan@presslab.us>
2025-05-28 08:16:27 +02:00
Florian Eckert d221309637 modemmanager: backport fixes for version 1.24.0
The following commits were added shortly after the release of Modemmanager
version '1.24.0'.

Patch: 0002-modem-helpers-cinterion-allow-spaces-in-SXRAT-test-r.patch
Backport: https://gitlab.freedesktop.org/mobile-broadband/ModemManager/-/commit/6b6997362b5530708725c16c80ef36cd21609f20
Issue: https://gitlab.freedesktop.org/mobile-broadband/ModemManager/-/issues/974

Patch: 0003-modem-helpers-fix-checking-of-CDMA-EVDO-access-techn.patch
Backport: https://gitlab.freedesktop.org/mobile-broadband/ModemManager/-/commit/9e205f47847ab9ef5887b79c077ef8468d769af0
Issue: no

Patch: 0004-iface-modem-voice-recheck-call-state-polling-when-ca.patch
Backport: https://gitlab.freedesktop.org/mobile-broadband/ModemManager/-/commit/92e666e1c92c205e896552604e717d5b39528ae3
Issue: no

Signed-off-by: Florian Eckert <fe@dev.tdt.de>
2025-05-15 14:33:22 +02:00
Daniel Golle 29a6674cb5 modemmanager: backport commit fixing crash with Fibocom mtk-7xx modems
Backport commit
https://gitlab.freedesktop.org/mobile-broadband/ModemManager/-/commit/046b79a6766b6384db9cd56a9af5d148787bafe4

See also
https://gitlab.freedesktop.org/mobile-broadband/ModemManager/-/issues/975

Signed-off-by: Daniel Golle <daniel@makrotopia.org>
2025-04-23 15:11:06 +02:00
Ryan Press 939939bcee modemmanager: bump to 1.24.0
100-ublox-remove-ID_MM_PROCESS-tags.patch has been removed as this change is now upstream.

Signed-off-by: Ryan Press <ryan@presslab.us>
2025-04-18 18:00:40 +02:00
Florian Eckert 6b9b6fdace modemmanager: add missing any option to allowedmode
The 'mmcli' also understands the option 'any'.

Signed-off-by: Florian Eckert <fe@dev.tdt.de>
2025-04-10 09:33:58 +02:00
Florian Eckert 6c8ad9f02b modemmanager: fix pending mmcli calls for ModemManager-monitor script
If the ModemManager is stopped via '/etc/init.d/modemmanager', mmcli calls
always remain in the process list. This is because the ModemManager-monitor
call is not terminated properly, as the kill signals are not handled
correctly in the startup script for mmcli.

To fix this, the signal handling is refactored.

Signed-off-by: Florian Eckert <fe@dev.tdt.de>
2025-04-01 10:08:27 +02:00
Florian Eckert 5c203c36d5 modemmanager: add missing mmcli timeout option during ubus call
The default 'timeout' value is 30 seconds when calling an mmcli action. That
is too long. For this reason, the mmcli 'timeout' option is specified for
calls and the value is set to 10 seconds.

Signed-off-by: Florian Eckert <fe@dev.tdt.de>
2025-04-01 10:08:27 +02:00
Gilles Lenaerts 5cb12d479b modemmanager: add config optional netifd integration
This change introduces an optional configuration
of the  netifd integration in the ModemManager package.
When disabled, it removes the NETIFD dependency and
other unwanted components from the root filesystem
during the build phase.

Additionally, in the modemmanager.common the netifd-proto.sh
inclusion line can be savely removed as there is no usage
of it in its functions.

Signed-off-by: Gilles Lenaerts <gilles.lenaerts_ext@softathome.com>
2025-02-26 10:03:30 +01:00
Florian Eckert 434c353e62 modemmanager: do not disable modem on reconnect
If the modem loses the connection, an attempt is made to re-establish the
connection via the report-down script.

Until now, the modem was disabled when the modem processed the teardown of
the modemmanager protohandler. The immediate up events of netifd renables
the modem right away. This takes time, which is not necessary.

This commit changes the behavior so that the modem is not disabled when
the modemmanager is disconnected via the report-down script.

Signed-off-by: Florian Eckert <fe@dev.tdt.de>
2025-02-12 16:52:16 +01:00
Florian Eckert 2ecfcce324 modemmanager: bump PKG_RELEASE
Bump PKG_RELEASE by one.

Signed-off-by: Florian Eckert <fe@dev.tdt.de>
2024-11-15 11:17:05 +01:00
Florian Eckert 24d2ba0ba8 modemmanager: check during SIM unlocking whether initialization has been completed
After the SIM has been successfully unlocked, it is initialized. This can
take longer on some modems, so we must wait until the modem is ready to
execute the next commands.

Otherwise the modem cannot be enabled and aborts with the following
error message:

error: couldn't enable the modem: 'GDBus.Error:org.freedesktop.ModemManager1.Error.Core.WrongState: modem in initializing state'

Signed-off-by: Florian Eckert <fe@dev.tdt.de>
2024-11-15 11:17:05 +01:00
Florian Eckert fa6198e36b modemmanager: reset to 'no' plmn if nothing is configured
If a configured 'plmn' is deleted from the configuration between a connection
setup, it will continue to be used because the modem remembers it.

Therefore, the 'plmn' stored in the modem must be deleted when a new
connection is established if it is no longer in the configuration.

Signed-off-by: Florian Eckert <fe@dev.tdt.de>
2024-11-15 11:17:05 +01:00
Florian Eckert 3a5aa8a387 modemmanager: swap plmn and technology set command in the proto
In the current implementation of the modemmanager 'proto', if a 'plmn' and a
'technology' is configured, the 'plmn' is set first and then second the
'technology' on a 'proto' setup.

However, this is problematic if a 'technology' has already been set in an
earlier run. It is possible, that this previously set 'technology' is not
available at the current location, as the modem remembers the setting.

To fix this, first set the technology and then the plmn.

Signed-off-by: Florian Eckert <fe@dev.tdt.de>
2024-11-15 11:17:05 +01:00
Florian Eckert 8682084e34 modemmanager: move plmn registration into own function
To improve the code, the setting of the 'plmn' is moved to separate function.

Signed-off-by: Florian Eckert <fe@dev.tdt.de>
2024-11-15 11:17:05 +01:00
Florian Eckert 5ab483aa44 modemmanager: rename function modemmanager_check_state to modemmanager_check_sim_state
This is a preparation commit for a new function.

Signed-off-by: Florian Eckert <fe@dev.tdt.de>
2024-11-15 11:17:05 +01:00
Florian Eckert 9f35173639 modemmanager: move initial eps settings after modem enable
This settings are needed before any other mmcli command is executed.

Signed-off-by: Florian Eckert <fe@dev.tdt.de>
2024-11-15 11:17:05 +01:00
Florian Eckert b6664ae938 modemmanager: add log file if syslog is set to DEBUG
If the ModemManager is started with debug, all outputs are written to the
system log. To simplify debugging, a logging file is now created under
'/var/log/mm.log' in this case. This simplifies error analysis.

Signed-off-by: Florian Eckert <fe@dev.tdt.de>
2024-11-15 11:17:05 +01:00
Florian Eckert dd2e7105e6 modemmanger: bump PKG_RELEASE number
Signed-off-by: Florian Eckert <fe@dev.tdt.de>
2024-10-17 18:29:16 +02:00
Florian Eckert 85a01e2bb3 modemmanager: add pin check attempts
This new check in the proto modemanager prevents the SIM card from being
blocked and therefore PUK is not required. If the PIN is entered incorrectly
in the 'uci' configuration, it makes no sense to try this several times
until the PUK is required. Should it nevertheless happen that the PUK
is required, then this will logged.

Signed-off-by: Florian Eckert <fe@dev.tdt.de>
2024-10-17 18:29:16 +02:00
Florian Eckert deaef51d07 modemmanager: improvement of readability by reversing the query
No functional change. The change makes reading the source clearer.

Signed-off-by: Florian Eckert <fe@dev.tdt.de>
2024-10-17 18:29:16 +02:00
Florian Eckert cdda998996 modemmanager: add missing interface argument to function modemmanager_check_state
The variable interface is used in the sub-function 'modemmanager_check_state'.
However, this is not an argument of the function and so the global value
is used. Addding the variable as an function call argument fixes this.

Signed-off-by: Florian Eckert <fe@dev.tdt.de>
2024-10-17 18:29:16 +02:00
Florian Eckert 64bd9e9d08 modemmanager: move modemmanager_check_state failed and locked into sub functions
To make the source clearer, the program parts for the 'locked' and 'failed'
cases are outsourced to sub-functions.

Signed-off-by: Florian Eckert <fe@dev.tdt.de>
2024-10-17 18:29:16 +02:00
Florian Eckert dced576bfe modemmanager: fix value call with modemmanager_get_field function
The correct values are prefixed with 'modem.generic'. This is missing
for the value 'state' and 'state-failed-reason.

While we're at it, let's move the readout of 'state-failed-reason' to the
failed case, because that's the only place it's needed.

Signed-off-by: Florian Eckert <fe@dev.tdt.de>
2024-10-17 18:29:16 +02:00
Florian Eckert e2822c9d80 modemmanager: extend log message with count on boot
This makes debugging at system startup easier and shows how long we are
waiting for the ModemManager to start.

Signed-off-by: Florian Eckert <fe@dev.tdt.de>
2024-10-17 18:29:16 +02:00
Christian Svensson f48f15a899 modemmanager: make rpcd integration optional
ModemManager does not depend on Lua by its own, so make it possible to
not have a requirement on Lua if the rpcd integration is not needed.

Signed-off-by: Christian Svensson <blue@cmd.nu>
2024-08-07 15:27:33 +02:00
Florian Eckert 9de61ea058 modemmanager: add missing ubus status backend via mmcli
The 'modemmanager' uses the 'dbus'. Status information can be retrieved
with the 'mmcli' command, this can also be output in json format.

This commit adds a new 'ubus' backend with which this information can
be easily accessed via ubus.

* ubus call modemmanager info
* ubus call modemmanager dump

Signed-off-by: Florian Eckert <fe@dev.tdt.de>
2024-07-10 12:26:51 +02:00
Chen Minqiang 9877676890 modemmanager: add sourcefilter option support
This make source based IPv6 routing option available for
modemmanager case dhcpv6

Signed-off-by: Chen Minqiang <ptpt52@gmail.com>
2024-06-23 16:39:01 -07:00
Oliver Sedlbauer 7eb763b962 modemmanager: remove status message from errors
The message 'MM_CONNECT_IN_PROGRESS' is a status message, not an error
message. To avoid confusion, the message has been removed.

Signed-off-by: Oliver Sedlbauer <osedlbauer@tdt.de>
2024-06-11 16:00:20 +02:00
Oliver Sedlbauer 06a6258035 modemmanager: add option to force connection
This commit improves the automatic reconnect logic. If the modem cannot
establish a connection, for example due to poor reception, the
proto_block_restart prevents the interface from trying to reconnect.
To enforce the connection, this commit adds a new option that allows the
system to attempt to establish a connection indefinitely.

Signed-off-by: Oliver Sedlbauer <osedlbauer@tdt.de>
2024-06-11 15:59:45 +02:00
Robert Marko 9cce31c309 treewide: fix incorrect hashes
It seems that PR #24113 introduced incorrect hashes for multiple packages.

So, lets fix all of them at once.

Signed-off-by: Robert Marko <robimarko@gmail.com>
2024-05-24 13:50:11 +08:00
Florian Eckert 35f1bed3fb modemmanager: fix PKG_MIRROR_HASH
Due to the change in the version description, the package must be
downloaded again. In addition, the standard compression method has changed
to zst. The checksum must therefore be recalculated.

Fixes: 22f8fd5c5b ("modemmanager: add missing PKG_VERSION for APK")
Signed-off-by: Florian Eckert <fe@dev.tdt.de>
2024-05-10 14:18:04 +02:00