Commit Graph

8619 Commits

Author SHA1 Message Date
Aleksander Morgado
470dff235c broadband-modem-mbim: use MBIMEx v2 signal loading explicitly if supported 2023-05-11 11:18:56 +00:00
Aleksander Morgado
d3deb0ef0b iface-modem-signal: launch explicit signal query after setting up thresholds 2023-05-11 11:15:20 +00:00
Aleksander Morgado
1564b54cff broadband-modem-mbim: non-zero interval when enabling thresholds
Fix bug in Fibocom FM350 modem where a non-zero signal strength
interval needs to be configured as part of threshold setup.

Fixes #733
2023-05-11 11:13:35 +00:00
Aleksander Morgado
ecea0a16e1 sierra: port type hints for RC7611 2023-05-11 11:02:31 +00:00
Aleksander Morgado
45c7ad1e56 Revert "iface-modem-signal: send a query after threshold set up"
This reverts commit 17ed63637f.

We were reusing the signal_state_query_ready() callback in the wrong
way.
2023-05-10 19:58:07 +00:00
Nagi Marupaka
17ed63637f iface-modem-signal: send a query after threshold set up
After the setup of threshold for signal state notifications, trigger a
query of the current signal state values.
2023-05-10 09:02:16 +00:00
Sebastian Krzyszkowiak
9007d7999d broadband-modem-qmi: enable/disable messaging AT unsolicited events too
When the host is resuming from system suspend, QMI indications
sent by the modem at resume time can be lost. The exact reason why it
happens is still unknown. Until this is fixed, ModemManager currently
workarounds that in QMI mode by listening and reacting to AT URCs too,
which are being received reliably. In order to achieve that,
messaging_setup_unsolicited_events chains the parent's implementation
with its own, effectively setting up handlers for both AT and QMI
channels.

This worked fine on modems such as EG25 which enable SMS indications
by default. However, some modems, such as BM818, don't have these
indications enabled on boot and don't report incoming messages via AT
unless requested via AT+CNMI.

To make SMS handling on resume reliable on such modems, make sure
that MMBroadbandModemQmi also enables/disables unsolicited events
in the same way it already sets up handlers for them.

Signed-off-by: Sebastian Krzyszkowiak <dos@dosowisko.net>
2023-05-10 08:58:13 +00:00
Maxim Anisimov
7f476c2e27 libmm-glib,location-3gpp: fix conversion to gulong in mm_location_3gpp_new_from_string_variant
Signed-off-by: Maxim Anisimov <maxim.anisimov.ua@gmail.com>
2023-05-09 09:15:12 +00:00
Aleksander Morgado
2455981ad6 build: unstable release version bump to 1.21.6 2023-05-03 19:59:37 +00:00
Aleksander Morgado
f3cdafb746 shared-qmi: don't assume cancellation signal handler is setup in the registration wait
The cancellation_id will not be set if the cancellable is already
cancelled by the time g_cancellable_connect() is called.
2023-05-03 14:25:51 +00:00
Aleksander Morgado
28eec45dbb shared-qmi: ensure cancellation is setup last in the registration wait
register_in_network_cancelled() may be called early if the given
cancellable is already cancelled, and if so, we want it to remove the
timeout and signal handler, which should have been configured before
setting up the cancellation signal handler.
2023-05-03 14:21:31 +00:00
Aleksander Morgado
5bd8bbb408 broadband-modem-mbim: group together all runtime state while enabled in its own struct 2023-05-03 13:00:47 +00:00
Aleksander Morgado
60735b2ea0 bearer-list: rename variables in the foreach contexts
So that the variable names in each context identify the action being
performed, to easier reading.
2023-05-03 12:42:09 +00:00
Aleksander Morgado
2895a4bb52 broadband-modem-mbim: ignore registration set error if NwError=0 reported
Returning an error in the registration set request completely breaks
the async operation requesting the explicit registration, even if the
modem may have already been registered via indications while waiting
for the set request to be completed.

We now ignore the registration set error if it returns a generic
failure with NwError=0, as in certain Qualcomm based devices. We
ignore unconditionally, without explicitly checking if we're
registered or not, because the upper logic will anyway do that.

