Commit Graph
5310 Commits
Author SHA1 Message Date
Florian Eckert a107de32a8 cinterion: add revision read via AT for the MV31 and MV32
Reading the revsion via the mbim interface returns an incorrect firmware
revsion string. This contains a '\n' character so that the revision looks
like this in 'mmcli'.

Hardware  |            manufacturer: Cinterion
          |            model: Cinterion PID 0x00F1 USB Mobile Broadband
          |            firmware revision: FDE.F0.3.0.1.1.DT.005
          |            062
          |            carrier config: DT

The correct string without '\n' is returned via the AT interface. To fix
the error, the 'mbim' revision interface is overwritten with an AT call
if a MV31 or a MV32 is detected. So we get the correct output via 'mmcli'.

Hardware  |            manufacturer: Cinterion
          |            model: Cinterion PID 0x00F1 USB Mobile Broadband
          |            firmware revision: FDE.F0.3.0.1.1.DT.005.062
          |            carrier config: DT

Signed-off-by: Florian Eckert <fe@dev.tdt.de>
2025-07-30 12:41:22 -05:00
Florian Eckert ebebce6111 cinterion: add MV31 to the rules file
Add the missing udev rules for the MV31 from 'Telit' which uses the
cinterion plugin.

Signed-off-by: Florian Eckert <fe@dev.tdt.de>
2025-07-30 12:41:22 -05:00
Florian Eckert f4a1c0fcec cinterion: add MV32 to the rules file
Add the missing udev rules for the MV32 from 'Telit' which uses the
cinterion plugin.

Signed-off-by: Florian Eckert <fe@dev.tdt.de>
2025-07-30 12:41:22 -05:00
Dan Williams 01208cc6c0 base-manager: increase suspend timeout for each active bearer
Some modems can take a very long time (~20s) to reply to bearer
disconnect requests especially in marginal signal situations where
the modem must resend messages to the network after internal
timeouts. Give the modem a chance to suspend successfully if
there are active bearers.

Related: https://gitlab.freedesktop.org/mobile-broadband/ModemManager/-/merge_requests/1311#note_2938638

Signed-off-by: Dan Williams <dan@ioncontrol.co>
2025-07-21 15:12:01 -05:00
Dan Williams 11489152d8 sleep-context: add ability to increase timeout
Track when the timeout was started, so that if it needs to be increased
we can calculate how long the new timeout should be. Then cancel the
original timeout and start a new one with.

Signed-off-by: Dan Williams <dan@ioncontrol.co>
2025-07-21 15:11:16 -05:00
Dan Williams f7897daeb5 broadband-modem,iface-modem: move bearer counting to interface and generalize
Allow counting more kinds of bearers than just multiplexed ones.

Signed-off-by: Dan Williams <dan@ioncontrol.co>
2025-07-21 15:11:16 -05:00
Daniele Palmas 0e1ba4c530 modem-helpers-qmi: support EUTRAN bands 85 and 106
Signed-off-by: Daniele Palmas <dnlplm@gmail.com>
2025-07-09 10:41:43 +02:00
Daniele Palmas c070b9015e test,modem-helpers-qmi: add unit tests for bands
Signed-off-by: Daniele Palmas <dnlplm@gmail.com>
2025-07-09 10:33:26 +02:00
Vanillan Wang 91adec212d plugin,mtk: remove the relevant log prints of the device model.
Rolling devices use mtk plugin, but there are some "FM350" log prints,
which is not appropriate.

Signed-off-by: Vanillan Wang <vanillanwang@163.com>
2025-07-04 12:15:29 -05:00
Rukun Mao ca4334de94 broadband-modem: exit with error if enable() is called in enabling state
We should not assert. We can error out the latest enabling attempt and let
the previous enabling gracefully reach an end.

