Commit Graph
4489 Commits
Author SHA1 Message Date
Aleksander Morgado 442c722d48 sim-qmi: define common SIM file paths for MF and ADF 2022-08-19 15:53:43 +00:00
Aleksander Morgado f61061044b base-sim: add steps to load GID1 and GID2 during init 2022-08-19 15:53:43 +00:00
Stephan Gerhold 3df2c4f03c mm-bearer-qmi: allocate separate WDS client for each endpoint
Multiplexing currently does not work correctly for BAM-DMUX because
ModemManager reuses the same WDS client for all data points. A second
bearer can be created but it effectively disables the first one.

Fix this similar to the existing checks for the mux-id by including the
endpoint type and number in the QMI client flags.
2022-08-18 18:14:31 +02:00
Stephan Gerhold bc1cecbfc4 broadband-modem-qmi: choose endpoint number based on data port
At the moment the endpoint type/number is chosen based on the QMI
control port. The assumption is that multiplexing is implemented using
an additional protocol layer (e.g. QMAP) or that each network interface
has its own QMI control port.

This is not necessarily the case for BAM-DMUX. To use the built-in
multiplexing the WDS client must be bound to the correct data port.
This works already for older firmware versions using "Bind Data Port"
(SIO port numbers), but not for newer ones using "Bind Mux Data Port"
(endpoint type/interface numbers).

Make it work for newer firmware versions as well by choosing the
endpoint type/number based on the data port similar to the existing
implementation for SIO port numbers.

Note: The correct endpoint interface number is currently only used for
the steps in mm-bearer-qmi. Ideally more refactoring should be done in
mm-port-qmi to call WDA Set Data Format for each of the endpoints.
In practice it usually works fine without because the data format is
set correctly by default.
2022-08-18 18:12:49 +02:00
Stephan Gerhold 2b83e27474 broadband-modem-qmi: add missing error check for MHI
Now that peek_port_qmi_for_data_mhi() is a separate function it becomes
obvious that it looks different from all the others: There is no check
that a QMI port was actually found.

Add it similar to the one used for qmi_wwan.
2022-08-18 15:35:35 +02:00
Stephan Gerhold 23c027a7a9 broadband-modem-qmi: split up peek_port_qmi_for_data()
peek_port_qmi_for_data() is currently quite confusing to read because it
mostly covers qmi_wwan while the mhi_net case returns early. Split this
up into separate functions per driver to make it less confusing, similar
to the variant in mm-broadband-modem-qmi-qcom-soc.

No functional change.
2022-08-18 15:35:35 +02:00
Stephan Gerhold 8b8b5c22f7 bearer-qmi: Add fallback for firmware with broken "Bind Data Port"
"Bind Data Port" does not work correctly on newer platforms with
BAM-DMUX (e.g. MSM8909). It returns "device unsupported" even for
valid SIO port numbers.

As an alternative, it seems to be possible to use the newer "Bind *Mux*
Data Port" instead. This works even when QMAP multiplexing is disabled
(using WDA "Set Data Format"). In this case the mux-id seems to be
entirely ignored and can be a dummy value such as MUX_ID_UNBOUND.

Implement this by checking for the error code of "Bind Data Port"
and fallback to "Bind Mux Data Port" instead.

The important part in this case is that the endpoint type and interface
number are set correctly. At the moment this works only for the "wwan0"
interface because the endpoint information is currently maintained
globally as part of the QMI control port instead of being handled
separately per data/net port. Further refactoring is needed to enable
multiplexing on these platforms.
2022-08-18 13:13:25 +00:00
Stephan Gerhold 5cc34d5f86 port-qmi: Detect endpoint type based on net driver
At the moment the endpoint type and number for the QMI WDA calls are
chosen based on the subsystem of the QMI control port. This does not
work correctly for some configurations:

  - SUBSYS_QRTR currently implies ENDPOINT_TYPE_EMBEDDED, but this is
    only valid for QRTR+IPA configurations. For QRTR+BAM-DMUX the
    correct type is ENDPOINT_TYPE_BAM_DMUX.

  - SUBSYS_WWAN currently implies ENDPOINT_TYPE_PCIE, but there is
    already a comment that mentions that this selection works only for
    MHI/PCIe modems. SUBSYS_WWAN is also used by RPMSG+BAM-DMUX
    configurations in which case the correct type is also
    ENDPOINT_TYPE_BAM_DMUX.

