* A way of polling SIM status
@ 2010-10-19 10:41 Zhang, Caiwen
2010-10-19 11:13 ` Marcel Holtmann
2010-10-19 18:28 ` Denis Kenzior
0 siblings, 2 replies; 8+ messages in thread
From: Zhang, Caiwen @ 2010-10-19 10:41 UTC (permalink / raw)
To: ofono
[-- Attachment #1: Type: text/plain, Size: 2451 bytes --]
Hi,
Due to some other tasks, it a long time did not take part in the
discussion
Here. I see there are much discussion about how to polling SIM status.
Maybe we can start to polling the SIM status with AT+CPIN? when the
probe
function of SIM atom driver is invoke. If it return +CME: 10 or +CME:
SIM not
inserted. It means there is no SIM inserted. If it return other result,
invoke
ofono_sim_register register the APIs first and then waiting user input
password
(if password is required) or notify SIM is ready(if SIM is ready).
Following are the proposed implementation:
static ofono_bool_t sim_status_poll(void *user_data)
{
if(!user_data)
return FALSE;
struct ofono_sim *sim = user_data;
struct sim_data *ud = ofono_sim_get_data(sim);
g_at_chat_send(ud->chat, "AT+CPIN?", cpin_prefix,
sim_status_cb, sim, NULL);
return FALSE;
}
static void sim_status_cb(gboolean ok, GAtResult *result, gpointer
user_data)
{
struct ofono_sim *sim = user_data;
GAtResultIter iter;
struct ofono_error error;
const char *pin_required;
const char *final = g_at_result_final_response(result);
decode_at_error(&error, final);
if(error.type == OFONO_ERROR_TYPE_CME && error.error == 10)
return; /* SIM is not inserted */
if (!ok) {
g_timeout_add_seconds(5, sim_status_poll, sim);
return;
}
g_at_result_iter_init(&iter, result);
if (!g_at_result_iter_next(&iter, "+CPIN:")) /* fatal error,
should not occur */
return;
g_at_result_iter_next_unquoted_string(&iter, &pin_required);
ofono_bool_t ready = FALSE;
if (!strcasecmp(pin_required,
at_sim_name[OFONO_SIM_PASSWORD_NONE].name))
ready = TRUE;
if( ofono_sim_get_state(sim) == OFONO_SIM_STATE_NOT_PRESENT) {
ofono_sim_register(sim);
ofono_sim_inserted_notify(sim, TRUE);
}
if( ready )
ofono_sim_set_ready(sim);
else
g_timeout_add_seconds(5, sim_status_poll, sim);
}
static int at_sim_probe(struct ofono_sim *sim, unsigned int vendor,
void *data)
{
GAtChat *chat = data;
struct sim_data *ud;
ud = g_new0(struct sim_data, 1);
ud->chat = chat;
ud->vendor = vendor;
ofono_sim_set_data(sim, ud);
g_at_chat_send(ud->chat, "AT+CPIN?", cpin_prefix,
sim_status_cb, sim, NULL);
return 0;
}
For modem that with SIM status unsolicited indication, should register
And monitor the SIM status at the same time.
Best regards
Caiwen
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: A way of polling SIM status
2010-10-19 10:41 A way of polling SIM status Zhang, Caiwen
@ 2010-10-19 11:13 ` Marcel Holtmann
2010-10-19 18:28 ` Denis Kenzior
1 sibling, 0 replies; 8+ messages in thread
From: Marcel Holtmann @ 2010-10-19 11:13 UTC (permalink / raw)
To: ofono
[-- Attachment #1: Type: text/plain, Size: 774 bytes --]
Hi Caiwen,
> Due to some other tasks, it a long time did not take part in the
> discussion
> Here. I see there are much discussion about how to polling SIM status.
>
> Maybe we can start to polling the SIM status with AT+CPIN? when the
> probe
> function of SIM atom driver is invoke. If it return +CME: 10 or +CME:
> SIM not
> inserted. It means there is no SIM inserted. If it return other result,
> invoke
> ofono_sim_register register the APIs first and then waiting user input
> password
> (if password is required) or notify SIM is ready(if SIM is ready).
you did look at the SIM ready patches that Pekka send a few days ago?
And do me a favor, even RFC patches should follow the coding style of
oFono upstream.
Regards
Marcel
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: A way of polling SIM status
2010-10-19 10:41 A way of polling SIM status Zhang, Caiwen
2010-10-19 11:13 ` Marcel Holtmann
@ 2010-10-19 18:28 ` Denis Kenzior
2010-10-20 13:21 ` Pekka Pessi
1 sibling, 1 reply; 8+ messages in thread
From: Denis Kenzior @ 2010-10-19 18:28 UTC (permalink / raw)
To: ofono
[-- Attachment #1: Type: text/plain, Size: 957 bytes --]
Hi Caiwen,
On 10/19/2010 05:41 AM, Zhang, Caiwen wrote:
> Hi,
>
> Due to some other tasks, it a long time did not take part in the
> discussion
> Here. I see there are much discussion about how to polling SIM status.
>
> Maybe we can start to polling the SIM status with AT+CPIN? when the
> probe
> function of SIM atom driver is invoke. If it return +CME: 10 or +CME:
> SIM not
> inserted. It means there is no SIM inserted. If it return other result,
> invoke
> ofono_sim_register register the APIs first and then waiting user input
> password
> (if password is required) or notify SIM is ready(if SIM is ready).
>
> Following are the proposed implementation:
>
Unfortunately some modems report CPIN: READY even though they're not
ready. The only reliable way to poll for this is to poll the IMSI, then
the phonebook and the sms store and report ready only once all of them
can be manipulated.
Regards,
-Denis
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: A way of polling SIM status
2010-10-19 18:28 ` Denis Kenzior
@ 2010-10-20 13:21 ` Pekka Pessi
2010-10-20 21:36 ` andrzej zaborowski
0 siblings, 1 reply; 8+ messages in thread
From: Pekka Pessi @ 2010-10-20 13:21 UTC (permalink / raw)
To: ofono
[-- Attachment #1: Type: text/plain, Size: 618 bytes --]
Hi all,
2010/10/19 Denis Kenzior <denkenz@gmail.com>:
> Unfortunately some modems report CPIN: READY even though they're not
> ready. The only reliable way to poll for this is to poll the IMSI, then
> the phonebook and the sms store and report ready only once all of them
> can be manipulated.
I seems to me that Caiwen is proposing SIM presence polling. Each and
every modem does it now separately. Unfortunately this seems to be
even trickier than PIN lock polling, at least MBM returns different
error codes depending on how far its own initialization has got.
--
Pekka.Pessi mail at nokia.com
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: A way of polling SIM status
2010-10-20 13:21 ` Pekka Pessi
@ 2010-10-20 21:36 ` andrzej zaborowski
2010-10-20 21:43 ` Marcel Holtmann
2010-10-21 2:39 ` Zhang, Caiwen
0 siblings, 2 replies; 8+ messages in thread
From: andrzej zaborowski @ 2010-10-20 21:36 UTC (permalink / raw)
To: ofono
[-- Attachment #1: Type: text/plain, Size: 1011 bytes --]
On 20 October 2010 15:21, Pekka Pessi <ppessi@gmail.com> wrote:
> 2010/10/19 Denis Kenzior <denkenz@gmail.com>:
>> Unfortunately some modems report CPIN: READY even though they're not
>> ready. The only reliable way to poll for this is to poll the IMSI, then
>> the phonebook and the sms store and report ready only once all of them
>> can be manipulated.
>
> I seems to me that Caiwen is proposing SIM presence polling. Each and
> every modem does it now separately. Unfortunately this seems to be
> even trickier than PIN lock polling, at least MBM returns different
> error codes depending on how far its own initialization has got.
My MBM seems to only detect the SIM if it is inserted during the modem
enumeration (on USB or PCI). If you there's no SIM during modem
initialisation, or you extract the SIM, then inserting a new SIM is
never detected, the modem will always return "SIM not inserted" until
reset.
Caiwen, have you looked at drivers/atmodem/sim-poll.c?
Best regards
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: A way of polling SIM status
2010-10-20 21:36 ` andrzej zaborowski
@ 2010-10-20 21:43 ` Marcel Holtmann
2010-10-20 22:42 ` Denis Kenzior
2010-10-21 2:39 ` Zhang, Caiwen
1 sibling, 1 reply; 8+ messages in thread
From: Marcel Holtmann @ 2010-10-20 21:43 UTC (permalink / raw)
To: ofono
[-- Attachment #1: Type: text/plain, Size: 1028 bytes --]
Hi Andrew,
> >> Unfortunately some modems report CPIN: READY even though they're not
> >> ready. The only reliable way to poll for this is to poll the IMSI, then
> >> the phonebook and the sms store and report ready only once all of them
> >> can be manipulated.
> >
> > I seems to me that Caiwen is proposing SIM presence polling. Each and
> > every modem does it now separately. Unfortunately this seems to be
> > even trickier than PIN lock polling, at least MBM returns different
> > error codes depending on how far its own initialization has got.
>
> My MBM seems to only detect the SIM if it is inserted during the modem
> enumeration (on USB or PCI). If you there's no SIM during modem
> initialisation, or you extract the SIM, then inserting a new SIM is
> never detected, the modem will always return "SIM not inserted" until
> reset.
there is a MBM specific event for SIM insertion. Not sure if it works on
the F35xx, but it should be working on the F36xx and later.
Regards
Marcel
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: A way of polling SIM status
2010-10-20 21:43 ` Marcel Holtmann
@ 2010-10-20 22:42 ` Denis Kenzior
0 siblings, 0 replies; 8+ messages in thread
From: Denis Kenzior @ 2010-10-20 22:42 UTC (permalink / raw)
To: ofono
[-- Attachment #1: Type: text/plain, Size: 1138 bytes --]
Hi Marcel,
On 10/20/2010 04:43 PM, Marcel Holtmann wrote:
> Hi Andrew,
>
>>>> Unfortunately some modems report CPIN: READY even though they're not
>>>> ready. The only reliable way to poll for this is to poll the IMSI, then
>>>> the phonebook and the sms store and report ready only once all of them
>>>> can be manipulated.
>>>
>>> I seems to me that Caiwen is proposing SIM presence polling. Each and
>>> every modem does it now separately. Unfortunately this seems to be
>>> even trickier than PIN lock polling, at least MBM returns different
>>> error codes depending on how far its own initialization has got.
>>
>> My MBM seems to only detect the SIM if it is inserted during the modem
>> enumeration (on USB or PCI). If you there's no SIM during modem
>> initialisation, or you extract the SIM, then inserting a new SIM is
>> never detected, the modem will always return "SIM not inserted" until
>> reset.
>
> there is a MBM specific event for SIM insertion. Not sure if it works on
> the F35xx, but it should be working on the F36xx and later.
Doesn't work on any F36xx I tried.
Regards,
-Denis
^ permalink raw reply [flat|nested] 8+ messages in thread
* RE: A way of polling SIM status
2010-10-20 21:36 ` andrzej zaborowski
2010-10-20 21:43 ` Marcel Holtmann
@ 2010-10-21 2:39 ` Zhang, Caiwen
1 sibling, 0 replies; 8+ messages in thread
From: Zhang, Caiwen @ 2010-10-21 2:39 UTC (permalink / raw)
To: ofono
[-- Attachment #1: Type: text/plain, Size: 1870 bytes --]
Hi andrzej,
>
> On 20 October 2010 15:21, Pekka Pessi <ppessi@gmail.com> wrote:
> > 2010/10/19 Denis Kenzior <denkenz@gmail.com>:
> >> Unfortunately some modems report CPIN: READY even though they're not
> >> ready. The only reliable way to poll for this is to poll the IMSI,
> then
> >> the phonebook and the sms store and report ready only once all of
> them
> >> can be manipulated.
> >
> > I seems to me that Caiwen is proposing SIM presence polling. Each and
> > every modem does it now separately. Unfortunately this seems to be
> > even trickier than PIN lock polling, at least MBM returns different
> > error codes depending on how far its own initialization has got.
>
> My MBM seems to only detect the SIM if it is inserted during the modem
> enumeration (on USB or PCI). If you there's no SIM during modem
> initialisation, or you extract the SIM, then inserting a new SIM is
> never detected, the modem will always return "SIM not inserted" until
> reset.
Yes, most modem don't support dynamic detect SIM.
>
> Caiwen, have you looked at drivers/atmodem/sim-poll.c?
>
I have read drivers/atmodem/sim-poll.c. It looks very good.
I have two questions.
1. It seems it depends on the invoking of ofono_sim_register to trigger the SIM status
Polling. I'm not sure whether it is allowed to register the APIs(invoke ofono_sim_register)
before make sure the SIM is inserted.
2. According to the modems that I used previously, it seems it is required to send profile
to SIM before fetch the first STK command. It just my guess, I don't test it. If it's wrong,
please correct me.
Here I suggest put STK initialization(fetch the SET UP MENU command) in SIM state watch,
Because it is also required to fetch SET UP MENU command after unblock PIN or REFRESH
Proactive command.
Thanks!
Caiwen
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2010-10-21 2:39 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-10-19 10:41 A way of polling SIM status Zhang, Caiwen
2010-10-19 11:13 ` Marcel Holtmann
2010-10-19 18:28 ` Denis Kenzior
2010-10-20 13:21 ` Pekka Pessi
2010-10-20 21:36 ` andrzej zaborowski
2010-10-20 21:43 ` Marcel Holtmann
2010-10-20 22:42 ` Denis Kenzior
2010-10-21 2:39 ` Zhang, Caiwen
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.