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
This commit is contained in:
Aleksander Morgado
2022-07-29 14:55:59 +02:00
committed by Aleksander Morgado
parent 31dec02c6f
commit dd51defd2b

View File

@@ -12302,13 +12302,13 @@ syncing_step (GTask *task)
return;
case SYNCING_STEP_IFACE_3GPP:
/*
* Start interface 3GPP synchronization.
/* Start 3GPP interface synchronization, only if modem was enabled.
* We hardly depend on the registration and bearer status,
* therefore we cannot continue with the other steps until
* this one is finished.
*/
if (self->priv->modem_3gpp_dbus_skeleton) {
if (self->priv->modem_3gpp_dbus_skeleton &&
(self->priv->modem_state >= MM_MODEM_STATE_ENABLED)) {
mm_obj_info (self, "resume synchronization state (%d/%d): 3GPP interface sync",
ctx->step, SYNCING_STEP_LAST);
mm_iface_modem_3gpp_sync (MM_IFACE_MODEM_3GPP (self), (GAsyncReadyCallback)iface_modem_3gpp_sync_ready, task);
@@ -12318,10 +12318,9 @@ syncing_step (GTask *task)
/* fall through */
case SYNCING_STEP_IFACE_TIME:
/*
* Synchronize asynchronously the Time interface.
*/
if (self->priv->modem_time_dbus_skeleton) {
/* Start Time interface synchronization, only if modem was enabled */
if (self->priv->modem_time_dbus_skeleton &&
(self->priv->modem_state >= MM_MODEM_STATE_ENABLED)) {
mm_obj_info (self, "resume synchronization state (%d/%d): time interface sync",
ctx->step, SYNCING_STEP_LAST);
mm_iface_modem_time_sync (MM_IFACE_MODEM_TIME (self), (GAsyncReadyCallback)iface_modem_time_sync_ready, task);
@@ -12356,17 +12355,6 @@ synchronize (MMBaseModem *self,
task = g_task_new (MM_BROADBAND_MODEM (self), NULL, callback, user_data);
/* Synchronization after resume is not needed on modems that have never
* been enabled.
*/
if (MM_BROADBAND_MODEM (self)->priv->modem_state < MM_MODEM_STATE_ENABLED) {
g_task_return_new_error (task, MM_CORE_ERROR, MM_CORE_ERROR_WRONG_STATE,
"Synchronization after resume not needed in modem state '%s'",
mm_modem_state_get_string (MM_BROADBAND_MODEM (self)->priv->modem_state));
g_object_unref (task);
return;
}
/* Create SyncingContext */
ctx = g_new0 (SyncingContext, 1);
ctx->step = SYNCING_STEP_FIRST;