Looking closer at these cases suggests that the endpoint type actually
refers to the data/net port and not the control port. It is more
reliable choose it based on the network driver and not the subsystem
of the control port.

Address this partially by choosing the endpoint type based on the
net_driver. Choosing the endpoint interface number correctly requires
more refactoring since most of the logic is currently handled globally
for a QMI control port, while it's actually specific to the chosen
data/net port in some cases (e.g. multiple BAM-DMUX network interfaces).
2022-08-18 09:05:58 +00:00
Aleksander Morgado 598b9ae639 dispatcher-fcc-unlock: remove unused variable
mm-dispatcher-fcc-unlock.c:100:27: warning: unused variable 'error' [-Wunused-variable]
          g_autoptr(GError) error = NULL;
                            ^
2022-08-17 16:23:33 +00:00
Aleksander Morgado 490a253033 broadband-modem-mbim: remove unused variables
mm-broadband-modem-mbim.c:8525:30: warning: unused variable 'message' [-Wunused-variable]
      g_autoptr(MbimMessage)   message = NULL;
                               ^
  mm-broadband-modem-mbim.c:8582:29: warning: unused variable 'message' [-Wunused-variable]
      g_autoptr(MbimMessage)  message = NULL;
                              ^
2022-08-17 14:08:30 +00:00
Aleksander Morgado 4aa33b8415 broadband-modem: remove unused variable
mm-broadband-modem.c:10703:23: warning: unused variable 'cmd' [-Wunused-variable]
      g_autofree gchar *cmd = NULL;
                        ^
2022-08-17 14:06:03 +00:00
Aleksander Morgado f6c1939f5c broadband-modem-mbim: remove context type comparison on disconnection reports
Since 1.18 the user can request a different APN type during the
connection attempt, which translates into a different context type in
the actual MBIM Connect Set request. Therefore, the context type of a
given connection is no longer always INTERNET.

Matching by the session id to report disconnections should be more
than enough, which also helps to cover the case where the modem
doesn't report the original context type used during the
attempt (e.g. reporting NONE unconditionally).

Fixes https://gitlab.freedesktop.org/mobile-broadband/ModemManager/-/issues/614
2022-08-16 16:40:16 +00:00
Aleksander Morgado d3ef860704 broadband-modem-mbim: fix typo 'proccessed'->'processed' 2022-08-15 20:31:54 +00:00
Daniele Palmas 15b031ce6d bearer-mbim: enable multiplex support for wwan devices 2022-08-11 09:48:38 +02:00
Aleksander Morgado c6921421da sleep-monitor-powerd: remove unused variables
mm-sleep-monitor-powerd.c: In function ‘signal_cb’:
  mm-sleep-monitor-powerd.c:81:14: error: unused variable ‘is_about_to_suspend’ [-Werror=unused-variable]
     81 |     gboolean is_about_to_suspend;
        |              ^~~~~~~~~~~~~~~~~~~
  mm-sleep-monitor-powerd.c: In function ‘on_pd_proxy_acquired’:
  mm-sleep-monitor-powerd.c:100:11: error: unused variable ‘owner’ [-Werror=unused-variable]
    100 |     char *owner;
        |           ^~~~~
2022-08-09 11:17:30 +02:00
Pavan Holla d9eb140b13 mm-sim-mbim: Fix compile failure if WITH_SUSPEND_RESUME is not set
Fixes 86f6d33513
2022-08-09 09:05:27 +00:00
Aleksander Morgado bb310526dc core, log: make libraries logging use the MM level and format
The log level of the libraries was not honoring the log level
configured in MM, so we would see debug messages reported even if the
default log level configured was INFO or MSG.

The format of the logs emitted by the libraries was also not following
the format of the rest of MM logs, e.g. they would not include timing
info in the logs which would make it hard to follow certain event
transitions.