Fixes https://gitlab.freedesktop.org/mobile-broadband/ModemManager/-/issues/723
2023-05-03 12:38:43 +00:00
Aleksander Morgado
f922a6be2d broadband-modem-mbim: ensure cached state info is reseted on disable
So that it is reloaded fresh once re-enabled, otherwise we may be
using stale state values that are not in sync with the state reported
in the interface skeletons.
2023-05-03 12:38:43 +00:00
Aleksander Morgado
22c4d88a24 iface-modem-3gpp: skip interface updates if it's disabled
E.g. we don't want to update the 3GPP registration state to "idle" if
the interface has already been disabled:

   <msg> [1681814812.903723] [modem0] 3GPP registration state changed (idle -> unknown)
   <inf> [1681814812.903842] [modem0] consolidated registration state: cs 'idle', ps 'idle', eps 'idle', 5gs 'unknown' --> 'unknown'
   <dbg> [1681814812.906194] [modem0] disabling the Modem interface...
   <inf> [1681814812.911148] [modem0] disabled modem
   <dbg> [1681814812.913453] [ttyACM0/at] device open count is 0 (close)
   <dbg> [1681814812.913629] [ttyACM0/at] closing serial port...
   <dbg> [1681814812.915559] [ttyACM0/at] serial port closed
   <msg> [1681814812.916569] [modem0] state changed (disabling -> disabled)
   <dbg> [1681814868.945069] [/dev/cdc-wdm4] number of consecutive timeouts: 1
   <msg> [1681814868.950724] [modem0] 3GPP registration state changed (unknown -> idle)
   <inf> [1681814868.950885] [modem0] consolidated registration state: cs 'idle', ps 'idle', eps 'idle', 5gs 'unknown' --> 'idle'
   <msg> [1681814868.951797] [modem0] state changed (disabled -> enabled)
   <dbg> [1681814868.955740] [modem0] registration in network: cancelled
   <wrn> [1681814868.958562] [modem0] registration in network failed: Operation was cancelled
2023-05-03 12:38:43 +00:00
Aleksander Morgado
e1691780f7 iface-modem-3gpp: coding style updates in initialization sequence 2023-05-03 12:38:43 +00:00
Aleksander Morgado
db6b45fa10 iface-modem-3gpp: coding style changes in initial EPS bearer update logic 2023-05-03 12:38:43 +00:00
Aleksander Morgado
8198a04f1a iface-modem-simple: improve logging and cancellability in network registration sequence 2023-05-03 12:38:43 +00:00
Aleksander Morgado
ef1887df05 iface-modem-3gpp: coding style updates in enabling/disabling sequences 2023-05-03 12:38:43 +00:00
Aleksander Morgado
d906443eee broadband-modem: explicitly abort ongoing attempt when disabling 2023-05-03 12:38:43 +00:00
Aleksander Morgado
200f827d38 bearer-list: new common method to disconnect one or all bearers 2023-05-03 12:38:43 +00:00
Aleksander Morgado
acc98e43ba iface-modem-3gpp: allow cancelling the wait for packet service state
When a request to disable the modem arrives while the packet service
state wait is ongoing we were not correctly cancelling the operation.
The main reason for this is that this operation does not change the
modem state, and so the "wait for final state" logic in the disabling
sequence was not being considered.

We solve this by plugging in the Simple.Connect() operation
cancellable in the wait for packet service state operation. The
connection attempt will be cancelled during the disabling sequence as
well, and when that happens we will explicitly halt the packet service
state wait as well.
2023-05-03 12:38:43 +00:00
Aleksander Morgado
b9a7cad247 iface-modem-3gpp: minor rename of variables 2023-05-03 12:27:21 +00:00
Aleksander Morgado
d77674d3f4 broadband-modem-qmi: use DSD system status to report packet service state
We now support modem-reported packet service state, instead of
guessing it in the 3GPP interface logic.

The DSD system status reporting a valid access technology is an
indication that the packet service is ready. Instead of holding back
the registration status until the DSD system status reports a valid
value, we will now report the modem as registered, and bind the DSD
system status exclusively to the packet service status.

