[PATCH 2/2] Adding a short delay after SIM unlock

Carlo Lobrano c.lobrano at gmail.com
Tue May 17 14:59:10 UTC 2016


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?.
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.

On Fri, 13 May 2016 at 20:06 Aleksander Morgado <aleksander at aleksander.es>
wrote:

> On Fri, May 13, 2016 at 5:15 PM, Carlo Lobrano <c.lobrano at gmail.com>
> wrote:
> > A short delay is necessary with some SIMs when
> > they have just been unlocked. Using 1 second as secure margin.
>
> I assume there's no SIM status notification, or maybe a command to
> check for SIM readiness, right?
>
> > ---
> >  plugins/telit/mm-broadband-modem-telit.c | 38
> ++++++++++++++++++++++++++++++++
> >  1 file changed, 38 insertions(+)
> >
> > diff --git a/plugins/telit/mm-broadband-modem-telit.c
> b/plugins/telit/mm-broadband-modem-telit.c
> > index 8baf2cf..9d9b6d3 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
> > --
> > 2.1.4
> >
> > _______________________________________________
> > ModemManager-devel mailing list
> > ModemManager-devel at lists.freedesktop.org
> > https://lists.freedesktop.org/mailman/listinfo/modemmanager-devel
>
>
>
> --
> Aleksander
> https://aleksander.es
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/modemmanager-devel/attachments/20160517/83c7b2db/attachment.html>


More information about the ModemManager-devel mailing list