Commit Graph
4074 Commits
Author SHA1 Message Date
Aleksander Morgado 8f48ba21af base-manager: don't assume a MMDevice always holds a MMModem
There are cases, e.g. during modem object disposal, where this is not
true.
2021-05-26 13:14:52 +00:00
Aleksander Morgado 01223b2d4d base-manager: make sure g_autoptr() variables are initialized to NULL
Otherwise, we may have memory issues if the variable isn't initialized
and the method exits.
2021-05-26 13:14:52 +00:00
Dylan Van Assche 38740e9d11 base-manager: add quick suspend/resume base
Quick suspend/resume infrastructure for
synchronizing the interfaces when resuming.
2021-05-26 13:14:52 +00:00
Aleksander Morgado 940063419a base-manager: ensure all GUdevDevices have subsystem and name set
Under certain rare conditions (e.g. race between querying devices of a
given subsystem and the kernel tearing those devices down), the
subsystem reported for a GUdevDevice seems to be NULL.

So, ensure both subsystem and name are set on the GUdevDevice before we
process them.

The issue has been observed on GUdevDevices listed by
g_udev_client_query_by_subsystem(), not on the ones asynchronously
reported via uevents, but we add the validity check on both places for
consistency.

Fixes https://gitlab.freedesktop.org/mobile-broadband/ModemManager/-/issues/343
2021-05-26 12:46:49 +00:00
Aleksander Morgado e4f106f311 broadband-modem-qmi: assume all QMI based modems support SIM hot swap
As we have a generic SIM hot swap implementation in the QMI broadband
modem object.
2021-05-26 12:20:00 +00:00
Aleksander Morgado 3da3623e11 broadband-modem: check if skeleton exists when creating device id
The logic that creates the device identifier uses some fields that are
exposed in DBus (e.g. model, manufacturer...).

We should not attempt to load any of that info if the DBus skeleton
for the Modem interface is no longer available, as e.g. the device may
have gone away already.

Fixes https://gitlab.freedesktop.org/mobile-broadband/ModemManager/-/issues/374
2021-05-24 12:52:52 +00:00
Aleksander Morgado 1f10b3ff7f broadband-modem: trivial coding style fix 2021-05-24 12:52:52 +00:00
Dylan Van Assche 4d095ae05b mm-iface-modem: fix typo in step function 2021-05-23 10:00:11 +00:00
Michal Mazur 9695f23faf iface-modem-3gpp: skip initialization in LOCKED state 2021-05-22 23:56:22 +00:00
Michal Mazur 83e7600a67 broadband-modem: allow 3GPP initialization before fallback
To enable call to disable-facility-lock in LOCKED state,
3gpp interface needs to be initialized before going to fallback step.
2021-05-22 23:56:22 +00:00
Michal Mazur d76c5c9bcd modem-qmi: detect personalization locks in LOCKED state 2021-05-22 23:56:22 +00:00
Michal Mazur c6b5045105 base-sim: ignore personalization locks after SIM unlock 2021-05-22 23:56:22 +00:00
Aleksander Morgado 6a56c5678c bearer-mbim: network error 0 is actually a valid error (unknown) 2021-05-23 01:22:07 +02:00
Aleksander Morgado e233d033fc broadband-modem-mbim: detailed connection error on disconnection reports
When we receive an indication reporting a network-initiated
disconnection, convert the MBIM network error into a
MMMobileEquipmentError, and publish it in the new 'ConnectionError'
property.
2021-05-23 01:22:07 +02:00
Aleksander Morgado 59ffa01bb0 bearer-qmi: detailed connection error on disconnection reports
When we receive an indication reporting a network-initiated
disconnection, convert the QMI call end reason into a
MMMobileEquipmentError, and publish it in the new 'ConnectionError'
property.
2021-05-23 01:22:07 +02:00
Aleksander Morgado 32995c8392 base-bearer: never overwrite a connection error that is already set 2021-05-23 01:22:07 +02:00
Aleksander Morgado ba53b6a64f base-bearer: limit the type of errors we can set as 'ConnectionError' 2021-05-23 01:22:07 +02:00
Aleksander Morgado a837ef4d81 base-bearer: clear connection error on every new attempt 2021-05-23 01:22:07 +02:00
Aleksander Morgado 43db860c44 base-bearer: report connection error on network initiated disconnections
By default, fallback to "unknown" mobile equipment error when the
modem gets disconnected by the network and we don't have any way to
know a more detailed reason.
2021-05-23 01:22:07 +02:00
Aleksander Morgado 7e8885d569 base-bearer: report connection error on failed connection attempts
When a user-requested connection attempt fails, we not only return the
connection error to the user that requested it, we also publish the
specific connection error in DBus for others to check why the failure
happened.
2021-05-23 01:22:07 +02:00
Aleksander Morgado ff45d292ee libmm-glib: setup common helper to register DBus errors 2021-05-22 22:58:37 +00:00
Aleksander Morgado b9c66e92ea bearer-qmi: rework connection failure error reporting
On a failed QMI modem connection, we won't return the generic
"CallFailed" error, we'll try to convert the 3GPP verbose call end
reason to a MMMobileEquipmentError.

