aboutsummaryrefslogtreecommitdiff
path: root/src/mm-broadband-modem.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/mm-broadband-modem.c')
-rw-r--r--src/mm-broadband-modem.c44
1 files changed, 44 insertions, 0 deletions
diff --git a/src/mm-broadband-modem.c b/src/mm-broadband-modem.c
index 39b5e500..ec00afdf 100644
--- a/src/mm-broadband-modem.c
+++ b/src/mm-broadband-modem.c
@@ -11943,6 +11943,7 @@ enable (MMBaseModem *self,
typedef enum {
SYNCING_STEP_FIRST,
+ SYNCING_STEP_IFACE_MODEM,
SYNCING_STEP_IFACE_3GPP,
SYNCING_STEP_IFACE_TIME,
SYNCING_STEP_LAST,
@@ -11999,6 +12000,36 @@ iface_modem_3gpp_sync_ready (MMIfaceModem3gpp *self,
}
static void
+iface_modem_sync_ready (MMIfaceModem *self,
+ GAsyncResult *res,
+ GTask *task)
+{
+ SyncingContext *ctx;
+ MMModemLock lock;
+ g_autoptr (GError) error = NULL;
+
+ ctx = g_task_get_task_data (task);
+ lock = mm_iface_modem_get_unlock_required (self);
+
+ if (!mm_iface_modem_sync_finish (self, res, &error)) {
+ mm_obj_warn (self, "synchronizing Modem interface failed: %s", error->message);
+ }
+
+ /* SIM is locked, skip synchronization */
+ if (lock == MM_MODEM_LOCK_UNKNOWN || lock == MM_MODEM_LOCK_SIM_PIN || lock == MM_MODEM_LOCK_SIM_PUK) {
+ mm_obj_warn (self, "SIM is locked... Synchronization skipped");
+ ctx->step = SYNCING_STEP_LAST;
+ syncing_step (task);
+ }
+
+ /* Not locked, go on to next step */
+ mm_obj_dbg (self, "modem unlocked, continue synchronization");
+ ctx->step++;
+ syncing_step (task);
+ return;
+}
+
+static void
syncing_step (GTask *task)
{
MMBroadbandModem *self;
@@ -12012,6 +12043,19 @@ syncing_step (GTask *task)
ctx->step++;
/* fall through */
+ case SYNCING_STEP_IFACE_MODEM:
+ /*
+ * Start interface Modem synchronization.
+ * We want to make sure that the SIM is unlocked and not swapped before
+ * synchronizing other interfaces.
+ */
+ mm_obj_info (self, "resume synchronization state (%d/%d): Modem interface sync",
+ ctx->step, SYNCING_STEP_LAST);
+ mm_iface_modem_sync (MM_IFACE_MODEM (self),
+ (GAsyncReadyCallback)iface_modem_sync_ready,
+ task);
+ return;
+
case SYNCING_STEP_IFACE_3GPP:
/*
* Start interface 3GPP synchronization.