100 Commits
Author SHA1 Message Date
Aleksander Morgado 9a2d5863eb Merge request !1455 from 'fix/inject-assistance-typo'
mm-shared-qmi: fix error message for xtra data injection timeout

https://gitlab.freedesktop.org/mobile-broadband/ModemManager/-/merge_requests/1455
2026-07-21 12:05:19 +02:00
Aleksander Morgado de4306bfda Merge request !1471 from 'aleksander/small-fixes'
libqcdm: minor fix in comment formatting

https://gitlab.freedesktop.org/mobile-broadband/ModemManager/-/merge_requests/1471
2026-07-20 20:19:15 +02:00
Aleksander Morgado 3568fb91a8 Merge request !1468 from 'aleksander/vreports3'
cinterion: fix heap double-free during GPS location disablement

https://gitlab.freedesktop.org/mobile-broadband/ModemManager/-/merge_requests/1468
2026-07-13 13:33:37 +02:00
Aleksander Morgado 8b77e71298 Merge request !1466 from 'aleksander/qcdm-vreports'
QCDM OOB read fixes

https://gitlab.freedesktop.org/mobile-broadband/ModemManager/-/merge_requests/1466
2026-07-13 11:25:58 +02:00
Aleksander Morgado 76ca77a897 Merge request !1465 from 'aleksander/vreports2'
Various use-after-free fixes

https://gitlab.freedesktop.org/mobile-broadband/ModemManager/-/merge_requests/1465
2026-07-10 15:02:49 +02:00
Aleksander Morgado 691bb4286d Merge request !1464 from 'aleksander/vreports'
Sanitize user inputs

https://gitlab.freedesktop.org/mobile-broadband/ModemManager/-/merge_requests/1464
2026-07-10 14:35:08 +02:00
Aleksander Morgado 74159e05e2 Merge request !1447 from 'fix-rolling-single-plugin-build'
rolling: fix single plugin build

https://gitlab.freedesktop.org/mobile-broadband/ModemManager/-/merge_requests/1447
2026-04-22 16:40:36 +02:00
Aleksander Morgado d111c242c9 Merge request !1436 from 'mtk_support'
Rolling: Add modifications related to the rw350-usb project

https://gitlab.freedesktop.org/mobile-broadband/ModemManager/-/merge_requests/1436
2026-04-22 12:34:56 +02:00
Aleksander Morgado fa32b5e1e9 Merge request !1445 from 'fix-qmi-wds-enum-missing'
modem-helpers-qmi: add missing QMI_WDS_PDP_TYPE_NON_IP check

https://gitlab.freedesktop.org/mobile-broadband/ModemManager/-/merge_requests/1445
2026-04-15 15:01:23 +02:00
Aleksander Morgado 8053db6cc0 Merge request !1426 from 'id-mm-typos'
api,doc: fix a typo in 'Modem.Device' documentation

https://gitlab.freedesktop.org/mobile-broadband/ModemManager/-/merge_requests/1426
2026-02-03 12:01:53 +01:00
Aleksander Morgado 66e72979a1 Merge request !1423 from 'local1'
rolling: update RW101 port type hints

https://gitlab.freedesktop.org/mobile-broadband/ModemManager/-/merge_requests/1423
2026-02-03 11:53:53 +01:00
Aleksander Morgado 1fc9059407 Merge request !1425 from 'dp/port-hints'
Port hints for various Telit modems

https://gitlab.freedesktop.org/mobile-broadband/ModemManager/-/merge_requests/1425
2026-02-03 10:58:52 +01:00
Aleksander Morgado 9d11ff4ba9 Merge request !1375 from 'aleksander/fibocom-urcs'
iface-modem: ignore SIM events during a controlled SIM slot switch

https://gitlab.freedesktop.org/mobile-broadband/ModemManager/-/merge_requests/1375
2025-06-25 00:33:29 +02:00
Aleksander Morgado bc7198df8a Merge request !1289 from 'piotrdrag/pl-update-250209'
po: update Polish translation 250209

