Commit Graph
5201 Commits
Author SHA1 Message Date
Dan Williams dc3a7f0d3b broadband-modem: detect old Mediatek 62xx chipsets as GSM-capable
They don't necessarily reply to +WS46 but like old Motorola ESX
devices they reply to +CGMM with a known string.

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

Signed-off-by: Dan Williams <dan@ioncontrol.co>
(cherry picked from commit 8cf25a97a1)
2025-05-08 16:07:58 -05:00
Dan Williams 9f0db52ed0 iface-modem-voice: recheck call state polling when call is started
When an outgoing call is created and added to the call list its state
is UNKNOWN. The call list emits the ADDED signal which MMIfaceModemVoice
listens for to check whether to begin polling call state.

But since UNKNOWN is not an in-progress call state polling isn't started.
And nothing was rechecking whether to start polling when the call state
changed to something other than UNKNOWN.

Do that so that we can track call progress as it dials out and is
answered.

Signed-off-by: Dan Williams <dan@ioncontrol.co>
(cherry picked from commit 92e666e1c9)
2025-05-08 16:07:39 -05:00
Dan Williams 240a9145ad modem-helpers-cinterion: allow spaces in ^SXRAT test response
^SXRAT: (0-6), (0,2,3), (0,2,3)

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

Signed-off-by: Dan Williams <dan@ioncontrol.co>
(cherry picked from commit 6b6997362b)
2025-05-08 16:07:33 -05:00
Dan Williams 018e440848 shared-fibocom: don't assume parent implements the firmware interface
MMBroadbandModemMbimMtkFibocom doesn't, so don't assert it.

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

Signed-off-by: Dan Williams <dan@ioncontrol.co>
(cherry picked from commit 046b79a676)
2025-05-08 16:07:22 -05:00
Dan Williams 0c7d573969 modem-helpers: fix checking of CDMA/EVDO access technology
Missing ! for strncmp() meant the test was backwards and would
erroneously report 1xRTT and EVDOr0 when those access technologies
were not in use.

Signed-off-by: Dan Williams <dan@ioncontrol.co>
(cherry picked from commit 9e205f4784)
2025-05-08 16:07:11 -05:00
Dan Williams dae00a9f2f broadband-modem: close serial ports in dispose
We want ports to be closed as early as possible; so make sure they
are closed in dispose() which is run explicitly by MMDevice when
cleaning up and removing the modem. Otherwise they could stay
open longer than we want, causing problems for suspend/resume.

This caused problems with suspend because cancelling the
MMBaseModem's cancellable triggered an idle handler that held
a reference to the modem, preventing finalize() from running
until after the suspend code was finished, thus preventing
ports from being closed and cleaned up. Closing them in
dispose() handles this.

Signed-off-by: Dan Williams <dan@ioncontrol.co>
2025-05-08 15:44:36 -05:00
Dan Williams 3157a90c5b broadband-modem: remove invalid idle handler during dispose
base_modem_invalid_idle() needs to keep a reference to the
MMBaseModem until its done. But if the modem is cancelled during
removal right before we're trying to forget about it, keeping
that reference can prevent everything getting cleaned up by
MMBaseModem's dispose() until after the mainloop has run again
and all our removal operations are supposedly complete.

MMDevice uses an explicit dispose() trigger that mitigates
most of this (and requires it for other reasons, like breaking
reference cycles between the modem and it's various child
classes) but it's somewhat error-prone to keep the modem
around if we don't really need to.

Signed-off-by: Dan Williams <dan@ioncontrol.co>
2025-05-08 15:44:36 -05:00
Dan Williams 34148f8e8b broadband-modem-qmi,mbim: remove redundant port closes
This will just be done immediately after by MMBaseModem's
dispose() handler.

Signed-off-by: Dan Williams <dan@ioncontrol.co>
2025-05-08 15:44:36 -05:00
Dan Williams c146dd6094 base-manager: convert shutdown to steps
Make the call flow clearer.

