diff options
-rw-r--r-- | src/mm-iface-modem.c | 33 | ||||
-rw-r--r-- | src/mm-iface-modem.h | 9 |
2 files changed, 40 insertions, 2 deletions
diff --git a/src/mm-iface-modem.c b/src/mm-iface-modem.c index 3373b5ba..f9266a4c 100644 --- a/src/mm-iface-modem.c +++ b/src/mm-iface-modem.c @@ -1972,12 +1972,41 @@ reinitialize_ready (MMBaseModem *self, } } -static gboolean -restart_initialize_idle (MMIfaceModem *self) +static void +modem_after_sim_unlock_ready (MMIfaceModem *self, + GAsyncResult *res) { + GError *error = NULL; + + if (!MM_IFACE_MODEM_GET_INTERFACE (self)->modem_after_sim_unlock_finish (self, res, &error)) { + mm_warn ("After SIM unlock failed setup: '%s'", error->message); + g_error_free (error); + } + + /* Go on */ mm_base_modem_initialize (MM_BASE_MODEM (self), (GAsyncReadyCallback) reinitialize_ready, NULL); +} + +static gboolean +restart_initialize_idle (MMIfaceModem *self) +{ + /* If we were asked to run something after having sent the PIN unlock, + * do it now. This may be just a timeout or some other command that gives us + * the real SIM state */ + if (MM_IFACE_MODEM_GET_INTERFACE (self)->modem_after_sim_unlock != NULL && + MM_IFACE_MODEM_GET_INTERFACE (self)->modem_after_sim_unlock_finish != NULL) { + MM_IFACE_MODEM_GET_INTERFACE (self)->modem_after_sim_unlock( + self, + (GAsyncReadyCallback)modem_after_sim_unlock_ready, + NULL); + } else { + /* If no wait needed, just go on */ + mm_base_modem_initialize (MM_BASE_MODEM (self), + (GAsyncReadyCallback) reinitialize_ready, + NULL); + } return FALSE; } diff --git a/src/mm-iface-modem.h b/src/mm-iface-modem.h index cad763ee..4a3d75b3 100644 --- a/src/mm-iface-modem.h +++ b/src/mm-iface-modem.h @@ -227,6 +227,15 @@ struct _MMIfaceModem { GAsyncResult *res, GError **error); + /* Asynchronous method to wait for the SIM to be ready after having + * unlocked it. */ + void (*modem_after_sim_unlock) (MMIfaceModem *self, + GAsyncReadyCallback callback, + gpointer user_data); + gboolean (*modem_after_sim_unlock_finish) (MMIfaceModem *self, + GAsyncResult *res, + GError **error); + /* Asynchronous modem power-up operation */ void (*modem_power_up) (MMIfaceModem *self, GAsyncReadyCallback callback, |