https://gitlab.freedesktop.org/mobile-broadband/ModemManager/-/merge_requests/1289
2025-02-17 21:46:11 +00:00
Aleksander Morgado 377a124865 port-probe: explicit close port steps
If by any chance the same ports needs to go through AT and
QMI/MBIM probing, make sure the serial port created during
AT probing is closed before starting the QMI/MBIM probing.
2024-12-27 15:24:01 +00:00
Aleksander Morgado e2633b46f0 port-probe: only run custom init on ports that will go through AT probing 2024-12-27 15:24:01 +00:00
Aleksander Morgado 0744ebd1c0 port-probe: rename serial_probe->probe 2024-12-27 15:24:01 +00:00
Aleksander Morgado 3de6cca46d broadband-modem-qmi: don't build operator id in network reject indication if it's unknown 2024-11-20 12:56:57 +01:00
Aleksander Morgado b2d52001e4 broadband-modem-qmi: avoid conditional jump due to uninitialized variable in network reject indications
==3851== Conditional jump or move depends on uninitialised value(s)
==3851==    at 0x23CF65: network_reject_indication_cb (mm-broadband-modem-qmi.c:5434)
==3851==    by 0x4D00865: g_cclosure_marshal_VOID__BOXEDv (in /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0.7200.4)
==3851==    by 0x4D196FF: g_signal_emit_valist (in /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0.7200.4)
==3851==    by 0x4D19862: g_signal_emit (in /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0.7200.4)
==3851==    by 0x4F7C250: process_indication (qmi-nas.c:70290)
==3851==    by 0x4DFA6C4: __qmi_client_process_indication (qmi-client.c:172)
==3851==    by 0x4DFEE2D: process_indication_idle (qmi-device.c:1697)
==3851==    by 0x4A26C43: g_main_context_dispatch (in /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0.7200.4)
==3851==    by 0x4A7C2B7: ??? (in /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0.7200.4)
==3851==    by 0x4A262B2: g_main_loop_run (in /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0.7200.4)
==3851==    by 0x178042: main (main.c:236)

Fixes https://gitlab.freedesktop.org/mobile-broadband/ModemManager/-/issues/931
2024-11-20 12:56:48 +01:00
Aleksander Morgado edd9cc2e95 device: fix double free of the GDBusConnection
Fixes a16ad2757d
2024-10-16 23:45:22 +02:00
Aleksander Morgado a16ad2757d device: don't attempt to export if bus connection has been lost
E.g. if aborting the initialization sequence.
2024-09-30 11:07:18 +00:00
Aleksander Morgado 17929188d8 broadband-modem: update modem state before enabling task is completed
The modem state property update was happening at enabling task context
free time, after the actual task completion has happened. Due to this,
scheduling a new enable request right after finishing one would end up
with the logic asserting, as the new enable operation would be
scheduled while the modem was still reporting "enabling" state.

  ModemManager[7673]: <inf> [1722359278.131123] [modem0] processing user request to enable modem...
  **
  ERROR:../src/mm-broadband-modem.c:12487:enable: code should not be reached
  Bail out! ERROR:../src/mm-broadband-modem.c:12487:enable: code should not be reached
  Aborted
2024-09-30 07:51:53 +00:00
Aleksander Morgado c60e76bf71 plugin-manager: use autoptr to simplify methods needing a valid PortContext reference 2024-05-13 09:13:33 +00:00
Aleksander Morgado 21998a7b3e plugin-manager: ensure DeviceContext is valid during the whole cancellation procedure 2024-05-13 09:13:33 +00:00
Aleksander Morgado 040adb141a device: launch modem initialization after inhibition
The mm_device_create_modem() was updated so that it would not run the
modem initialization implicitly. Due to this change, we must ensure
the modem initialization is run after a modem inhibition operation
after we recreate the modem object.