Issue log:
"2025-06-22T21:56:52.972448Z NOTICE ModemManager[1842]: <msg> [modem2] state changed (disabled -> enabling)
...
2025-06-22T21:57:53.146572Z ERR ModemManager[1842]: <err> [modem2] port cdc-wdm0 timed out 10 consecutive times, marking modem as invalid
...
2025-06-22T21:57:53.185751Z INFO shill[870]: INFO shill: [modem_info.cc(120)] RemoveModem: /org/freedesktop/ModemManager1/Modem/2
2025-06-22T21:57:53.187595Z INFO ModemManager[1842]: <inf> [modem2] processing user request to enable modem...
"

which led to a crash:
"
0x00007c474ceb979f (libc.so.6 -pthread_kill.c:44)               ??__pthread_kill_implementation
0x00007c474ce6d92c (libc.so.6 -raise.c:26)                      ??raise
0x00007c474ce584aa (libc.so.6 -abort.c:79)                      ??abort
0x00007c474d72b269 (libglib-2.0.so.0 -gtestutils.c:3450)        ??g_assertion_message
0x00007c474d72b2e3 (libglib-2.0.so.0 -gtestutils.c:3476)        ??g_assertion_message_expr
0x00005979074b4b6a (ModemManager -mm-broadband-modem.c)         enable
0x00005979074e3b9c (ModemManager -mm-iface-modem.c:2340)        handle_enable_auth_ready
0x00007c474d591997 (libgio-2.0.so.0 -gtask.c:1309)              g_task_return_now
0x00007c474d590555 (libgio-2.0.so.0 -gtask.c:1378)              g_task_return
0x00005979074a57bd (ModemManager -mm-base-modem.c:2011)         lock_after_authorize_ready
0x00007c474d591997 (libgio-2.0.so.0 -gtask.c:1309)              g_task_return_now
0x00007c474d590555 (libgio-2.0.so.0 -gtask.c:1378)              g_task_return
0x00005979074a3fa8 (ModemManager -mm-base-modem.c:1841)         base_modem_operation_run
...
"

Signed-off-by: Rukun Mao <rmao@google.com>
2025-06-26 20:24:16 +00:00
Kirill Buksha e8d781ae0b cinterion: allow missing LTE-TDD bands in SCFG response
Some modems (at least ELS62-E) doesn't support TDD LTE bands and their SCFG
responses doesn't contain LTE-TDD bands.

Signed-off-by: Kirill Buksha <kirbuk200@gmail.com>
2025-06-25 07:55:40 -05:00
Aleksander Morgado a24b60e52e fibocom: setup several +SIM URCs as hotplug event indications
Treat the following URCs as indications of possible SIM hot swap
events:
  +SIM: Inserted
  +SIM: Removed
  +SIM DROP

Any time any of these is received, a SIM hot swap event is reported,
and the logic can then determine what to do. These should lead to
doing nothing if they happen as part of a controlled SIM slot switch.

Signed-off-by: Aleksander Morgado <aleksandermj@google.com>
2025-06-18 22:10:54 +00:00
Aleksander Morgado 7d4784ed28 iface-modem: ignore SIM events during a controlled SIM slot switch
If there is an ongoing SIM slot switch, we must ignore all SIM hotswap
related events happening during the process. The flag that is set in
the Modem interface private info to track this is never reset back to
FALSE on a successful SIM slot switch, it will be set for as long as
the modem object exists.

After the successful SIM slot switch, a new modem reprobe will be
requested, which leads to the old modem object to be disposed (the one
that had the flag set) and a new modem object created.

The logic that already existed in the MBIM modem object is now
generalized in the Modem interface itself so that SIM events reported
via other protocols are also properly ignored.

Signed-off-by: Aleksander Morgado <aleksandermj@google.com>
2025-06-18 22:10:54 +00:00
biemster c30052ffc9 iface-modem: disable unsolicited 3GPP events during quick suspend/resume
This introduces the "terse" mode during quick suspend/resume, right now
it is used by 3GPP interface to disable unsolicited events, but in
future it can be used by other interfaces as well.