And if we cannot find a mapping, or if the reported error is not a
3GPP verbose call end reason, we'll return a Unknown
MMMobileEquipmentError with a string message providing detailed error
information.
2021-05-22 22:58:37 +00:00
Aleksander Morgado a878cfa003 modem-helpers-mbim: rework nw error code mapping
Instead of having a switch with a lot of cases, provide a one to one
mapping for the MbimNwError and MMMobileEquipmentError codes in an
array, and make use of the mm_mobile_equipment_error_for_code() helper
to build the actual GError.
2021-05-22 22:58:37 +00:00
Aleksander Morgado 8da8fd0248 api: update MMMobileEquipmentError enum values
Update the list of mobile equipment error codes according to v17.1.0
of 3GPP TS 27.007 (March 2021).

A lot of the enum values that were prefixed with the 'GPRS_' keyword
have now been flagged as deprecated, and a new enum name given to the
corresponding value.

The deprecated symbol names are kept in the compat support to avoid
breaking API/ABI.
2021-05-22 22:58:37 +00:00
Aleksander Morgado d1bd0a2971 core: improve error helpers
First, simplify the logic that attempts to find the correct error code
associated to an error text string. This logic is very flaky, as it
relies on knowing what the modems report as text string for the
different error codes, and obviously that is not always the same.
Instead of supporting all error codes in this logic, we now limit them
to a small subset with common error codes and hopefully common error
strings.

Second, in order to quickly get the error description string for a
given error code, we rework the array of supported errors so that
the index of the array is the error code itself. For mobile equipment
errors the logic is straightforward, as they're always in the [0,255]
range, but for the message errors we create an array where the index
of the array is equal to the code plus 300 as they're always in the
[300,500] range. By doing this, we avoid having an array with 300 NULL
items before the actual values we want to support.
2021-05-22 22:58:37 +00:00
Aleksander Morgado 76f2425617 broadband-modem-mbim: setup FCC unlock step
Use the new generic FCC unlock step instead of implementing it within
the power up setup logic.
2021-05-23 00:23:17 +02:00
Aleksander Morgado b9596c8187 broadband-modem-qmi: setup FCC unlock step
Use the new generic FCC unlock step instead of implementing it within
the operating mode setup logic.

The operation is implemented in the MMSharedQmi interface as it will
also be used by the MBIM modem object.
2021-05-23 00:23:17 +02:00
Aleksander Morgado 6ca75c76db iface-modem: new optional FCC unlock step in the power state update
There are devices that come locked before they can be put online.
Until now we had a specific implementation for this in the generic QMI
modem, but we should have it in a more generic way for any kind of
modem.
2021-05-23 00:23:17 +02:00
Aleksander Morgado ec8bf7f0e3 shared-qmi: trivial coding style update 2021-05-23 00:23:17 +02:00
Aleksander Morgado 18fe7856af base-bearer: trivial fix printing stats reports 2021-05-18 23:17:01 +02:00
Aleksander Morgado 268cab885b core: drop "volatile" for g_once_init_enter locations
This fixes a few (fatal in gcc 11) warnings.