Fixes: 04d826f563
2024-04-30 00:00:34 +02:00
Aleksander Morgado 200ff43a07 dispatcher-modem-setup: update example test script with more details 2024-04-16 13:00:12 +02:00
Aleksander Morgado e2ae9946ce base-manager: launch modem initialization also in unit tests
The new modem_initialize() method is run for both real devices (after
the modem setup phase) and also for virtual devices in unit
tests (where no modem setup phase exists).
2024-04-16 12:53:49 +02:00
Aleksander Morgado 941461a2c5 huawei: plugin sources depend on enums types 2024-04-16 11:45:51 +02:00
Aleksander Morgado 19da7559c0 base-manager: start device support check on first port addition
This avoids the "port in device added after device probing has already
finished" warning, and also the creation of modem objects for single
port devices.
2024-04-09 10:25:59 +02:00
Aleksander Morgado a03da1f3cb broadband-modem: plug leak processing SIM loading steps
==6971== 52 (16 direct, 36 indirect) bytes in 1 blocks are definitely lost in loss record 3,764 of 6,140
  ==6971==    at 0x4842839: malloc (in /usr/libexec/valgrind/vgpreload_memcheck-amd64-linux.so)
  ==6971==    by 0x4A1ADE8: g_malloc (in /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0.6800.1)
  ==6971==    by 0x4A31FF1: g_slice_alloc (in /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0.6800.1)
  ==6971==    by 0x4A3266D: g_slice_alloc0 (in /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0.6800.1)
  ==6971==    by 0x49FD397: ??? (in /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0.6800.1)
  ==6971==    by 0x49FD8B4: g_error_new_valist (in /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0.6800.1)
  ==6971==    by 0x49FDACE: g_set_error (in /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0.6800.1)
  ==6971==    by 0x187A4C: mm_base_modem_peek_best_at_port (mm-base-modem.c:1129)
  ==6971==    by 0x184116: _at_command (mm-base-modem-at.c:634)
  ==6971==    by 0x1841FE: mm_base_modem_at_command (mm-base-modem-at.c:660)
  ==6971==    by 0x18F6F1: load_sim_identifier (mm-base-sim.c:2016)
  ==6971==    by 0x18CA03: mm_base_sim_load_sim_identifier (mm-base-sim.c:820)
2023-05-17 14:07:20 +02:00
Aleksander Morgado 22c4d88a24 iface-modem-3gpp: skip interface updates if it's disabled
E.g. we don't want to update the 3GPP registration state to "idle" if
the interface has already been disabled:

   <msg> [1681814812.903723] [modem0] 3GPP registration state changed (idle -> unknown)
   <inf> [1681814812.903842] [modem0] consolidated registration state: cs 'idle', ps 'idle', eps 'idle', 5gs 'unknown' --> 'unknown'
   <dbg> [1681814812.906194] [modem0] disabling the Modem interface...
   <inf> [1681814812.911148] [modem0] disabled modem
   <dbg> [1681814812.913453] [ttyACM0/at] device open count is 0 (close)
   <dbg> [1681814812.913629] [ttyACM0/at] closing serial port...
   <dbg> [1681814812.915559] [ttyACM0/at] serial port closed
   <msg> [1681814812.916569] [modem0] state changed (disabling -> disabled)
   <dbg> [1681814868.945069] [/dev/cdc-wdm4] number of consecutive timeouts: 1
   <msg> [1681814868.950724] [modem0] 3GPP registration state changed (unknown -> idle)
   <inf> [1681814868.950885] [modem0] consolidated registration state: cs 'idle', ps 'idle', eps 'idle', 5gs 'unknown' --> 'idle'
   <msg> [1681814868.951797] [modem0] state changed (disabled -> enabled)
   <dbg> [1681814868.955740] [modem0] registration in network: cancelled
   <wrn> [1681814868.958562] [modem0] registration in network failed: Operation was cancelled
2023-05-03 12:38:43 +00:00
Aleksander Morgado e1691780f7 iface-modem-3gpp: coding style updates in initialization sequence 2023-05-03 12:38:43 +00:00
Aleksander Morgado db6b45fa10 iface-modem-3gpp: coding style changes in initial EPS bearer update logic 2023-05-03 12:38:43 +00:00
Aleksander Morgado 8198a04f1a iface-modem-simple: improve logging and cancellability in network registration sequence 2023-05-03 12:38:43 +00:00
Aleksander Morgado ef1887df05 iface-modem-3gpp: coding style updates in enabling/disabling sequences 2023-05-03 12:38:43 +00:00
Aleksander Morgado d906443eee broadband-modem: explicitly abort ongoing attempt when disabling 2023-05-03 12:38:43 +00:00
Aleksander Morgado 200f827d38 bearer-list: new common method to disconnect one or all bearers 2023-05-03 12:38:43 +00:00
Aleksander Morgado acc98e43ba iface-modem-3gpp: allow cancelling the wait for packet service state
When a request to disable the modem arrives while the packet service
state wait is ongoing we were not correctly cancelling the operation.
The main reason for this is that this operation does not change the
modem state, and so the "wait for final state" logic in the disabling
sequence was not being considered.

