Commit Graph

8691 Commits

Author SHA1 Message Date
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
Aleksander Morgado
cc90f2ffe8 build: compile plugins before daemon 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
e14b904cbd build: move plugins directory to src/plugins
We are going to allow including the plugin sources built within the
ModemManager daemon binary; moving the sources within the daemon
sources directory makes it easier.
2023-01-03 13:56:25 +00:00
Aleksander Morgado
072d7ac906 log: avoid redefining MM_MODULE_NAME 2023-01-03 13:56:25 +00:00
Fabrice Fontaine
a9651f2390 meson: Un-hardcode building a shared library
Use library() instead of shared_library() to allow specifying which kind
of library to build with "meson setup --default-library ..."

This will avoid the following static build failure:

FAILED: src/ModemManager
/home/autobuild/autobuild/instance-11/output-1/per-package/modem-manager/host/bin/m68k-linux-gcc  -o src/ModemManager src/ModemManager.p/meson-generated_.._mm-daemon-enums-types.c.o src/ModemManager.p/main.c.o src/ModemManager.p/mm-auth-provider.c.o src/ModemManager.p/mm-base-bearer.c.o src/ModemManager.p/mm-base-call.c.o src/ModemManager.p/mm-base-manager.c.o src/ModemManager.p/mm-base-modem-at.c.o src/ModemManager.p/mm-base-modem.c.o src/ModemManager.p/mm-base-sim.c.o src/ModemManager.p/mm-base-sms.c.o src/ModemManager.p/mm-bearer-list.c.o src/ModemManager.p/mm-broadband-bearer.c.o src/ModemManager.p/mm-broadband-modem.c.o src/ModemManager.p/mm-call-list.c.o src/ModemManager.p/mm-context.c.o src/ModemManager.p/mm-device.c.o src/ModemManager.p/mm-dispatcher.c.o src/ModemManager.p/mm-dispatcher-connection.c.o src/ModemManager.p/mm-dispatcher-fcc-unlock.c.o src/ModemManager.p/mm-filter.c.o src/ModemManager.p/mm-iface-modem-3gpp.c.o src/ModemManager.p/mm-iface-modem-3gpp-profile-manager.c.o src/ModemManager.p/mm-iface-modem-3gpp-ussd.c.o src/ModemManager.p/mm-iface-modem.c.o src/ModemManager.p/mm-iface-modem-cdma.c.o src/ModemManager.p/mm-iface-modem-firmware.c.o src/ModemManager.p/mm-iface-modem-location.c.o src/ModemManager.p/mm-iface-modem-messaging.c.o src/ModemManager.p/mm-iface-modem-oma.c.o src/ModemManager.p/mm-iface-modem-sar.c.o src/ModemManager.p/mm-iface-modem-signal.c.o src/ModemManager.p/mm-iface-modem-simple.c.o src/ModemManager.p/mm-iface-modem-time.c.o src/ModemManager.p/mm-iface-modem-voice.c.o src/ModemManager.p/mm-plugin.c.o src/ModemManager.p/mm-plugin-manager.c.o src/ModemManager.p/mm-port-probe.c.o src/ModemManager.p/mm-port-probe-at.c.o src/ModemManager.p/mm-private-boxed-types.c.o src/ModemManager.p/mm-sms-list.c.o -Wl,--as-needed -Wl,--no-undefined -Wl,-O1 -static '-Wl,-rpath,$ORIGIN/../libmm-glib' -Wl,-rpath-link,/home/autobuild/autobuild/instance-11/output-1/build/modem-manager-1.20.2/build/libmm-glib -Wl,--start-group src/libport.a src/libkerneldevice.a src/libhelpers.a libmm-glib/libmm-glib.so.0.9.0 libqcdm/src/libqcdm.a libmm-glib/generated/tests/libmm-test-generated.a -Wl,--export-dynamic /home/autobuild/autobuild/instance-11/output-1/per-package/modem-manager/host/m68k-buildroot-linux-uclibc/sysroot/usr/lib/libgmodule-2.0.a /home/autobuild/autobuild/instance-11/output-1/per-package/modem-manager/host/m68k-buildroot-linux-uclibc/sysroot/usr/lib/libglib-2.0.a -pthread -lm /home/autobuild/autobuild/instance-11/output-1/per-package/modem-manager/host/m68k-buildroot-linux-uclibc/sysroot/usr/lib/libpcre.a /home/autobuild/autobuild/instance-11/output-1/per-package/modem-manager/host/m68k-buildroot-linux-uclibc/sysroot/usr/lib/libgio-2.0.a /home/autobuild/autobuild/instance-11/output-1/per-package/modem-manager/host/m68k-buildroot-linux-uclibc/sysroot/usr/lib/libgobject-2.0.a /home/autobuild/autobuild/instance-11/output-1/per-package/modem-manager/host/m68k-buildroot-linux-uclibc/sysroot/usr/lib/libffi.a /home/autobuild/autobuild/instance-11/output-1/per-package/modem-manager/host/m68k-buildroot-linux-uclibc/sysroot/usr/lib/libz.a /home/autobuild/autobuild/instance-11/output-1/per-package/modem-manager/host/m68k-buildroot-linux-uclibc/sysroot/usr/lib/libmount.a /home/autobuild/autobuild/instance-11/output-1/per-package/modem-manager/host/m68k-buildroot-linux-uclibc/sysroot/usr/lib/libblkid.a -Wl,--end-group
/home/autobuild/autobuild/instance-11/output-1/per-package/modem-manager/host/opt/ext-toolchain/bin/../lib/gcc/m68k-buildroot-linux-uclibc/11.2.0/../../../../m68k-buildroot-linux-uclibc/bin/ld: attempted static link of dynamic object `libmm-glib/libmm-glib.so.0.9.0'

Fixes:
 - http://autobuild.buildroot.org/results/9803d593305df36c4a8d67aac2fb4c9a3120a072

Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
2022-12-31 13:18:04 +00:00
Ivan Mikhanchuk
a07d04b0ca quectel: add new modem variants to port type rules
Adds new variants of Quectel modems which rely on ModemManager port type
rules for fwupd updates.
2022-12-27 11:01:38 -08:00
Aleksander Morgado
a5058eb799 base-modem: don't assume ports tables always exist
The 'link_ports' and 'ports' tables are created during object init(),
but they are fully removed and cleared during dispose(). Given that
the MMDevice executes an explicit g_object_run_dispose(), there may be
cases where a long-running operation that isn't cancelled ends up
being completed by the time the object disposal has already run at
least once.

That would end up crashing the process if we attempt to e.g. iterate
over one of the ports hash tables:

  0x00007c3594eb3b93 (libglib-2.0.so.0 - ghash.c: 1180)   g_hash_table_iter_next
  0x00005b60d86f2563 (ModemManager - mm-base-modem.c: 1133)       mm_base_modem_get_port_infos
  0x00005b60d870228e (ModemManager - mm-iface-modem.c: 4013)      fcc_unlock
  0x00007c35950126a8 (libgio-2.0.so.0 - gtask.c: 1230)    g_task_return_now
  0x00007c35950116fa (libgio-2.0.so.0 - gtask.c: 1300)    g_task_return
  0x00007c3595011d12 (libgio-2.0.so.0 - gtask.c: 1930)    g_task_return_new_error
  0x00005b60d87518f2 (ModemManager - mm-broadband-modem-mbim.c: 1970)     radio_state_set_up_ready
  0x00007c35950126a8 (libgio-2.0.so.0 - gtask.c: 1230)    g_task_return_now
  0x00007c35950116fa (libgio-2.0.so.0 - gtask.c: 1300)    g_task_return
  0x00007c35950c486c (libmbim-glib.so.4 - mbim-device.c: 253)     transaction_task_complete_and_free
  0x00007c35950c714b (libmbim-glib.so.4 - mbim-device.c: 335)     transaction_timed_out
  0x00007c3594ec1232 (libglib-2.0.so.0 - gmain.c: 4971)   g_timeout_dispatch
  0x00007c3594ec43fc (libglib-2.0.so.0 - gmain.c: 3417)   g_main_context_dispatch
  0x00007c3594ec4704 (libglib-2.0.so.0 - gmain.c: 4211)   g_main_context_iterate
  0x00007c3594ec4978 (libglib-2.0.so.0 - gmain.c: 4411)   g_main_loop_run
  0x00005b60d86d7c56 (ModemManager - main.c: 217) main
  0x00007c3594c526c5 (libc.so.6 + 0x000286c5)     __libc_init_first
  0x00007c3594c52781 (libc.so.6 + 0x00028781)     __libc_start_main
  0x00005b60d86d7970 (ModemManager + 0x00061970)  _start

Fixes https://gitlab.freedesktop.org/mobile-broadband/ModemManager/-/issues/677

Change-Id: I6695c284f86a196e60de7f714bc1671332d08848
2022-12-20 20:53:58 +00:00
Aleksander Morgado
c7dac25315 port-mbim: chain up device notifications through the port
Instead of having the modem object listen notifications in the
MbimDevice, the MMPortMbim will act as an intermediate emitter for the
same.

The primary benefit is that the lifecycle of the port object is
tightly coupled to the life of the modem object, so there is no chance
that the port object outlives the modem object.

And the port object will ensure its own device notification handler is
correctly cleared up on its dispose, so there should be no chance of
firing up a signal in the device for a listener that is already
freed.
2022-12-18 21:55:21 +00:00
Aleksander Morgado
309a8a515b port-mbim: implement the new generic 'removed' signal
Letting the MMBroadbandModemMbim listen for the notifications of the
MbimDevice was not a good idea, especially since no explicit reference
to the device object was hold in the modem object. This leads to race
conditions in which the MbimDevice outlives the MMBroadbandModemMbim and
the MMPortMbim, and when the "device-removed" signal is triggered, the
program crashes.

The MMPortMbim will now emit its own 'removed' signals when the
underlying MbimDevice emits "device-removed', ensuring that the signal
handler is properly cleared up during the MMPortMbim disposal.

Fixes https://gitlab.freedesktop.org/mobile-broadband/ModemManager/-/issues/518
2022-12-18 21:54:58 +00:00
Aleksander Morgado
a20f2428ee port-qmi: implement the new generic 'removed' signal
Letting the MMBroadbandModemQmi listen for the notifications of the
QmiDevice was not a good idea, especially since no explicit reference
to the device object was hold in the modem object. This leads to race
conditions in which the QmiDevice outlives the MMBroadbandModemQmi and
the MMPortQmi, and when the "device-removed" signal is triggered, the
program crashes.

The MMPortQmi will now emit its own 'removed' signals when the
underlying QmiDevice emits "device-removed', ensuring that the signal
handler is properly cleared up during the MMPortQmi disposal.
2022-12-18 21:52:51 +00:00
Aleksander Morgado
455c486091 port: define new generic 'removed' signal
This signal indicates that the port is no longer accessible. Unlike a
udev port removal event, this indication may happen even if the port
is still exposed by the system.

It is designed to detect protocol proxy crashes, and so when such
event is detected by the modem, a full reprobe of the device will be
done to start from scratch the protocol management operations.
2022-12-18 21:52:51 +00:00
Aleksander Morgado
2a1851536c build: unstable release version bump to 1.21.2 2022-12-14 09:20:55 +00:00
Aleksander Morgado
53c5e23bba decode: remove legacy tool 2022-12-06 22:49:22 +00:00
Aleksander Morgado
a4b6b33cf4 vl600: remove legacy notes and tool 2022-12-06 22:49:16 +00:00
Sven Schwermer
e96ea83f61 iface-modem-3gpp: Check before registering
If the modem is already registered when ModemManager probes the modem,
it will ignore the registration state since the modem is not enabled
yet. Always querying the registration state before starting the
registration procedure makes sure to catch such cases and not perform
unnecessary registration steps.

Signed-off-by: Sven Schwermer <sven.schwermer@disruptive-technologies.com>
2022-12-06 14:03:47 +00:00
Clayton Craft
279d1c99c4 broadmobi: add MM_PLUGIN_REQUIRED_QCDM flag
This fixes an issue where, with an BM818 connected over USB,
suspending/resuming the modem causes the modem to reset immediately.

The culprit was bisected to d6203265c2, where QCDM probing was disabled
unless explicitly requested, so I assume this modem needs it based on
the constant resetting when power management was enabled on the modem's
usb connection.
2022-12-06 13:55:33 +00:00
Aleksander Morgado
0d6651aeb6 broadband-modem-mbim: print MbimSmsStatusFlag as flags string
This requires bumping libmbim to 1.29.2, which is the version
including the enum->flags change.
2022-12-06 12:46:28 +00:00
Aleksander Morgado
913022ed90 broadband-modem-mbim: MbimSmsStatusFlag is flags, not an enum
We can directly use this change instead of requiring the libmbim
version bump because the numeric values of the enum didn't change:
  NEW_MESSAGE == 2 == (1<<1)

Fixes https://gitlab.freedesktop.org/mobile-broadband/ModemManager/-/issues/673
2022-12-05 22:38:57 +00:00
Aleksander Morgado
b515f72bb0 base-sms: improve logging of user operations 2022-11-30 13:40:19 +00:00
Aleksander Morgado
bab798211a base-sms: refactor memory management in handlers
Use g_auto* helpers where needed, and switch to use the slice
allocator for the handler operation contexts.
2022-11-30 13:40:19 +00:00
Aleksander Morgado
c359a05219 iface-modem-messaging: improve logging of user operations 2022-11-30 13:40:19 +00:00
Aleksander Morgado
a962d63179 iface-modem-messaging: refactor memory management in handlers
Use g_auto* helpers where needed, and switch to use the slice
allocator for the handler operation contexts.
2022-11-30 13:40:19 +00:00
Aleksander Morgado
74441e8549 iface-modem-messaging: use the abort_invocation_if_state_not_reached() helper 2022-11-30 13:40:19 +00:00
Aleksander Morgado
ef6cf656f7 iface-modem-messaging: allow Delete operation during enabling/disabling
Fixes https://gitlab.freedesktop.org/mobile-broadband/ModemManager/-/issues/671
2022-11-30 13:02:07 +00:00