---
plugins/zte.c | 25 +++++++++++++++++++++++--
1 files changed, 23 insertions(+), 2 deletions(-)
diff --git a/plugins/zte.c b/plugins/zte.c
index 4426b4c..610c164 100644
--- a/plugins/zte.c
+++ b/plugins/zte.c
@@ -52,6 +52,8 @@ static const char *none_prefix[] = { NULL };
struct zte_data {
GAtChat *modem;
GAtChat *aux;
+ gboolean have_sim;
+ struct at_util_sim_state_query *sim_state_query;
};
static int zte_probe(struct ofono_modem *modem)
@@ -120,6 +122,18 @@ 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 zte_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);
+}
+
static void cfun_enable(gboolean ok, GAtResult *result, gpointer user_data)
{
struct ofono_modem *modem = user_data;
@@ -133,9 +147,16 @@ static void cfun_enable(gboolean ok, GAtResult *result, gpointer
user_data)
g_at_chat_unref(data->aux);
data->aux = 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->aux,
+ 2, 20,
+ sim_state_cb,
+ modem);
}
static int zte_enable(struct ofono_modem *modem)
@@ -239,7 +260,7 @@ static void zte_pre_sim(struct ofono_modem *modem)
sim = ofono_sim_create(modem, OFONO_VENDOR_QUALCOMM_MSM,
"atmodem", data->aux);
- if (sim)
+ if (data->have_sim && sim)
ofono_sim_inserted_notify(sim, TRUE);
}
--
1.7.4.1
---------------------------------------------------------------------
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.
Show replies by date
Hi Bertrand,
plugins/zte.c | 25 +++++++++++++++++++++++--
1 files changed, 23 insertions(+), 2 deletions(-)
patch has been applied, but I had to fix it up manually due to other
conflicting changes.
Regards
Marcel