We solve this by plugging in the Simple.Connect() operation
cancellable in the wait for packet service state operation. The
connection attempt will be cancelled during the disabling sequence as
well, and when that happens we will explicitly halt the packet service
state wait as well.
2023-05-03 12:38:43 +00:00
Aleksander Morgado b9a7cad247 iface-modem-3gpp: minor rename of variables 2023-05-03 12:27:21 +00:00
Aleksander Morgado 9c5989f116 port-serial: close_force() may dispose the last object reference 2023-04-12 14:58:59 +02:00
Aleksander Morgado 024485e321 port-probe: don't assume port is QCDM when QCDM is not required
When QCDM is not required we don't run an explicit QCDM port probing
operation.

In this case, though, we should not assume that the port is QCDM
capable, even if it is also flagged as ignored.

Instead, we'll flag the port as QCDM capable and ignored only if there
was a udev port type hint associated to the port. Otherwise, we'll
report the port as not being QCDM capable, and the port won't even be
reported in the list of ports as its type is unknown.
2023-03-27 13:10:17 +00:00
Aleksander Morgado 7787c34af0 port-probe: minor refactor in QCDM probing 2023-03-27 12:54:46 +00:00
Aleksander Morgado a9ae995323 iface-modem-3gpp: avoid to connect signal on NULL SIM object
Happens when we boot without a SIM card inserted:

  ModemManager[12065]: <dbg> [1679912011.887410] [ttyACM2/at] --> 'AT+CLCK="PC",2<CR>'
  ModemManager[12065]: <dbg> [1679912011.905401] [ttyACM2/at] <-- '<CR><LF>+CLCK: 0<CR><LF><CR><LF>OK<CR><LF>'
  (ModemManager:12065): GLib-GObject-CRITICAL **: 12:13:31.905: invalid (NULL) pointer instance
2023-03-27 12:28:15 +00:00
Aleksander Morgado aa28fc7a9e ci: build single plugins also in main and tags 2023-01-03 17:01:00 +01:00
Aleksander Morgado ce2a2614e6 ci: list of plugins from meson configuration itself 2023-01-03 17:00:49 +01:00
Aleksander Morgado 6c6ece19c1 ci: update image with gawk and without autotools 2023-01-03 17:00:49 +01:00
Aleksander Morgado 6eae758a11 ci: fix enabling qmi/mbim/qrtr support in single-plugin tests 2023-01-03 17:00:49 +01:00
Aleksander Morgado 4a552aa362 ci: fix disabling introspection in single-plugin tests 2023-01-03 17:00:49 +01:00
Aleksander Morgado efcabb2cd6 ci: run suspend-resume build tests also in master and tags 2023-01-03 16:17:03 +01:00
Aleksander Morgado 5f3565f95a ci: use YAML anchor to setup dependencies 2023-01-03 16:12:31 +01:00
Aleksander Morgado e3dae370da ci: add tests for builtin plugins 2023-01-03 15:08:22 +01:00
Aleksander Morgado d30ba8414a plugin-manager: don't crash when loading an invalid shared utils library
<wrn> [plugin-manager] could not load shared '/usr/lib/ModemManager/libmm-shared-xmm.so': Missing major version info
  Thread 1 "ModemManager" received signal SIGSEGV, Segmentation fault.
  0x000055555562b79d in load_external_shared (path=<optimized out>, self=0x5555557b5880) at ../src/mm-plugin-manager.c:1885
  1885        if (module && !(*shared_name))
  (gdb) p module
  $1 = (GModule *) 0x5555557b9670
  (gdb) p shared_name
  $2 = (const gchar **) 0x0
2023-01-03 13:56:25 +00:00
Aleksander Morgado f562a51afb build: fix missing module name in shared option utils 2023-01-03 13:56:25 +00:00
Aleksander Morgado b3f315ad2d core,log: new 'MSG' log level between 'INFO' and 'WARN'
We're bumping the current "INFO" level messages to the new "MSG"
level, also making the new level the default.

The old "INFO" level will be used to setup an intermediate level of
logging which is not as verbose as "DEBUG" but still provides some
capabilities to analyze the behavior of a modem.
2022-11-04 13:12:56 +00:00
Aleksander Morgado 011f9b366b foxconn: carrier mapping conf file shouldn't be executable 2022-09-15 09:30:33 +02:00
Aleksander Morgado 726442b576 fibocom: source files shouldn't be executable 2022-09-15 09:30:02 +02:00
Aleksander Morgado 4a62ea3e84 broadband-modem-mbim: SIM slots ptr array should have GDestroyNotify
The SIM slots ptr array should have a proper GDestroyNotify, so that
whenever the array is unref-ed as part of the modem disposal logic,
the SIM objects (and the modem object references they keep) are also
unref-ed.

