Commit Graph

7493 Commits

Author SHA1 Message Date
Aleksander Morgado
6fae479bd7 plugins: ignore reload_connection_status() where not supported
Some of the AT-based connection methods don't have any way to query
connection status, or we don't have a proper implementation for those
yet. Ignore the reload operation in all those.
2021-05-26 13:14:52 +00:00
Aleksander Morgado
4038c243f9 cinterion: reuse the same method for load and reload
The load_() method is used for connection monitoring; while the
reload_() method is used to sync connection status after a
suspend/resume operation. The same method can be used for both things
in the Cinterion plugin.
2021-05-26 13:14:52 +00:00
Aleksander Morgado
c188ba3c15 sierra: reuse the same method for load and reload
The load_() method is used for connection monitoring; while the
reload_() method is used to sync connection status after a
suspend/resume operation. The same method can be used for both things
in the Sierra plugin.
2021-05-26 13:14:52 +00:00
Aleksander Morgado
205f46620e novatel-lte: reuse the same method for load and reload
The load_() method is used for connection monitoring; while the
reload_() method is used to sync connection status after a
suspend/resume operation. The same method can be used for both things
in the Novatel LTE plugin.
2021-05-26 13:14:52 +00:00
Aleksander Morgado
2466ddbdaf broadband-bearer: reuse the same method for load and reload
The load_() method is used for connection monitoring; while the
reload_() method is used to sync connection status after a
suspend/resume operation. The same method can be used for both things
in the case of AT+CGACT? based modems.
2021-05-26 13:14:52 +00:00
Aleksander Morgado
6c1d4808b1 base-bearer: ignore cancellation during sync()
There is no input cancellable in the method, so the GTask will never
get cancelled from the outside.
2021-05-26 13:14:52 +00:00
Aleksander Morgado
e096b50208 iface-modem,bearer-list: sync all bearers one after the other
Do not launch N checks for N bearers and ignore their result. Instead,
go one by one, and report errors one by one.
2021-05-26 13:14:52 +00:00
Aleksander Morgado
e4f7da5624 base-bearer: propagate the new connection status after reload
Just triggering a connection status reload won't change the actual
bearer object state.

We change the signature of the reload_connection_status_finish()
method so that it returns the actual reloaded bearer connection
status, and so both the load_ and reload_ methods can be implemented
with exactly the same method, something that was not possible before.

Once we get the new connection status reloaded, we apply it in the
bearer object only if it's DISCONNECTED (and it wasn't DISCONNECTED
before). This should cover the true real case we're interested in, and
nothing else (i.e. we won't overcomplicate the logic attempting to
handle disconnected->connected transitions detected in the sync()
operation).
2021-05-26 13:14:52 +00:00
Aleksander Morgado
8cfc2a237a base-bearer: fix connection reload completion
If we called the class reload_connection_status() method, we should
call the class reload_connection_status_finish() as well.
2021-05-26 13:14:52 +00:00
Aleksander Morgado
29a1c24538 base-bearer: improve comments of the load/reload_connection_status() methods 2021-05-26 13:14:52 +00:00
Dylan Van Assche
8913bab1c5 base-bearer: synchronize state when resuming
Refresh connection status on resume to confirm
that the connection bearers are still valid.
2021-05-26 13:14:52 +00:00
Aleksander Morgado
0a99cca277 iface-modem: ignore cancellation during sync()
There is no input cancellable in the method, so the GTask will never
get cancelled from the outside.
2021-05-26 13:14:52 +00:00
Aleksander Morgado
8a70dbe34b iface-modem: remove the signal quality enforced refresh during sync()
when mm_iface_modem_refresh_signal() is called, we'll restart the
signal quality refresh logic already, there is no need to request
an enforced start.

The enforced start was also modifying ctx->enabled unconditionally,
which is really not ok. This logic would be enabled only when we're
registered, and that logic is fine, no need to change that.
2021-05-26 13:14:52 +00:00
Aleksander Morgado
7156d5ee50 broadband-modem: abort sync if locked SIM card found
We made sure that the after resume synchronization was only started on
modems that had been enabled (and so unlocked). If we detect a locked
SIM card during the sync operation, it's either because the SIM card
was swapped, or because the modem was fully shutdown during the
suspension (and so the SIM requires SIM-PIN again).

