aboutsummaryrefslogtreecommitdiff
path: root/src/mm-broadband-modem.c
diff options
context:
space:
mode:
authorAleksander Morgado <aleksander@aleksander.es>2021-05-23 14:44:44 +0200
committerAleksander Morgado <aleksander@aleksander.es>2021-05-26 13:14:52 +0000
commit7156d5ee50edbb3a14ed93865294637aae4c1f9b (patch)
treeafc1009c46cf874a765be7bf78155459333ef504 /src/mm-broadband-modem.c
parent8a6b18198dd4f42b30233ae25017b57e63ab7e47 (diff)
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.
Diffstat (limited to 'src/mm-broadband-modem.c')
-rw-r--r--src/mm-broadband-modem.c26
1 files changed, 15 insertions, 11 deletions
diff --git a/src/mm-broadband-modem.c b/src/mm-broadband-modem.c
index 5bd75adc..d9f5c250 100644
--- a/src/mm-broadband-modem.c
+++ b/src/mm-broadband-modem.c
@@ -12004,22 +12004,26 @@ iface_modem_sync_ready (MMIfaceModem *self,
GAsyncResult *res,
GTask *task)
{
- SyncingContext *ctx;
- MMModemLock lock;
- g_autoptr (GError) error = NULL;
+ 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);
- }
+ if (!mm_iface_modem_sync_finish (self, res, &error))
+ mm_obj_warn (self, "modem interface synchronization failed: %s", error->message);
- /* SIM is locked, skip synchronization */
+ /* The synchronization logic only runs on modems that were enabled before
+ * the suspend/resume cycle, and therefore we should not get SIM-PIN locked
+ * at this point, unless the SIM was swapped. */
+ lock = mm_iface_modem_get_unlock_required (self);
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);
+ /* Abort the sync() operation right away, and report a new SIM event that will
+ * disable the modem and trigger a full reprobe */
+ mm_obj_warn (self, "SIM is locked... synchronization aborted");
+ g_task_return_new_error (task, MM_CORE_ERROR, MM_CORE_ERROR_ABORTED,
+ "Locked SIM found during modem interface synchronization");
+ g_object_unref (task);
return;
}