Fixes https://gitlab.freedesktop.org/mobile-broadband/ModemManager/-/issues/571
2022-08-04 17:58:55 +02:00
Aleksander Morgado 3893396e20 broadband-modem: SIM swap check should consider errors loading as no SIM
A failure loading IMSI or ICCID (unless for the UNSUPPORTED case)
could be an indication that there is no SIM.

Ideally, the logic checking if a SIM swap happened should have checked
first if there is a SIM card in the slot, and only if there is one go
on to try to load IMSI or ICCID.
2022-08-04 13:08:55 +00:00
Aleksander Morgado a32538fa32 helpers-mbim: report correct network availability from mbim bitmask
MbimProviderState is a bitset, so don't try to match exact values in a
switch statement when converting to MMModem3gppNetworkAvailability.

Fixes https://gitlab.freedesktop.org/mobile-broadband/ModemManager/-/issues/524
2022-07-25 20:43:07 +00:00
Aleksander Morgado 041f53af8b base-sms: don't clear parts on send/store error
The part generation logic is independent to whether the SMS send or
store operation failed, so just avoid doing the parts cleanup. E.g.
if we created the parts for store() but storing failed, the same parts
could still be used for send() successfully.
2022-07-24 13:14:26 +00:00
Aleksander Morgado 4aaea37022 base-sms: fix segfault when storing already sent messages
The internal list of parts in the base SMS object is created either
when the message is sent or when the message is stored.

The daemon should not expect the list of SMS parts to be empty upon a
store() operation requested via DBus, as the list of parts may have
already been created during send().

Fixes https://gitlab.freedesktop.org/mobile-broadband/ModemManager/-/issues/598
2022-07-24 13:14:26 +00:00
Aleksander Morgado 115692dd91 api,tags: fix typo in ID_MM_PORT_TYPE_AT_GPS_CONTROL doc 2022-07-16 22:22:11 +02:00
Aleksander Morgado 36d3a2c4f5 docs: add missing reference to ID_MM_PORT_TYPE_AT_GPS_CONTROL 2022-07-16 22:21:22 +02:00
Aleksander Morgado f5151fb02e po: update after source file rename 2022-07-16 22:13:04 +02:00
Aleksander Morgado 1f2bea9184 port-mbim: monitor consecutive timeouts 2022-06-30 11:15:04 +02:00
Aleksander Morgado 7a3cbfec64 port-qmi: monitor consecutive timeouts 2022-06-30 11:15:04 +02:00
Aleksander Morgado b91823012a base-modem: setup timeout monitoring in all control ports
If any of the control ports ends up timing out 10 consecutive times,
the modem will be flagged as invalid and it will be reprobed from
scratch.

This allows us to detect modems that end up irresponsive in QMI or
MBIM while they're still exposed in e.g. the USB bus.
2022-06-30 11:15:04 +02:00
Aleksander Morgado 8387629a8c port: make 'timed-out' a signal for all port types, not just serial 2022-06-30 01:08:15 +02:00
Aleksander Morgado db33a43b45 build,meson: require libqmi 1.31.7, in sync with autotools
The required libqmi version was updated in configure.ac to 1.31.7 in
commit ac06052b97, but we forgot to do
the same in the meson setup.
2022-06-24 12:25:51 +02:00
Aleksander Morgado 9fa1b32e34 cli: don't print signal quality unless modem is enabled
We don't have a clear way to report "unknown" signal quality, so for
now just skip printing it altogether in the mmcli human output if the
modem is not yet enabled.
2022-05-25 11:15:29 +02:00
Aleksander Morgado 63d02f9da2 iface-modem: allow state updates without bearer list
E.g. if we reach the failed state before the bearer list is created.
2022-05-25 11:15:27 +02:00
Aleksander Morgado 9c773fcad4 iface-modem: report failed modems with unknown capabilities
Instead of not creating a modem object, create it in failed state with
the "unknown capabilities" failed state reason.
2022-05-25 11:15:06 +02:00
Aleksander Morgado e90a7410b4 iface-modem: minor coding style fix 2022-05-25 11:15:05 +02:00
Aleksander Morgado 234f185c3a iface-modem: fail initialization if eSIM without profiles
A modem using an eSIM without profiles should not be allowed to get
enabled, it should be really treated as a modem without a physical
SIM.
2022-05-25 11:14:45 +02:00
Aleksander Morgado 0123030136 iface-modem: skip setting up carrier config on esim without profiles 2022-05-25 11:14:40 +02:00
Aleksander Morgado fe91a3044d iface-modem: load current modes and current bands even without SIM
These are current settings in the modem, they don't really depend on
whether there is a SIM or not.
2022-05-25 11:14:39 +02:00
Aleksander Morgado 061f9a275a iface-modem: move helper method out of the initialization logic 2022-05-25 11:14:38 +02:00
Aleksander Morgado a535b2fddc base-sim: skip loading SIM identifier in eSIM without profiles 2022-05-25 11:14:37 +02:00
Aleksander Morgado 38f631e00e broadband-modem: rework checking for SIM swap
Avoid calling the MMBaseSim class method directly, and use the helper
mm_base_sim_load_sim_identifier() instead.