Either way, we cannot sync the state cleanly at this point, we must
trigger a full modem reprobe in order to move back the modem state to
Locked.
2021-05-26 13:14:52 +00:00
Aleksander Morgado
8a6b18198d broadband-modem: fix state machine logic when synchronizing modem interface 2021-05-26 13:14:52 +00:00
Aleksander Morgado
14325d85a8 broadband-modem: fail synchronization if no modem exported in DBus 2021-05-26 13:14:52 +00:00
Dylan Van Assche
0e47ba4041 iface-modem: synchronize state when resuming
Refresh signal strength and access technologies,
check for SIM swaps, and check if the SIM is locked.
The modem may have switched to a different
access technologies or have a different signal strength
when resuming. Moreover, the user may swap or remove
the SIM when suspended.
2021-05-26 13:14:52 +00:00
Aleksander Morgado
3afa8e6f3b broadband-modem: skip 3GPP interface sync if no 3GPP support 2021-05-26 13:14:52 +00:00
Aleksander Morgado
890694e0c3 broadband-modem: fix type in the ready() for iface_modem_3gpp_sync()
When calling an async method ona given type, the convention is to use
the same type in the corresponding ready() method, so that we can use
it without additional casts on the finish().
2021-05-26 13:14:52 +00:00
Aleksander Morgado
e716a306b1 iface-modem-3gpp: ignore cancellation during sync()
There is no input cancellable in the method, so the GTask will never
get cancelled from the outside.
2021-05-26 13:14:52 +00:00
Aleksander Morgado
e46e36b36e iface-modem-3gpp: remove redundant log message
It doesn't give us any valuable information, so just remove it.
2021-05-26 13:14:52 +00:00
Aleksander Morgado
7c5e27caf9 iface-modem-3gpp: fix double GError free on registration sync failure 2021-05-26 13:14:52 +00:00
Aleksander Morgado
5b3709e61e iface-modem-3gpp: use g_autoptr() for the MMBearerProperties during sync 2021-05-26 13:14:52 +00:00
Dylan Van Assche
84aa134ad9 iface-modem-3gpp: synchronize state when resuming
On resume, refresh the EPS bearers and 3GPP registration
as the registration and bearers may expired during suspend.
2021-05-26 13:14:52 +00:00
Aleksander Morgado
a9868638a7 iface-modem-time: ignore cancellation during sync()
There is no input cancellable in the method, so the GTask will never
get cancelled from the outside.
2021-05-26 13:14:52 +00:00
Aleksander Morgado
ac1ff45f44 broadband-modem: skip time interface sync if no time support 2021-05-26 13:14:52 +00:00
Dylan Van Assche
41db2e5e82 iface-modem-time: synchronize state when resuming
On resume, fetch the current network time as
the network time may be changed when suspended.
2021-05-26 13:14:52 +00:00
Aleksander Morgado
e58d525826 broadband-modem: skip synchronization after resume if not needed
The synchronization after resume should only be needed on enabled
modems, as otherwise there is really no chance that the state of the
modem may have changed during suspend.

E.g. if a modem is failed because it doesn't have a SIM card, or if
the SIM-PIN is locked, or if the modem has never been enabled, there
is no point in attempting to synchronize the runtime state of the
modem.
2021-05-26 13:14:52 +00:00
Aleksander Morgado
42bc953749 broadband-modem: ignore cancellation during sync()
There is no input cancellable in the method, so the GTask will never
get cancelled from the outside.
2021-05-26 13:14:52 +00:00
Aleksander Morgado
eaf14b8d79 base-modem: make sync() available only if suspend-resume enabled 2021-05-26 13:14:52 +00:00
Aleksander Morgado
eb5ae16ac4 base-modem: don't fail if sync() isn't implemented 2021-05-26 13:14:52 +00:00
Aleksander Morgado
728e6cd398 base-modem: fix modem_sync() operation handling
The mm_base_modem_sync() method is an asynchronous method that
receives a callback and user data, and therefore we MUST always
complete the async method calling that callback. Set that up with a
GTask as usual.

