Commit Graph

8615 Commits

Author SHA1 Message Date
Aleksander Morgado
6d1f4aee30 broadband-modem-mbim: limit the use of context types defined in MBIMEx
The Tethering context type UUID was defined by Microsoft in its
extensions as `5e4e0601-48dc-4e2b-acb8-08b4016bbaac` (along with
others like Admin, Xcap, App and EmergencyCalling), see
https://learn.microsoft.com/en-us/windows-hardware/drivers/network/mb-provisioned-context-operations.

These UUIDs are expected to be usable only if the modem supports
`MBIM_CID_MS_PROVISIONED_CONTEXT_V2` (CID=1) in the Basic Connect
Extensions service (3d01dcc5-fef5-4d05-0d3abef7058e9aaf).

If the modem doesn't support these, we should try to fallback to a
more generic APN type automatically, e.g. "Internet", which was
defined in MBIM 1.0 and should always be supported.

There should be no problem in a modem to have 2 separate PDN
connections with the same context type.
2023-02-20 11:07:38 +00:00
Aleksander Morgado
278678d8ed modem-helpers-mbim: add missing support for 'emergency' APN type 2023-02-17 14:18:41 +00:00
Frederic Martinsons
02aafa2948 libmm-glib,common-helpers: Add multiple apn-type management
Fixes #676

Signed-off-by: Frederic Martinsons <frederic.martinsons@gmail.com>
2023-02-17 10:46:44 +00:00
Frederic Martinsons
511f712160 libmm-glib,tests: extend tests for common helpers (string conversion)
Signed-off-by: Frederic Martinsons <frederic.martinsons@gmail.com>
2023-02-17 10:46:44 +00:00
Aleksander Morgado
3e960b97e2 modem-helpers-mbim: small refactor in the EARFCN/NRARFCN to frequency converters 2023-02-17 10:43:20 +00:00
Aleksander Morgado
5c5126b7ff broadband-modem-mbim: avoid using already freed element during iteration
If we remove the current element being iterated in the GList, we can
no longer call g_list_next() on it. Ensure we keep a valid pointer to
the next element in the list before removing the current one.
2023-02-17 10:43:20 +00:00
som
d1ed6114a8 broadband-modem-mbim: cell-info core logic implementation
Handling of gdbus interface changes for additional
properties(service cell type and bandwidth) in
broadband modem mbim.

Co-author: Shilpa Shivakumar
2023-02-17 10:43:20 +00:00
som
e8d63c1743 modem-cellinfo: adding bandwidth and serving cell type
adding bandwidth information in mm-dbus interface
for the serving cell. In serving cell, the details
on whether the pcell/scell are from MCS or SCG is
also updated.

Co-author: Shilpa Shivakumar
2023-02-17 10:43:20 +00:00
Aleksander Morgado
fe7008e414 cli,output: coding style fixes 2023-02-17 10:33:11 +00:00
Florian Eckert
c3365a36f0 cli,output: print valid json for network scan result
A network scan with json output currently returns the following:

root@G3-10940 ~ # mmcli -m 0 -J --3gpp-scan --timeout=300 | jq
{
  "modem": {
    "3gpp": {
      "scan-networks": [
        "operator-code: 26201, operator-name: TDG, access-technologies: lte, availability: forbidden",
        "operator-code: 26203, operator-name: o2 - de, access-technologies: lte, availability: forbidden",
        "operator-code: 26202, operator-name: vodafone.de, access-technologies: lte, availability: current"
      ]
    }
  }
}

This is a valid JSON, but in order to be able to access the individual
data elements more easily, the line can also be dumped as a json object.

The following commit converts the lines into a JSON obejct, so that it
looks like this:

