huawei: use a 3s timeout as after-sim-unlock step

Huawei e220 may fail miserably (rebooting itself) if we issue commands just
after having unlocked the PIN.
This commit is contained in:
Aleksander Morgado
2013-04-08 18:03:39 +02:00
parent 55fdc76a56
commit dff23f57b3

View File

@@ -345,6 +345,42 @@ load_unlock_retries (MMIfaceModem *self,
user_data);
}
/*****************************************************************************/
/* 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 3-second wait is necessary for SIM to become ready, or the firmware may
* fail miserably and reboot itself */
g_timeout_add_seconds (3, (GSourceFunc)after_sim_unlock_wait_cb, result);
}
/*****************************************************************************/
/* Common band/mode handling code */
@@ -2237,6 +2273,8 @@ iface_modem_init (MMIfaceModem *iface)
iface->load_access_technologies_finish = load_access_technologies_finish;
iface->load_unlock_retries = load_unlock_retries;
iface->load_unlock_retries_finish = load_unlock_retries_finish;
iface->modem_after_sim_unlock = modem_after_sim_unlock;
iface->modem_after_sim_unlock_finish = modem_after_sim_unlock_finish;
iface->load_current_bands = load_current_bands;
iface->load_current_bands_finish = load_current_bands_finish;
iface->set_bands = set_bands;