Make the libraries logging use the ModemManager logging method, to fix
all those issues.
2022-08-05 17:11:34 +02:00
Aleksander Morgado 4cb8ca8f0b core,log: minor coding style changes 2022-08-05 17:11:31 +02:00
Aleksander Morgado 4a62ea3e84 broadband-modem-mbim: SIM slots ptr array should have GDestroyNotify
The SIM slots ptr array should have a proper GDestroyNotify, so that
whenever the array is unref-ed as part of the modem disposal logic,
the SIM objects (and the modem object references they keep) are also
unref-ed.

Fixes https://gitlab.freedesktop.org/mobile-broadband/ModemManager/-/issues/571
2022-08-04 17:58:55 +02:00
Aleksander Morgado a783d9f68a shared-qmi: minor rework SetPacketServiceState()
Port to using g_autoptr() so that we avoid the gotos.
2022-08-04 14:26:33 +00:00
Aleksander Morgado f58dcc832b iface-modem-3gpp: update packet service state in the interface
The skeleton property will be update automatically as they're bound.
2022-08-04 14:26:33 +00:00
Aleksander Morgado d82f0d5371 iface-modem-simple: wait for packet service state is 3GPP specific 2022-08-04 14:26:33 +00:00
Aleksander Morgado 9746600a12 broadband-modem-qmi: force IDLE state if PS registered but DSD RAT unavailable
We provide a consolidated method to update the PS/EPS/5GS registration
states, based on the actual state reported via NAS and the availabiity
or not of the DSD data RAT.

On this consolidated method, we now force the IDLE state for every
case where it would have been HOME/ROAMING if the data RAT reported
via the DSD service is unknown. This includes not only transitions
into the HOME/ROAMING state, but also transitions to unknown data RAT.
2022-08-04 14:26:33 +00:00
Akash Aggarwal 213cd81b3a iface-modem-simple: wait for packet service 'attach' state in ConnectionStep 2022-08-04 14:26:33 +00:00
Akash Aggarwal d008e437c3 broadband-modem-qmi,mm-shared-qmi: implement support for 'SetPacketServiceState()' 2022-08-04 14:26:33 +00:00
Akash Aggarwal 6761fc0099 broadband-modem-qmi: Move to "registered" state based on DSD System Status for PS domain
"registered" state should not wholly depend on the PS/EPS/5GS domain
state reported by NAS.

It should listen to DSD system status for availabilty of data network
at modem before moving to 'registered' state".
2022-08-04 14:26:33 +00:00
Aleksander Morgado 3893396e20 broadband-modem: SIM swap check should consider errors loading as no SIM
A failure loading IMSI or ICCID (unless for the UNSUPPORTED case)
could be an indication that there is no SIM.

Ideally, the logic checking if a SIM swap happened should have checked
first if there is a SIM card in the slot, and only if there is one go
on to try to load IMSI or ICCID.
2022-08-04 13:08:55 +00:00
Aleksander Morgado 86f6d33513 sim-mbim: clear cached subscriber info on modem sync request 2022-08-01 20:17:43 +00:00
Aleksander Morgado f5b3dc7689 broadband-modem: notify when a sync is needed after a suspend/resume
Modem/SIM implementations that keep cached info that is not supposed
to change during runtime of a modem may need to be notified about when
a suspend/resume has happened, so that they can clear and reload the
internally cached data.
2022-08-01 19:51:26 +00:00
Aleksander Morgado bda3ade5a8 iface-modem: reordering of ready methods in sync() 2022-07-29 15:07:45 +02:00
Aleksander Morgado dd51defd2b broadband-modem: quick sync the Modem interface also if disabled
If the modem was in disabled state, we still want to sync the Modem
interface, among other things to make sure no SIM event happened
during the system suspension.

Fixes https://gitlab.freedesktop.org/mobile-broadband/ModemManager/-/issues/605
2022-07-29 15:06:49 +02:00
Aleksander Morgado a32538fa32 helpers-mbim: report correct network availability from mbim bitmask
MbimProviderState is a bitset, so don't try to match exact values in a
switch statement when converting to MMModem3gppNetworkAvailability.

Fixes https://gitlab.freedesktop.org/mobile-broadband/ModemManager/-/issues/524
2022-07-25 20:43:07 +00:00
Dylan Van Assche ba96ccc615 build: make tests optional
Add a meson option -Dtests and --without-tests automake option
to disable the compilation of all available testcases.
This is useful for compiling projects with Flatpak such as
GNOME Control Center which disables all possible integrations since they
only need the DBus part of ModemManager.

