Commit Graph
100 Commits
Author SHA1 Message Date
Aleksander Morgado 781428ddcd iface-modem-firmware: common logic to check for sahara/firehose tags
The logic will exclusively look for the udev tags reporting
sahara/firehose support in the primary control port of each modem
type.
2025-02-21 14:08:50 +00:00
Aleksander Morgado 93da5e0b93 fibocom: add Sahara/Firehose support for NL668-EAU
Signed-off-by: default avatarLukas Voegl <lvoegl@tdt.de>
2025-02-21 14:08:50 +00:00
Aleksander Morgado 623e786f7c libmm-glib,unlock-retries: remove invalid 'closure' annotation
../libmm-glib/mm-unlock-retries.c:135: Warning: ModemManager:
  invalid "closure" annotation: only valid on callback parameters
2024-12-22 17:12:40 +01:00
Aleksander Morgado 9a76a00095 broadband-modem: don't assert Modem interface skeleton during enabling
There is no guarantee that during an enabling operation the skeleton
for the Modem interface unconditionally exists, e.g. the modem may
have been flagged as invalid and untracked from DBus during the
operation.

Just remove the assertion, because mm_iface_modem_enable() will
already cleanly fail if the skeleton object is not found.

   Thread 0 (crashed),
    0  libc.so.6!__pthread_kill_implementation [pthread_kill.c : 44 + 0x0],
    1  libc.so.6!raise [raise.c : 26 + 0xb],
    2  libc.so.6!abort [abort.c : 79 + 0xa],
    3  libglib-2.0.so.0!g_assertion_message [gtestutils.c : 3450 + 0x5],
    4  libglib-2.0.so.0!g_assertion_message_expr [gtestutils.c : 3476 + 0x14],
    5  ModemManager!enabling_step [mm-broadband-modem.c : 0 + 0x7],
    6  libgio-2.0.so.0!g_task_return_now [gtask.c : 1309 + 0x5],
    7  libgio-2.0.so.0!g_task_return [gtask.c : 1378 + 0x8],
    8  ModemManager!parent_enabling_started_ready [mm-broadband-modem-mbim.c : 3239 + 0xd],
    9  libgio-2.0.so.0!g_task_return_now [gtask.c : 1309 + 0x5],
   10  libgio-2.0.so.0!complete_in_idle_cb [gtask.c : 1323 + 0x5],
   11  libglib-2.0.so.0!g_main_dispatch [gmain.c : 3460 + 0x2],
2024-10-29 18:16:27 +00:00
Aleksander Morgado cb6a56fa0c quectel: fix crash when parsing +CTZU=? response
The logic should consider that mm_parse_uint_list() may return NULL
without setting the output GError, in the case where an empty string
is given.

This should ideally be changed in the mm_parse_uint_list() itself, but
that approach is not trivial as the method is being used in multiple
different places.

This change exclusively tries to solve this crash.

  0x000057435d315eca (ModemManager - mm-shared-quectel.c: 1060)	ctzu_test_ready
  0x00007eea3d019e86 (libgio-2.0.so.0 - gtask.c: 1309)	g_task_return_now
  0x00007eea3d018e50 (libgio-2.0.so.0 - gtask.c: 1378)	g_task_return
  0x000057435d268eab (ModemManager - mm-base-modem-at.c: 544)	at_command_ready
  0x00007eea3d019e86 (libgio-2.0.so.0 - gtask.c: 1309)	g_task_return_now
  0x00007eea3d018e50 (libgio-2.0.so.0 - gtask.c: 1378)	g_task_return
  0x000057435d318a18 (ModemManager - mm-port-serial-at.c: 350)	serial_command_ready
  0x00007eea3d019e86 (libgio-2.0.so.0 - gtask.c: 1309)	g_task_return_now
  0x00007eea3d018e50 (libgio-2.0.so.0 - gtask.c: 1378)	g_task_return
  0x000057435d31c7bd (ModemManager - mm-port-serial.c: 734)	port_serial_got_response
  0x000057435d31cc3e (ModemManager - mm-port-serial.c: 911)	parse_response_buffer
  0x000057435d31cc3e (ModemManager - mm-port-serial.c: 1028)	common_input_available
  0x00007eea3d16591b (libglib-2.0.so.0 - gmain.c: 3460)	g_main_dispatch
  0x00007eea3d16591b (libglib-2.0.so.0 - gmain.c: 4200)	g_main_context_dispatch
  0x00007eea3d165c37 (libglib-2.0.so.0 - gmain.c: 4276)	g_main_context_iterate
  0x00007eea3d165eb5 (libglib-2.0.so.0 - gmain.c: 4479)	g_main_loop_run
  0x000057435d25f5bf (ModemManager - main.c: 236)	main
  0x00007eea3c980705 (libc.so.6 - libc_start_call_main.h: 58)	__libc_start_call_main
  0x00007eea3c9807c1 (libc.so.6 - libc-start.c: 360)	__libc_start_main_impl
  0x000057435d25ef10 (ModemManager + 0x000b3f10)	_start
  0x00007ffcc0b5d517
2024-10-29 08:39:05 +00:00
Aleksander Morgado ea9438ab98 device: log vid:pid information at msg level
The vid:pid information of a given device is useful information,
especially when analyzing user provided logs.

