Commit Graph

8153 Commits

Author SHA1 Message Date
Rukun Mao
3da84c2079 suspend: add suspend/resume support with powerd on ChromeOS
ModemManager handles suspend and resume signals sent from powerd

Fixes https://gitlab.freedesktop.org/mobile-broadband/ModemManager/-/issues/547
2022-06-09 08:32:13 +00:00
Thilo-Alexander Ginkel
ac06052b97 fcc-unlock: add support for new Lenovo T99W175 SDX55 FCC unlock method
Tested w/ Lenovo firmware T99W175.F0.1.0.0.9.DT.003.055 (old unlock method) and
T99W175.F0.1.0.0.9.DT.003.079 (new unlock method)
2022-05-30 23:29:36 +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
Daniele Palmas
0f1cd36e65 telit: add LE910Cx MBIM composition port hints 2022-05-24 09:22:06 +02:00
Daniele Palmas
1642c5e00f telit: add wwan support 2022-05-24 09:22:06 +02:00
Daniele Palmas
ce71b580fc filter: add vendor id/subsystem vendor id filter
Some PCI modems prefer customizing the subsytem vendor ID,
instead of the vendor ID.

Add a filter for the couple vendor/subsystem vendor IDs.
2022-05-24 09:22:06 +02:00
Daniele Palmas
654c5f5014 base-modem: add subsystem vendor ID property
Subsystem vendor ID can be used for identifying PCI modems,
so expose the property.
2022-05-24 09:22:06 +02:00
Daniele Palmas
ff5840c3c7 kernel-device, generic: add subsystem vendor ID support
Add subsystem vendor ID support, that can be used in pci devices
instead of vendor ID customization.
2022-05-24 09:22:06 +02: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
Jack Song
0c67d93edd mm-bearer-mbim: fix connect_set_ready always parse result for needing to check NwError on failure
Issue and bugfix suggestion by Aleksander Morgado.

Fixes https://gitlab.freedesktop.org/mobile-broadband/ModemManager/-/issues/549
2022-05-20 11:35:52 +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
Aleksander Morgado
c659492022 xmm: wait for +XLSRSTOP URC before starting next session
It is important to gracefully stop the session before starting the
next session, making sure the engine is completely stopped. This can
be ensured by waiting for the +XLSRSTOP URC just after having received
the +XLSRSTOP command response.

We'll do an explicit wait for that URC with a 10s timeout, in order to
avoid waiting forever if the URC is never received. It will be assumed
that the engine is off if the 10s timeout happens, in the same way as
we were doing until now.

During the wait time for the URC, the operation task ownership is
shared among the response processor, the URC handler and the timeout
source. Once any of them decides to complete the task, the others will
automatically avoid attempting to complete the same task.

Based on a patch originally developed by:
Som_SP <somashekhar.puttagangaiah@intel.com>
2022-05-19 11:45:37 +00:00
Aleksander Morgado
7de4d6673b broadband-modem-mbim: plug memleak when MBIMEx v2 not supported
==11025== 40 bytes in 1 blocks are definitely lost in loss record 3,313 of 5,483
  ==11025==    at 0x483E7C5: malloc (vg_replace_malloc.c:380)
  ==11025==    by 0x4A32CA9: g_malloc (in /usr/lib/libglib-2.0.so.0.7000.2)
  ==11025==    by 0x4A4A082: g_slice_alloc (in /usr/lib/libglib-2.0.so.0.7000.2)
  ==11025==    by 0x49F8574: g_array_sized_new (in /usr/lib/libglib-2.0.so.0.7000.2)
  ==11025==    by 0x24DEB1: load_supported_modes_mbim (mm-broadband-modem-mbim.c:958)
  ==11025==    by 0x24E2D5: modem_load_supported_modes (mm-broadband-modem-mbim.c:1042)
  ==11025==    by 0x1D4DC5: interface_initialization_step (mm-iface-modem.c:5718)
  ==11025==    by 0x1D26D6: load_device_identifier_ready (mm-iface-modem.c:4903)
  ==11025==    by 0x4BACB83: ??? (in /usr/lib/libgio-2.0.so.0.7000.2)
  ==11025==    by 0x4BACBB8: ??? (in /usr/lib/libgio-2.0.so.0.7000.2)
  ==11025==    by 0x4A2A434: g_main_context_dispatch (in /usr/lib/libglib-2.0.so.0.7000.2)
  ==11025==    by 0x4A7E7B8: ??? (in /usr/lib/libglib-2.0.so.0.7000.2)