Contributes to https://gitlab.gnome.org/GNOME/gnome-control-center/-/merge_requests/1392
2022-07-25 11:01:51 +02:00
Aleksander Morgado 041f53af8b base-sms: don't clear parts on send/store error
The part generation logic is independent to whether the SMS send or
store operation failed, so just avoid doing the parts cleanup. E.g.
if we created the parts for store() but storing failed, the same parts
could still be used for send() successfully.
2022-07-24 13:14:26 +00:00
Aleksander Morgado 4aaea37022 base-sms: fix segfault when storing already sent messages
The internal list of parts in the base SMS object is created either
when the message is sent or when the message is stored.

The daemon should not expect the list of SMS parts to be empty upon a
store() operation requested via DBus, as the list of parts may have
already been created during send().

Fixes https://gitlab.freedesktop.org/mobile-broadband/ModemManager/-/issues/598
2022-07-24 13:14:26 +00:00
Aleksander Morgado 1615c8627c broadband-modem: don't make fatal SIM swap check of IMSI or ICCID
If the SIM swap check using ICCID or IMSI fail, don't completely fail
the operation, as the other one may still succeed.

Fail the operation only if both checks failed.
2022-07-16 22:24:33 +02:00
Aleksander Morgado 76f837697a broadband-modem: plug leaks in sim_swap_context_free() 2022-07-16 22:24:28 +02:00
Aleksander Morgado 41ff262006 shared-qmi: improve logging of steps in SIM hot swap setup 2022-07-16 22:24:25 +02:00
Aleksander Morgado e96a111a63 shared-qmi: only transfer state to priv info if SIM hotswap setup succeeds
Don't transfer state to the private info until we know the operation
has fully succeeded.
2022-07-16 22:24:23 +02:00
Aleksander Morgado c994ae1b3a shared-qmi: move indication callbacks out of the SIM hot swap setup 2022-07-16 22:24:20 +02:00
Aleksander Morgado ba3b15fe29 shared-qmi: return error if none of the methods succeeded in SIM hot swap setup 2022-07-16 22:24:17 +02:00
Aleksander Morgado b7da236567 shared-qmi: avoid jumps in the SIM hot swap setup state machine
Always transition to the next step, and decide what to do based on the
state tracked by the previously run steps.
2022-07-16 22:24:14 +02:00
Aleksander Morgado 21d24657eb shared-qmi: make refresh all non-fatal during SIM hot swap setup
If for any reason "Refresh all" fails, don't return an error, as we
may have already configured SIM slot status correctly.
2022-07-16 22:24:02 +02:00
Aleksander Morgado d2bc73f394 shared-qmi: add slot status indication in its own step during SIM hot swap setup 2022-07-16 22:23:57 +02:00
Aleksander Morgado 405f5867c7 shared-qmi: add slot status check in its own step during SIM hot swap setup
Also, don't make the "Get Slot Status" operation fatal; just go on
assuming that the slot status indications are unsupported.
2022-07-16 22:23:53 +02:00
Aleksander Morgado 76c0896535 shared-qmi: new step in SIM hot swap setup to connect to refresh signal
Instead of connecting to the signal in multiple places, do it in one
single place in the logic.
2022-07-16 22:23:45 +02:00
Prakash Pabba 5c0db37432 mm-iface-modem,mm-broadband-modem,mm-shared-qmi: support SIM IMSI switch
It is possible that SIM IMSI might change in roaming conditions for a sim.

Register for UIM refresh indication always and reprobe if ICCID or IMSI changes for QMI modem.
2022-07-16 22:22:59 +02:00
Dylan Van Assche efb497e2e6 mm-call-qmi: implement DTMF support
Overwrite the base class with a QMI implementation
to send DTMF characters during a call. Uses the continuous DTMF
QMI messages to support both CDMA and 3GPP networks.
2022-07-16 13:33:29 +00:00
Dylan Van Assche ea3f5ccad8 mm-call-qmi: drop unnecessary white space 2022-07-16 13:33:29 +00:00
Dylan Van Assche 3e61d07419 mm-call-qmi: fix comment consistency
Do not use caps for 'call'
2022-07-16 13:33:29 +00:00