Commit Graph
4345 Commits
Author SHA1 Message Date
Dylan Van Assche 90397fa1bb iface-modem-firmware: expose device id builder
Expose the generic device id method as a public API for plugins.
Plugins can call this method first and then add their own device ids on
top in case the generic ones aren't specific enough like in the case of
Quectel modems.
2022-02-08 19:33:56 +01:00
Aleksander Morgado 967d748f04 sim-mbim: don't crash if SIM IMSI not provided
E.g. if we have an eSIM without profiles.
2022-02-01 10:35:56 +01:00
Aleksander Morgado 5cf15b3f6f broadband-modem-mbim: treat update in eSIM profiles list as a SIM hotplug event 2022-01-31 23:12:46 +01:00
Aleksander Morgado 8ae31be1be broadband-modem-mbim: minor alignment fix 2022-01-31 23:11:11 +01:00
Aleksander Morgado 9c08e54fb9 shared-qmi: filter out modes not currently available
Do not build the mask of "all" modes based only on the supported radio
interfaces, also filter out those modes that would not be available
based on the current capabilities enabled.
2022-01-31 22:48:57 +01:00
Aleksander Morgado c7ff014e07 modem-helpers-qmi: multimode devices shouldn't always have 4G/5G only modes
In GSM/UMTS+CDMA/EVDO multimode devices, the 4G and 5G mode switching
operations are exclusively limited to the capability selection that
has LTE+5GNR exclusively.

We cannot allow switching to 4G-only, 5G-only or 4G+5G if the current
capabilities have GSM/UMTS or CDMA/EVDO.

Fixes https://gitlab.freedesktop.org/mobile-broadband/ModemManager/-/issues/503
2022-01-31 22:48:57 +01:00
Aleksander Morgado ccf0b7eba2 tests,modem-helpers-qmi: add tests for supported modes loading 2022-01-31 22:48:57 +01:00
Aleksander Morgado b323a73137 modem-helpers-qmi: new helper to build array of supported modes 2022-01-31 22:48:57 +01:00
Aleksander Morgado 6efde10714 tests,modem-helpers-qmi: add additional tests for supported capabilities loading
Including tests for 5G-only and non-multimode 5G+4G and 5G+4G+3G devices.
2022-01-31 22:48:57 +01:00
Aleksander Morgado ff51fe637d tests,modem-helpers-qmi: add tests for supported capabilities loading 2022-01-31 22:48:57 +01:00
Aleksander Morgado d0c87c5877 modem-helpers-qmi: new helper to build array of supported capabilities 2022-01-31 22:48:57 +01:00
Aleksander Morgado f370c096ec modem-helpers-qmi: refer explicitly to current capabilities in helper method
The helper method for which we have unit tests available refers
exclusively to the current capabilities loading, so rename it to
clarify that.
2022-01-31 22:48:57 +01:00
Prakash Pabba 2322988855 test-modem-helpers-qmi: add unit test for generic 5g modem 2022-01-30 15:37:05 +00:00
Prakash Pabba 3a1390f1dd test-modem-helpers-qmi: Fix tests for UML290
Change due to update in current capabilities loading logic.
2022-01-30 15:37:05 +00:00
Prakash Pabba 38f067c4e4 mm-shared-qmi,mm-modem-helpers: Fix supported capabilities and modes for multimode device
We use capability switching logic exclusively for configuring GSM/UMTS+CDMA/EVDO devices
(regardless of whether it has LTE/5GNR or not) to add or remove the GSM/UMTS and CDMA/EVDO
capabilities.

Based on the same logic, we will allow 4 combinations for GSM/UMTS+CDMA/EVDO+LTE+5GNR device:
"GSM/UMTS+CDMA/EVDO+LTE+5GNR", "GSM/UMTS+LTE+5GNR", "CDMA/EVDO+LTE+5GNR" and "LTE+5GNR"

Similarly, we will allow 4 combinations for GSM/UMTS+CDMA/EVDO+LTE device:
"GSM/UMTS+CDMA/EVDO+LTE", "GSM/UMTS+LTE", "CDMA/EVDO+LTE" and "LTE"

And, we will allow 3 combinations for GSM/UMTS+CDMA/EVDO device:
"GSM/UMTS+CDMA/EVDO", "GSM/UMTS" and "CDMA/EVDO"

Also, supported combination modes should be based on current capabilities and not entirely
upon supported radio interfaces.

1) If current capability has "gsm-umts" or "cdma-evdo" or both, do not
   support 4G only, 5G only, or 4G+5G combination modes
2) If current capability neither has "gsm-umts" nor "cdma-evdo", only support
   combination modes involving 4G and 5G.
2022-01-30 15:37:05 +00:00
Prakash Pabba f05258e757 mm-modem-helpers-qmi: Fix current capabilities for multimode device
Keep LTE or 5GNR always in current capabilities if supported by device.

