Re: [PATCH] add UnlockRetries property to the modem dbus interface

2010-06-30 Thread Torgny Johansson
>>
>> Pushed.
>
> Thank you!
>
> Then we also need to address the issue that the UnlockRequired and 
> UnlockRetries properties don't get updated if you enter an invalid pin code. 
> That was the reason for the change (removed the return on error) I did in 
> send_pin_done in the original patch.
>
> The issue is that when you enter the wrong pin code, the modem returns ERROR. 
> In send_pin_done that means that the error will be set, the callback 
> scheduled and the function then returns without running check_pin which would 
> update the state of UnlockRequired and UnlockRetries.

Just a reminder about the issue mentioned above :)

Any comments on it?

Thanks

/Torgny
___
networkmanager-list mailing list
networkmanager-list@gnome.org
http://mail.gnome.org/mailman/listinfo/networkmanager-list


RE: [PATCH] add UnlockRetries property to the modem dbus interface

2010-06-23 Thread Torgny Johansson

> -Original Message-
> From: networkmanager-list-boun...@gnome.org 
> [mailto:networkmanager-list-boun...@gnome.org] On Behalf Of 
> Robert Vogelgesang
> Sent: den 23 juni 2010 10:19
> To: networkmanager-list@gnome.org
> Subject: Re: [PATCH] add UnlockRetries property to the modem 
> dbus interface
> 
> Hey all,
> 
> On Wed, Jun 23, 2010 at 09:51:07AM +0200, Torgny Johansson wrote:
> > > -Original Message-
> > > From: Dan Williams [mailto:d...@redhat.com]
> > > Sent: den 23 juni 2010 02:21
> > > To: Torgny Johansson
> > > Cc: networkmanager-list@gnome.org
> > > Subject: RE: [PATCH] add UnlockRetries property to the modem dbus 
> > > interface
> > >
> [over 600 lines deleted]
> 
> *please* don't forget the good old Netiquette rule to not 
> quote several hundred lines only to add just a few new lines 
> (or even a single one).

My apologies, didn't think about that...

Regards
Torgny
___
networkmanager-list mailing list
networkmanager-list@gnome.org
http://mail.gnome.org/mailman/listinfo/networkmanager-list


Re: [PATCH] add UnlockRetries property to the modem dbus interface

2010-06-23 Thread Robert Vogelgesang
Hey all,

On Wed, Jun 23, 2010 at 09:51:07AM +0200, Torgny Johansson wrote:
> > -Original Message-
> > From: Dan Williams [mailto:d...@redhat.com]
> > Sent: den 23 juni 2010 02:21
> > To: Torgny Johansson
> > Cc: networkmanager-list@gnome.org
> > Subject: RE: [PATCH] add UnlockRetries property to the modem
> > dbus interface
> >
[over 600 lines deleted]

*please* don't forget the good old Netiquette rule to not quote
several hundred lines only to add just a few new lines (or even
a single one).

Thanks.

Robert

___
networkmanager-list mailing list
networkmanager-list@gnome.org
http://mail.gnome.org/mailman/listinfo/networkmanager-list


RE: [PATCH] add UnlockRetries property to the modem dbus interface

