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