root@G3-10940 ~ # mmcli -m 0 -J --3gpp-scan --timeout=300 | jq
{
  "modem": {
    "3gpp": {
      "scan-networks": [
        {
          "operator-code": "26201",
          "operator-name": "TDG",
          "access-technologies": "lte",
          "availability": "forbidden"
        },
        {
          "operator-code": "26203",
          "operator-name": "o2 - de",
          "access-technologies": "lte",
          "availability": "forbidden"
        },
        {
          "operator-code": "26202",
          "operator-name": "vodafone.de",
          "access-technologies": "lte",
          "availability": "current"
        }
      ]
    }
  }
}

Signed-off-by: Florian Eckert <fe@dev.tdt.de>
2023-02-17 10:15:36 +00:00
Michal Mazur
6f00fb867b iface-modem-3gpp: enable reading of IMEI in FAILED state
It was not possible to read IMEI of modem when SIM was not inserted or
initialization failed due to modem facility locks. To load IMEI, the
3gpp interface need to be initialized before going to FALLBACK_LIMITED.
2023-02-15 15:00:41 +00:00
Alyssa Ross
7cd28955a0 build: allow installing examples to be disabled
In Nixpkgs, sysconfdir is not writeable in the sandbox in which
packages are built, so it's important for us to be able to disable
installing example files.  (We create configuration files and install
them into /etc separately through our "module system".)

Signed-off-by: Alyssa Ross <hi@alyssa.is>
2023-02-12 17:35:20 +00:00
Akash Aggarwal
02d730604d mm-broadband-modem-qmi: update signal values while processing NAS signal info indication 2023-02-06 23:38:02 +05:30
Eric Caruso
e31c43ebd2 mm-iface-modem-3gpp: reject unspecified values for 5G reg settings
It seems like users can put the "unsupported" value for
both DRX cycle and MICO mode, so we should reject that.
2023-02-03 21:09:36 +00:00
Oliver Kästner
652a562aeb qmi: implement GetCellInfo for LTE, NR 2023-02-03 10:23:44 +00:00
Daniele Palmas
6748fb7c2c telit: fallback to AT commands in case of MBIM loading revision failure
Some firmware versions return an empty string for the revision when
using the device caps MBIM request, so use AT commands as a fallback
in case this happens.
2023-01-30 16:00:45 +01:00
Daniele Palmas
a9e841e931 telit: increase initial delay for AT ports
FN990 requires more time for the AT ports to become responsive,
so increase the initial delay up to 40 seconds.
2023-01-30 16:00:45 +01:00
Daniele Palmas
6632136990 telit: add port type hints for FN990 0x1070, 0x1071 compositions 2023-01-30 16:00:45 +01:00
Daniele Palmas
2c235260e4 telit: add shared support for 5G modes 2023-01-30 16:00:45 +01:00
Aleksander Morgado
664c95c684 build: unstable release version bump to 1.21.3 2023-01-27 14:57:54 +00:00
Louis-Alexis Eyraud
6006dd1d63 broadband-modem-qmi: don't fail on power indication registration error
This commit modifies the QMI DMS Operating Mode indication registration logic.
During the power sequence chance, if a QMI_PROTOCOL_ERROR_MISSING_ARGUMENT error
was returned in "DMS Set Event Report" operation for Operating Mode Reporting failed,
the whole sequence was aborted, leading the modem to be disabled.

<debug> [modem0] Power indication registration request is sent
...
<debug> [modem0] couldn't update power state: Couldn't register for power indications: QMI protocol error (17): 'MissingArgument'
<warn>  [modem0] couldn't enable interface: 'Couldn't register for power indications: QMI protocol error (17): 'MissingArgument''
<debug> [modem0] running implicit disable after failed enable...

This commit modifies the logic to properly detect the failure and
continue the sequence without the indications.

Fixes #683

