From: Denis Kenzior <denkenz@gmail.com>
To: ofono@ofono.org
Subject: Re: [PATCH] sim: showing lock state with call meter
Date: Thu, 24 Feb 2011 14:17:46 -0600 [thread overview]
Message-ID: <4D66BCEA.2090307@gmail.com> (raw)
In-Reply-To: <1298474674.26475.79.camel@jussi-desktop>
[-- Attachment #1: Type: text/plain, Size: 2814 bytes --]
Hi Jussi,
On 02/23/2011 09:24 AM, Jussi Kangas wrote:
> Hi,
>
> On Wed, 2011-02-23 at 08:15 +0200, Denis Kenzior wrote:
>>>
>>> - if (pin_type != OFONO_SIM_PASSWORD_NONE &&
>>> - sim->state == OFONO_SIM_STATE_READY) {
>>> + if ((pin_type != OFONO_SIM_PASSWORD_NONE &&
>>> + sim->state == OFONO_SIM_STATE_READY) &&
>>> + (pin_type != OFONO_SIM_PASSWORD_SIM_PIN2)) {
>>
>> I don't see how this can work. You need to check for pin_type != NONE,
>> PIN2 and PUK2 AND state == READY here. This also only covers the case
>> of the PIN2 or PUK2 being triggered when call-meter is active. You do
>> not take care of the case where PIN2 or PUK2 are already required during
>> sim initialization.
>
> Hmm. It seems to work here. If I try reset call meter with wrong
> password I get pin_type OFONO_SIM_PASSWORD_SIM_PIN2 and
> OFONO_SIM_STATE_READY. APIs stay up and SIM manager shows pin2 locked
> and pin2 required. (Which is kinda wrong I admit, u cannot unlock the
> pin2, pin2 should always be visible in LockedPins or not at all, I would
> prefer the later. However it is showed as it is showed and it was
> working that way already before this patch). If I run same case three
> times I get same values but API shows that puk2 is required and all
> API:s stay up. If I run the case with correct password it does not come
> to this code at all all.
What I'm saying here is that it would be safer to do it like this:
switch (pin_type) {
case OFONO_SIM_PASSWORD_NONE:
case OFONO_SIM_PASSWORD_SIM_PIN2:
case OFONO_SIM_PASSWORD_SIM_PUK2:
break;
default:
if (sim->state == OFONO_SIM_STATE_READY)
...
}
We have to check for the PUK2 case above since we might be in PUK2
required state already. If we fail to unlock the PUK2, then
pin_type = puk2pin(pin_type);
will never be executed.
And I'm fine with your suggestion of blacklisting PIN2 from LockedPins,
but lets handle this separately.
>
> PIN2 cannot be required in startup. It is only required if u do
> something with certain features like fdn or call meter. PUK2 can be
> blocked in startup all right but it does not matter from startup point
> of view. If I start the oFono with PIN2 blocked I get pin_type
> OFONO_SIM_PASSWORD_SIM_PIN2 and OFONO_SIM_STATE_INSERTED states and API
> shows pin2 locked and puk2 required as required. (does not seem work if
> I boot up the modem and not just oFono though. Looks like modem bug
> where it does not read voluntarily PIN2 state.)
>
Again, my point here is that you have this code at the bottom of the
function:
if (pin_type == OFONO_SIM_PASSWORD_NONE)
sim_initialize_after_pin(sim);
If you want the SIM initialization to proceed then you need to add a
check for SIM PIN2/PUK2.
Regards,
-Denis
next prev parent reply other threads:[~2011-02-24 20:17 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-02-22 12:05 [PATCH] sim: showing lock state with call meter Jussi Kangas
2011-02-23 6:15 ` Denis Kenzior
2011-02-23 15:24 ` Jussi Kangas
2011-02-24 20:17 ` Denis Kenzior [this message]
2011-02-25 13:19 ` Jussi Kangas
2011-02-25 17:07 ` Denis Kenzior
-- strict thread matches above, loose matches on Subject: below --
2011-02-25 13:20 Jussi Kangas
2011-02-25 17:58 ` Denis Kenzior
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=4D66BCEA.2090307@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