<div dir="ltr">I tried with +CPIN?, but it returns READY, while the next command for loading the unlock retries fails. It would be possible to check QSS actually, but it would require more steps (enable it with maximum information (as default is similar to +CPIN?) and then waiting for the value to become the right one) and it is possible that it would work as well as +CPIN?.<br>Managing QSS is part of the "SIM hot insertion" branch I was working on, but that branch still require some more work and I had to stop because of other priorities.<br></div><br><div class="gmail_quote"><div dir="ltr">On Fri, 13 May 2016 at 20:06 Aleksander Morgado <<a href="mailto:aleksander@aleksander.es">aleksander@aleksander.es</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">On Fri, May 13, 2016 at 5:15 PM, Carlo Lobrano <<a href="mailto:c.lobrano@gmail.com" target="_blank">c.lobrano@gmail.com</a>> wrote:<br>
> A short delay is necessary with some SIMs when<br>
> they have just been unlocked. Using 1 second as secure margin.<br>
<br>
I assume there's no SIM status notification, or maybe a command to<br>
check for SIM readiness, right?<br>
<br>
> ---<br>
>  plugins/telit/mm-broadband-modem-telit.c | 38 ++++++++++++++++++++++++++++++++<br>
>  1 file changed, 38 insertions(+)<br>
><br>
> diff --git a/plugins/telit/mm-broadband-modem-telit.c b/plugins/telit/mm-broadband-modem-telit.c<br>
> index 8baf2cf..9d9b6d3 100644<br>
> --- a/plugins/telit/mm-broadband-modem-telit.c<br>
> +++ b/plugins/telit/mm-broadband-modem-telit.c<br>
> @@ -42,6 +42,42 @@ G_DEFINE_TYPE_EXTENDED (MMBroadbandModemTelit, mm_broadband_modem_telit, MM_TYPE<br>
>                          G_IMPLEMENT_INTERFACE (MM_TYPE_IFACE_MODEM, iface_modem_init)<br>
>                          G_IMPLEMENT_INTERFACE (MM_TYPE_IFACE_MODEM_3GPP, iface_modem_3gpp_init));<br>
><br>
> +<br>
> +/*****************************************************************************/<br>
> +/* After Sim Unlock (Modem interface) */<br>
> +static gboolean<br>
> +modem_after_sim_unlock_finish (MMIfaceModem *self,<br>
> +                               GAsyncResult *res,<br>
> +                               GError **error)<br>
> +{<br>
> +    return TRUE;<br>
> +}<br>
> +<br>
> +static gboolean<br>
> +after_sim_unlock_ready (GSimpleAsyncResult *result)<br>
> +{<br>
> +    g_simple_async_result_complete (result);<br>
> +    g_object_unref (result);<br>
> +    return G_SOURCE_REMOVE;<br>
> +}<br>
> +<br>
> +static void<br>
> +modem_after_sim_unlock (MMIfaceModem *self,<br>
> +                        GAsyncReadyCallback callback,<br>
> +                        gpointer user_data)<br>
> +{<br>
> +    GSimpleAsyncResult *result;<br>
> +<br>
> +    result = g_simple_async_result_new (G_OBJECT (self),<br>
> +                                        callback,<br>
> +                                        user_data,<br>
> +                                        modem_after_sim_unlock);<br>
> +<br>
> +    /* A short delay is necessary with some SIMs when<br>
> +    they have just been unlocked. Using 1 second as secure margin. */<br>
> +    g_timeout_add_seconds (1, (GSourceFunc) after_sim_unlock_ready, result);<br>
> +}<br>
> +<br>
>  /*****************************************************************************/<br>
>  /* Set current bands (Modem interface) */<br>
><br>
> @@ -1052,6 +1088,8 @@ iface_modem_init (MMIfaceModem *iface)<br>
>      iface->load_current_modes_finish = load_current_modes_finish;<br>
>      iface->set_current_modes = set_current_modes;<br>
>      iface->set_current_modes_finish = set_current_modes_finish;<br>
> +    iface->modem_after_sim_unlock = modem_after_sim_unlock;<br>
> +    iface->modem_after_sim_unlock_finish = modem_after_sim_unlock_finish;<br>
>  }<br>
><br>
>  static void<br>
> --<br>
> 2.1.4<br>
><br>
> _______________________________________________<br>
> ModemManager-devel mailing list<br>
> <a href="mailto:ModemManager-devel@lists.freedesktop.org" target="_blank">ModemManager-devel@lists.freedesktop.org</a><br>
> <a href="https://lists.freedesktop.org/mailman/listinfo/modemmanager-devel" rel="noreferrer" target="_blank">https://lists.freedesktop.org/mailman/listinfo/modemmanager-devel</a><br>
<br>
<br>
<br>
--<br>
Aleksander<br>
<a href="https://aleksander.es" rel="noreferrer" target="_blank">https://aleksander.es</a><br>
</blockquote></div>