diff options
author | Carlo Lobrano <c.lobrano@gmail.com> | 2016-05-13 17:15:21 +0200 |
---|---|---|
committer | Aleksander Morgado <aleksander@aleksander.es> | 2016-07-26 14:10:27 +0200 |
commit | bff43b26bf1fb678e0e13284a581b41fd2af7ec9 (patch) | |
tree | a214e47fdc69daf162d8a37f8ec16e4cb43a5bc3 | |
parent | 43d97a46233e65eb5d13a38b4fe4d70b6725e904 (diff) |
telit: adding a short delay after SIM unlock
A short delay is necessary with some SIMs when
they have just been unlocked. Using 1 second as secure margin.
-rw-r--r-- | plugins/telit/mm-broadband-modem-telit.c | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/plugins/telit/mm-broadband-modem-telit.c b/plugins/telit/mm-broadband-modem-telit.c index 8baf2cf9..9d9b6d37 100644 --- a/plugins/telit/mm-broadband-modem-telit.c +++ b/plugins/telit/mm-broadband-modem-telit.c @@ -42,6 +42,42 @@ G_DEFINE_TYPE_EXTENDED (MMBroadbandModemTelit, mm_broadband_modem_telit, MM_TYPE G_IMPLEMENT_INTERFACE (MM_TYPE_IFACE_MODEM, iface_modem_init) G_IMPLEMENT_INTERFACE (MM_TYPE_IFACE_MODEM_3GPP, iface_modem_3gpp_init)); + +/*****************************************************************************/ +/* 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_ready (GSimpleAsyncResult *result) +{ + g_simple_async_result_complete (result); + g_object_unref (result); + return G_SOURCE_REMOVE; +} + +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 short delay is necessary with some SIMs when + they have just been unlocked. Using 1 second as secure margin. */ + g_timeout_add_seconds (1, (GSourceFunc) after_sim_unlock_ready, result); +} + /*****************************************************************************/ /* Set current bands (Modem interface) */ @@ -1052,6 +1088,8 @@ iface_modem_init (MMIfaceModem *iface) iface->load_current_modes_finish = load_current_modes_finish; iface->set_current_modes = set_current_modes; iface->set_current_modes_finish = set_current_modes_finish; + iface->modem_after_sim_unlock = modem_after_sim_unlock; + iface->modem_after_sim_unlock_finish = modem_after_sim_unlock_finish; } static void |