Since capability switching logic is exclusively used for configuring
GSM/UMTS+CDMA/EVDO devices, decide if to have GSM/UMTS or CDMA/EVDO or both
or none when loading current capabilities.
2022-01-30 15:37:05 +00:00
Michal Mazur 9843546a49 iface-modem: make update_unlock_retries method static 2022-01-30 13:48:48 +00:00
Michal Mazur 5d4957935b sim-mbim,broadband-modem-mbim: store number of remaining attempts
On MBIM modems the type of PIN cannot be specified in MBIM_CID_PIN query
command and the modem responds only remaining attempts for the currently
active lock.
If PIN1 is unlocked and user tries to disable (or enable) it, MM won't
get an update of remaining attempts in response to PIN Query. This value
is returned only after the Set command and MM need to store it in
all (pin/puk)_set_(enter/enable/change)_ready functions.

Previous solution was to call the mm_iface_modem_update_unlock_retries
directly from these functions but it caused the notification to be send
too early and invalid number was displayed to user sometimes.
Instead of this MM will store numbers of remaining attempts and send
them in a single notification from modem_load_unlock_retries.
2022-01-30 13:48:48 +00:00
Michal Mazur ee87a68532 Revert "mm-sim-mbim: Remove update of remaining attempts"
This reverts commit 46c5cd8b72.
2022-01-30 13:48:48 +00:00
Nagi Marupaka 73e3da3a10 mm-kernel-device-helpers: fix memory leak
Newly refactored string manipulation function is leaking memory as per
our tests. This submission fixes that memory leak.
2022-01-26 18:27:09 +00:00
Aleksander Morgado 86496bd326 plugin-manager: longer extra probing time when not using udev
When using udev, we rely on the kernel to timely report port additions
in the same device.

When not using udev, e.g. when using hotplug scripts in openwrt, we
use mmcli --report-kernel-event operations to report the port
additions, which may end up requiring much more time to process,
especially during bootup as we would be reporting a lot of port
addition events one after the other.

Fixes https://gitlab.freedesktop.org/mobile-broadband/ModemManager/-/issues/493
2022-01-22 21:03:48 +01:00
Aleksander Morgado 11b7aa46cb broadband-modem-qmi: minor code reordering in profile manager setup/cleanup/enable/disable
The finish() method with the GTask result propagation must be in the
same context as the GTask creation itself, not elsewhere.

Code is reordered so that the async methods can be read from bottom to
top, with the finish() method that includes the GTask result
propagation at the very top.
2022-01-22 10:35:54 +01:00
Florence Chan 6b9709245d mm-broadband-modem-qmi: implement ProfileManager.Updated signal
This uses the PDC Refresh indication to notify clients that
there is a new list of profiles.
2022-01-22 10:31:59 +01:00
Aleksander Morgado af0665c573 broadband-modem-mbim: implement support for GetCellInfo() 2022-01-18 09:00:10 +00:00
Aleksander Morgado 3c49e04377 iface-modem: implement support for 'GetCellInfo()' 2022-01-18 09:00:10 +00:00
Aleksander Morgado 322a601b29 broadband-modem-qmi: if UNSUPPORTED, ignore power update operation
We were returning success on this operation upon an UNSUPPORTED error,
and we should keep on doing the same after all the indication support
changes.
2022-01-14 10:36:39 +01:00
Aleksander Morgado 60f61e9740 broadband-modem-qmi: setup operation context for power up/down/off
We must keep a valid QmiClient reference for as long as the operation
runs, so that we can use it in all the request send operations we do,
and also so that we can remove the indication id upon completing the
operation.

The timeout id and indication id, which are also part of a single
power operation are also included in the operation context, because
they don't have any other meaning out of it.

The operation context is stored as task data.
2022-01-14 10:36:39 +01:00
Aleksander Morgado 1291754e60 broadband-modem-qmi: rework log and error messages 2022-01-14 10:36:39 +01:00
Aleksander Morgado 3216e7a21a broadband-modem-qmi: don't pass full reference to signal handlers
As in the case of the timeouts, we should not pass a full reference as
data to the signal handler as we don't know how many times we'll
receive the signal or if we'll ever receive it.

We already make sure that the signal handler is disconnected when the
operation ends, so we can be sure the self pointer is valid while the
signal handler is connected.
2022-01-14 10:36:39 +01:00
Aleksander Morgado 504d6f51a3 broadband-modem-qmi: reorder code and minor coding style fixes 2022-01-14 10:36:39 +01:00
Aleksander Morgado c3fcb66acf broadband-modem-qmi: don't pass full reference in timeouts
The timeout may not be called if we remove it earlier (e.g. if the
indication is received) and therefore we must not pass a full new
reference, otherwise it may get leaked.

