Commit Graph
9379 Commits
Author SHA1 Message Date
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
Dan Williams 38417c6520 Merge request !1280 from 'intel-rpc-xmm7360'
intel: XMM7360: unlocking/enabling RPC timeout fix and location support

https://gitlab.freedesktop.org/mobile-broadband/ModemManager/-/merge_requests/1280
2025-06-14 16:09:43 -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
Maciej S. Szmigiero f9146378b8 .gitignore: ignore clangd cache directory
Signed-off-by: Maciej S. Szmigiero <mail@maciej.szmigiero.name>
2025-06-14 16:02:23 -05:00
Dan Williams 93a63c85ea Merge request !1368 from 'simtech-audio-format-dbus'
Fix setting call audio format and add Simtech audio properties support

https://gitlab.freedesktop.org/mobile-broadband/ModemManager/-/merge_requests/1368

Closes #996
2025-06-14 15:51:50 -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
Dan Williams e55dde034b Merge request !1372 from '32bit'
Fix 32bit format specifiers and don't run tests on free'd cbm part

https://gitlab.freedesktop.org/mobile-broadband/ModemManager/-/merge_requests/1372
2025-06-14 15:31:19 -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
Dan Williams 1bc3db766b Merge request !1369 from 'main'
foxconn: add subsystem ID support for T99W696

https://gitlab.freedesktop.org/mobile-broadband/ModemManager/-/merge_requests/1369
2025-06-14 15:26:43 -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
Guido Günther 8486641f92 Merge request !1371 from 'rel-1.25.1'
build: Bump minimum libqmi dependency and release 1.25.1

https://gitlab.freedesktop.org/mobile-broadband/ModemManager/-/merge_requests/1371
2025-06-04 09:26:37 +00:00
Guido Günther e88e481ca3 build: Bump version to 1.25.1
Signed-off-by: Guido Günther <agx@sigxcpu.org>
2025-06-04 10:01:08 +02:00
Guido Günther 32f7e3ec09 build: Bump minimum libqmi dependency to 1.37.1
Signed-off-by: Guido Günther <agx@sigxcpu.org>
2025-06-04 10:01:08 +02:00
Dan Williams cf7d037ed3 Merge request !1366 from 'mr/20250530-timeout'
mm-port-serial: add new MM_SERIAL_ERROR_SEND_TIMEOUT

https://gitlab.freedesktop.org/mobile-broadband/ModemManager/-/merge_requests/1366
2025-06-02 08:46:40 -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 37f17d4b58 Merge request !1336 from 'dtmf-serialize'
Serialize DTMF requests and allow setting DTMF duration at call creation time

https://gitlab.freedesktop.org/mobile-broadband/ModemManager/-/merge_requests/1336

Closes #970
2025-05-30 18:54:05 -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
Dan Williams 3ed7f37876 Merge request !1290 from 'port-scheduler'
port-serial: add command scheduler infrastructure and use it

https://gitlab.freedesktop.org/mobile-broadband/ModemManager/-/merge_requests/1290
2025-05-23 18:58:30 -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
Dan Williams 39f4cf77f2 Merge request !1361 from 'cbm-lang'
Parse CBM's language when available and export it on DBus

https://gitlab.freedesktop.org/mobile-broadband/ModemManager/-/merge_requests/1361
2025-05-23 14:22:50 -05:00
Guido Günther 87aaebcec0 cli/cbm: Show CBMs language when available
Signed-off-by: Guido Günther <agx@sigxcpu.org>
2025-05-23 14:15:14 -05:00
Guido Günther 68d241b5aa mmcbmmonitor: Print language when available
Signed-off-by: Guido Günther <agx@sigxcpu.org>
2025-05-23 14:15:14 -05:00
Guido Günther 9625c81d39 mm-glib/cbm: Allow to get language
Signed-off-by: Guido Günther <agx@sigxcpu.org>
2025-05-23 14:15:14 -05:00