This prevents device to wake-up from suspend for each unsolicited while
still allowing to wake up on calls or SMS messages.

Signed-off-by: biemster <biemster@gmail.com>
Signed-off-by: Bhushan Shah <bshah@kde.org>
2025-06-16 08:34:57 -05:00
Dan Williams 7029cdba3e base-manager: rename manager/device shutdown to manager/device cleanup
In preparation for a "terse" mode, but also because "shutdown" was
kind of weird since we're not always shutting the modem down; sometimes
we're just putting it in low-power mode.

Signed-off-by: Dan Williams <dan@ioncontrol.co>
2025-06-16 08:30:30 -05:00
Guido Günther aa9447c833 tests: Allow to run some tests under asan
Signed-off-by: Guido Günther <agx@sigxcpu.org>
2025-06-14 16:10:05 -05:00
Guido Günther 04229ca146 modem-helpers: Don't leak in tests
Signed-off-by: Guido Günther <agx@sigxcpu.org>
2025-06-14 16:10:05 -05:00
Guido Günther fc762626ab modem-helpers: Don't leak str when parsing cscb response
We currently overwrite the value without freeing it.

Fixes: d8135be6e ("modem-helpers: Add helpers to parse channel lists")

Signed-off-by: Guido Günther <agx@sigxcpu.org>
2025-06-14 16:10:05 -05:00
Guido Günther 8553dc3623 modem-helpers: Don't leak strings when parsing DTMF response
`g_ptr_array_new()` creates an array without a free func,
this means we'd leak the strings when the reference count
drops to 0.

Fixes: 56fe8e7d3 ("modem-helpers: add utility function to split DTMF runs")

Signed-off-by: Guido Günther <agx@sigxcpu.org>
2025-06-14 16:10:05 -05:00
Maciej S. Szmigiero 0d29f6dfa5 intel: XMM7360: Allow re-trying the first RPC init command command once
It seems that the very first XMM7360 RPC init command often times out after
resuming the laptop from s2idle for unknown reasons.
This makes the modem unusable in such situation until the next sleep/resume
cycle.

Re-trying this RPC command allows the modem to initialize normally.

It's possible that this is a kernel iosm driver or modem firmware issue
but considering that the kernel driver seems orphaned by Intel and one
can't really expect much firmware support for this modem either let's do
the easiest thing and simply allow retrying (once) the very first RPC init
command if it fails or times out.

Signed-off-by: Maciej S. Szmigiero <mail@maciej.szmigiero.name>
2025-06-14 16:02:23 -05:00
Maciej S. Szmigiero 4c319181e2 shared-xmm: Properly stop GPS if it was running on modem init
With the recent addition of serial port scheduler it often happens that
NMEA traces are mistaken for command responses at init time if GPS was left
enabled in the modem.

For this reason, the proper NMEA packet parser needs to be enabled early
at modem init before the code ensures that GPS is stopped (if it is not
supposed to be running of course).

Since this modem disables GPS asynchronously with processing of the
+XLSRSTOP AT command the full GPS stop machinery has be used to reliably
achieve that GPS engine stop.

It's also important to flush the existing serial port data after attaching
the NMEA packet parser but before issuing that stop AT command, otherwise
command processor for the stop command can also be confused by the existing
queued data.

Signed-off-by: Maciej S. Szmigiero <mail@maciej.szmigiero.name>
2025-06-14 16:02:23 -05:00
Maciej S. Szmigiero adb6dc9b44 port-serial: add flush operation
Add a serial port flush operation which can be used to discard either
serial port data received but not read, or serial port written but not
transmitted, or both types of data.

Signed-off-by: Maciej S. Szmigiero <mail@maciej.szmigiero.name>
2025-06-14 16:02:23 -05:00
Maciej S. Szmigiero 0787d04a39 intel: XMM7360: Better NMEA packets parsing
XMM7360 modem NMEA trace packets are wrapped to look like AT command
responses (with "<CR><LF><CR><LF>OK<CR><LF>" at the end).
This wrapping causes problems if a genuine AT command was just sent and
ModemManager is expecting a similarly formatted response to it.