2010-06-23 Thread Torgny Johansson
> -Original Message-
> From: Dan Williams [mailto:d...@redhat.com]
> Sent: den 23 juni 2010 02:21
> To: Torgny Johansson
> Cc: networkmanager-list@gnome.org
> Subject: RE: [PATCH] add UnlockRetries property to the modem
> dbus interface
>
> On Wed, 2010-06-09 at 16:03 +0200, Torgny Johansson wrote:
> > > -Original Message-
> > > From: networkmanager-list-boun...@gnome.org
> > > [mailto:networkmanager-list-boun...@gnome.org] On Behalf
> Of Torgny
> > > Johansson
> > > Sent: Wednesday, June 02, 2010 12:49 PM
> > > To: Dan Williams
> > > Cc: networkmanager-list@gnome.org
> > > Subject: RE: [PATCH] add UnlockRetries property to the modem dbus
> > > interface
> > >
> > > Hi!
> > >
> > > Any other comments on this patch?
> > >
> > > Regards
> > > Torgny
> > >
> > > > -Original Message-
> > > > From: networkmanager-list-boun...@gnome.org
> > > > [mailto:networkmanager-list-boun...@gnome.org] On
> Behalf Of Torgny
> > > > Johansson
> > > > Sent: den 27 maj 2010 12:07
> > > > To: networkmanager-list@gnome.org
> > > > Subject: [PATCH] add UnlockRetries property to the modem dbus
> > > > interface
> > > >
> > > > Hi!
> > > >
> > > > This is a new patch that fixes the issues from your comments.
> > > >
> > > > Now only a property containing the UnlockRetries for
> the currently
> > > > locked pin type is added and no extra dbus method.
> > > >
> > > > I also removed the change in send_pin_done, but as
> mentioned in a
> > > > previously mail that will still have to be addressed somehow as
> > > > the UnlockRequired and UnlockRetries properties do not properly
> > > update on
> > > > failed SendPin attempts.
> > > >
> > > > Regards
> > > > Torgny
> > > >
> > > > ---
> > > >
> > > >  introspection/mm-modem.xml |7 +++
> > > >  plugins/mm-modem-mbm.c |   93
> > > > +++-
> > > >  src/mm-generic-gsm.c   |   38 ++
> > > >  src/mm-modem-base.c|   46 ++
> > > >  src/mm-modem-base.h|6 +++
> > > >  src/mm-modem-gsm-card.c|   28 +
> > > >  src/mm-modem-gsm-card.h|   17 
> > > >  src/mm-modem.c |8 
> > > >  src/mm-modem.h |4 +-
> > > >  9 files changed, 245 insertions(+), 2 deletions(-)
> > > >
> > > > diff --git a/introspection/mm-modem.xml
> > > b/introspection/mm-modem.xml
> > > > index da7635b..2810db0 100644
> > > > --- a/introspection/mm-modem.xml
> > > > +++ b/introspection/mm-modem.xml
> > > > @@ -125,6 +125,13 @@
> > > >
> > > >  
> > > >
> > > > +   
> > > > +  
> > > > +The number of unlock retries for the unlock code
> > > > given by the property UnlockRequired, or 999 if
> > > > +   the device does not support reporting
> > > unlock retries.
> > > > +  
> > > > +
> > > > +
> > > >   > > > tp:type="MM_MODEM_IP_METHOD">
> > > >
> > > >  The IP configuration method.
> > > > diff --git a/plugins/mm-modem-mbm.c
> b/plugins/mm-modem-mbm.c index
> > > > 10be0be..8441d96 100644
> > > > --- a/plugins/mm-modem-mbm.c
> > > > +++ b/plugins/mm-modem-mbm.c
> > > > @@ -28,17 +28,20 @@
> > > >
> > > >  #include "mm-modem-mbm.h"
> > > >  #include "mm-modem-simple.h"
> > > > +#include "mm-modem-gsm-card.h"
> > > >  #include "mm-errors.h"
> > > >  #include "mm-callback-info.h"
> > > >
> > > >  static void modem_init (MMModem *modem_class);  static void
> > > > modem_gsm_network_init (MMModemGsmNetwork
> > > *gsm_network_class);  static
> > > > void modem_simple_init (MMModemSimple *class);
> > > > +static void modem_gsm_card_init (MMModemGsmCard *class);
> > > >
> > > >  G_DEFINE_TYPE_EXTENDED (MMModemMbm, mm_modem_mbm,
> > > > MM_TYPE_GENERIC_GSM, 0,
> > > >  

RE: [PATCH] add UnlockRetries property to the modem dbus interface

2010-06-22 Thread Dan Williams
On Wed, 2010-06-09 at 16:03 +0200, Torgny Johansson wrote:
> > -Original Message-
> > From: networkmanager-list-boun...@gnome.org
> > [mailto:networkmanager-list-boun...@gnome.org] On Behalf Of
> > Torgny Johansson
> > Sent: Wednesday, June 02, 2010 12:49 PM
> > To: Dan Williams
> > Cc: networkmanager-list@gnome.org
> > Subject: RE: [PATCH] add UnlockRetries property to the modem
> > dbus interface
> >
> > Hi!
> >
> > Any other comments on this patch?
> >
> > Regards
> > Torgny
> >
> > > -Original Message-
> > > From: networkmanager-list-boun...@gnome.org
> > > [mailto:networkmanager-list-boun...@gnome.org] On Behalf Of Torgny
> > > Johansson
> > > Sent: den 27 maj 2010 12:07
> > > To: networkmanager-list@gnome.org
> > > Subject: [PATCH] add UnlockRetries property to the modem dbus
> > > interface
> > >
> > > Hi!
> > >
> > > This is a new patch that fixes the issues from your comments.
> > >
> > > Now only a property containing the UnlockRetries for the currently
> > > locked pin type is added and no extra dbus method.
> > >
> > > I also removed the change in send_pin_done, but as mentioned in a
> > > previously mail that will still have to be addressed somehow as the
> > > UnlockRequired and UnlockRetries properties do not properly
> > update on
> > > failed SendPin attempts.
> > >
> > > Regards
> > > Torgny
> > >
> > > ---
> > >
> > >  introspection/mm-modem.xml |7 +++
> > >  plugins/mm-modem-mbm.c |   93
> > > +++-
> > >  src/mm-generic-gsm.c   |   38 ++
> > >  src/mm-modem-base.c|   46 ++
> > >  src/mm-modem-base.h|6 +++
> > >  src/mm-modem-gsm-card.c|   28 +
> > >  src/mm-modem-gsm-card.h|   17 
> > >  src/mm-modem.c |8 
> > >  src/mm-modem.h |4 +-
> > >  9 files changed, 245 insertions(+), 2 deletions(-)
> > >
> > > diff --git a/introspection/mm-modem.xml
> > b/introspection/mm-modem.xml
> > > index da7635b..2810db0 100644
> > > --- a/introspection/mm-modem.xml
> > > +++ b/introspection/mm-modem.xml
> > > @@ -125,6 +125,13 @@
> > >
> > >  
> > >
> > > +   
> > > +  
> > > +The number of unlock retries for the unlock code
> > > given by the property UnlockRequired, or 999 if
> > > +   the device does not support reporting
> > unlock retries.
> > > +  
> > > +
> > > +
> > >   > > tp:type="MM_MODEM_IP_METHOD">
> > >
> > >  The IP configuration method.
> > > diff --git a/plugins/mm-modem-mbm.c b/plugins/mm-modem-mbm.c index
> > > 10be0be..8441d96 100644
> > > --- a/plugins/mm-modem-mbm.c
> > > +++ b/plugins/mm-modem-mbm.c
> > > @@ -28,17 +28,20 @@
> > >
> > >  #include "mm-modem-mbm.h"
> > >  #include "mm-modem-simple.h"
> > > +#include "mm-modem-gsm-card.h"
> > >  #include "mm-errors.h"
> > >  #include "mm-callback-info.h"
> > >
> > >  static void modem_init (MMModem *modem_class);  static void
> > > modem_gsm_network_init (MMModemGsmNetwork
> > *gsm_network_class);  static
> > > void modem_simple_init (MMModemSimple *class);
> > > +static void modem_gsm_card_init (MMModemGsmCard *class);
> > >
> > >  G_DEFINE_TYPE_EXTENDED (MMModemMbm, mm_modem_mbm,
> > > MM_TYPE_GENERIC_GSM, 0,
> > >  G_IMPLEMENT_INTERFACE (MM_TYPE_MODEM,
> > > modem_init)
> > >  G_IMPLEMENT_INTERFACE
> > > (MM_TYPE_MODEM_GSM_NETWORK, modem_gsm_network_init)
> > > -G_IMPLEMENT_INTERFACE
> > > (MM_TYPE_MODEM_SIMPLE, modem_simple_init))
> > > +G_IMPLEMENT_INTERFACE
> > > (MM_TYPE_MODEM_SIMPLE, modem_simple_init)
> > > +G_IMPLEMENT_INTERFACE
> > > (MM_TYPE_MODEM_GSM_CARD,
> > > + modem_gsm_card_init))
> > >
> > >  #define MM_MODEM_MBM_GET_PRIVATE(o)
> > > (G_TYPE_INSTANCE_GET_PRIVATE ((o), MM_TYPE_MODEM_MBM,
> > > MMModemMbmPrivate))
> > >
> > > @@ -736,