Also, rework a bit the logic to have a single completion method once
we know the current ICCID.
2022-05-25 11:14:35 +02:00
Aleksander Morgado 638841281e base-sim: disallow SIM user operations in eSIM without profiles 2022-05-25 11:14:34 +02:00
Aleksander Morgado 38a69011bd base-sim: skip loading SIM properties based on SIM type
If the reported eSIM doesn't have profiles, there is no point in
trying to load properties like ICCID, IMSI or operator name/id.

If the reported SIM is a physical SIM, there is no point in trying
to load properties like EID or eSIM status.
2022-05-25 11:14:03 +02:00
Aleksander Morgado 073404313e broadband-modem-mbim: improve logging of found SIM slots 2022-05-25 10:59:17 +02:00
Aleksander Morgado f593421d8d iface-modem: minor coding style fix 2022-05-25 10:59:17 +02:00
Aleksander Morgado 1b30d10ad1 base-sim: don't reload properties that may have been already initialized
If we created the SIM objects during the SIM slots processing, we
should not attempt to reload the settings that were already set during
the re-initialization, as that may end up clearing the initial
properties.
2022-05-25 10:59:17 +02:00
Aleksander Morgado ac3f9be3d3 base-sim: remove bogus comments in initialization
All properties loaded during initialization are meant to be loaded
only once, no point in saying that for each property.
2022-05-25 10:59:17 +02:00
Aleksander Morgado eee6e46d4e broadband-modem-mbim: assume no lock is required in eSIM without profiles 2022-05-25 10:59:17 +02:00
Aleksander Morgado 1ad5526972 bearer-mbim: plug user cancellable to all MBIM operations 2022-05-24 08:44:22 +00:00
Aleksander Morgado 0cfe498354 bearer-mbim: if connection attempt fails, trigger an explicit disconnection
E.g. if the error reported by the MbimDevice is a timeout error, it
means the connection attempt is still ongoing in the device, we need
to ask it to stop.
2022-05-24 08:44:22 +00:00
Aleksander Morgado 8679396d99 bearer-mbim: use common helper to build disconnection message 2022-05-24 08:44:22 +00:00
Aleksander Morgado 4140758fdf base-modem: if ABORTED during initialization, modem not exported
Commit b497de325 introduced a change by which some common errors (e.g.
SIM missing) would be reported as MM_CORE_ERROR_ABORTED.

This had the undesired effect of making the MMBaseModem object not
flag as valid the modem, because the returned error wasn't
MM_CORE_ERROR_WRONG_STATE.

We now change this logic so that only ABORTED makes the modem object
not flagged as valid, and we'll do that only if the Modem interface
isn't exposed in DBus.

Fixes b497de325
2022-05-20 15:36:43 +02:00
Aleksander Morgado 82b574a6e7 broadband-modem-mbim: ignore SIM swap events during a slot switch action
When we explicitly request to perform a SIM slot switch operation, we
should ignore the 'slot info status' and 'subscriber ready status'
indications that report an active SIM slot change, or otherwise they'll
end up interfering with the correct reporting of the slot switch
operation.

We could have attempted to complete the slot switch operation early
using the indications, but that solution would have forced us to
assume that theinfo in the indications is the one we had requested,
which is not easy because the 'slot info status' indication is
reported once for each slot, so a single SIM slot switch operation
triggers multiple 'slot info status' indications, as well as
additional 'subscriber ready status' indications reporting the same.