In such case the NMEA trace packet is taken as the response to the AT
command, which usually causes the command to fail due to response parsing
failure.

Fix this by implementing a custom NMEA trace packets parser for these
modems.

Signed-off-by: Maciej S. Szmigiero <mail@maciej.szmigiero.name>
2025-06-14 16:02:23 -05:00
Maciej S. Szmigiero 6c4b90de79 intel: XMM7360: Print raw serial port data when it is actually sent/dispatched
With serial port interlocking just queuing serial port data does not mean
it will be immediately sent - the other serial port could be still busy.

For debugging serial port issues it is often necessary to see the exact
moment the data was sent or received.

Implement debug_log method for MMPortSerialXmmrpcXmm7360 and log raw serial
port data there (just as MMPortSerialAt does) instead of doing this in the
command queuing function.
The debug_log method is called by MMPortSerial base when the data is about
to be actually sent to the serial port.

Additionally, log command response body where it is actually returned to
higher layers rather than in the unsolicited response handler.

Signed-off-by: Maciej S. Szmigiero <mail@maciej.szmigiero.name>
2025-06-14 16:02:23 -05:00
Maciej S. Szmigiero 912e857831 shared-xmm: keep GPS port open if GPS is enabled
We need to keep GPS port open if would not be kept open otherwise (like
it is the case with a locked/non-enabled modem).

Otherwise:
* While GPS can be enabled in that modem state the traces don't reach MM
API consumers since nothing is servicing the serial port.

* Once modem actually gets enabled the queued GPS output in the modem
serial port floods the main port and often confuses the init sequence.