RE: [PATCH] add UnlockRetries property to the modem dbus interface

2010-06-09 Thread Torgny Johansson

> -Original Message-
> From: networkmanager-list-boun...@gnome.org
> [mailto:networkmanager-list-boun...@gnome.org] On Behalf Of
> Torgny Johansson
> Sent: Wednesday, June 02, 2010 12:49 PM
> To: Dan Williams
> Cc: networkmanager-list@gnome.org
> Subject: RE: [PATCH] add UnlockRetries property to the modem
> dbus interface
>
> Hi!
>
> Any other comments on this patch?
>
> Regards
> Torgny
>
> > -Original Message-
> > From: networkmanager-list-boun...@gnome.org
> > [mailto:networkmanager-list-boun...@gnome.org] On Behalf Of Torgny
> > Johansson
> > Sent: den 27 maj 2010 12:07
> > To: networkmanager-list@gnome.org
> > Subject: [PATCH] add UnlockRetries property to the modem dbus
> > interface
> >
> > Hi!
> >
> > This is a new patch that fixes the issues from your comments.
> >
> > Now only a property containing the UnlockRetries for the currently
> > locked pin type is added and no extra dbus method.
> >
> > I also removed the change in send_pin_done, but as mentioned in a
> > previously mail that will still have to be addressed somehow as the
> > UnlockRequired and UnlockRetries properties do not properly
> update on
> > failed SendPin attempts.
> >
> > Regards
> > Torgny
> >
> > ---
> >
> >  introspection/mm-modem.xml |7 +++
> >  plugins/mm-modem-mbm.c |   93
> > +++-
> >  src/mm-generic-gsm.c   |   38 ++
> >  src/mm-modem-base.c|   46 ++
> >  src/mm-modem-base.h|6 +++
> >  src/mm-modem-gsm-card.c|   28 +
> >  src/mm-modem-gsm-card.h|   17 
> >  src/mm-modem.c |8 
> >  src/mm-modem.h |4 +-
> >  9 files changed, 245 insertions(+), 2 deletions(-)
> >
> > diff --git a/introspection/mm-modem.xml
> b/introspection/mm-modem.xml
> > index da7635b..2810db0 100644
> > --- a/introspection/mm-modem.xml
> > +++ b/introspection/mm-modem.xml
> > @@ -125,6 +125,13 @@
> >
> >  
> >
> > +   
> > +  
> > +The number of unlock retries for the unlock code
> > given by the property UnlockRequired, or 999 if
> > +   the device does not support reporting
> unlock retries.
> > +  
> > +
> > +
> >   > tp:type="MM_MODEM_IP_METHOD">
> >
> >  The IP configuration method.
> > diff --git a/plugins/mm-modem-mbm.c b/plugins/mm-modem-mbm.c index
> > 10be0be..8441d96 100644
> > --- a/plugins/mm-modem-mbm.c
> > +++ b/plugins/mm-modem-mbm.c
> > @@ -28,17 +28,20 @@
> >
> >  #include "mm-modem-mbm.h"
> >  #include "mm-modem-simple.h"
> > +#include "mm-modem-gsm-card.h"
> >  #include "mm-errors.h"
> >  #include "mm-callback-info.h"
> >
> >  static void modem_init (MMModem *modem_class);  static void
> > modem_gsm_network_init (MMModemGsmNetwork
> *gsm_network_class);  static
> > void modem_simple_init (MMModemSimple *class);
> > +static void modem_gsm_card_init (MMModemGsmCard *class);
> >
> >  G_DEFINE_TYPE_EXTENDED (MMModemMbm, mm_modem_mbm,
> > MM_TYPE_GENERIC_GSM, 0,
> >  G_IMPLEMENT_INTERFACE (MM_TYPE_MODEM,
> > modem_init)
> >  G_IMPLEMENT_INTERFACE
> > (MM_TYPE_MODEM_GSM_NETWORK, modem_gsm_network_init)
> > -G_IMPLEMENT_INTERFACE
> > (MM_TYPE_MODEM_SIMPLE, modem_simple_init))
> > +G_IMPLEMENT_INTERFACE
> > (MM_TYPE_MODEM_SIMPLE, modem_simple_init)
> > +G_IMPLEMENT_INTERFACE
> > (MM_TYPE_MODEM_GSM_CARD,
> > + modem_gsm_card_init))
> >
> >  #define MM_MODEM_MBM_GET_PRIVATE(o)
> > (G_TYPE_INSTANCE_GET_PRIVATE ((o), MM_TYPE_MODEM_MBM,
> > MMModemMbmPrivate))
> >
> > @@ -736,6 +739,88 @@ mbm_modem_authenticate (MMModemMbm *self,
> >
> >
> > /*
> > /
> >
> > +static void
> > +send_epin_done (MMAtSerialPort *port,
> > +   GString *response,
> > +   GError *error,
> > +   gpointer user_data)
> > +{
> > +MMCallbackInfo *info = (MMCallbackInfo *) user_data;
> > +const char *pin_type;
> > +int attempts_left = 0;
> > +
> > +if (error) {
> > +info->error = g

RE: [PATCH] add UnlockRetries property to the modem dbus interface

2010-06-02 Thread Torgny Johansson
Hi!

Any other comments on this patch?

Regards
Torgny

> -Original Message-
> From: networkmanager-list-boun...@gnome.org
> [mailto:networkmanager-list-boun...@gnome.org] On Behalf Of
> Torgny Johansson
> Sent: den 27 maj 2010 12:07
> To: networkmanager-list@gnome.org
> Subject: [PATCH] add UnlockRetries property to the modem dbus
> interface
>
> Hi!
>
> This is a new patch that fixes the issues from your comments.
>
> Now only a property containing the UnlockRetries for the
> currently locked pin type is added and no extra dbus method.
>
> I also removed the change in send_pin_done, but as mentioned
> in a previously mail that will still have to be addressed
> somehow as the UnlockRequired and UnlockRetries properties do
> not properly update on failed SendPin attempts.
>
> Regards
> Torgny
>
> ---
>
>  introspection/mm-modem.xml |7 +++
>  plugins/mm-modem-mbm.c |   93
> +++-
>  src/mm-generic-gsm.c   |   38 ++
>  src/mm-modem-base.c|   46 ++
>  src/mm-modem-base.h|6 +++
>  src/mm-modem-gsm-card.c|   28 +
>  src/mm-modem-gsm-card.h|   17 
>  src/mm-modem.c |8 
>  src/mm-modem.h |4 +-
>  9 files changed, 245 insertions(+), 2 deletions(-)
>
> diff --git a/introspection/mm-modem.xml
> b/introspection/mm-modem.xml index da7635b..2810db0 100644
> --- a/introspection/mm-modem.xml
> +++ b/introspection/mm-modem.xml
> @@ -125,6 +125,13 @@
>
>  
>
> +   
> +  
> +The number of unlock retries for the unlock code
> given by the property UnlockRequired, or 999 if
> +   the device does not support reporting unlock retries.
> +  
> +
> +
>   tp:type="MM_MODEM_IP_METHOD">
>
>  The IP configuration method.
> diff --git a/plugins/mm-modem-mbm.c b/plugins/mm-modem-mbm.c
> index 10be0be..8441d96 100644
> --- a/plugins/mm-modem-mbm.c
> +++ b/plugins/mm-modem-mbm.c
> @@ -28,17 +28,20 @@
>
>  #include "mm-modem-mbm.h"
>  #include "mm-modem-simple.h"
> +#include "mm-modem-gsm-card.h"
>  #include "mm-errors.h"
>  #include "mm-callback-info.h"
>
>  static void modem_init (MMModem *modem_class);  static void
> modem_gsm_network_init (MMModemGsmNetwork
> *gsm_network_class);  static void modem_simple_init
> (MMModemSimple *class);
> +static void modem_gsm_card_init (MMModemGsmCard *class);
>
>  G_DEFINE_TYPE_EXTENDED (MMModemMbm, mm_modem_mbm,
> MM_TYPE_GENERIC_GSM, 0,
>  G_IMPLEMENT_INTERFACE
> (MM_TYPE_MODEM, modem_init)
>  G_IMPLEMENT_INTERFACE
> (MM_TYPE_MODEM_GSM_NETWORK, modem_gsm_network_init)
> -G_IMPLEMENT_INTERFACE
> (MM_TYPE_MODEM_SIMPLE, modem_simple_init))
> +G_IMPLEMENT_INTERFACE
> (MM_TYPE_MODEM_SIMPLE, modem_simple_init)
> +G_IMPLEMENT_INTERFACE
> (MM_TYPE_MODEM_GSM_CARD,
> + modem_gsm_card_init))
>
>  #define MM_MODEM_MBM_GET_PRIVATE(o)
> (G_TYPE_INSTANCE_GET_PRIVATE ((o), MM_TYPE_MODEM_MBM,
> MMModemMbmPrivate))
>
> @@ -736,6 +739,88 @@ mbm_modem_authenticate (MMModemMbm *self,
>
>
> /*
> /
>
> +static void
> +send_epin_done (MMAtSerialPort *port,
> +   GString *response,
> +   GError *error,
> +   gpointer user_data)
> +{
> +MMCallbackInfo *info = (MMCallbackInfo *) user_data;
> +const char *pin_type;
> +int attempts_left = 0;
> +
> +if (error) {
> +info->error = g_error_copy (error);
> +goto done;
> +}
> +
> +pin_type = ((char *)mm_callback_info_get_data (info,
> "pin_type"));
> +
> +if (strstr (pin_type, MM_MODEM_GSM_CARD_SIM_PIN))
> +sscanf (response->str, "*EPIN: %d", &attempts_left);
> +else if (strstr (pin_type, MM_MODEM_GSM_CARD_SIM_PUK))
> +sscanf (response->str, "*EPIN: %*d, %d", &attempts_left);
> +else if (strstr (pin_type, MM_MODEM_GSM_CARD_SIM_PIN2))
> +sscanf (response->str, "*EPIN: %*d, %*d, %d",
> &attempts_left);
> +else if (strstr (pin_type, MM_MODEM_GSM_CARD_SIM_PUK2))
> +sscanf (response->str, "*EPIN: %*d, %*d, %*d, %d",
> &attempts_left);
> +else {
> +g_debug ("%s unknown pin type: %s", __FUNCTION__, pin_type);
> +
> +info->error = g_error_new_literal (MM_MODEM_ERROR,
> MM_MODEM_ERROR_GENERAL, "Unknown PIN type");
> +}
> +
> +mm_callback_info_set_result (info, GUINT_TO_POINTER
> + (attempts_left), NULL);
> +
> +done:
> +mm_serial_port_close (MM_SERIAL_PORT (port));
> +mm_callback_info_schedule (info);
> +}
> +
> +static void
> +mbm_get_unlock_retries (MMModemGsmCard *modem,
> +  const char *pin_type,
> +  MMModemUIntFn callback,
> +  gpointer user_data)
> +{
> +MMAtSerialPort *port;
> +char *command;
> +MMCallbackInfo *info = mm_callback_info_uint_new
> (MM_MODEM 

Re: [PATCH] add UnlockRetries property to the modem dbus interface

2010-06-02 Thread Dan Williams
On Sun, 2010-05-30 at 18:53 +0200, Frederik Nnaji wrote:
> hahaah, here's why:
> 
> On Fri, May 28, 2010 at 15:25, Torgny Johansson
>  wrote:
> 
> While not entirely sure how, I'm still very glad to hear that
> my contribution may have that unexpected positive impact! ;)
> 
> 
> Here's the most personal Use Case you'll probably ever get out of me:
> 
> 
> Fred visits his girlfriend. As he swaps SIM cards with his girlfriend
> for performance reasons, the new SIM simply doesn't work. He selects
> the appropriate connection from the Network Manager applet in his
> panel repeatedly, as it does not seem to work immediately.
> After trying unsuccessfully for a while, Fred inserts the SIM card
> into a mobile phone for more verbose debugging (to "see" what's
> wrong). The phone reports "SIM permanently locked, enter PUK to
> unlock"
> 
> 
> Fred is pissed, because the PUK to the SIM is in an other town.

Recent versions of NM (0.8.1) and MM (0.4) will request the PIN to
unlock the device when the device is plugged in so the SIM won't get PUK
locked there.  We still do need to get a better way of tying a cached
PIN code to the specific SIM card, though this isn't possible for a lot
of devices that don't allow access to the SIM's IMSI until you've
entered the PIN.  Some devices do allow it though.

Dan



___
networkmanager-list mailing list
networkmanager-list@gnome.org
http://mail.gnome.org/mailman/listinfo/networkmanager-list


Re: [PATCH] add UnlockRetries property to the modem dbus interface

2010-05-30 Thread Frederik Nnaji
hahaah, here's why:

On Fri, May 28, 2010 at 15:25, Torgny Johansson <
torgny.johans...@ericsson.com> wrote:

> While not entirely sure how, I'm still very glad to hear that my
> contribution may have that unexpected positive impact! ;)
>

Here's the most personal Use Case you'll probably ever get out of me:

Fred visits his girlfriend. As he swaps SIM cards with his girlfriend for
performance reasons, the new SIM simply doesn't work. He selects the
appropriate connection from the Network Manager applet in his panel
repeatedly, as it does not seem to work immediately.
After trying unsuccessfully for a while, Fred inserts the SIM card into a
mobile phone for more verbose debugging (to "see" what's wrong). The phone
reports "SIM permanently locked, enter PUK to unlock"

Fred is pissed, because the PUK to the SIM is in an other town.


;)
___
networkmanager-list mailing list
networkmanager-list@gnome.org
http://mail.gnome.org/mailman/listinfo/networkmanager-list


RE: [PATCH] add UnlockRetries property to the modem dbus interface

2010-05-28 Thread Torgny Johansson
> -Original Message-
> From: Frederik Nnaji [mailto:frederik.nn...@gmail.com]
> Sent: den 28 maj 2010 04:35
> To: Torgny Johansson
> Cc: networkmanager-list@gnome.org
> Subject: Re: [PATCH] add UnlockRetries property to the modem
> dbus interface
>
> Hi Torgny
>
>
> On Thu, May 27, 2010 at 12:06, Torgny Johansson
>  wrote:
>
>
>   Hi!
>
>   This is a new patch that fixes the issues from your comments.
>
>   Now only a property containing the UnlockRetries for
> the currently locked pin type is added and no extra dbus method.
>
>   I also removed the change in send_pin_done, but as
> mentioned in a previously mail that will still have to be
> addressed somehow as the UnlockRequired
>   and UnlockRetries properties do not properly update on
> failed SendPin attempts.
>
>   Regards
>   Torgny
>
>   ---
>
>introspection/mm-modem.xml |7 +++
>plugins/mm-modem-mbm.c |   93
> +++-
>src/mm-generic-gsm.c   |   38 ++
>src/mm-modem-base.c|   46 ++
>src/mm-modem-base.h|6 +++
>src/mm-modem-gsm-card.c|   28 +
>src/mm-modem-gsm-card.h|   17 
>src/mm-modem.c |8 
>src/mm-modem.h |4 +-
>9 files changed, 245 insertions(+), 2 deletions(-)
>
>   diff --git a/introspection/mm-modem.xml
> b/introspection/mm-modem.xml
>   index da7635b..2810db0 100644
>   --- a/introspection/mm-modem.xml
>   +++ b/introspection/mm-modem.xml
>   @@ -125,6 +125,13 @@
> 
>   
>
>   +   
>   +  
>   +The number of unlock retries for the unlock
> code given by the property UnlockRequired, or 999 if
>   +   the device does not support reporting
> unlock retries.
>   +  
>   +
>   +
>tp:type="MM_MODEM_IP_METHOD">
> 
>   The IP configuration method.
>   diff --git a/plugins/mm-modem-mbm.c b/plugins/mm-modem-mbm.c
>   index 10be0be..8441d96 100644
>   --- a/plugins/mm-modem-mbm.c
>   +++ b/plugins/mm-modem-mbm.c
>   @@ -28,17 +28,20 @@
>
>#include "mm-modem-mbm.h"
>#include "mm-modem-simple.h"
>   +#include "mm-modem-gsm-card.h"
>#include "mm-errors.h"
>#include "mm-callback-info.h"
>
>static void modem_init (MMModem *modem_class);
>static void modem_gsm_network_init (MMModemGsmNetwork
> *gsm_network_class);
>static void modem_simple_init (MMModemSimple *class);
>   +static void modem_gsm_card_init (MMModemGsmCard *class);
>
>G_DEFINE_TYPE_EXTENDED (MMModemMbm, mm_modem_mbm,
> MM_TYPE_GENERIC_GSM, 0,
>   G_IMPLEMENT_INTERFACE
> (MM_TYPE_MODEM, modem_init)
>   G_IMPLEMENT_INTERFACE
> (MM_TYPE_MODEM_GSM_NETWORK, modem_gsm_network_init)
>   -G_IMPLEMENT_INTERFACE
> (MM_TYPE_MODEM_SIMPLE, modem_simple_init))
>   +G_IMPLEMENT_INTERFACE
> (MM_TYPE_MODEM_SIMPLE, modem_simple_init)
>   +G_IMPLEMENT_INTERFACE
> (MM_TYPE_MODEM_GSM_CARD, modem_gsm_card_init))
>
>#define MM_MODEM_MBM_GET_PRIVATE(o)
> (G_TYPE_INSTANCE_GET_PRIVATE ((o), MM_TYPE_MODEM_MBM,
> MMModemMbmPrivate))
>
>   @@ -736,6 +739,88 @@ mbm_modem_authenticate (MMModemMbm *self,
>
>
> /*
> /
>
>   +static void
>   +send_epin_done (MMAtSerialPort *port,
>   +   GString *response,
>   +   GError *error,
>   +   gpointer user_data)
>   +{
>   +MMCallbackInfo *info = (MMCallbackInfo *) user_data;
>   +const char *pin_type;
>   +int attempts_left = 0;
>   +
>   +if (error) {
>   +info->error = g_error_copy (error);
>   +goto done;
>   +}
>   +
>   +pin_type = ((char *)mm_callback_info_get_data
> (info, "pin_type"));
>   +
>   +if (strstr (pin_type, MM_MODEM_GSM_CARD_SIM_PIN))
>   +sscanf (response->str, "*EPIN: %d", &attempts_left);
>   +else if (strstr (pin_type, MM_MODEM_GSM_CARD_SIM_PUK))
>   +sscanf (response->str, "*EPIN: %*d, %d",
> &attempts_left);
>   +else if (str

Re: [PATCH] add UnlockRetries property to the modem dbus interface

2010-05-27 Thread Frederik Nnaji
Hi Torgny

On Thu, May 27, 2010 at 12:06, Torgny Johansson <
torgny.johans...@ericsson.com> wrote:

> Hi!
>
> This is a new patch that fixes the issues from your comments.
>
> Now only a property containing the UnlockRetries for the currently locked
> pin type is added and no extra dbus method.
>
> I also removed the change in send_pin_done, but as mentioned in a
> previously mail that will still have to be addressed somehow as the
> UnlockRequired
> and UnlockRetries properties do not properly update on failed SendPin
> attempts.
>
> Regards
> Torgny
>
> ---
>
>  introspection/mm-modem.xml |7 +++
>  plugins/mm-modem-mbm.c |   93
> +++-
>  src/mm-generic-gsm.c   |   38 ++
>  src/mm-modem-base.c|   46 ++
>  src/mm-modem-base.h|6 +++
>  src/mm-modem-gsm-card.c|   28 +
>  src/mm-modem-gsm-card.h|   17 
>  src/mm-modem.c |8 
>  src/mm-modem.h |4 +-
>  9 files changed, 245 insertions(+), 2 deletions(-)
>
> diff --git a/introspection/mm-modem.xml b/introspection/mm-modem.xml
> index da7635b..2810db0 100644
> --- a/introspection/mm-modem.xml
> +++ b/introspection/mm-modem.xml
> @@ -125,6 +125,13 @@
>   
> 
>
> +   
> +  
> +The number of unlock retries for the unlock code given by the
> property UnlockRequired, or 999 if
> +   the device does not support reporting unlock retries.
> +  
> +
> +
>  tp:type="MM_MODEM_IP_METHOD">
>   
> The IP configuration method.
> diff --git a/plugins/mm-modem-mbm.c b/plugins/mm-modem-mbm.c
> index 10be0be..8441d96 100644
> --- a/plugins/mm-modem-mbm.c
> +++ b/plugins/mm-modem-mbm.c
> @@ -28,17 +28,20 @@
>
>  #include "mm-modem-mbm.h"
>  #include "mm-modem-simple.h"
> +#include "mm-modem-gsm-card.h"
>  #include "mm-errors.h"
>  #include "mm-callback-info.h"
>
>  static void modem_init (MMModem *modem_class);
>  static void modem_gsm_network_init (MMModemGsmNetwork *gsm_network_class);
>  static void modem_simple_init (MMModemSimple *class);
> +static void modem_gsm_card_init (MMModemGsmCard *class);
>
>  G_DEFINE_TYPE_EXTENDED (MMModemMbm, mm_modem_mbm, MM_TYPE_GENERIC_GSM, 0,
> G_IMPLEMENT_INTERFACE (MM_TYPE_MODEM, modem_init)
> G_IMPLEMENT_INTERFACE (MM_TYPE_MODEM_GSM_NETWORK,
> modem_gsm_network_init)
> -G_IMPLEMENT_INTERFACE (MM_TYPE_MODEM_SIMPLE,
> modem_simple_init))
> +G_IMPLEMENT_INTERFACE (MM_TYPE_MODEM_SIMPLE,
> modem_simple_init)
> +G_IMPLEMENT_INTERFACE (MM_TYPE_MODEM_GSM_CARD,
> modem_gsm_card_init))
>
>  #define MM_MODEM_MBM_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o),
> MM_TYPE_MODEM_MBM, MMModemMbmPrivate))
>
> @@ -736,6 +739,88 @@ mbm_modem_authenticate (MMModemMbm *self,
>
>
>  
> /*/
>
> +static void
> +send_epin_done (MMAtSerialPort *port,
> +   GString *response,
> +   GError *error,
> +   gpointer user_data)
> +{
> +MMCallbackInfo *info = (MMCallbackInfo *) user_data;
> +const char *pin_type;
> +int attempts_left = 0;
> +
> +if (error) {
> +info->error = g_error_copy (error);
> +goto done;
> +}
> +
> +pin_type = ((char *)mm_callback_info_get_data (info, "pin_type"));
> +
> +if (strstr (pin_type, MM_MODEM_GSM_CARD_SIM_PIN))
> +sscanf (response->str, "*EPIN: %d", &attempts_left);
> +else if (strstr (pin_type, MM_MODEM_GSM_CARD_SIM_PUK))
> +sscanf (response->str, "*EPIN: %*d, %d", &attempts_left);
> +else if (strstr (pin_type, MM_MODEM_GSM_CARD_SIM_PIN2))
> +sscanf (response->str, "*EPIN: %*d, %*d, %d", &attempts_left);
> +else if (strstr (pin_type, MM_MODEM_GSM_CARD_SIM_PUK2))
> +sscanf (response->str, "*EPIN: %*d, %*d, %*d, %d",
> &attempts_left);
> +else {
> +g_debug ("%s unknown pin type: %s", __FUNCTION__, pin_type);
> +
> +info->error = g_error_new_literal (MM_MODEM_ERROR,
> MM_MODEM_ERROR_GENERAL, "Unknown PIN type");
> +}
> +
> +mm_callback_info_set_result (info, GUINT_TO_POINTER (attempts_left),
> NULL);
> +
> +done:
> +mm_serial_port_close (MM_SERIAL_PORT (port));
> +mm_callback_info_schedule (info);
> +}
> +
> +static void
> +mbm_get_unlock_retries (MMModemGsmCard *modem,
> +  const char *pin_type,
> +  MMModemUIntFn callback,
> +  gpointer user_data)
> +{
> +MMAtSerialPort *port;
> +char *command;
> +MMCallbackInfo *info = mm_callback_info_uint_new (MM_MODEM (modem),
> callback, user_data);
> +
> +g_debug ("%s pin type: %s", __FUNCTION__, pin_type);
> +
> +/* Ensure we have a usable port to use for the command */
> +port = mm_generic_gsm_get_best_at_port (MM_GENERIC_GSM (modem),
> &info->error);
> +if (!port) {
> +