In the simple connection attempt we're already waiting first for being
registered, and then for being attached in PS.
2023-05-03 12:27:20 +00:00
Aleksander Morgado
22ac850eb6 broadband-modem-mbim: minor refactor in speeds reporting 2023-05-03 12:27:20 +00:00
Aleksander Morgado
6b05e268e0 broadband-modem-mbim: report packet service state updates
Use the Packet Service messages to report the state of PS domain,
instead of guessing.
2023-05-03 12:27:20 +00:00
Aleksander Morgado
45406e78e2 iface-modem-3gpp: don't guess packet service state if modem can report it
In certain protocols like QMI or MBIM we may be able to report an
exact packet service state, so there is no need to guess it, as the
guess may not always be right.

The logic will track automatically whether modem-reported packet
service states are available, and use them if so. Otherwise, it'll try
to guess as we were doing before (e.g. if registered in EPS, packet
service is considered attached).
2023-05-03 12:12:18 +00:00
Aleksander Morgado
bf2843ad77 libmm-glib: separate files for flags and enums types
This allows us to skip needing to include the non-existent
build_string_from_mask() or get_string() counterparts in the
documentation index.
2023-04-27 12:23:04 +00:00
Aleksander Morgado
fdf03f9b2c build-aux,mkenums: use mixed enums+flags template without docs in daemon 2023-04-27 12:23:04 +00:00
Aleksander Morgado
efcfce02a9 build-aux,mkenums: import custom mkenums tool from libqmi/libmbim
We're going to use certain new features included in the custom tool.
2023-04-27 12:23:04 +00:00
Andrew Lassalle
549e2f5118 iface-modem-3gpp: don't compare profile-name on attach APNs
When a request to set a new eps bearer settings is received, ignore the
profile-name when comparing the previous configuration with the new one,
since the modem's profile might already have a name that won't match the
settings provided by the user. Profile names are used in QMI modems.
If the profile name does not match the existing one, the modem will
detach and reattach to the network.
2023-04-19 19:10:12 +00:00
Aleksander Morgado
1a133dca5e helpers-mbim: fix MMSignal selection based on data class
MbimDataClass is a flags bitmask, not an enumeration.

This logic was broken if the reported data class was e.g. 4G+5GNSA.
2023-04-19 11:32:01 +00:00
Aleksander Morgado
552359b57e docs: update copyright 2023-04-14 08:50:38 +00:00
Aleksander Morgado
c0e613ee35 daemon: update copyright 2023-04-14 08:49:29 +00:00
Aleksander Morgado
19b910b60f cli: update copyright 2023-04-14 08:48:35 +00:00
Aleksander Morgado
7e0663f922 udev: new ID_MM_REQUIRED tag
Users with QMI or MBIM capable modems may want to ensure that these
are never managed using plain AT commands, as that also involves using
PPP. This fallback to AT could happen if the QMI or MBIM port probing
fails for whatever reason.

The new `ID_MM_REQUIRED` udev tag allows specifying that a given port
MUST be successfully grabbed when creating a new modem object, or
otherwise the modem object will not be created at all (even if there
are other fallback control ports like AT that could have been used).

Use this tag with caution.

It is assumed that when this tag is used some other external process
may be monitoring the existence of the modem object in DBus as exposed
by ModemManager, and if it does not appear for any reason then the
modem would be reseted with some other mechanism (e.g. GPIOs, if
available). If no such mechanism to autorecover the modem is in place,
using this tag may leave the modem exposed in the kernel but ignored
by ModemManager.

This tag must be applied on the specific port for which the existence
and usability must be ensured.

E.g. flagging the MBIM port of the Fibocom L850 module as required:

   $ vim /lib/udev/rules.d/78-mm-test.rules
   ACTION!="add|change|move|bind", GOTO="mm_test_rules_end"
   SUBSYSTEMS=="usb", ATTRS{bInterfaceNumber}=="?*", ENV{.MM_USBIFNUM}="$attr{bInterfaceNumber}"
   ATTRS{idVendor}=="2cb7", ATTRS{idProduct}=="0007", ENV{.MM_USBIFNUM}=="00", ENV{ID_MM_REQUIRED}="1"
   LABEL="mm_test_rules_end"

   $ sudo udevadm control --reload
   $ sudo udevadm trigger

   $ sudo udevadm info -p /sys/class/usbmisc/cdc-wdm0
   ...
   E: ID_MM_REQUIRED=1
   E: ID_MM_CANDIDATE=1