2022-05-19 13:30:32 +02:00
Prakash Pabba
2788c6c5f6 mm-broadband-modem-qmi: Update access technology based on "NAS system info" or "NAS serving system"
For NR5G NSA, both LTE and NR5G should be set in access technology.

Use NAS "system info" or "serving system", instead of NAS "signal info"
or "signal strength", for deciding access technology based on current
registration state.
2022-05-18 22:16:41 +00:00
Aleksander Morgado
5fbe7c0c82 broadband-modem-mbim: fix additional double GError free
We're returning the GError as GTask result, we should not explicitly
free it ourselves.

Same as the previous fix, should solve the crash sometimes seen in
https://gitlab.freedesktop.org/mobile-broadband/ModemManager/-/issues/550
2022-05-13 11:54:06 +02:00
Aleksander Morgado
b4d0fc4adf broadband-modem-mbim: fix double GError free
We're returning the GError as GTask result, we should not explicitly
free it ourselves.

Fixes the crash sometimes seen in
https://gitlab.freedesktop.org/mobile-broadband/ModemManager/-/issues/550

  ==15994== Invalid free() / delete / delete[] / realloc()
  ==15994==    at 0x484B27F: free (in /usr/libexec/valgrind/vgpreload_memcheck-amd64-linux.so)
  ==15994==    by 0x4F9A8A0: g_error_free (in /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0.7102.0)
  ==15994==    by 0x2251CC: ??? (in /usr/sbin/ModemManager)
  ==15994==    by 0x4DD2B48: ??? (in /usr/lib/x86_64-linux-gnu/libgio-2.0.so.0.7102.0)
  ==15994==    by 0x4DD2D4A: ??? (in /usr/lib/x86_64-linux-gnu/libgio-2.0.so.0.7102.0)
  ==15994==    by 0x4CA9049: ??? (in /usr/lib/x86_64-linux-gnu/libmbim-glib.so.4.6.0)
  ==15994==    by 0x4CB0367: ??? (in /usr/lib/x86_64-linux-gnu/libmbim-glib.so.4.6.0)
  ==15994==    by 0x4FAF287: ??? (in /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0.7102.0)
  ==15994==    by 0x4FAEC03: g_main_context_dispatch (in /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0.7102.0)
  ==15994==    by 0x5003497: ??? (in /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0.7102.0)
  ==15994==    by 0x4FAE282: g_main_loop_run (in /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0.7102.0)
  ==15994==    by 0x16916F: main (in /usr/sbin/ModemManager)
  ==15994==  Address 0x80db490 is 0 bytes inside a block of size 16 free'd
  ==15994==    at 0x484B27F: free (in /usr/libexec/valgrind/vgpreload_memcheck-amd64-linux.so)
  ==15994==    by 0x4F9A8A0: g_error_free (in /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0.7102.0)
  ==15994==    by 0x1984FA: ??? (in /usr/sbin/ModemManager)
  ==15994==    by 0x4DD2B48: ??? (in /usr/lib/x86_64-linux-gnu/libgio-2.0.so.0.7102.0)
  ==15994==    by 0x4DD2D4A: ??? (in /usr/lib/x86_64-linux-gnu/libgio-2.0.so.0.7102.0)
  ==15994==    by 0x2251A6: ??? (in /usr/sbin/ModemManager)
  ==15994==    by 0x4DD2B48: ??? (in /usr/lib/x86_64-linux-gnu/libgio-2.0.so.0.7102.0)
  ==15994==    by 0x4DD2D4A: ??? (in /usr/lib/x86_64-linux-gnu/libgio-2.0.so.0.7102.0)
  ==15994==    by 0x4CA9049: ??? (in /usr/lib/x86_64-linux-gnu/libmbim-glib.so.4.6.0)
  ==15994==    by 0x4CB0367: ??? (in /usr/lib/x86_64-linux-gnu/libmbim-glib.so.4.6.0)
  ==15994==    by 0x4FAF287: ??? (in /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0.7102.0)
  ==15994==    by 0x4FAEC03: g_main_context_dispatch (in /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0.7102.0)
  ==15994==  Block was alloc'd at
  ==15994==    at 0x4848899: malloc (in /usr/libexec/valgrind/vgpreload_memcheck-amd64-linux.so)
  ==15994==    by 0x4FB76F8: g_malloc (in /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0.7102.0)
  ==15994==    by 0x4FCF1A4: g_slice_alloc (in /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0.7102.0)
  ==15994==    by 0x4FCF80D: g_slice_alloc0 (in /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0.7102.0)
  ==15994==    by 0x4F9A3A6: ??? (in /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0.7102.0)
  ==15994==    by 0x4F9A5A3: g_error_copy (in /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0.7102.0)
  ==15994==    by 0x4CA903E: ??? (in /usr/lib/x86_64-linux-gnu/libmbim-glib.so.4.6.0)
  ==15994==    by 0x4CB0367: ??? (in /usr/lib/x86_64-linux-gnu/libmbim-glib.so.4.6.0)
  ==15994==    by 0x4FAF287: ??? (in /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0.7102.0)
  ==15994==    by 0x4FAEC03: g_main_context_dispatch (in /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0.7102.0)
  ==15994==    by 0x5003497: ??? (in /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0.7102.0)
  ==15994==    by 0x4FAE282: g_main_loop_run (in /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0.7102.0)