See https://gitlab.gnome.org/GNOME/glib/-/issues/600
2021-05-18 11:28:18 +02:00
Teijo Kinnunen 5e629b8ea7 broadband-modem-qmi: set MNC PCS digit in modem_3gpp_load_operator_name()
If the network has three digit MNC and MNC < 100, set the PCS digit status
field in the QMI request.
2021-05-17 12:46:52 +03:00
Teijo Kinnunen 1147d376cd shared-qmi: set MNC PCS digit for manual network registration
Set the MNC PCS digit status when attempting to register to a network
with 3 digit MNC and MNC < 100.
2021-05-17 12:46:52 +03:00
Teijo Kinnunen 2471b950b0 sim-qmi: use mm_3gpp_parse_operator_id() for preferred PLMN MNC digits
MNC PCS digit status is now available from mm_3gpp_parse_operator_id(),
so use it.
2021-05-17 12:46:52 +03:00
Teijo Kinnunen 879ec1a5d4 libmm-glib,iface-modem-location: add MMLocation3gpp 3 digit MNC support
MMLocation3gpp provides MCC/MNC information as integers, so it can not
make distinction between operator codes such as XXX01 and XXX001.

This commit deprecates mm_location_3gpp_get_mobile_network_code() and
implements a new function mm_location_3gpp_get_operator_code() which
provides the MCC+MNC in string format.

The mm_location_3gpp_get_mobile_country_code() is still available as
returning the MCC as an integer does not have ambiguity issues.
2021-05-17 12:46:52 +03:00
Teijo Kinnunen 14c4f27ae4 modem-helpers: add 3 digit MNC output to mm_3gpp_parse_operator_id()
MNC digit count information is lost on conversion to integers. Make it
possible for the caller to get this information through a separate
boolean.
2021-05-17 12:46:52 +03:00
Aleksander Morgado 98fbd5a156 iface-modem-3gpp: don't assume operator code implies we're registered
The modem may be camping in a forbidden network just for emergency
services, and we'll be able to have a MCCMNC reported in that case,
but this does not mean the modem is registered.

So, don't consider that a valid registration flag during the new
network registration request.
2021-05-15 21:55:28 +00:00
Aleksander Morgado af756a1bf7 port-qmi: avoid running install_properties() without properties defined
We'll setup the properties only if QRTR support is being built,
otherwise we fully skip all property related setup.

  (ModemManager:480463): GLib-GObject-CRITICAL **: 22:48:14.264: g_object_class_install_properties: assertion 'n_pspecs > 1' failed

  Thread 1 "ModemManager" received signal SIGTRAP, Trace/breakpoint trap.
  0x00007ffff76e3295 in ?? () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
  (gdb) bt
  #0  0x00007ffff76e3295 in  () at /lib/x86_64-linux-gnu/libglib-2.0.so.0
  #1  0x00007ffff76e4579 in g_logv () at /lib/x86_64-linux-gnu/libglib-2.0.so.0
  #2  0x00007ffff76e4743 in g_log () at /lib/x86_64-linux-gnu/libglib-2.0.so.0
  #3  0x00005555556af70c in mm_port_qmi_class_init (klass=0x5555557fae20) at mm-port-qmi.c:2619
  #4  0x00005555556a94c3 in mm_port_qmi_class_intern_init (klass=0x5555557fae20) at mm-port-qmi.c:34
  #5  0x00007ffff77ed1d1 in g_type_class_ref () at /lib/x86_64-linux-gnu/libgobject-2.0.so.0
  #6  0x00007ffff77d05e1 in g_object_new_valist () at /lib/x86_64-linux-gnu/libgobject-2.0.so.0
  #7  0x00007ffff77d06cd in g_object_new () at /lib/x86_64-linux-gnu/libgobject-2.0.so.0
  #8  0x00005555556af25a in mm_port_qmi_new (name=0x5555557e54e0 "cdc-wdm0", subsys=MM_PORT_SUBSYS_USBMISC) at mm-port-qmi.c:2481
  #9  0x000055555563c8d7 in wdm_probe_qmi (self=0x5555557de1b0) at mm-port-probe.c:517
  #10 0x000055555563cc70 in wdm_probe (self=0x5555557de1b0) at mm-port-probe.c:623
  #11 0x00007ffff76dd04e in g_main_context_dispatch () at /lib/x86_64-linux-gnu/libglib-2.0.so.0
  #12 0x00007ffff76dd400 in  () at /lib/x86_64-linux-gnu/libglib-2.0.so.0
  #13 0x00007ffff76dd6f3 in g_main_loop_run () at /lib/x86_64-linux-gnu/libglib-2.0.so.0
  #14 0x00005555555b1ae4 in main (argc=1, argv=0x7fffffffe558) at main.c:213
