Hi Guillaume,
static void sierra_debug(const char *str, void *user_data) @@ -79,6
+81,12
@@ 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->chat);
Seems that you found an issue not related to your change. Maybe a dedicated submit would
be nice.
+
g_free(data);
}
@@ -115,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); }
+
static void cfun_enable(gboolean ok, GAtResult *result, gpointer user_data) {
struct ofono_modem *modem = user_data; @@ -127,7 +150,8 @@
static void cfun_enable(gboolean ok, GAtResult *result, gpointer user_data)
data->chat = NULL;
}
- ofono_modem_set_powered(modem, ok);
+ data->sim_state_query = at_util_sim_state_query_new(data->chat,
+ 2, 20, sim_state_cb, modem);
So in case of cfun_enable failure, you will query for SIM state?
}
static int sierra_enable(struct ofono_modem *modem)
--
Regards,
Bertrand
---------------------------------------------------------------------
Intel Corporation SAS (French simplified joint stock company)
Registered headquarters: "Les Montalets"- 2, rue de Paris,
92196 Meudon Cedex, France
Registration Number: 302 456 199 R.C.S. NANTERRE
Capital: 4,572,000 Euros
This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.