2022-05-13 10:50:39 +02:00
Aleksander Morgado
e163ab504a broadband-modem-mbim: fix task completion when peeking device fails
We cannot call peek_device() when we have already created a GTask for
the async operation, because if the operation failed we would be
completing the async operation with a totally different GTask than the
one we had created ourselves, triggering memory leaks and leaving
modem references around that should not exist (as the GTask we create
holds a modem reference).

Issue found in the context of debugging this, may actually be fully
related:

https://gitlab.freedesktop.org/mobile-broadband/ModemManager/-/issues/550
2022-05-11 12:13:34 +00:00
Aleksander Morgado
acd5f466d7 broadband-modem-mbim: minor coding style changes 2022-05-11 12:13:34 +00:00
Andrew Lassalle
3745ce8b1f Revert "plugins,fibocom: Add udev filter for pci wwan"
This reverts commit 115a5d876e.
2022-05-09 14:24:09 -07:00
Andrew Lassalle
115a5d876e plugins,fibocom: Add udev filter for pci wwan
Add a udev filter to identify pci wwan ports from fibocom modems.
2022-05-05 09:35:36 -07:00
Dylan Van Assche
3239fc22ff mm-iface-modem: mark signal strength as recent on init
When initializing the Modem interface, we set the signal strength
to the default value (0%) and we are certain this is the recent value
until the modem reports the actual signal strength if available.
Therefore, mark the signal strength as recent instead of cached.
2022-05-03 13:50:13 +02:00
Dylan Van Assche
a1b52c14bf mm-iface-modem: set signal quality to 0% on shutdown
If a modem is disabled, the signal quality is still set to the cached
value, even though the modem is not connected to any network anymore.
Set the signal quality to 0% when the interface is removed from DBus.

Fixes https://gitlab.freedesktop.org/mobile-broadband/ModemManager/-/issues/558
2022-04-29 17:43:10 +02:00