Fixes suggested by Pavan Holla <pholla@chromium.org> and tested by
Jinjian Song <Jinjian.Song@fibocom.com>.

Fixes https://gitlab.freedesktop.org/mobile-broadband/ModemManager/-/issues/550
2022-05-20 09:03:54 +00:00
Aleksander Morgado b497de325a iface-modem: common SIM event reporting logic
We no longer have separate mm_base_modem_process_sim_event() and
mm_broadband_modem_sim_hot_swap_detected() methods. The only
difference between both of them was that one of them would attempt to
cleanup the ports context associated to the SIM hot swap event logic
as soon as a swap was detected, in order to avoid queueing up multiple
such events.

The previous logic wasn't working well, though, as there could be
mixed AT+QMI or AT+MBIM devices that would also require that same
cleanup and so we didn't always know which one should have been
called.

Now we have a single mm_iface_modem_process_sim_event() method, which
will trigger the reprobe and disabling, but which will also perform
the cleanup of the SIM ports swap setup as specified by the
implementation.

So, if a plugin explicitly initializes the serial ports context for
SIM hot swap handling, it should also explicitly clean it up.

Also, the initialization of the serial ports context for SIM hot swap
handling is no longer done automatically for all modems, it will be
done only for those modems using it; i.e. the modems that explicitly
report support SIM hot swap handling using AT URCs.
2022-05-20 09:03:54 +00:00
Aleksander Morgado c987757a2c broadband-modem-mbim-quectel: SIM hot swap supported by default in MBIM 2022-05-20 09:03:54 +00:00
Aleksander Morgado 61144e2103 iface-modem: remove MM_IFACE_MODEM_SIM_HOT_SWAP_CONFIGURED property
This property is used in the MMIfaceModem to flag whether the SIM hot
swap setup has been performed or not. The flag is now moved to the
iface-specific private context.

The property was also used in AT-based modems, so that implementations
supporting the SIM hot swap via AT URCs could flag the upper layers
whether the enabling of the feature was done correctly or not, and if
so, create and keep the AT ports context open. But this feature only
made sense in AT-based modems, i.e. an MBIM modem that detects SIM hot
swaps via MBIM indications exclusively should not require the AT ports
context open for anything. The check in the MMBroadbandModem object
has therefore been removed, and the logic will be updated so that it
only applies to AT-based modems.
2022-05-20 09:03:54 +00:00
Aleksander Morgado 86eabf4316 iface-modem: initialization restart support moved to iface-specific private context 2022-05-20 09:03:54 +00:00
Aleksander Morgado 0080ed612d iface-modem: rework signal check logic to use the iface-specific private context
The signal and access tech loading operation was using a context that
contained both overall state and state specific to the current
attempt.

The overall modem state is now moved to the iface-specific private
context, and the state specific to the operation is kept in a GTask
that is bound to the ongoing loading operation.
2022-05-20 09:03:54 +00:00
Aleksander Morgado 95da87046c iface-modem: move recent signal quality handling to iface-specific private context 2022-05-20 09:03:54 +00:00
Aleksander Morgado 9fde6f9162 iface-modem: move state update context to iface-specific private context
Avoid keeping separate per-operation contexts, it doesn't make
sense. Just have one single Private context for the whole interface
where we can add support for all operations performed by the
interface.
2022-05-20 09:03:54 +00:00
Aleksander Morgado c059f16871 broadband-modem-mbim: don't disable subscriber info if used by SIM hotswap
The SIM hot swap operation relies on multiple different types of
indications, but the most important one is the subscriber info
indication. We should make sure that indication is kept enabled for as
long as the SIM hot swap detection should be active.

We also skip using the MM_IFACE_MODEM_SIM_HOT_SWAP_CONFIGURED
property, which should be removed or made MMBroadbandModem-specific,
as it is only really used in the AT-based SIM hot swap detection
logic.
2022-05-20 09:03:54 +00:00
Aleksander Morgado fd0a5d42a9 broadband-modem-mbim: reset enable flags if enabling them failed
This is not extremely important, because we don't really flag as
disabled those indications that failed to be enabled (as usually we
attempt to enable them in a group, not one by one), but in this case
this will allow us to keep a clean state after a failed SIM hot swap
setup.
2022-05-20 09:03:54 +00:00