Signed-off-by: Louis-Alexis Eyraud <louis-alexis.eyraud@unabiz.com>
2023-01-23 14:49:33 +00:00
Lubomir Rintel
90c1788be0 build: fix a typo in meson_options doc string
Now it's perfect!
2023-01-22 14:13:01 +00:00
Lubomir Rintel
3a1cc27f2e bearer-qmi: fix a mnc/mcc typo
Makes my compiler unhappy:

  [471/539] Compiling C object src/ModemManager.p/mm-bearer-qmi.c.o
  ../src/mm-bearer-qmi.c: In function ‘process_operator_reserved_pco’:
  ../src/mm-bearer-qmi.c:580:18: warning: logical ‘and’ of equal expressions [-Wlogical-op]
    580 |     if (!tmp_mcc && !tmp_mcc && !container_id && !array->len)
        |                  ^~

Fixes: f4b8d14b8d ('bearer-qmi: explicitly ignore PCOs with undefined contents:')
2023-01-20 15:05:50 +01:00
Ulrich Mohr
5ed79518be broadband-modem-mbim,qmi-shared: Fallback from qmi uim service only when not supported
When using qmi uim service from mbim broadband modem, a fallback from using
qmi uim service to normal mbim operations is done every time a call to
qmi_set_primary_sim_slot fails. But this may fall for various reasons,
and a fallback only makes sense when the device does not support that call

Patch reworked by Aleksander Morgado <aleksandermj@chromium.org>
2023-01-18 11:14:14 +00:00
Frederic Martinsons
766962167c cli: add formating option (json and key/value) for created SMS
Fixes #657

Signed-off-by: Frederic Martinsons <frederic.martinsons@gmail.com>
2023-01-18 11:00:17 +00:00
Lubomir Rintel
3b56efed0b build: enable GLib deprecation warnings
These were disabled to avoid a large spew of deprecation warnings post
GLib 2.44. That might have been too big a hammer, because it made us
miss us of API from newer GLib than we require.

Let's re-enable the warnings and lower the bottom bound instead.
That way we're get warned about use of API that's too new and also be
warned about things that was deprecated long long ago. We may miss
things that got deprecated in favor of better API after 2.44, but that's
unlikely to be an issue and is definitely better than ignoring
everything altogether.
2023-01-18 10:51:40 +00:00
Lubomir Rintel
1af34e1746 libmm-glib,common-helpers: undeprecate g_date_time_format_iso8601()
Avoid a deprecation warning with too new glib:

  ../libmm-glib/mm-common-helpers.c: In function ‘date_time_format_iso8601’:
  ../libmm-glib/mm-common-helpers.c:1729:5: warning: ‘g_date_time_format_iso8601’ is deprecated: Not available before 2.62 [-Wdeprecated-declarations]
   1729 |     return g_date_time_format_iso8601 (dt);
        |     ^~~~~~

This call site is protected by version guards and provides an alternative
implementation in date_time_format_iso8601().
2023-01-18 10:51:40 +00:00
Lubomir Rintel
6179667d3d libmm-glib,common-helpers: avoid using g_time_zone_new_offset()
It requires newer glib than we do:

  ../libmm-glib/mm-common-helpers.c: In function ‘mm_new_iso8601_time’:
  ../libmm-glib/mm-common-helpers.c:1787:9: warning: ‘g_time_zone_new_offset’ is deprecated: Not available before 2.58 [-Wdeprecated-declarations]
   1787 |         tz = g_time_zone_new_offset (offset_minutes * 60);
        |         ^~
  In file included from /usr/include/glib-2.0/glib/gdatetime.h:33:
  /usr/include/glib-2.0/glib/gtimezone.h:67:25: note: declared here
     67 | GTimeZone *             g_time_zone_new_offset                          (gint32       seconds);
        |                         ^~~~~~~~~~~~~~~~~~~~~~