Signed-off-by: Dan Williams <dan@ioncontrol.co>
2025-05-08 15:44:36 -05:00
Dan Williams d80f98da01 base-manager,device: consolidate modem cancelling into mm_device_remove_modem()
Every use of mm_device_remove_modem() was already trying to cancel the
modem's canellable, so let's just put it there and simplify the callers.

Signed-off-by: Dan Williams <dan@ioncontrol.co>
2025-05-08 15:44:36 -05:00
Dan Williams b97f864acd base-manager,sleep-monitor: wait for modem operations before sleeping
Signed-off-by: Dan Williams <dan@ioncontrol.co>
2025-05-08 15:44:36 -05:00
Dan Williams 5e29ece5ec base-modem: clarify port cleanup/close behavior for serial ports
Signed-off-by: Dan Williams <dan@ioncontrol.co>
2025-05-08 15:44:36 -05:00
Dan Williams e12b3adb35 base-modem: allow port teardown operation to use callbacks if needed
Signed-off-by: Dan Williams <dan@ioncontrol.co>
2025-05-08 15:44:36 -05:00
Dan Williams 649350dfff port-serial: don't log force-closes if not really being forced close
Signed-off-by: Dan Williams <dan@ioncontrol.co>
2025-05-08 15:44:36 -05:00
Dan Williams f5ae14d0b2 modem-helpers-qmi: better handle no supported modes
Dell Snapdragon X62 before FCC Unlock reports no radio interfaces
from QMI and no device capabilities from MBIM. Instead of asserting
in mm_filter_supported_modes() when called from
mm_supported_modes_from_qmi_supported_modes_context() gracefully
handle the lack of supported modes.

Signed-off-by: Dan Williams <dan@ioncontrol.co>
2025-04-09 13:19:50 +00:00
Dan Williams 2246e9c0a0 modem-helpers-qmi: fix deprecated usage of QMI_NAS_NETWORK_SERVICE_DOMAIN_UNKNOWN
Signed-off-by: Dan Williams <dan@ioncontrol.co>
2025-04-08 20:48:18 -05:00
Dan Williams ceb1cd9a99 tests: add tests for mm_signal_from_mbim_signal_state()
Signed-off-by: Dan Williams <dan@ioncontrol.co>
2025-04-03 15:33:45 -05:00
Dan Williams a420972e9b broadband-modem-mbim: consolidate determination of data class
Do it in a function instead of the same thing in a bunch of places.

Signed-off-by: Dan Williams <dan@ioncontrol.co>
2025-04-01 10:25:43 -05:00
Dan Williams 19c817cfe9 broadband-modem-mbim: consistently handle custom data classes
Consistently interpret the modem's reported custom data class when
loading current mode, supported mode, supported capabilities,
setting current mode, and current access technology.

Normalize the data class to include any custom data class immediately
after reading it from any MBIM message. De-normalize it when sending
back to the modem when setting current modes so the modem receives
MBIM_DATA_CLASS_CUSTOM for the custom mode.

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

Signed-off-by: Dan Williams <dan@ioncontrol.co>
2025-04-01 10:25:43 -05:00
Guido Günther b83df955fa modem: Load current channels on startup
Signed-off-by: Guido Günther <agx@sigxcpu.org>
2025-03-28 20:53:52 +00:00
Guido Günther 2878833f5c modem: Allow to set current channel list
This adds support for setting the channels to override the boot up modem
defaults:

```
  busctl --system call org.freedesktop.ModemManager1 /org/freedesktop/ModemManager1/Modem/0 org.freedesktop.ModemManager1.Modem.CellBroadcast SetChannels 'a(uu)' 1 0 9999
  busctl --system get-property org.freedesktop.ModemManager1 /org/freedesktop/ModemManager1/Modem/0 org.freedesktop.ModemManager1.Modem.CellBroadcast Channels
  a(uu) 1 0 9999
```

Closes: https://gitlab.freedesktop.org/mobile-broadband/ModemManager/-/issues/934

