aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Chan <benchan@chromium.org>2012-08-28 13:35:25 -0700
committerAleksander Morgado <aleksander@lanedo.com>2012-08-30 09:18:00 +0200
commita2aad7d2931baf1260fe2652dc75b991416e0c2d (patch)
tree8e2b505f33c7113055f3833d413b70666f1855dc
parent1c49e35a8e03ea0724cd0831f2ca7819368b0a66 (diff)
novatel-lte: add a 2-second wait after SIM unlock
-rw-r--r--plugins/novatel/mm-broadband-modem-novatel-lte.c38
1 files changed, 38 insertions, 0 deletions
diff --git a/plugins/novatel/mm-broadband-modem-novatel-lte.c b/plugins/novatel/mm-broadband-modem-novatel-lte.c
index 71544ea4..e3f6bfa5 100644
--- a/plugins/novatel/mm-broadband-modem-novatel-lte.c
+++ b/plugins/novatel/mm-broadband-modem-novatel-lte.c
@@ -97,6 +97,42 @@ modem_create_bearer (MMIfaceModem *self,
}
/*****************************************************************************/
+/* After SIM unlock (Modem interface) */
+
+static gboolean
+modem_after_sim_unlock_finish (MMIfaceModem *self,
+ GAsyncResult *res,
+ GError **error)
+{
+ return TRUE;
+}
+
+static gboolean
+after_sim_unlock_wait_cb (GSimpleAsyncResult *result)
+{
+ g_simple_async_result_complete (result);
+ g_object_unref (result);
+ return FALSE;
+}
+
+static void
+modem_after_sim_unlock (MMIfaceModem *self,
+ GAsyncReadyCallback callback,
+ gpointer user_data)
+{
+ GSimpleAsyncResult *result;
+
+ result = g_simple_async_result_new (G_OBJECT (self),
+ callback,
+ user_data,
+ modem_after_sim_unlock);
+
+ /* A 2-second wait is necessary for SIM to become ready.
+ * Otherwise, a subsequent AT+CRSM command will likely fail. */
+ g_timeout_add_seconds (2, (GSourceFunc)after_sim_unlock_wait_cb, result);
+}
+
+/*****************************************************************************/
/* Load supported bands (Modem interface) */
/*
@@ -360,6 +396,8 @@ iface_modem_init (MMIfaceModem *iface)
{
iface->create_bearer = modem_create_bearer;
iface->create_bearer_finish = modem_create_bearer_finish;
+ iface->modem_after_sim_unlock = modem_after_sim_unlock;
+ iface->modem_after_sim_unlock_finish = modem_after_sim_unlock_finish;
iface->load_supported_bands = load_supported_bands;
iface->load_supported_bands_finish = load_supported_bands_finish;
iface->load_current_bands = load_current_bands;