Also, the mm_base_modem_sync_finish() method should be implemented
along with mm_base_modem_sync(), not in the source file of the
caller of the async method. The finish() always depends on how the
async method was implemented, in our case using a GTask.
2021-05-26 13:14:52 +00:00
Aleksander Morgado
6397aacfdb base-manager: avoid using the mm_ prefix for static private methods 2021-05-26 13:14:52 +00:00
Aleksander Morgado
8f48ba21af base-manager: don't assume a MMDevice always holds a MMModem
There are cases, e.g. during modem object disposal, where this is not
true.
2021-05-26 13:14:52 +00:00
Aleksander Morgado
01223b2d4d base-manager: make sure g_autoptr() variables are initialized to NULL
Otherwise, we may have memory issues if the variable isn't initialized
and the method exits.
2021-05-26 13:14:52 +00:00
Dylan Van Assche
38740e9d11 base-manager: add quick suspend/resume base
Quick suspend/resume infrastructure for
synchronizing the interfaces when resuming.
2021-05-26 13:14:52 +00:00
Aleksander Morgado
940063419a base-manager: ensure all GUdevDevices have subsystem and name set
Under certain rare conditions (e.g. race between querying devices of a
given subsystem and the kernel tearing those devices down), the
subsystem reported for a GUdevDevice seems to be NULL.

So, ensure both subsystem and name are set on the GUdevDevice before we
process them.

The issue has been observed on GUdevDevices listed by
g_udev_client_query_by_subsystem(), not on the ones asynchronously
reported via uevents, but we add the validity check on both places for
consistency.

Fixes https://gitlab.freedesktop.org/mobile-broadband/ModemManager/-/issues/343
2021-05-26 12:46:49 +00:00
Aleksander Morgado
10651ba93f quectel: the generic AT based modem supports SIM hot swap 2021-05-26 12:20:00 +00:00
Aleksander Morgado
e4f106f311 broadband-modem-qmi: assume all QMI based modems support SIM hot swap
As we have a generic SIM hot swap implementation in the QMI broadband
modem object.
2021-05-26 12:20:00 +00:00
Aleksander Morgado
58f28c2a45 ci: build with artifacts only in master and tags 2021-05-26 12:30:58 +02:00
Aleksander Morgado
342b0ba648 ci: don't trigger build on branches or pushes
We rely on merge requests to merge new changes, so let's free a bit
the number of pipelines we launch, and avoid doing it on every branch
update.
2021-05-26 12:27:04 +02:00
Aleksander Morgado
3da3623e11 broadband-modem: check if skeleton exists when creating device id
The logic that creates the device identifier uses some fields that are
exposed in DBus (e.g. model, manufacturer...).

We should not attempt to load any of that info if the DBus skeleton
for the Modem interface is no longer available, as e.g. the device may
have gone away already.

Fixes https://gitlab.freedesktop.org/mobile-broadband/ModemManager/-/issues/374
2021-05-24 12:52:52 +00:00
Aleksander Morgado
1f10b3ff7f broadband-modem: trivial coding style fix 2021-05-24 12:52:52 +00:00
Dylan Van Assche
4d095ae05b mm-iface-modem: fix typo in step function 2021-05-23 10:00:11 +00:00
Michal Mazur
9695f23faf iface-modem-3gpp: skip initialization in LOCKED state 2021-05-22 23:56:22 +00:00
Michal Mazur
83e7600a67 broadband-modem: allow 3GPP initialization before fallback
To enable call to disable-facility-lock in LOCKED state,
3gpp interface needs to be initialized before going to fallback step.
2021-05-22 23:56:22 +00:00
Michal Mazur
d76c5c9bcd modem-qmi: detect personalization locks in LOCKED state 2021-05-22 23:56:22 +00:00
Michal Mazur
c6b5045105 base-sim: ignore personalization locks after SIM unlock 2021-05-22 23:56:22 +00:00
Aleksander Morgado
db5837d9b4 docs,libmm-glib: add missing reference for DisableFacilityLock() support 2021-05-23 01:22:07 +02:00
Aleksander Morgado
6c66152d1a docs,libmm-glib: add missing non-API methods to Private sections 2021-05-23 01:22:07 +02:00