* [PATCH] sierra: add sim state polling after CFUN enable
@ 2015-01-30 10:34 Cedric Jehasse
2015-01-31 16:21 ` Denis Kenzior
0 siblings, 1 reply; 2+ messages in thread
From: Cedric Jehasse @ 2015-01-30 10:34 UTC (permalink / raw)
To: ofono
[-- Attachment #1: Type: text/plain, Size: 2230 bytes --]
From: Cedric Jehasse <cedric.jehasse@softathome.com>
When pin is queried shortly after a Siera dongle is plugged in, "AT+CPIN?"
responds with "CME ERROR 14: SIM".
Poll the sim, as already done by several other vendor plugins.
---
plugins/sierra.c | 26 ++++++++++++++++++++++++--
1 file changed, 24 insertions(+), 2 deletions(-)
diff --git a/plugins/sierra.c b/plugins/sierra.c
index a458e38..458fec2 100644
--- a/plugins/sierra.c
+++ b/plugins/sierra.c
@@ -48,6 +48,8 @@ static const char *none_prefix[] = { NULL };
struct sierra_data {
GAtChat *modem;
+ gboolean have_sim;
+ struct at_util_sim_state_query *sim_state_query;
};
static void sierra_debug(const char *str, void *user_data)
@@ -80,6 +82,9 @@ static void sierra_remove(struct ofono_modem *modem)
ofono_modem_set_data(modem, NULL);
+ /* Cleanup potential SIM state polling */
+ at_util_sim_state_query_free(data->sim_state_query);
+
/* Cleanup after hot-unplug */
g_at_chat_unref(data->modem);
@@ -119,6 +124,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);
+
+ DBG("%p", 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);
+
+}
+
static void cfun_enable(gboolean ok, GAtResult *result, gpointer user_data)
{
struct ofono_modem *modem = user_data;
@@ -131,7 +151,9 @@ static void cfun_enable(gboolean ok, GAtResult *result, gpointer user_data)
data->modem = NULL;
}
- ofono_modem_set_powered(modem, ok);
+ data->sim_state_query = at_util_sim_state_query_new(data->modem,
+ 2, 20, sim_state_cb, modem,
+ NULL);
}
static int sierra_enable(struct ofono_modem *modem)
@@ -222,7 +244,7 @@ static void sierra_pre_sim(struct ofono_modem *modem)
sim = ofono_sim_create(modem, OFONO_VENDOR_SIERRA,
"atmodem", data->modem);
- if (sim)
+ if (sim && data->have_sim == TRUE)
ofono_sim_inserted_notify(sim, TRUE);
}
--
1.9.2
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] sierra: add sim state polling after CFUN enable
2015-01-30 10:34 [PATCH] sierra: add sim state polling after CFUN enable Cedric Jehasse
@ 2015-01-31 16:21 ` Denis Kenzior
0 siblings, 0 replies; 2+ messages in thread
From: Denis Kenzior @ 2015-01-31 16:21 UTC (permalink / raw)
To: ofono
[-- Attachment #1: Type: text/plain, Size: 477 bytes --]
Hi Cedric,
On 01/30/2015 04:34 AM, Cedric Jehasse wrote:
> From: Cedric Jehasse <cedric.jehasse@softathome.com>
>
> When pin is queried shortly after a Siera dongle is plugged in, "AT+CPIN?"
> responds with "CME ERROR 14: SIM".
> Poll the sim, as already done by several other vendor plugins.
> ---
> plugins/sierra.c | 26 ++++++++++++++++++++++++--
> 1 file changed, 24 insertions(+), 2 deletions(-)
>
Patch has been applied, thanks.
Regards,
-Denis
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2015-01-31 16:21 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-01-30 10:34 [PATCH] sierra: add sim state polling after CFUN enable Cedric Jehasse
2015-01-31 16:21 ` Denis Kenzior
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.