This change makes the vid:pid information be included at msg level in
the same message that reports the plugin in use. It also removes some
redundant messages.
2024-10-21 09:41:14 +00:00
Aleksander Morgado 6c1888f76c iface-modem-3gpp: fix crash when trying to set unknown power state
Certain QMI-based USB modems will report an "unknown" power state upon
boot, before our first attempt to set one:

  $ sudo qmicli --dms-get-operating-mode -d /dev/cdc-wdm0 -p
  [/dev/cdc-wdm0] Operating mode retrieved:
       Mode: 'unknown'
       HW restricted: 'no'

Due to this, the logic trying to recover the previous power state
during an attach settings update would end up asserting:

  [modem3] set initial EPS bearer settings state (3/5): recover previous power state
  **
  ERROR:../src/mm-iface-modem.c:4554:mm_iface_modem_set_power_state:
  code should not be reached
  Bail out! ERROR:../src/mm-iface-modem.c:4554:mm_iface_modem_set_power_state:
  code should not be reached
  Aborted

This is a rare case, and instead of handling it in the QMI specific
implementation, we can try to fix it in a safer way directly in the
logic that handles the attach settings update. If we ever detect that
the reported power state is "unknown", we will default it to "on"
while emitting a warning.
2024-10-21 09:14:00 +00:00
Aleksander Morgado 891b1a41f9 plugin-manager: disallow port additions to an already cancelled device context
If the DeviceContext is cancelled, we remove it from the list of
tracked DeviceContexts in the MMPluginManager, so that new port
additions happening at the same time don't end up being added to
it.

This should allow an early cancellation of the DeviceContext without
asserting on g_assert (!device_context->extra_probing_time_id) as
there is no chance that a new port addition has reseted the extra
probing time timeout.

    0x00007c1154f16abf (libc.so.6 - pthread_kill.c: 44)	__pthread_kill_implementation
    0x00007c1154ecbf0c (libc.so.6 - raise.c: 26)	raise
    0x00007c1154eb74aa (libc.so.6 - abort.c: 79)	abort
    0x00007c11556c08a9 (libglib-2.0.so.0 - gtestutils.c: 3450)	g_assertion_message
    0x00007c11556c091d (libglib-2.0.so.0 - gtestutils.c: 3476)	g_assertion_message_expr
    0x00005897d1ed6e7b (ModemManager - mm-plugin-manager.c: 805)	device_context_unref
    0x00005897d1ed6ab9 (ModemManager - mm-plugin-manager.c: 163)	common_async_context_free
    0x00005897d1ed5dd6 (ModemManager - mm-plugin-manager.c: 1136)	port_context_run_ready
    0x00007c1155550e86 (libgio-2.0.so.0 - gtask.c: 1309)	g_task_return_now
    0x00007c115554fe50 (libgio-2.0.so.0 - gtask.c: 1378)	g_task_return
    0x00007c115555047b (libgio-2.0.so.0 - gtask.c: 2022)	g_task_return_new_error
    0x00005897d1ed581a (ModemManager - mm-plugin-manager.c: 296)	port_context_complete
    0x00005897d1ed6259 (ModemManager - mm-plugin-manager.c)	plugin_supports_port_ready
    0x00007c1155550e86 (libgio-2.0.so.0 - gtask.c: 1309)	g_task_return_now
    0x00007c1155550eb9 (libgio-2.0.so.0 - gtask.c: 1323)	complete_in_idle_cb
    0x00007c115569c91b (libglib-2.0.so.0 - gmain.c: 3460)	g_main_dispatch
    0x00007c115569c91b (libglib-2.0.so.0 - gmain.c: 4200)	g_main_context_dispatch
    0x00007c115569cc37 (libglib-2.0.so.0 - gmain.c: 4276)	g_main_context_iterate
    0x00007c115569ceb5 (libglib-2.0.so.0 - gmain.c: 4479)	g_main_loop_run
    0x00005897d1e715bf (ModemManager - main.c: 236)	main
    0x00007c1154eb7705 (libc.so.6 - libc_start_call_main.h: 58)	__libc_start_call_main
    0x00007c1154eb77c1 (libc.so.6 - libc-start.c: 360)	__libc_start_main_impl
    0x00005897d1e70f10 (ModemManager + 0x000b3f10)	_start
    0x00007ffd5acc5057

Manually reproducing this issue was challenging, so adding here the
steps taken, for reference. This is with ModemManager running with
--no-udev (i.e. port additions reported via mmcli). The key to
reproduce the problem is the different timing between the port
additions and removals of the three ttyACM ports.

  COUNT=1
  while ((COUNT < 10000)); do
      echo "$COUNT..."
      COUNT=$((COUNT + 1))
      (
          sudo mmcli --report-kernel-event="name=ttyACM0,subsystem=tty,action=add"
          TIMEOUT="0.0$(((RANDOM % 10) + 1))"
          sleep $TIMEOUT
          sudo mmcli --report-kernel-event="name=ttyACM0,subsystem=tty,action=remove"
      ) &
      (
          sudo mmcli --report-kernel-event="name=ttyACM1,subsystem=tty,action=add"
          TIMEOUT="0.0$(((RANDOM % 10) + 1))"
          sleep $TIMEOUT
          sudo mmcli --report-kernel-event="name=ttyACM1,subsystem=tty,action=remove"
      ) &
      (
          sudo mmcli --report-kernel-event="name=ttyACM2,subsystem=tty,action=add"
          TIMEOUT="0.0$(((RANDOM % 10) + 1))"
          sleep $TIMEOUT
          sudo mmcli --report-kernel-event="name=ttyACM2,subsystem=tty,action=remove"
      ) &
      TIMEOUT="0.0$(((RANDOM % 10) + 1))"
      sleep $TIMEOUT
      COUNT=$((COUNT + 1))
  done