2021-05-15 23:24:50 +02:00
Andrew Lassalle 7711e84af9 iface-modem-3gpp: Add verbose logging for initial eps bearer
Print a debug message when the user provides initial eps bearer settings
that match the ones being used. This will save time to whomever is
experimenting with initial eps bearer settings.
2021-05-15 06:14:58 -07:00
Loic Poulain c39d1d2fbc udev: Do not consider USB WWAN ports as valid candidates
For now WWAN subsystem support has only been validated for PCI/MHI
based devices and extra patches for USB based devices (qmi_wwan,
cdc-mbim...) may be required, so do not consider WWAN ports being
on USB bus.

Signed-off-by: Loic Poulain <loic.poulain@linaro.org>
2021-05-14 22:15:40 +00:00
Freedom Liu 76e700f4fd broadband-modem-mbim: get model through QMI-over-MBIM
move the modem_load_model() async method from mm-broadband-modem-qmi.c
to mm-shared-qmi.c, and then make use of the method from both the QMI
and MBIM implementations.
2021-05-14 22:10:49 +02:00
Aleksander Morgado bb928dbf74 iface-modem: fix segfault if attempting to switch slot and slots unsupported
Reported and fix suggested by Maxim Anisimov

Fixes https://gitlab.freedesktop.org/mobile-broadband/ModemManager/-/issues/368
2021-05-12 22:12:46 +02:00
goapunk f916d075a7 modem-helpers-qmi: fix auth validation always returning error 2021-05-09 10:42:09 +02:00
Eric Caruso ba0701b67d mm-shared-qmi: parse ICCID as hex instead of BCD
Fixes issue 364.
2021-05-05 18:51:08 +00:00
Andrew Lassalle 27c43075f9 bearer-mbim: Fix double free in ip_configuration_query_ready 2021-05-04 13:45:51 -07:00
Aleksander Morgado 973b1bdec8 broadband-modem-mbim: use the new 'LTE attach info' message name
The older 'LTE attach status' message name is deprecated.
2021-05-03 23:58:55 +00:00
Aleksander Morgado 9e2c9cce97 iface-modem-3gpp: delete unused mm_iface_modem_3gpp_disable_facility_lock()
The action of disabling facility locks is user-triggered, so there is
no need to have an internal method to run the logic without user
interaction.
2021-04-30 18:40:29 +00:00
Aleksander Morgado c070ca82f8 modem-helpers: improve logging on unhandled features when parsing UIM Get Configuration 2021-04-30 18:40:29 +00:00
Michal Mazur 7f425d9b15 broadband-modem: support disabling facility lock on MBIM and QMI modems 2021-04-30 18:40:29 +00:00
Michal Mazur e8edcedc9e modem-helpers: introduce functions to convert MMModem3gppFacility 2021-04-30 18:40:29 +00:00