Signed-off-by: Guido Günther <agx@sigxcpu.org>
2025-03-28 20:53:52 +00:00
Guido Günther d8135be6e2 modem-helpers: Add helpers to parse channel lists
`CSCB` has the form

```
CSCB: [0|1],"<channel-list>","<data-coding-scheme>"
```

If the first parameter is `0` this specifies the accepted types if `1`
it specifies rejected.

So far seen in the wild were CSCB strings with accepted types only and a
coding scheme of "" so this is what we handle for the moment.

Signed-off-by: Guido Günther <agx@sigxcpu.org>
2025-03-28 20:53:52 +00:00
Dan Williams bad4765581 broadband-modem: detect modem modes with +CEREG and +C5GREG
Some AT-based modems like the Quectel Unisoc-based RM500U don't
support the older AT commands we used to detect modes like
AT*CNTI=2 and AT+WS46. Add support for detecting 4G and 5G
with generic commands too.

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

Signed-off-by: Dan Williams <dan@ioncontrol.co>
2025-03-27 23:51:17 +00:00
Dan Williams cc93b11db7 telit: use generic early AT port probe logic
Use the new early port probe logic to do AT probes before the custom
init hook actually starts.

Signed-off-by: Dan Williams <dan@ioncontrol.co>
2025-03-27 18:40:38 -05:00
Dan Williams 7d75a897a8 port-probe: allow per-port ID_MM_TTY_AT_PROBE_TRIES tag for custom number of AT probes
For modems that need more time to respond to AT port probes (like some Telit devices,
and Cinterion-based Telit MV31/MV32) allow a custom number of AT probe tries on a
per-port basis for generic probing, or plugins that opt into this functionality.

Signed-off-by: Dan Williams <dan@ioncontrol.co>
2025-03-27 18:40:38 -05:00
Dan Williams 57d1f21b36 broadband-modem,iface-modem: don't treat SIM unlocks as hot-swaps
If the old IMSI was unavailable because the SIM was locked, but now
is available because the SIM was unlocked, don't treat the SIM
properties change as a hotswap that may trigger dropping and re-probing
the modem.

Signed-off-by: Dan Williams <dan@ioncontrol.co>
2025-03-23 09:04:42 -05:00
Guido Günther 68933455df treewide: Fix typos
Signed-off-by: Guido Günther <agx@sigxcpu.org>
2025-03-11 23:15:57 +01:00
Dan Williams 89466b583b port-probe: ensure port is open for all plugin AT probes
If multiple plugins are selected for probing a modem with AT probes,
earlier plugins may only request some probes but not all.  When
those probes complete successfully, subsequent plugins won't re-do
the probes that were already completed, but jump to ones that
haven't yet been done.

For example, plugin A may request only AT probes but plugin B
may request AT, AT_PRODUCT, and AT_VENDOR. Plugin B will start
with AT_PRODUCT probes because plugin A already completed the AT
probe.

The code in probe_step() only opened the serial port for the
AT probe, I guess assuming that all AT-type probes would be
done in sequence. But in the above scenario they are not.

Instead, make sure the port is opened for all AT style probes
that have not yet been executed.

Fixes: 7937a89a37 port-probe: rework and consolidate port probe flow for AT/QCDM/QMI/MBIM

Signed-off-by: Dan Williams <dan@ioncontrol.co>
2025-03-09 14:44:23 +00:00
Dan Williams f014f3843e broadband-modem,cli: slightly bump 3GPP scan timeout; add some cli dbus timeout slack
Add some mmcli D-Bus timeout slack, making them slightly higher than the
ModemManager internal timeout, to ensure the cli doesn't time out the
D-Bus call when MM succeeds.

For 3GPP scan, some modems appear to have internal 5 minute timeouts,
so ensure MM doesn't time out right before the modem returns results:

ModemManager[282578]: <dbg> [1741054422.321400] [ttyUSB2/at] --> 'AT+COPS=?<CR>'
ModemManager[282578]: <wrn> [1741054722.247806] [modem1] failed scanning networks: Serial command timed out
ModemManager[282578]: <dbg> [1741054724.119770] [ttyUSB2/at] <-- '<CR><LF>+COPS: (1,"T-Mobile","T-Mobile","310260",0),,(0,1,2,3,4),(0,1,2)<CR><LF><CR><LF>OK<CR><LF>'

Signed-off-by: Dan Williams <dan@ioncontrol.co>
2025-03-06 04:52:50 +00:00
Guido Günther 54dcc25d8b treewide: Fix some spelling errors
All in debug messages or code comments so not user / client visible.

Signed-off-by: Guido Günther <agx@sigxcpu.org>
2025-03-05 16:53:26 +00:00
Guido Günther db37e063f8 mbim: Fix typo in error message
Signed-off-by: Guido Günther <agx@sigxcpu.org>
2025-03-05 16:53:26 +00:00
Robert Marko f72dd493e8 broadband-modem-qmi: implement UE mode get/set
Instead of relying on getting/setting the UE mode via AT +CEMODE command
which on Quectel RM520N (And I assume other QMI based modems) only allows
getting the value and not setting one it has special AT commands for CS/PS
and voice/data centric values.

So lets instead use the QMI Get/Set System Selection Preference TLV which
offers service domain and usage domain preference info so we can use those
to get/set the 3GPP TS 24.301 UE mode values.

Signed-off-by: Robert Marko <robert.marko@sartura.hr>
2025-03-03 10:46:13 +01:00
Akula Susmitha bf5245bb27 messaging: load default storage from modem during initialization
Signed-off-by: Akula Susmitha <quic_asusmith@quicinc.com>
2025-02-27 15:04:59 +00:00
Sushrut Shree Trivedi 9c63f0acb0 iface-modem-firmware: report new ID's based on PCI SSVID/SSPID
Add new device ID based on PCI SSVID/SSPID to enable
FW download based on the same.

Signed-off-by: Sushrut Shree Trivedi <quic_sushruts@quicinc.com>
2025-02-25 18:43:47 +00:00
Michał Sułek 3966e1c019 Fixed code formatting 2025-02-24 17:35:47 +01:00
Michał Sułek 602808c0eb Setup variable declared after function call, fixed. 2025-02-24 16:18:55 +00:00
Michał Sułek 60bc733004 Was not compiling due to setup being undefined in call_audio_channel_set 2025-02-24 16:18:55 +00:00
Michał Sułek 9477469db4 Dan Williams changed g_usleep to g_timeout_add 2025-02-24 16:18:55 +00:00
Michał Sułek 31e486d672 Fixed the bug regarding SIM7600 modem family that made USB audio to not turn on.
Added the support for 16kHz sample rate for simtech modems and set it as default if available.
2025-02-24 16:18:55 +00:00
Akula Susmitha 0d6c9279d3 iface-modem-messaging: Validate supported storages
Check for supported storages before setting default storage.

Signed-off-by: Akula Susmitha <quic_asusmith@quicinc.com>
2025-02-24 14:02:02 +00:00
Aleksander Morgado 781428ddcd iface-modem-firmware: common logic to check for sahara/firehose tags
The logic will exclusively look for the udev tags reporting
sahara/firehose support in the primary control port of each modem
type.
2025-02-21 14:08:50 +00:00
Aleksander Morgado 93da5e0b93 fibocom: add Sahara/Firehose support for NL668-EAU
Signed-off-by: default avatarLukas Voegl <lvoegl@tdt.de>
2025-02-21 14:08:50 +00:00
Lukas Voegl 155893ea38 broadband-modem: generic Firehose and Sahara support
Allows setting the renamed `ID_MM_QUALCOMM_FIREHOSE` and
`ID_MM_QUALCOMM_SAHARA` environment variables for all devices.

