Open Source Telephony
 help / color / mirror / Atom feed
From: Denis Kenzior <denkenz@gmail.com>
To: ofono@ofono.org
Subject: Re: [PATCH] sim: Check SIM pin status after changing pin.
Date: Tue, 02 Nov 2010 10:22:46 -0500	[thread overview]
Message-ID: <4CD02CC6.30201@gmail.com> (raw)
In-Reply-To: <1288710522-10153-1-git-send-email-maritsofie.henriksen8@gmail.com>

[-- Attachment #1: Type: text/plain, Size: 1770 bytes --]

Hi Marit,

On 11/02/2010 10:08 AM, Marit Henriksen wrote:
> From: Marit Henriksen <marit.henriksen@stericsson.com>
> 
> When changing pin, it is possible to get in a state where the modem requests puk 
> (if incorrect pin is entered too many times). Need to check the SIM pin status 
> to discover this.
> ---
>  src/sim.c |   15 ++++++++-------
>  1 files changed, 8 insertions(+), 7 deletions(-)
> 
> diff --git a/src/sim.c b/src/sim.c
> index 699ebe9..b2277c5 100644
> --- a/src/sim.c
> +++ b/src/sim.c
> @@ -628,15 +628,16 @@ static DBusMessage *sim_unlock_pin(DBusConnection *conn, DBusMessage *msg,
>  static void sim_change_pin_cb(const struct ofono_error *error, void *data)
>  {
>  	struct ofono_sim *sim = data;
> +	DBusMessage *reply;
>  
> -	if (error->type != OFONO_ERROR_TYPE_NO_ERROR) {
> -		__ofono_dbus_pending_reply(&sim->pending,
> -				__ofono_error_failed(sim->pending));
> -		return;
> -	}
> +	if (error->type != OFONO_ERROR_TYPE_NO_ERROR)
> +		reply = __ofono_error_failed(sim->pending);
> +	else
> +		reply = dbus_message_new_method_return(sim->pending);
>  
> -	__ofono_dbus_pending_reply(&sim->pending,
> -				dbus_message_new_method_return(sim->pending));
> +	__ofono_dbus_pending_reply(&sim->pending, reply);
> +
> +	sim_pin_check(sim);

I don't think that running sim_pin_check is such a good idea.  That
function initializes the sim interface when +CPIN returns READY.

You also need to tear down the modem state back to pre-sim if the modem
asks for a PUK after change pin fails.  That entails removing all
post_sim/post_online atoms and bring the modem back to the offline state ;)

>  }
>  
>  static DBusMessage *sim_change_pin(DBusConnection *conn, DBusMessage *msg,

Regards,
-Denis

  reply	other threads:[~2010-11-02 15:22 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-11-02 15:08 [PATCH] sim: Check SIM pin status after changing pin Marit Henriksen
2010-11-02 15:22 ` Denis Kenzior [this message]
2010-11-05 14:25   ` Marit Sofie Henriksen
2010-11-05 20:12     ` Denis Kenzior
2010-11-05 20:19     ` Marcel Holtmann

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4CD02CC6.30201@gmail.com \
    --to=denkenz@gmail.com \
    --cc=ofono@ofono.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox