From: Guillaume Zajac <guillaume.zajac@linux.intel.com>
To: ofono@ofono.org
Subject: Re: [RFC_v1 2/2] sierra: Add SIM state polling
Date: Mon, 05 Dec 2011 11:57:54 +0100 [thread overview]
Message-ID: <4EDCA3B2.2060406@linux.intel.com> (raw)
In-Reply-To: <4ED51833.7050208@gmail.com>
[-- Attachment #1: Type: text/plain, Size: 3144 bytes --]
Hi Denis,
On 29/11/2011 18:36, Denis Kenzior wrote:
> Hi Guillaume,
>
> On 12/01/2011 10:48 AM, Guillaume Zajac wrote:
>> It has been reported than for some Sierra modem, the SIM
>> initialization process leads to +CME ERROR: 10 sim not
>> present. The issue might come from SIM is not ready.
> Do you have an AT log of these reports?
Yes I had one but it was given to me through pastebin from IRC.
As soon as I see the guy on #ofono, I will ask him to send the log over
oFono mailing list.
>> ---
>> plugins/sierra.c | 26 +++++++++++++++++++++++++-
>> 1 files changed, 25 insertions(+), 1 deletions(-)
>>
>> diff --git a/plugins/sierra.c b/plugins/sierra.c
>> index b33382d..45e75c1 100644
>> --- a/plugins/sierra.c
>> +++ b/plugins/sierra.c
>> @@ -47,6 +47,8 @@ static const char *none_prefix[] = { NULL };
>>
>> struct sierra_data {
>> GAtChat *chat;
>> + gboolean have_sim;
>> + struct at_util_sim_state_query *sim_state_query;
>> };
>>
>> static void sierra_debug(const char *str, void *user_data)
>> @@ -82,6 +84,9 @@ static void sierra_remove(struct ofono_modem *modem)
>> /* Cleanup after hot-unplug */
>> g_at_chat_unref(data->chat);
>>
>> + /* Cleanup potential SIM state polling */
>> + at_util_sim_state_query_free(data->sim_state_query);
>> +
>> g_free(data);
>> }
>>
>> @@ -118,6 +123,21 @@ static GAtChat *open_device(struct ofono_modem *modem,
>> return chat;
>> }
>>
>> +static void sim_state_cb(gboolean present, gpointer user_data)
>> +{
>> + struct ofono_modem *modem = user_data;
>> + struct sierra_data *data = ofono_modem_get_data(modem);
>> +
>> + at_util_sim_state_query_free(data->sim_state_query);
>> + data->sim_state_query = NULL;
>> +
>> + data->have_sim = present;
>> +
>> + ofono_modem_set_powered(modem, TRUE);
>> +
>> + g_at_chat_send(data->chat, "AT&C0", NULL, NULL, NULL, NULL);
> Fair enough, however:
>
> - You are not using data->have_sim anywhere, presumably you want to use
> it in sierra_pre_sim to notify the sim inserted status...
Yes, I forgot to use it.
> - The sierra driver does not instantiate any gprs_context drivers, so it
> isn't even capable of GPRS in its current state. Sending the&C0
> command is only needed if you are planning to use PPP and probably
> belongs in a separate patch.
>
I didn't see the gprs context was never created into sierra plugin, do
we have a reason for that?
>> +}
>> +
>> static void cfun_enable(gboolean ok, GAtResult *result, gpointer user_data)
>> {
>> struct ofono_modem *modem = user_data;
>> @@ -128,9 +148,13 @@ static void cfun_enable(gboolean ok, GAtResult *result, gpointer user_data)
>> if (!ok) {
>> g_at_chat_unref(data->chat);
>> data->chat = NULL;
>> +
>> + ofono_modem_set_powered(modem, FALSE);
>> + return;
>> }
>>
>> - ofono_modem_set_powered(modem, ok);
>> + data->sim_state_query = at_util_sim_state_query_new(data->chat,
>> + 2, 20, sim_state_cb, modem);
>> }
>>
>> static int sierra_enable(struct ofono_modem *modem)
> Regards,
> -Denis
>
Kind regards,
Guillaume
next prev parent reply other threads:[~2011-12-05 10:57 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-12-01 16:48 [RFC_v1 0/2] Add SIM polling mechanism for Sierra Guillaume Zajac
2011-12-01 16:48 ` [RFC_v1 1/2] sierra: Fix memory leak Guillaume Zajac
2011-11-29 17:32 ` Denis Kenzior
2011-12-01 16:48 ` [RFC_v1 2/2] sierra: Add SIM state polling Guillaume Zajac
2011-11-29 17:36 ` Denis Kenzior
2011-12-05 10:57 ` Guillaume Zajac [this message]
2011-12-02 12:11 ` Denis Kenzior
2011-12-05 14:43 ` 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=4EDCA3B2.2060406@linux.intel.com \
--to=guillaume.zajac@linux.intel.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