Signed-off-by: Lukas Voegl <lvoegl@tdt.de>
2025-02-21 14:08:50 +00:00
Sushrut Shree Trivedi 092439369b base-modem: add subsystem device ID property
Subsystem device ID can be used for identifying PCI modems,
so expose the property.

Signed-off-by: Sushrut Shree Trivedi <quic_sushruts@quicinc.com>
2025-02-21 10:39:29 +05:30
Sushrut Shree Trivedi 894b517dae kernel-device, generic: add subsystem device ID support
Add subsystem device ID support, that can be used in pci devices
instead of vendor/device ID customization.

Signed-off-by: Sushrut Shree Trivedi <quic_sushruts@quicinc.com>
2025-02-21 10:39:03 +05:30
Kévin L'hôpital b1e58e0f6e src: plugins: quectel: add DTMF dbus notification support
The quectel modems that are not using QMI could receive DTMF events but
no dbus notification was sent to the user space. This patch adds the
DTMF notification support to the quectel plugin.

Signed-off-by: Kévin L'hôpital <kevin.lhopital@savoirfairelinux.com>
2025-02-19 09:47:28 +01:00
Dan Williams 0a94b0138d netlink: add RTM_GETLINK support to read MAC address
Since we're also now reading responses we need to check sender
credentials to make sure we're talking to the kernel, and not
some other process spoofing netlink.

Signed-off-by: Dan Williams <dan@ioncontrol.co>
2025-02-18 21:06:19 +00:00
Aleksander Morgado ef5fe9b8d5 broadband-modem: prefer explicit return to break
Just to make it explicit that there is no more logic running
afterwards.
2025-02-03 10:21:32 +00:00
Aleksander Morgado 4ce23a9ebd broadband-modem: exit with error if enable() while in unknown state
We should not assert if the modem is flagged as invalid but an
outstanding enabling request is processed. Let's exit gracefully and
let the object get properly disposed afterwards.

   (libc.so.6 - pthread_kill.c: 44)         __pthread_kill_implementation
   (libc.so.6 - raise.c: 26)    raise
   (libc.so.6 - abort.c: 79)    abort
   (libglib-2.0.so.0 - gtestutils.c: 3450)  g_assertion_message
   (libglib-2.0.so.0 - gtestutils.c: 3476)  g_assertion_message_expr
   (ModemManager - mm-broadband-modem.c)    enable
   (ModemManager - mm-iface-modem.c: 2340)  handle_enable_auth_ready
   (libgio-2.0.so.0 - gtask.c: 1309)        g_task_return_now
   (libgio-2.0.so.0 - gtask.c: 1378)        g_task_return
   (ModemManager - mm-base-modem.c: 2011)   lock_after_authorize_ready
   (libgio-2.0.so.0 - gtask.c: 1309)        g_task_return_now
   (libgio-2.0.so.0 - gtask.c: 1378)        g_task_return
   (ModemManager - mm-base-modem.c: 1841)   base_modem_operation_run
   (ModemManager - mm-base-modem.c: 764)    state_operation_ready
   (libgio-2.0.so.0 - gtask.c: 1309)        g_task_return_now
   (libgio-2.0.so.0 - gtask.c: 1323)        complete_in_idle_cb
   (libglib-2.0.so.0 - gmain.c: 3460)       g_main_dispatch
   (libglib-2.0.so.0 - gmain.c: 4200)       g_main_context_dispatch
   (libglib-2.0.so.0 - gmain.c: 4276)       g_main_context_iterate
   (libglib-2.0.so.0 - gmain.c: 4479)       g_main_loop_run
   (ModemManager - main.c: 236) main
   (libc.so.6 - libc_start_call_main.h: 58) __libc_start_call_main
   (libc.so.6 - libc-start.c: 360)          __libc_start_main_impl
   (ModemManager + 0x000b8850)              _start
2025-02-03 10:18:19 +00:00
Daniele Palmas f6c0917a65 shared-telit: fix missing error initialization in load_revision_ready
Closes #953
2025-01-31 16:37:53 +01:00