aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/mm-broadband-modem.c23
-rw-r--r--src/mm-iface-modem.c1
-rw-r--r--src/mm-iface-modem.h1
3 files changed, 24 insertions, 1 deletions
diff --git a/src/mm-broadband-modem.c b/src/mm-broadband-modem.c
index 8441a2cf..61a07406 100644
--- a/src/mm-broadband-modem.c
+++ b/src/mm-broadband-modem.c
@@ -4120,7 +4120,8 @@ load_sim_identifier_ready (MMBaseSim *sim,
}
if (g_strcmp0 (current_simid, cached_simid) != 0) {
- mm_obj_info (self, "sim identifier has changed: possible SIM swap during power down/low");
+ mm_obj_info (self, "sim identifier has changed: %s -> %s - possible SIM swap",
+ cached_simid, current_simid);
mm_broadband_modem_sim_hot_swap_detected (self);
}
@@ -4146,6 +4147,7 @@ load_sim_identifier (GTask *task)
static void
modem_check_for_sim_swap (MMIfaceModem *self,
+ const gchar *iccid,
GAsyncReadyCallback callback,
gpointer user_data)
{
@@ -4171,6 +4173,25 @@ modem_check_for_sim_swap (MMIfaceModem *self,
return;
}
+ /* We may or may not get the new SIM identifier (iccid). In case
+ * we've got it, the load_sim_identifier phase can be skipped. */
+ if (iccid) {
+ const gchar *cached_simid;
+
+ cached_simid = mm_gdbus_sim_get_sim_identifier (MM_GDBUS_SIM (ctx->sim));
+ if (!cached_simid || g_strcmp0 (iccid, cached_simid) != 0) {
+ mm_obj_info (self, "detected ICCID change (%s -> %s), handle as SIM hot-swap",
+ cached_simid ? cached_simid : "<none>",
+ iccid);
+ mm_broadband_modem_sim_hot_swap_detected (MM_BROADBAND_MODEM (self));
+ } else
+ mm_obj_dbg (self, "ICCID not changed");
+
+ g_task_return_boolean (task, TRUE);
+ g_object_unref (task);
+ return;
+ }
+
if (!MM_BASE_SIM_GET_CLASS (ctx->sim)->load_sim_identifier ||
!MM_BASE_SIM_GET_CLASS (ctx->sim)->load_sim_identifier_finish) {
g_task_return_new_error (task,
diff --git a/src/mm-iface-modem.c b/src/mm-iface-modem.c
index 955453be..40a56c74 100644
--- a/src/mm-iface-modem.c
+++ b/src/mm-iface-modem.c
@@ -4040,6 +4040,7 @@ interface_enabling_step (GTask *task)
MM_IFACE_MODEM_GET_INTERFACE (self)->check_for_sim_swap_finish) {
MM_IFACE_MODEM_GET_INTERFACE (self)->check_for_sim_swap (
self,
+ NULL,
(GAsyncReadyCallback)check_for_sim_swap_ready,
task);
return;
diff --git a/src/mm-iface-modem.h b/src/mm-iface-modem.h
index c40323fc..10f22d1e 100644
--- a/src/mm-iface-modem.h
+++ b/src/mm-iface-modem.h
@@ -290,6 +290,7 @@ struct _MMIfaceModem {
* Useful for when the modem changes power states since we might
* not get the relevant notifications from the modem. */
void (*check_for_sim_swap) (MMIfaceModem *self,
+ const gchar *iccid,
GAsyncReadyCallback callback,
gpointer user_data);
gboolean (*check_for_sim_swap_finish) (MMIfaceModem *self,