Let's not use the routine with older versions of glib.
2023-01-18 10:51:40 +00:00
Michal Mazur
7750e927f6 broadband-modem-mbim: Sync state of sim_hot_swap_configured variable 2023-01-18 10:15:43 +00:00
Michal Mazur
68e92d9308 broadband-modem-mbim: Fix bug in cleanup_unsolicited_events_3gpp() 2023-01-18 10:15:43 +00:00
Aleksander Morgado
f4b8d14b8d bearer-qmi: explicitly ignore PCOs with undefined contents:
There is nothing to process in this kind of PCO fields:

  <<<<<< TLV:
  <<<<<<   type       = "Operator Reserved PCO" (0x2f)
  <<<<<<   length     = 8
  <<<<<<   value      = 00:00:00:00:00:00:00:00
  <<<<<<   translated = [ mcc = '0' mnc = '0' mnc_includes_pcs_digit = 'no' app_specific_info = '{}' container_id = '0' ]

Fixes https://gitlab.freedesktop.org/mobile-broadband/ModemManager/-/issues/690
2023-01-16 15:05:29 +00:00
Aleksander Morgado
cf59b497bc bearer-qmi: app specific info in PCO may be empty
ModemManager[562783]: <err> [1673538458.350130] mm_utils_bin2hexstr: assertion 'bin != NULL' failed
  ModemManager[562783]: <dbg> [1673538458.350167] [modem0/bearer0] container ID: 0
  ModemManager[562783]: <dbg> [1673538458.350201] [modem0/bearer0] app specific info: (null)

Treat it better by only trying to build the app specific info string
if there are contents in the array.
2023-01-16 15:05:21 +00:00
Daniele Palmas
34ba11b3fa bearer-qmi: fix pco array declaration 2023-01-12 17:03:58 +01:00
Michal Mazur
d7e599f13f sim-mbim: Reset cached SIM info when SIM is unlocked
Fixes https://gitlab.freedesktop.org/mobile-broadband/ModemManager/-/issues/684
2023-01-11 10:30:33 +00:00
Aleksander Morgado
cc78a6439f broadband-modem-qmi: ignore our own profile changed indications
The device may emit a "WDS Profile Changed" indication triggered from
our own "WDS Modify Profile", "WDS Create Profile" or "WDS Delete
Profile" operations, so ensure those are fully ignored so that we
don't emit the "Updated" signal in the ProfileManager interface.

The logic keeps track of the amount of concurrent operations so that
the signal is ignored for as long as there is at least one operation
running.

Fixes https://gitlab.freedesktop.org/mobile-broadband/ModemManager/-/issues/687
2023-01-11 08:43:27 +00:00
Aleksander Morgado
e3667ecb56 build: fix dependency on daemon enums required by plugins
Fixes https://gitlab.freedesktop.org/mobile-broadband/ModemManager/-/issues/686
2023-01-10 14:13:34 +00:00
Frederic Martinsons
99570090ea build: set LD_LIBRARY_PATH along with GI_TYPELIB_PATH when launching stub
Otherwise we may use a wrong typelib shared library (the one that
is installed on the system which run the test)

Signed-off-by: Frederic Martinsons <frederic.martinsons@gmail.com>
2023-01-09 14:17:22 +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
1c4da332ee build: new option to build plugins within the daemon binary
Instead of creating libmm-plugin* and libmm-shared* libraries that are
dlopen()-ed on runtime, allow incorporating all plugins into the
daemon binary itself.

This makes the startup of the daemon much faster and also avoids
issues with builds that require linker namespace isolation.

Fixes https://gitlab.freedesktop.org/mobile-broadband/ModemManager/-/issues/674
2023-01-03 13:56:25 +00:00
Aleksander Morgado
1dd70be4c8 plugins: setup new helper macros to define shared utils 2023-01-03 13:56:25 +00:00
Aleksander Morgado
f0a9f09558 plugins: setup new helper macros to define plugins
We also remove the plugin headers completely as they are not really
required anywhere.
2023-01-03 13:56:25 +00: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
876e8537c4 plugins: don't include daemon enums sources 2023-01-03 13:56:25 +00:00