2023-04-13 11:54:04 +00:00
Aleksander Morgado
79b15cf87c plugin: refactor how list of probe flags is built
To make it clearer that the initial list of flags must be the one
based on which ones are expected in the subsystem and which one the
plugin is requesting.
2023-04-13 11:54:03 +00:00
Aleksander Morgado
cb2dea5dc4 port-probe: perform auto detection of port type hints for wwan
We can remove the port type hint udev tags for the wwan subsystem, as
that logic is now incorporated in the port type hint processing logic
in the daemon itself.

This makes it clearer to know what exact hints are being used, as the
logic is in a single place and it has proper logging of all possible
cases.
2023-04-13 11:53:54 +00:00
Aleksander Morgado
e77df40b68 port-probe: perform auto detection of port type hints for cdc_wdm
Do not do this in the plugin; instead, do it along with the logic that
looks for port type hints in udev, so that we can properly warn if
things don't match.
2023-04-13 11:53:03 +00:00
Aleksander Morgado
131e783a5f port-probe: improve logging of detected port type hints in udev tags
Explicitly log when a tag is found, and also warn if too many por type
hints are provided in the same port.
2023-04-13 11:49:19 +00:00
Aleksander Morgado
585d2af713 port-probe: simplify AT port type hints handling
When processing the hints for port probing we don't care if the AT
port is flagged as primary or secondary.
2023-04-13 11:44:50 +00:00
Marcus Folkesson
5406abc187 sierra: add port hints for HL7812
Signed-off-by: Marcus Folkesson <marcus.folkesson@gmail.com>
2023-04-13 08:23:09 +00:00
Aleksander Morgado
9c5989f116 port-serial: close_force() may dispose the last object reference 2023-04-12 14:58:59 +02:00
Lubomir Rintel
42048cb2fc build: align GLIB_VERSION_MIN_REQUIRED with glib version we actually require
Now that we've dealt with everything that has been deprecated since
glib-2.44 until glib-2.56 (which we check), we can enable warnings that
guard against using the deprecated constructs.
2023-04-11 13:49:03 +00:00
Lubomir Rintel
0c1ad4eb77 base-modem-at: use better names for pairs of dependent cancellables
We cancel AT commands (or sequences) on cancellation of the modem's
cancellable as well as of the optional user-provided one.

However, the GTask can be associated with only one. That's okay if the
user didn't supply one -- we just use the modem's cancellable only.
Otherwise we chain the cancellables together (also cancel the user one
with the modem one) at cost of some extra complexity.

This aims to make the above a little clearer by using hopefully
better names.

Suggested-by: Aleksander Morgado <aleksandermj@chromium.org>
2023-04-11 13:49:03 +00:00
Lubomir Rintel
da55fa769e base-modem-at: make abort_task_if_port_unusable() unref the GTask
Aleksander seems to prefer it this way. Looks better.

Suggested-by: Aleksander Morgado <aleksandermj@chromium.org>
2023-04-11 13:49:03 +00:00
Lubomir Rintel
f0a77a2292 base-modem: remove mm_base_modem_get_cancellable()
No users left for the getter that takes a reference after a port of
MMBaseModemAT to GTask.

peek_cancellable() is used instead, because the GTask constructor
takes a reference itself.
2023-04-11 13:49:03 +00:00
Lubomir Rintel
476cb2bbc2 base-modem-at: port mm_base_modem_at_{command,sequence}_full() to GTask
Use GTask API in place of the deprecated GSimpleAsyncResult.
2023-04-11 13:49:03 +00:00
Lubomir Rintel
189606a8f3 port-serial-at: port mm_port_serial_at_command() to GTask
Use GTask API in place of the deprecated GSimpleAsyncResult.
2023-04-11 13:49:03 +00:00