There is no problem with the validity of the self pointer in timeout
callbacks because we're removing the timeout as part of the operation
teardown logic.
2022-01-11 11:33:38 +01:00
Aleksander Morgado fa1e581f13 broadband-modem-qmi: remove paranoid assert
We just created the GTask and we just updated the stored pointer,
checking for it being non-NULL at this point is a bit paranoid
2022-01-11 11:32:36 +01:00
Aleksander Morgado 447243f667 broadband-modem-qmi: avoid capitalizing all words in error message 2022-01-11 11:32:02 +01:00
Prakash Pabba 2d96df774a broadband-modem-qmi: Handle DMS operating mode indications
If Mode online is triggered just after Mode LPM and Mode LPM
processing is not complete in modem, modem will not process the next
request and the device will be stuck in an unwanted modem power
state. Thus, wait for a mode change indication from the modem before
declaring that a power on/off has been successful.
2022-01-11 11:30:19 +01:00
Aleksander Morgado fb0dfb8751 iface-modem-3gpp: fix variant ref handling in scan output 2022-01-07 21:35:43 +01:00
Aleksander Morgado 3fac73a113 iface-modem-simple: explicit short wait after enabling
When we have just enabled, we want to give it some time before
starting the registration process, so that any pending registration
update that may have been scheduled during the enabling phase is
applied. We don't want to trigger a new automatic registration if
e.g. we're already registered.
2021-12-26 11:02:45 +01:00
Aleksander Morgado 1ffd693f54 iface-modem-simple: fix connection attempt start place
The 'ENABLE + 1' step is 'WAIT_FOR_ENABLED' really, and that should be
only used when the current state is not a final one. If we're already
enabled, or registered, or connected, then jump to 'REGISTER' right
away.
2021-12-26 11:02:45 +01:00
Aleksander Morgado 1199fa934d broadband-modem-mbim: schedule reg info updates as soon as enabled
During the enabling phase, the modem may receive a lot of asynchronous
updates reporting registration info changes, but we were fully
ignoring them because the modem was not yet enabled. The problem with
this is that as soon as we reach the enabled state, we may not receive
additional info, so we would be left in 'enabled' state until new
asynchronous updates are received or until we start a connection
attempt.

We can solve this by triggering an explicit update with the
registration information that we have cached as soon as we're enabled.
2021-12-26 11:02:45 +01:00
Aleksander Morgado 73eda8cdc8 broadband-modem-mbim: don't miss operator id/name on packet service updates 2021-12-26 11:01:50 +01:00
Aleksander Morgado 59c79b07ae iface-modem: minor coding style changes 2021-12-26 11:01:50 +01:00
Aleksander Morgado f2f2dfec13 broadband-modem-mbim: reload ATDS location on reg state changes
Only if transitioning into a "registered" state ("home", "roaming",
"partner") or if "denied"; otherwise, assume LAC/TAC/CID are all
unknown.

This change makes the logic also reload the location info on
registration updates reported asynchronously via notifications.
2021-12-26 11:01:50 +01:00
Aleksander Morgado f9487cf3d1 core: new '--test-mbimex-profile-management' option
The profile management APIs implemented by Microsoft in the MBIM
extensions provide certain features that are not available via other
means (e.g. ip type, access type preference, roaming allowance...).

Unfortunately, these APIs require the current list of profiles
installed in the modem to be a bit special; e.g. with one profile max
for each context/APN type. If this does not happen, the operations
will fail, or they will update contexts that should not be updated.

So, we disable for now the MBIM extension profile management support;
the logic is there, but not used by default.
2021-12-26 10:12:33 +01:00
Aleksander Morgado 853aa29be8 iface-modem-3gpp-profile-manager: support 'apn-type' as index field
The modem may report the 'apn-type' field is the one to be used as
index; if that's the case, allow setting and deleting profiles based
on the given 'apn-type' field.

This change also makes the internal profile management operations use
one index field or another, based on what the protocol implements.
2021-12-26 10:12:11 +01:00
Aleksander Morgado 0d0ad722d9 iface-modem-3gpp-profile-manager: initialize the 'IndexField' property 2021-12-26 10:12:05 +01:00
Aleksander Morgado b90d64192a broadband-modem-mbim: support profile properties from MbimProvisionedContextElementV2
Microsoft defined a new extended version of the "provisioned contexts"
operation from the generic MBIM basic connect service. This extended
version adds several new settings that can be stored in the profile
(e.g. IP type, media type, roaming allowance...).

But this new version has a huge drawback; we cannot specify single
profiles via their unique id while we perform update/delete operations
in the modem. Instead, Microsoft explains that we should use the
context type to identify the target context; but this will ONLY work
if we have one context defined for each type. As soon as we have
multiple contexts of the same type, this operation may fail or
otherwise update multiple contexts at once.
2021-12-24 14:06:11 +01:00
Aleksander Morgado 6ba245cedc broadband-modem-mbim: new profile settings not available in MBIM protocol
At least not yet.
2021-12-24 14:05:35 +01:00
Aleksander Morgado 1b37ccc27a broadband-modem-qmi: new profile settings not available in QMI protocol
At least not yet.
2021-12-24 14:05:35 +01:00
Aleksander Morgado ebe9a33411 broadband-modem: new profile settings not available in generic AT protocol 2021-12-24 14:05:35 +01:00
Aleksander Morgado 87eaac8f9d iface-modem-3gpp: don't compare new properties when matching initial EPS bearer 2021-12-24 14:05:35 +01:00
Aleksander Morgado 93709f8dc2 broadband-modem-mbim: implement 5GNR registration settings update 2021-12-24 12:41:27 +00:00