diff options
author | Aleksander Morgado <aleksander@lanedo.com> | 2012-10-15 13:34:51 +0200 |
---|---|---|
committer | Aleksander Morgado <aleksander@lanedo.com> | 2012-10-15 13:34:51 +0200 |
commit | 4f55511680c04c89f8288cdf07fc7ad2c5c5b096 (patch) | |
tree | 231865a6ae337b0ea64d0b4231283a5b21699977 | |
parent | 5c8ef351bb191e3735efcc9ac65df5a844afedb7 (diff) |
pantech: wait up to 5s after SIM unlock before sending new commands
Or the modem will get stuck completely.
-rw-r--r-- | plugins/pantech/mm-broadband-modem-pantech.c | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/plugins/pantech/mm-broadband-modem-pantech.c b/plugins/pantech/mm-broadband-modem-pantech.c index 72ed0c47..22b50083 100644 --- a/plugins/pantech/mm-broadband-modem-pantech.c +++ b/plugins/pantech/mm-broadband-modem-pantech.c @@ -22,6 +22,7 @@ #include <ctype.h> #include "ModemManager.h" +#include "mm-iface-modem.h" #include "mm-log.h" #include "mm-errors-types.h" #include "mm-broadband-modem-pantech.h" @@ -56,6 +57,41 @@ create_sim (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); + + /* wait so sim pin is done */ + g_timeout_add_seconds (5, (GSourceFunc)after_sim_unlock_wait_cb, result); +} + +/*****************************************************************************/ MMBroadbandModemPantech * mm_broadband_modem_pantech_new (const gchar *device, @@ -84,6 +120,9 @@ iface_modem_init (MMIfaceModem *iface) /* Create Pantech-specific SIM */ iface->create_sim = create_sim; iface->create_sim_finish = create_sim_finish; + + iface->modem_after_sim_unlock = modem_after_sim_unlock; + iface->modem_after_sim_unlock_finish = modem_after_sim_unlock_finish; } static void |