2024-10-17 10:50:19 +00:00
Aleksander Morgado 7ec338dafe cinterion: fix propagating NULL GError
(ModemManager:2925): GLib-CRITICAL **: 09:21:32.082: g_propagate_error: assertion 'src != NULL' failed
  (ModemManager:2925): GLib-GIO-CRITICAL **: 09:21:32.083: g_task_return_error: assertion 'error != NULL' failed`

Fixes https://gitlab.freedesktop.org/mobile-broadband/ModemManager/-/issues/916
2024-10-17 09:11:11 +00:00
Aleksander Morgado 70e761d91c build: unstable release version bump to 1.23.12 2024-10-14 08:03:15 +00:00
Aleksander Morgado d1ed88638e api,enums: remove doc for undeclared enum value 2024-10-07 13:44:34 +00:00
Aleksander Morgado 1f828e3802 api: fix MM_BEARER_IP_FAMILY_ANY ABI break introduced in 1.20
The value was changed in commit 4ab2c80858 from
0xFFFFFFFF to 0xFFFFFFF7. Revert that ABI break.
2024-10-07 13:39:02 +00:00
Aleksander Morgado 0f2e86b2a6 docs: add missing references to sections file 2024-10-07 13:39:02 +00:00
Aleksander Morgado 80da775433 docs: add symbol indices for 1.22 and 1.24 2024-10-07 12:03:27 +00:00
Aleksander Morgado 93a57f0d3a docs: add 2024 as copyright year 2024-10-07 12:02:10 +00:00
Aleksander Morgado a63c300437 ublox: remove custom power operation synchronization logic
These are already synchronized at interface level, so there is already
a guarantee that they won't happen at the same time.
2024-09-30 11:07:20 +00:00
Aleksander Morgado 87dc3d36b4 quectel: remove custom power operation synchronization logic
The power up and down operations are already synchronized at
interface level, so there is already a guarantee that they won't
happen at the same time.

For the reset and power off operations, it is assumed that the modem
will either reset or power off, so there should be no need to sync
those operations with others, as the modem object will eventually go
away altogether in both cases.
2024-09-30 11:07:19 +00:00
Aleksander Morgado dfc0f8ebfd base-modem: override disable operations done before modem object removal
If we are going to inhibit the modem or fully reprobe it after a SIM
switch event, we should forbid further operations done with the modem
object.

This logic can be tested by queing different operations one after the
other, and then adding a last device inhibition ("override" operation)
that should trigger the early abort of all non-running operations,
e.g.:
  mmcli -m a -e &
  sleep 0.2
  mmcli -m a --3gpp-set-initial-eps-bearer-settings="apn=internet,ip-type=ipv4v6,force=true" &
  sleep 0.2
  mmcli -m a -d &
  sleep 0.2
  mmcli -m a -e &
  sleep 0.2
  mmcli -m a --set-power-state-low &
  sleep 0.2
  mmcli -m a -e &
  sleep 0.2
  mmcli -m a --inhibit

This previous sequence produces MM logs as follows:
  <dbg> [1726567756.430308] [modem0] [operation 22] default - enable: scheduled
  <dbg> [1726567756.430806] [modem0] [operation 22] default - enable: lock acquired
  <dbg> [1726567756.623746] [modem0] [operation 23] default - set-initial-eps-bearer-settings: scheduled
  <dbg> [1726567756.751743] [modem0] [operation 22] default - enable: lock released
  <dbg> [1726567756.752027] [modem0] [operation 23] default - set-initial-eps-bearer-settings: lock acquired
  <dbg> [1726567756.823739] [modem0] [operation 24] default - disable: scheduled
  <dbg> [1726567757.049581] [modem0] [operation 25] default - enable: scheduled
  <dbg> [1726567757.250165] [modem0] [operation 26] default - set-power-state: scheduled
  <dbg> [1726567757.450518] [modem0] [operation 27] default - enable: scheduled
  <dbg> [1726567757.676362] [modem0] [operation 28] override - disabling: override requested - no new operations will be allowed
  <dbg> [1726567757.678792] [modem0] [operation 24] default - disable: aborted early
  <dbg> [1726567757.679866] [modem0] [operation 25] default - enable: aborted early
  <dbg> [1726567757.680157] [modem0] [operation 26] default - set-power-state: aborted early
  <dbg> [1726567757.680496] [modem0] [operation 27] default - enable: aborted early
  <dbg> [1726567759.695780] [modem0] [operation 23] default - set-initial-eps-bearer-settings: lock released
  <dbg> [1726567759.695935] [modem0] [operation 28] override - disabling: lock acquired
  <dbg> [1726567759.872196] [modem0] [operation 28] override - disabling: lock released
2024-09-30 11:07:11 +00:00
Aleksander Morgado 0aef4c422f base-modem: new 'override' operation lock type
If a request to lock the operation with the override type arrives, all
pending operations will be immediately cancelled, and no new lock
requests will be allowed.
2024-09-30 11:07:05 +00:00
Aleksander Morgado 3510ffc418 iface-[modem|modem3gpp]: operation lock in all operations that change state
This logic can be tested by queing different operations one after the
other, e.g.:
  mmcli -m a -e &
  sleep 0.2
  mmcli -m a --3gpp-set-initial-eps-bearer-settings="apn=internet,ip-type=ipv4v6,force=true" &
  sleep 0.2
  mmcli -m a -d &
  sleep 0.2
  mmcli -m a -e &
  sleep 0.2
  mmcli -m a --set-power-state-low &
  sleep 0.2
  mmcli -m a -e &

This previous sequence produces MM logs as follows:
  <dbg> [1726567176.214906] [modem0] [operation 15] default - enable: scheduled
  <dbg> [1726567176.215108] [modem0] [operation 15] default - enable: lock acquired
  <dbg> [1726567176.436234] [modem0] [operation 16] default - set-initial-eps-bearer-settings: scheduled
  <dbg> [1726567176.554153] [modem0] [operation 15] default - enable: lock released
  <dbg> [1726567176.554492] [modem0] [operation 16] default - set-initial-eps-bearer-settings: lock acquired
  <dbg> [1726567176.619021] [modem0] [operation 17] default - disable: scheduled
  <dbg> [1726567176.840024] [modem0] [operation 18] default - enable: scheduled
  <dbg> [1726567177.037155] [modem0] [operation 19] default - set-power-state: scheduled
  <dbg> [1726567177.240225] [modem0] [operation 20] default - enable: scheduled
  <dbg> [1726567179.496397] [modem0] [operation 16] default - set-initial-eps-bearer-settings: lock released
  <dbg> [1726567179.496576] [modem0] [operation 17] default - disable: lock acquired
  <dbg> [1726567179.672141] [modem0] [operation 17] default - disable: lock released
  <dbg> [1726567179.672658] [modem0] [operation 18] default - enable: lock acquired
  <dbg> [1726567179.938481] [modem0] [operation 18] default - enable: lock released
  <dbg> [1726567179.940470] [modem0] [operation 19] default - set-power-state: lock acquired
  <dbg> [1726567182.147894] [modem0] [operation 19] default - set-power-state: lock released
  <dbg> [1726567182.148041] [modem0] [operation 20] default - enable: lock acquired
  <dbg> [1726567184.494469] [modem0] [operation 20] default - enable: lock released

iface-modem-3gpp: operation lock in all operations that change state
2024-09-30 11:07:02 +00:00
Aleksander Morgado be668462c0 base-modem: synchronize initialize/enable/disable/sync operations
Each of these now holds an exclusive lock, so all these operations are
synchronized.

This logic can be tested by queing different enable/disable operations
one after the other, e.g.:
  mmcli -m a -d &    --> Disable 1
  sleep 0.2
  mmcli -m a -e &    --> Enable 1
  sleep 0.2
  mmcli -m a -e &    --> Enable 2
  sleep 0.2
  mmcli -m a -d &    --> Disable 2
  sleep 0.2
  mmcli -m a -e &    --> Enable 3
  sleep 0.2
  mmcli -m a -d &    --> Disable 3

This previous sequence produces MM logs as follows:
  <dbg> [1726566352.936025] [modem0] [operation 9] default - disable:  scheduled     --> Disable 1 requested
  <dbg> [1726566352.936399] [modem0] [operation 9] default - disable:  lock acquired --> Disable 1 started
  <dbg> [1726566353.136445] [modem0] [operation 10] default - enable:  scheduled     --> Enable 1 requested
  <dbg> [1726566353.202980] [modem0] [operation 9] default - disable:  lock released --> Disable 1 finished
  <dbg> [1726566353.203526] [modem0] [operation 10] default - enable:  lock acquired --> Enable 1 started
  <dbg> [1726566353.320057] [modem0] [operation 11] default - enable:  scheduled     --> Enable 2 requested
  <dbg> [1726566353.440931] [modem0] [operation 10] default - enable:  lock released --> Enable 1 finished
  <dbg> [1726566353.443238] [modem0] [operation 11] default - enable:  lock acquired --> Enable 2 started
  <dbg> [1726566353.452984] [modem0] [operation 11] default - enable:  lock released --> Enable 2 finished
  <dbg> [1726566353.517512] [modem0] [operation 12] default - disable: scheduled     --> Disable 2 requested
  <dbg> [1726566353.517699] [modem0] [operation 12] default - disable: lock acquired --> Disable 2 started
  <dbg> [1726566353.688695] [modem0] [operation 12] default - disable: lock released --> Disable 2 finished
  <dbg> [1726566353.718237] [modem0] [operation 13] default - enable:  scheduled     --> Enable 3 requested
  <dbg> [1726566353.718417] [modem0] [operation 13] default - enable:  lock acquired --> Enable 3 started
  <dbg> [1726566353.937122] [modem0] [operation 14] default - disable: scheduled     --> Disable 3 requested
  <dbg> [1726566353.970791] [modem0] [operation 13] default - enable:  lock released --> Enable 3 finished
  <dbg> [1726566353.970964] [modem0] [operation 14] default - disable: lock acquired --> Disable 3 started
  <dbg> [1726566354.170938] [modem0] [operation 14] default - disable: lock released --> Disable 3 finished
2024-09-30 07:55:05 +00:00
Aleksander Morgado 8e0cbd9c94 base-modem: remove support for parallel enable/disable operations
Follow up changes will introduce support to run exclusive enable and
disable operations, effectively ensuring that only one enabling or
disabling task is processed at any given time, so the support for
completing parallel operations with the same result is no longer
needed.

That logic was anyway flawed, as it did not consider complex cases
like a disable request received between two enable requests, the order
of incoming requests was not maintained.

The main reason for adding the parallel enable/disable operation logic
was for the case where 2 separate users tried to enable the modem at
the same time. In that case, we did not want to run 2 separate
enabling operations from scratch, and completing one would complete
the second one as well. With the new operation lock logic, the same
result is achieved, as the 2nd enabling operation would find the modem
already enabled, if the 1st one succeeded.

This removal is done before introducing the new exclusive operation
support in the enable/disable path in order to make it easier and more
consistent with other operations that will also be included in the
synchronization.
2024-09-30 07:55:05 +00:00
Aleksander Morgado a24a6ee4c5 base-modem: add setup to allow exclusive operations
There are certain operations that cannot be run in parallel, e.g. one
should not disable and bring the modem to low power mode while there
are also incoming requests to enable the modem. This type of errors
will typically happen when multiple DBus clients are trying to use the
same modem at the same time for different purposes.

We do not have any way to have DBus clients take exclusive ownership
of a given modem object, so the best we can do for now is trying to
synchronize operations that cannot be run together, preserving the
order in which they arrived, and running them one by one.
2024-09-30 07:54:56 +00:00
Aleksander Morgado 8e8e88b75d broadband-modem: update modem state before disabling task is completed
The modem state property update was happening at disabling task context
free time, after the actual task completion has happened.

Avoid wrong assumptions on the modem state value in operations
scheduled after the task completion, in the same way as done in the
enabling sequence.
2024-09-30 07:51:53 +00:00
Aleksander Morgado a1f8045c53 build: require libmbim 1.31.5
We need a newer libmbim to handle the MBIM_CID_QDU_COMMAND operation
introduced for AT over MBIM in Quectel modems.

Fixes https://gitlab.freedesktop.org/mobile-broadband/ModemManager/-/issues/892
2024-09-20 09:31:05 +00:00
Aleksander Morgado a1214b5fd5 build: unstable release version bump to 1.23.11 2024-09-16 09:19:23 +00:00
Aleksander Morgado a1f2d8c99b broadband-modem-mbim: log hex value of IP type if unknown
The L850 seems to report 0xFFFFFFFF as MbimContextIpType value, which
is not a correct value.

Instead of printing "(none)" (the default used by glib when trying to
print a NULL pointer as a string), make it so that we end up printing
the actual numeric value in hex.

   <dbg> [modem0] 'home' settings found at configuration index 0
   <dbg> [modem0] 'non-partner' settings found at configuration index 1
   <dbg> [modem0] 'partner' settings not found
   <dbg> [modem0] updates in the home LTE attach configuration settings:
   <dbg> [modem0]   ip type: 'unknown (0xffffffff)' -> ''ipv4v6'
   <dbg> [modem0] updates in the partner LTE attach configuration settings:
   <dbg> [modem0]   none (skipped)
   <dbg> [modem0] updates in the non-partner LTE attach configuration settings:
   <dbg> [modem0]   none
2024-09-11 11:01:19 +00:00
Aleksander Morgado 4748ebf300 broadband-modem-mbim: update all home/partner/non-partner LTE attach settings
Instead of updating the attach settings associated with the home
network, update all three to the same values, so that network attach
while roaming uses the same settings as in home.

This is a major change in behavior; if there is ever a need to roll
back to the old behavior because a given device doesn't support this,
we can provided device-specific behaviors using the
load_set_initial_eps_bearer_settings_mask() virtual method.
2024-09-11 11:01:18 +00:00
Aleksander Morgado 8a5aab8be5 fibocom: L850 specific hack when using an AT&T 310280 SIM card
L850 modems running a firmware version less than 18500.5001.0.7 and
using AT&T SIM cards with MCCMNC 310280 do not support specifying
"partner" settings in the MBIM operation to set the LTE attach
configuration.
2024-09-11 11:01:18 +00:00
Aleksander Morgado 58f25ec5f9 broadband-modem-mbim: rework the logic to set LTE attach configuration
The ModemManager API provides a single method to update the attach
settings used in LTE registration, but in the MBIM protocol there are
three different distinct configurations associated with that
operation.

Until now we have exclusively updated the "home" settings, leaving the
"partner" and "non-partner" settings untouched (i.e. we loaded the
existing settings for these sections, and used the same ones when
providing our update operation).

Unfortunately, this logic does not fit all needs. Some modems will
require all 3 elements to be unconditionally updated, and some other
modems may need to fully skip one of the configuration sections.

The rework done in this commit does not change the behavior, but
provides the ability for subclasses to modify how the operation is
done, via a set of flags that is provided on each update attempt (as
sometimes the behavior is operator-specific).
2024-09-11 11:01:18 +00:00
Aleksander Morgado a5c15ec7d8 broadband-modem-mbim: rework home settings lookup in LTE attach config response
We look for the home settings, but also allow to optionally lookup for
the partner and non-partner settings, logging in each case if we find
anomalies (e.g. if not found or if found duplicated entries).
2024-09-11 11:01:18 +00:00
Aleksander Morgado 9d4eb8f1ba modem-helpers-mbim: minor coding style fix 2024-09-11 11:01:18 +00:00
Aleksander Morgado 096455947a mtk: never reload TX/RX stats in FM350
The device always reports empty TX/RX values so there is no point in
periodically asking.

The logic to poll for stats is kept in place only if the device
requires the IP packet filters removal hack.
2024-08-29 10:07:43 +00:00
Aleksander Morgado 2b3f4f22c2 fibocom: NL668 ttys are managed by the option driver
So they are ttyUSB instead of ttyACM.
2024-08-23 16:26:34 +00:00
Aleksander Morgado e30ed1bc47 fibocom: add L850 AT port hints
Just so that we make sure no other probing type is tried with them.
2024-08-23 16:24:37 +00:00
Aleksander Morgado 04b3a3f01c build: unstable release version bump to 1.23.10 2024-08-21 17:52:24 +00:00
Aleksander Morgado 8ff4b3638f modem-helpers-qmi: map the DUN/tethering APN type
libqmi version is bumped to 1.35.6, which is the unstable tag that
includes the new symbols.
2024-08-21 17:04:38 +00:00
Aleksander Morgado e685479a6e build: reorder netprisma plugin alphabetically 2024-08-02 14:40:12 +00:00
Aleksander Morgado e1d0bd0a64 netprisma: remove serial modems support 2024-08-02 14:38:03 +00:00
Aleksander Morgado 14192af87e build: unstable release version bump to 1.23.9 2024-07-26 16:35:18 +00:00
Aleksander Morgado 79b0696a74 Revert "fibocom: disable CPOL features in NL668"
This reverts commit f7b351fc85.

The whole AT over MBIM support is disabled in the NL668.
2024-06-21 10:00:36 +00:00
Aleksander Morgado 06ccd09bef fibocom: disable AT over MBIM in NL668
The AT over MBIM support is exposed as a supported service, but the
underlying implementation is not good enough.
2024-06-21 09:57:19 +00:00
Aleksander Morgado f7b351fc85 fibocom: disable CPOL features in NL668
Running +CPOL? in the NL668 using AT over MBIM seems to trigger a
firmware crash. Let's disable the feature altogether in this device
for this reason.
2024-06-19 13:16:43 +00:00
Aleksander Morgado 79ad16e32b build: unstable release version bump to 1.23.8 2024-06-14 09:16:08 +00:00
Aleksander Morgado b3277a8563 port-mbim-fibocom: fix duplicated GError free 2024-05-30 08:46:54 +00:00
Aleksander Morgado 5ea26af0e4 rolling: new plugin
This plugin provides support for modems from Rolling Wireless. The
current approach is to re-use the AT-based and MBIM-based specific
modem implementations from the Fibocom plugin.

Based on an original implementation from:
vanillan wang <vanillanwang@163.com>

See https://gitlab.freedesktop.org/mobile-broadband/ModemManager/-/merge_requests/1170
2024-05-29 10:14:39 +00:00
Aleksander Morgado 800c2bb02a fibocom: MBIM in shared utils is optional 2024-05-29 09:50:05 +00:00
Aleksander Morgado 33649756f5 build: remove unnecessary shared dependency info from plugin option definitions 2024-05-29 09:50:05 +00:00
Aleksander Morgado 6c92749d20 broadband-modem-cinterion: use generic initial EPS bearer management logic
The Cinterion specific implementation relies on the generic one but
adds the authentication information support using ^SGAUTH.

The loading of the initial EPS bearer status (i.e. the one agreed with
the network, not the settings) no longer has any Cinterion specific
behavior. The auth settings are NOT reported in the initial EPS bearer
status.
2024-05-29 09:08:18 +00:00
Aleksander Morgado 9fcff66406 broadband-modem: allow subclassing initial eps bearer cid selection 2024-05-29 09:08:13 +00:00
Aleksander Morgado a063e2a15c fibocom: remove custom initial EPS bearer management
The implementation in the generic MMBroadbandModem object should fit
well instead of the custom implementation.

There is also no need to specify via udev tags which is the initial
EPS bearer context id, we try to automatically guess it in runtime.
2024-05-29 09:05:23 +00:00
Aleksander Morgado e7492270c2 broadband-modem: implement setting initial EPS bearer settings 2024-05-29 09:05:22 +00:00
Aleksander Morgado 471656addf broadband-modem: implement loading initial EPS bearer info 2024-05-29 09:05:22 +00:00
Aleksander Morgado 97cab9f37e broadband-modem: implement loading initial EPS bearer settings
The main issue here is how to select the id of the context that is
used for attach in the modem.

We will assume that the lowest cid value for the IP range returned in
the CGDCONT=? test is the one used for the attach context. This
assumption works with modems following the 3GPP specs (with cid=0) and
also in Qualcomm based modems (with cid=1).
2024-05-29 09:05:04 +00:00
Aleksander Morgado 50755b07d3 cli,3ppp: allow updating EPS settings before enabling 2024-05-29 08:14:13 +00:00
Aleksander Morgado 1263905753 cinterion: remove custom logic to power down modem before initial EPS bearer settings update 2024-05-29 08:14:12 +00:00
Aleksander Morgado cf1035169c fibocom: remove custom logic to power down modem before initial EPS bearer settings update
This is now done for all modems unconditionally.
2024-05-29 08:14:03 +00:00
Aleksander Morgado 1f508a8e1b broadband-modem-qmi: remove custom logic to power down modem before initial EPS bearer settings update 2024-05-29 08:02:40 +00:00
Aleksander Morgado fa169bda9f iface-modem-3gpp: power down before updating initial EPS bearer settings
Before the operation to update the current initial EPS bearer
settings, we will now unconditionally put the modem in low power
mode. so that when the next network registration happens we are sure
the new settings are in place.

This approach was previously applied already to all QMI-based modems
as well as to all Fibocom modems. The approach applies now to all
modems of all vendors and in all control protocols.
2024-05-29 08:02:40 +00:00
Aleksander Morgado c5b9effdc7 iface-modem: allow reporting the previous power state after an update
Let the caller of mm_iface_modem_set_power_state() know which was the
power state in the device before the actual update happened.

This is useful in cases where we want to temporarily switch to a given
power state (e.g. low) before returning to the original power state.
2024-05-29 08:02:40 +00:00
Aleksander Morgado e215f644d6 huawei: trivial: remove trailing whitespaces 2024-05-29 08:01:36 +00:00
Aleksander Morgado e01eac5bfe test: longer timeout to wait for modem in test fixture
If the system running the test is under heavy load, the modem may need
time to get exposed. Just bump the timeout to a long enough value.
2024-05-17 08:36:43 +00:00
Aleksander Morgado 6a60543495 mtk: FM350 multiplexing support is checked in runtime
This was introduced in 2f306e8e7c
2024-05-17 08:12:47 +00:00
Aleksander Morgado 378d28118b build: unstable release version bump to 1.23.7 2024-05-13 11:29:21 +00:00
Aleksander Morgado 48e2452754 broadband-modem-mbim: add support for MS extensions device reset 2024-05-13 09:43:46 +00:00
Aleksander Morgado 0bb31c3e8b plugin-manager: fix comment specifying which context should exist 2024-05-10 10:27:57 +00:00
Aleksander Morgado e77c644ce2 kernel-device-generic: plug memleak when processing platform ports
ptr_array_add_sysfs_attribute_link_basename() already reads the
current subsystem, so we should avoid overwriting the pointer.

  ==1630== 13 bytes in 2 blocks are definitely lost in loss record 270 of 3,092
  ==1630==    at 0x4842839: malloc (in /usr/libexec/valgrind/vgpreload_memcheck-amd64-linux.so)
  ==1630==    by 0x4A1DDE8: g_malloc (in /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0.6800.1)
  ==1630==    by 0x4A329E3: g_strdup (in /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0.6800.1)
  ==1630==    by 0x26128E: ptr_array_add_sysfs_attribute_link_basename (mm-kernel-device-generic.c:244)
  ==1630==    by 0x263FD0: preload_contents_platform (mm-kernel-device-generic.c:314)
  ==1630==    by 0x263FD0: preload_contents (mm-kernel-device-generic.c:549)
  ==1630==    by 0x263FD0: check_preload (mm-kernel-device-generic.c:992)
  ==1630==    by 0x263FD0: initable_init (mm-kernel-device-generic.c:1139)
  ==1630==    by 0x4B6DDB9: g_initable_new_valist (in /usr/lib/x86_64-linux-gnu/libgio-2.0.so.0.6800.1)
  ==1630==    by 0x4B6DE6C: g_initable_new (in /usr/lib/x86_64-linux-gnu/libgio-2.0.so.0.6800.1)
  ==1630==    by 0x262087: mm_kernel_device_generic_new_with_rules (mm-kernel-device-generic.c:1054)
  ==1630==    by 0x17F66F: handle_kernel_event (mm-base-manager.c:689)
  ==1630==    by 0x17F7D2: report_kernel_event_auth_ready (mm-base-manager.c:1238)
  ==1630==    by 0x4BA37D8: ??? (in /usr/lib/x86_64-linux-gnu/libgio-2.0.so.0.6800.1)
  ==1630==    by 0x4BA3A1A: ??? (in /usr/lib/x86_64-linux-gnu/libgio-2.0.so.0.6800.1)
2024-05-10 10:27:07 +00:00
Aleksander Morgado 405e7a6012 broadband-modem-mbim: add missing MBIM port header 2024-05-09 14:11:10 +00:00
Aleksander Morgado 35292eec2f base-sim: avoid printing IMSI/ICCID and others twice
The logic initializing the SIM object already prints the loaded
fields, taking into account that some of them should be treated as
personal info (so redacted by default).

   [modem0/sim0] loaded SIM identifier: 8988211000000123456
   [modem0/sim0] loaded SIM identifier: ###
   [modem0/sim0] loaded IMSI: 901700000012345
   [modem0/sim0] loaded IMSI: ###
2024-05-08 21:49:54 +00:00
Aleksander Morgado 218d6d2c58 shared-simtech: use G_DECLARE|DEFINE_INTERFACE() macros 2024-05-06 13:45:39 +00:00
Aleksander Morgado 4afb6a3172 shared-cinterion: use G_DECLARE|DEFINE_INTERFACE() macros 2024-05-06 13:45:39 +00:00
Aleksander Morgado e4e6857aed shared-quectel: use G_DECLARE|DEFINE_INTERFACE() macros 2024-05-06 13:45:39 +00:00
Aleksander Morgado 18a084940a shared-option: use G_DECLARE|DEFINE_INTERFACE() macros 2024-05-06 13:45:39 +00:00
Aleksander Morgado 5a9634773b shared-fibocom: use G_DECLARE|DEFINE_INTERFACE() macros 2024-05-06 13:45:39 +00:00
Aleksander Morgado acca9dc9ec shared-xmm: use G_DECLARE|DEFINE_INTERFACE() macros 2024-05-06 13:45:39 +00:00
Aleksander Morgado b34d547d9c shared-telit: use G_DECLARE|DEFINE_INTERFACE() macros 2024-05-06 13:45:39 +00:00
Aleksander Morgado 1c919890c6 iface-modem-cdma: use G_DECLARE|DEFINE_INTERFACE() macros 2024-05-06 13:45:39 +00:00
Aleksander Morgado 92a89efd02 iface-modem-oma: use G_DECLARE|DEFINE_INTERFACE() macros 2024-05-06 13:45:39 +00:00
Aleksander Morgado 0f48695d54 iface-modem-voice: use G_DECLARE|DEFINE_INTERFACE() macros 2024-05-06 13:45:38 +00:00
Aleksander Morgado 074277ca1a iface-modem-time: use G_DECLARE|DEFINE_INTERFACE() macros 2024-05-06 13:45:38 +00:00
Aleksander Morgado bec62a406c iface-modem-signal: use G_DECLARE|DEFINE_INTERFACE() macros 2024-05-06 13:45:38 +00:00
Aleksander Morgado 0a91a6035b iface-modem-simple: use G_DECLARE|DEFINE_INTERFACE() macros 2024-05-06 13:45:38 +00:00
Aleksander Morgado cc2f1317b3 iface-modem-sar: use G_DECLARE|DEFINE_INTERFACE() macros 2024-05-06 13:45:38 +00:00
Aleksander Morgado 070975736f iface-modem-messaging: use G_DECLARE|DEFINE_INTERFACE() macros 2024-05-06 13:45:38 +00:00
Aleksander Morgado aa94b21e0a iface-modem-location: use G_DECLARE|DEFINE_INTERFACE() macros 2024-05-06 13:45:38 +00:00
Aleksander Morgado e535c90f5f iface-modem-firmware: use G_DECLARE|DEFINE_INTERFACE() macros 2024-05-06 13:27:05 +00:00
Aleksander Morgado 2b7e738b9b iface-modem-3gpp-ussd: use G_DECLARE|DEFINE_INTERFACE() macros 2024-05-06 13:27:04 +00:00
Aleksander Morgado f033a0a9f2 iface-modem-3gpp-profile-manager: use G_DECLARE|DEFINE_INTERFACE() macros 2024-05-06 13:27:04 +00:00
Aleksander Morgado ab6e4bf391 iface-modem-3gpp: use G_DECLARE|DEFINE_INTERFACE() macros 2024-05-06 13:27:04 +00:00
Aleksander Morgado 35c0a6905b iface-modem: use G_DECLARE|DEFINE_INTERFACE() macros 2024-05-06 13:27:04 +00:00
Aleksander Morgado 9aab129759 iface-port-at: use G_DECLARE|DEFINE_INTERFACE() macros 2024-05-06 13:27:04 +00:00
Aleksander Morgado 1e26e16168 broadband-modem-qmi-quectel: fix task completion when not enabling profile manager events
Fixes e3024ec620
2024-05-06 13:24:22 +00:00
Aleksander Morgado 95099a3ef4 device: launch modem initialization after reprobe
The mm_device_create_modem() was updated so that it would not run the
modem initialization implicitly. Due to this change, we must ensure
the modem initialization is run after a modem reprobe operation,
e.g. when switching SIM slots.

The logic to run the modem initialization is moved to MMDevice for
simplicity and clarity.

Fixes: 04d826f563
2024-04-29 09:45:06 +00:00
Aleksander Morgado c66a6b89ec fibocom: create custom MBIM port object with potential AT support 2024-04-23 07:25:12 +00:00
Aleksander Morgado 586f98f71d fibocom: change parent class peeker method
Use the more generic MMBaseModemClass instead of MMBroadbandModemClass.
2024-04-23 07:25:12 +00:00
Aleksander Morgado 6980f2ff6a port-mbim: preload supported services and allow querying 2024-04-23 07:25:12 +00:00
Aleksander Morgado 0d11ff8566 base-modem: allow subclassing tty/usbmisc/wwan port creation
So that plugins can provide their own implementations as needed.
2024-04-23 07:25:12 +00:00
Aleksander Morgado 939be0fbf8 base-modem: support non-serial ports when peeking the best AT port
When we don't care about the type of AT port to use, prefer the QMI or
MBIM based ones if any available.
2024-04-23 07:25:12 +00:00
Aleksander Morgado 480e12c34e base-modem-at: switch to use the MMIfacePortAt by default
The whole codebase is updated to assume the MMBaseModem AT operations
require an object implementing the MMIfacePortAt interface, instead of
a MMPortSerialAt object.

In the places where we know the port is a MMPortSerialAt, e.g. when we
query explicitly for the primary or secondary serial AT port, we will
use an explicit MM_IFACE_PORT_AT() cast when calling the AT command
method.

In the places where we get_best_at_port() we're going to assume that
we don't know the port type. This method will be updated in a follow
up commit to support the MMIfacePortAt interface as well.
2024-04-23 07:25:12 +00:00
Aleksander Morgado 67a0af3575 base-modem-at: switch internals to use MMIfacePortAt 2024-04-23 07:25:12 +00:00