We also have to make sure that we don't stop GPS during the init sequence
if it is supposed to be running, otherwise there will be the same
issue as commit d3a2aebf16 ("mbm: don't stop GPS interface on
reinitialization if it should be running") fixed for mbm.

Signed-off-by: Maciej S. Szmigiero <mail@maciej.szmigiero.name>
2025-06-14 16:02:23 -05:00
Maciej S. Szmigiero a83a9bf437 intel: XMM7360: Re-enable location interface
Seems to work just fine once the port interlocking is being done
and some other fixes are made in the next commit.

Signed-off-by: Maciej S. Szmigiero <mail@maciej.szmigiero.name>
2025-06-14 16:02:23 -05:00
Maciej S. Szmigiero 5059b812fc intel: XMM7360: RPC and AT port interlocking
We have to avoid sending RPC and AT commands at the same time (even thought
they are sent via different serial ports) since apparently this modems does
not like it.

It also looks like this modem does not like to receive a RPC command soon
after an AT one, since such RPC commands sometimes fail to generate any
response.

Prevent this problem by delaying a RPC command if there was an AT command
completed recently.

The sufficient time gap was determined experimentally, but 300 ms seems to
be enough.

RPC commands are relatively rare so this should not be a performance issue.
Otherwise we often never get any response to RPC calls if AT command
happens to be sent at the same time.

Signed-off-by: Maciej S. Szmigiero <mail@maciej.szmigiero.name>
2025-06-14 16:02:23 -05:00
Maciej S. Szmigiero df9f2d0de5 intel: XMM7360: Make compatible with recent binding changes
Commit ec5104c9a8 ("Move log parent and connection property binding
to helper") made it obligatory for MM_TYPE_BASE_BEARER and MM_TYPE_BASE_SIM
derived classes to specify MM_BIND_TO property, but recently merged XMM7360
support wasn't converted before being merged.

This caused XMM7360 to fail to set-up SIM D-Bus object and mmcli to throw
assertions when trying to access that non-existing SIM object.

Add the missing XMM7360 MM_BIND_TO properties.

Signed-off-by: Maciej S. Szmigiero <mail@maciej.szmigiero.name>
2025-06-14 16:02:23 -05:00
Dan Williams ad23d5f22c simtech: report call audio properties if audio settings are supported
Suggested by David Timber.

Fixes: https://gitlab.freedesktop.org/mobile-broadband/ModemManager/-/issues/996

Signed-off-by: Dan Williams <dan@ioncontrol.co>
2025-06-14 15:39:43 -05:00
Dan Williams 5d663976ea voice: fix setting call audio format
MM should be updating the call audio format and port on ongoing/active
calls, not terminated ones.

Signed-off-by: Dan Williams <dan@ioncontrol.co>
2025-06-14 15:39:43 -05:00
Guido Günther 5ecf00aaf0 cbm: Don't leak cbm-part in tests
Signed-off-by: Guido Günther <agx@sigxcpu.org>
2025-06-14 15:27:08 -05:00
Guido Günther c89266facb cbm: Don't check language past free
Fixes: 3559f606d ("cbm-part: Fix parsing of language encodings")

Signed-off-by: Guido Günther <agx@sigxcpu.org>
2025-06-14 15:27:08 -05:00
Guido Günther 061bc1ff2d intel: Use correct format specifier
The arguments are `gsize` and otherwise emit warnings on e.g. i386

Fixes 4cae04064 ("intel: implement support for RPC-powered xmm7360")

Signed-off-by: Guido Günther <agx@sigxcpu.org>
2025-06-14 15:27:08 -05:00
Slark Xiao 41f82a4d33 dell: update the foxconn mbim interface
Keep the mm_broadband_modem_mbim_foxconn_new() align with the
new changes in src/plugins/foxconn.

Signed-off-by: Slark Xiao <slark_xiao@163.com>
2025-06-14 15:23:33 -05:00
Slark Xiao bf5458acdd foxconn: add subsystem ID support for T99W696
T99W696 is the first Foxconn PCIE modem whick uses Qualcomm's VID/
PID. Driver ref: https://lore.kernel.org/mhi/20250528092232.16111-1-slark_xiao@163.com

This changes include 2 parts:
i:  Add device for foxconn plugin
ii: Show SSVID/SSPID for parameter "--firmware-status". This helps
    the fwupd get the right firmware upgrade method.

Signed-off-by: Slark Xiao <slark_xiao@163.com>
2025-06-14 15:23:33 -05:00
Florian Eckert 6a2cb8dd8e mm-port-probe-at: also check for MM_SERIAL_ERROR_SEND_TIMEOUT
Check here for the new error 'MM_SERIAL_ERROR_SEND_TIMEOUT'.

Signed-off-by: Florian Eckert <fe@dev.tdt.de>
2025-06-02 08:43:45 -05:00
Florian Eckert 44b9f74301 mm-port-serial: add new MM_SERIAL_ERROR_SEND_TIMEOUT
This new error code 'MM_SERIAL_ERROR_SEND_TIMEOUT' is used to make it easier
to distinguish why the transmission failed. Until now,
'MM_SERIAL_ERROR_SEND_FAILED' was always returned. This new error code is now
returned for an 'EAGAIN', as this is more likely to be a TIMEOUT.

This makes debugging easier, as a better error analysis is now possible.

Signed-off-by: Florian Eckert <fe@dev.tdt.de>
2025-06-02 08:43:45 -05:00
Dan Williams dad2d49b69 tests: test call DTMF functionality
Signed-off-by: Dan Williams <dan@ioncontrol.co>
2025-05-30 08:06:11 -05:00
Dan Williams ae3d37030a base-call: handle multiple DTMF characters
Send each character through the state machine one at a time. Some
modems (various Quectel ones for example) can process multiple at
the same time, and while that should be easily implemented using
the new changes to send_dtmf() it's not done in any plugin yet.

Signed-off-by: Dan Williams <dan@ioncontrol.co>
2025-05-30 08:02:48 -05:00
Dan Williams 56fe8e7d31 modem-helpers: add utility function to split DTMF runs
Split into groups of non-pause characters and single pause characters
by themselves and return as an array of strings.

Signed-off-by: Dan Williams <dan@ioncontrol.co>
2025-05-30 08:02:47 -05:00
Dan Williams 957a141e57 base-call: interpret DTMF character ',' as two-second pause
Do what other dialers do and interpret ',' as a short pause, which
helps handle automated menus.

Signed-off-by: Dan Williams <dan@ioncontrol.co>
2025-05-30 07:59:59 -05:00
Dan Williams 2726f8e8a2 base-call: convert DTMF tone handling to a state machine
Generalize the timeout/stop logic that QMI requires into the
base call. We'll use this to implement the pause character (,)
generically.

Signed-off-by: Dan Williams <dan@ioncontrol.co>
2025-05-30 07:59:59 -05:00
Dan Williams 5448a85a2b call: allow setting DTMF tone duration at call creation time
Instead of hard-coding a 500ms DTMF tone duration, let applications
use a specific duration at call setup time.

Signed-off-by: Dan Williams <dan@ioncontrol.co>
2025-05-30 07:59:58 -05:00
Dan Williams 28b1954654 call-list: remove unused modem property
Signed-off-by: Dan Williams <dan@ioncontrol.co>
2025-05-30 07:57:50 -05:00
Dan Williams b9c49c7b4d base-call: remove usage of MMBaseModem
Split out the things we actually use from MMBaseModem into
separate properties that can be independently implemented
(or just left NULL) for unit tests.

Signed-off-by: Dan Williams <dan@ioncontrol.co>
2025-05-30 07:57:50 -05:00
Dan Williams 8392f30388 base-call: split AT-specific call code into MMCallAt
Signed-off-by: Dan Williams <dan@ioncontrol.co>
2025-05-30 07:57:50 -05:00
Maciej S. Szmigiero 7d410387cf port-scheduler: implement LOG_OBJECT interface and add scheduler logging
Otherwise log functions crash.

Signed-off-by: Maciej S. Szmigiero <mail@maciej.szmigiero.name>
2025-05-23 18:46:53 -05:00
Dan Williams a769bbed6d port-serial: add serial port command scheduler
Add an interface and implementation for a port scheduler that round-
robins between ports the scheduler is attached to, serializing command
execution among one or more MMPortSerial instances.

Theory of operation:

Sources (e.g. MMPort subclasses) register themselves with the scheduler.

Each source notifies the scheduler whenever its command queue depth changes,
for example when new commands are submitted, when commands are completed,
or when commands are canceled.

The scheduler will round-robin between all sources with pending commands,
sleeping when there are no pending commands from any source.

For each source with a pending command the scheduler will emit the
'send-command' signal with that source's ID. The given source should
send the next command in its queue to the modem.

When that command is finished (either successfully or with an error/timeout)
the source must call mm_port_scheduler_notify_command_done() to notify the
scheduler that it may advance to the next source with a pending command, if
any. If the 'send-command' signal and the notify_command_done() call are not
balanced the scheduler may stall.

Signed-off-by: Dan Williams <dan@ioncontrol.co>
2025-05-23 18:46:53 -05:00
Dan Williams b24615d801 log-object: don't construct log ID with NULL self_id
If the object has an owner ID already but doesn't yet have enough
information to build its log ID, don't cache a less-than-useful
log ID string for it.

Signed-off-by: Dan Williams <dan@ioncontrol.co>
2025-05-23 18:46:32 -05:00
Maciej S. Szmigiero 42ead88266 log-object: Add possibility to reset logger id
Logger id (the one generated from build_id interface method and owner_id
property) is generated and cached the first time it is required, further
uses just return the cached value.

Add a cache reset method so if the interface implementer knows that its
logger id could have changed it could force its re-generation.

Signed-off-by: Maciej S. Szmigiero <mail@maciej.szmigiero.name>
2025-05-23 18:46:32 -05:00