diff options
author | Aleksander Morgado <aleksandermj@google.com> | 2022-07-29 14:55:59 +0200 |
---|---|---|
committer | Aleksander Morgado <aleksander@aleksander.es> | 2022-07-29 15:06:49 +0200 |
commit | dd51defd2be3aac7b31b67b4ae38677f98af1b76 (patch) | |
tree | 93ef1a8f2a48d58b558bd2221f509b70c5b2eafb | |
parent | 31dec02c6fcecd5f0ab99e344c0fadcf149ea675 (diff) |
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
-rw-r--r-- | src/mm-broadband-modem.c | 24 |
1 files changed, 6 insertions, 18 deletions
diff --git a/src/mm-broadband-modem.c b/src/mm-broadband-modem.c index f1a0aee2..5295c058 100644 --- a/src/mm-broadband-modem.c +++ b/src/mm-broadband-modem.c @@ -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; |