Re: [PATCH 4/6] gemalto: handle sim is inserted or removed URCs

2018-03-20 Thread Gabriel Lucas

Hi Denis,


On 19/03/2018 18:10, Denis Kenzior wrote:

Hi Gabriel, Mariem,

On 03/19/2018 11:26 AM, Gabriel Lucas wrote:

From: Mariem Cherif 

---
  plugins/gemalto.c | 78 
---

  1 file changed, 74 insertions(+), 4 deletions(-)

diff --git a/plugins/gemalto.c b/plugins/gemalto.c
index 5573606..029e09d 100644
--- a/plugins/gemalto.c
+++ b/plugins/gemalto.c
@@ -57,6 +57,8 @@
  #define GEMALTO_MODEL_PHS8P "0053"
  #define GEMALTO_MODEL_ALS3 "0061"
  +static void gemalto_ciev_notify(GAtResult *result, gpointer 
user_data);

+


Please note doc/coding-style.txt item M17.  I silently re-structured 
this patch to avoid the need for this forward-declaration.


Patch has been applied, thanks!

Regards,
-Denis


Thank you, that's better that way

Best regards,
Gabriel
___
ofono mailing list
ofono@ofono.org
https://lists.ofono.org/mailman/listinfo/ofono


Re: [PATCH 4/6] gemalto: handle sim is inserted or removed URCs

2018-03-19 Thread Denis Kenzior

Hi Gabriel, Mariem,

On 03/19/2018 11:26 AM, Gabriel Lucas wrote:

From: Mariem Cherif 

---
  plugins/gemalto.c | 78 ---
  1 file changed, 74 insertions(+), 4 deletions(-)

diff --git a/plugins/gemalto.c b/plugins/gemalto.c
index 5573606..029e09d 100644
--- a/plugins/gemalto.c
+++ b/plugins/gemalto.c
@@ -57,6 +57,8 @@
  #define GEMALTO_MODEL_PHS8P   "0053"
  #define GEMALTO_MODEL_ALS3"0061"
  
+static void gemalto_ciev_notify(GAtResult *result, gpointer user_data);

+


Please note doc/coding-style.txt item M17.  I silently re-structured 
this patch to avoid the need for this forward-declaration.


Patch has been applied, thanks!

Regards,
-Denis
___
ofono mailing list
ofono@ofono.org
https://lists.ofono.org/mailman/listinfo/ofono


[PATCH 4/6] gemalto: handle sim is inserted or removed URCs

2018-03-19 Thread Gabriel Lucas
From: Mariem Cherif 

---
 plugins/gemalto.c | 78 ---
 1 file changed, 74 insertions(+), 4 deletions(-)

diff --git a/plugins/gemalto.c b/plugins/gemalto.c
index 5573606..029e09d 100644
--- a/plugins/gemalto.c
+++ b/plugins/gemalto.c
@@ -57,6 +57,8 @@
 #define GEMALTO_MODEL_PHS8P"0053"
 #define GEMALTO_MODEL_ALS3 "0061"
 
+static void gemalto_ciev_notify(GAtResult *result, gpointer user_data);
+
 static const char *none_prefix[] = { NULL };
 static const char *sctm_prefix[] = { "^SCTM:", NULL };
 static const char *sbv_prefix[] = { "^SBV:", NULL };
@@ -157,6 +159,14 @@ static void sim_state_cb(gboolean present, gpointer 
user_data)
 
data->have_sim = present;
ofono_modem_set_powered(modem, TRUE);
+
+   /* Register for specific sim status reports */
+   g_at_chat_register(data->app, "+CIEV:",
+   gemalto_ciev_notify, FALSE, modem, NULL);
+
+   g_at_chat_send(data->app, "AT^SIND=\"simstatus\",1", none_prefix,
+   NULL, NULL, NULL);
+
 }
 
 static void cfun_enable(gboolean ok, GAtResult *result, gpointer user_data)
@@ -489,20 +499,80 @@ static void gemalto_set_online(struct ofono_modem *modem, 
ofono_bool_t online,
g_free(cbd);
 }
 
+static void sim_ready_cb(gboolean present, gpointer user_data)
+{
+   struct ofono_modem *modem = user_data;
+   struct gemalto_data *data = ofono_modem_get_data(modem);
+   struct ofono_sim *sim = data->sim;
+
+   at_util_sim_state_query_free(data->sim_state_query);
+   data->sim_state_query = NULL;
+
+   DBG("sim present: %d", present);
+
+   ofono_sim_inserted_notify(sim, present);
+}
+
+static void gemalto_ciev_notify(GAtResult *result, gpointer user_data)
+{
+   struct ofono_modem *modem = user_data;
+   struct gemalto_data *data = ofono_modem_get_data(modem);
+   struct ofono_sim *sim = data->sim;
+
+   const char *sim_status = "simstatus";
+   const char *ind_str;
+   int status;
+   GAtResultIter iter;
+
+   g_at_result_iter_init(, result);
+
+   /* Example: +CIEV: simstatus, */
+   if (!g_at_result_iter_next(, "+CIEV:"))
+   return;
+
+   if (!g_at_result_iter_next_unquoted_string(, _str))
+   return;
+
+   if (!g_str_equal(sim_status, ind_str))
+   return;
+
+   if (!g_at_result_iter_next_number(, ))
+   return;
+
+   DBG("sim status %d", status);
+
+   switch (status) {
+   /* SIM is removed from the holder */
+   case 0:
+   ofono_sim_inserted_notify(sim, FALSE);
+   break;
+
+   /* SIM is inserted inside the holder */
+   case 1:
+   /* The SIM won't be ready yet */
+   data->sim_state_query = at_util_sim_state_query_new(data->app,
+   1, 20, sim_ready_cb, modem,
+   NULL);
+   break;
+
+   default:
+   break;
+   }
+}
+
 static void gemalto_pre_sim(struct ofono_modem *modem)
 {
struct gemalto_data *data = ofono_modem_get_data(modem);
-   struct ofono_sim *sim;
 
DBG("%p", modem);
 
ofono_devinfo_create(modem, 0, "atmodem", data->app);
ofono_location_reporting_create(modem, 0, "gemaltomodem", data->app);
-   sim = ofono_sim_create(modem, OFONO_VENDOR_CINTERION, "atmodem",
+   data->sim = ofono_sim_create(modem, OFONO_VENDOR_CINTERION, "atmodem",
data->app);
 
-   if (sim && data->have_sim == TRUE)
-   ofono_sim_inserted_notify(sim, TRUE);
+   if (data->sim && data->have_sim == TRUE)
+   ofono_sim_inserted_notify(data->sim, TRUE);
 }
 
 static void gemalto_post_sim(struct ofono_modem *modem)
-- 
1.9.1

___
ofono mailing list
ofono@ofono.org
https://lists.ofono.org/mailman/listinfo/ofono


Re: [PATCH 4/6] gemalto: handle sim is inserted or removed URCs

2018-03-19 Thread Denis Kenzior

Hi Gabriel,

On 03/19/2018 10:57 AM, Gabriel Lucas wrote:

From: Mariem Cherif 

---
  plugins/gemalto.c | 70 +++
  1 file changed, 66 insertions(+), 4 deletions(-)

diff --git a/plugins/gemalto.c b/plugins/gemalto.c
index 5573606..13270d6 100644
--- a/plugins/gemalto.c
+++ b/plugins/gemalto.c
@@ -489,20 +489,82 @@ static void gemalto_set_online(struct ofono_modem *modem, 
ofono_bool_t online,
g_free(cbd);
  }
  
+static void sim_ready_cb(gboolean present, gpointer user_data)

+{
+   struct ofono_sim *sim = user_data;
+
+   DBG("sim present: %d", present);
+
+   ofono_sim_inserted_notify(sim, present);


You should free sim_state_query here and zero out the variable, 
otherwise you will leak memory on repeated sim insertion / reinsertion.



+}
+
+static void gemalto_ciev_notify(GAtResult *result, gpointer user_data)


Okay, this part looks good now


  static void gemalto_pre_sim(struct ofono_modem *modem)
  {
struct gemalto_data *data = ofono_modem_get_data(modem);
-   struct ofono_sim *sim;
  
  	DBG("%p", modem);
  
  	ofono_devinfo_create(modem, 0, "atmodem", data->app);

ofono_location_reporting_create(modem, 0, "gemaltomodem", data->app);
-   sim = ofono_sim_create(modem, OFONO_VENDOR_CINTERION, "atmodem",
+   data->sim = ofono_sim_create(modem, OFONO_VENDOR_CINTERION, "atmodem",
data->app);
  
-	if (sim && data->have_sim == TRUE)

-   ofono_sim_inserted_notify(sim, TRUE);
+   /* Register for specific sim status reports */
+   g_at_chat_register(data->app, "+CIEV:",
+   gemalto_ciev_notify, FALSE, modem, NULL);
+
+   g_at_chat_send(data->app, "AT^SIND=\"simstatus\",1", none_prefix,
+   NULL, NULL, NULL);
+


As a general rule of thumb, there should be no AT commands being sent in 
pre_sim/post_sim/post_online callbacks.  Move this sequence as part of 
the initialization procedure, perhaps after calling 
ofono_modem_set_powered() in sim_state_cb()



+   if (data->sim && data->have_sim == TRUE)
+   ofono_sim_inserted_notify(data->sim, TRUE);
  }
  
  static void gemalto_post_sim(struct ofono_modem *modem)




Regards,
-Denis
___
ofono mailing list
ofono@ofono.org
https://lists.ofono.org/mailman/listinfo/ofono


[PATCH 4/6] gemalto: handle sim is inserted or removed URCs

2018-03-19 Thread Gabriel Lucas
From: Mariem Cherif 

---
 plugins/gemalto.c | 70 +++
 1 file changed, 66 insertions(+), 4 deletions(-)

diff --git a/plugins/gemalto.c b/plugins/gemalto.c
index 5573606..13270d6 100644
--- a/plugins/gemalto.c
+++ b/plugins/gemalto.c
@@ -489,20 +489,82 @@ static void gemalto_set_online(struct ofono_modem *modem, 
ofono_bool_t online,
g_free(cbd);
 }
 
+static void sim_ready_cb(gboolean present, gpointer user_data)
+{
+   struct ofono_sim *sim = user_data;
+
+   DBG("sim present: %d", present);
+
+   ofono_sim_inserted_notify(sim, present);
+}
+
+static void gemalto_ciev_notify(GAtResult *result, gpointer user_data)
+{
+   struct ofono_modem *modem = user_data;
+   struct gemalto_data *data = ofono_modem_get_data(modem);
+   struct ofono_sim *sim = data->sim;
+
+   const char *sim_status = "simstatus";
+   const char *ind_str;
+   int status;
+   GAtResultIter iter;
+
+   g_at_result_iter_init(, result);
+
+   /* Example: +CIEV: simstatus, */
+   if (!g_at_result_iter_next(, "+CIEV:"))
+   return;
+
+   if (!g_at_result_iter_next_unquoted_string(, _str))
+   return;
+
+   if (!g_str_equal(sim_status, ind_str))
+   return;
+
+   if (!g_at_result_iter_next_number(, ))
+   return;
+
+   DBG("sim status %d", status);
+
+   switch (status) {
+   /* SIM is removed from the holder */
+   case 0:
+   ofono_sim_inserted_notify(sim, FALSE);
+   break;
+
+   /* SIM is inserted inside the holder */
+   case 1:
+   /* The SIM won't be ready yet */
+   data->sim_state_query = at_util_sim_state_query_new(data->app,
+   1, 20, sim_ready_cb, sim,
+   NULL);
+   break;
+
+   default:
+   break;
+   }
+}
+
 static void gemalto_pre_sim(struct ofono_modem *modem)
 {
struct gemalto_data *data = ofono_modem_get_data(modem);
-   struct ofono_sim *sim;
 
DBG("%p", modem);
 
ofono_devinfo_create(modem, 0, "atmodem", data->app);
ofono_location_reporting_create(modem, 0, "gemaltomodem", data->app);
-   sim = ofono_sim_create(modem, OFONO_VENDOR_CINTERION, "atmodem",
+   data->sim = ofono_sim_create(modem, OFONO_VENDOR_CINTERION, "atmodem",
data->app);
 
-   if (sim && data->have_sim == TRUE)
-   ofono_sim_inserted_notify(sim, TRUE);
+   /* Register for specific sim status reports */
+   g_at_chat_register(data->app, "+CIEV:",
+   gemalto_ciev_notify, FALSE, modem, NULL);
+
+   g_at_chat_send(data->app, "AT^SIND=\"simstatus\",1", none_prefix,
+   NULL, NULL, NULL);
+
+   if (data->sim && data->have_sim == TRUE)
+   ofono_sim_inserted_notify(data->sim, TRUE);
 }
 
 static void gemalto_post_sim(struct ofono_modem *modem)
-- 
1.9.1

___
ofono mailing list
ofono@ofono.org
https://lists.ofono.org/mailman/listinfo/ofono


Re: [PATCH 4/6] gemalto: handle sim is inserted or removed URCs

2018-03-16 Thread Denis Kenzior

Hi Gabriel,

On 03/16/2018 08:28 AM, Gabriel Lucas wrote:

Hi Denis,

On 15/03/2018 18:26, Denis Kenzior wrote:

Hi Gabriel,

On 03/15/2018 07:49 AM, Gabriel Lucas wrote:

From: Mariem Cherif 

+    g_at_result_iter_init(, result);
+
+    if (!g_at_result_iter_next(, "+CIEV:"))
+    return;
+


So generally +CIEV indication is an , syntax.

We receive this kind of signal: +CIEV: simstatus,.
In this code, Mariem is ensuring the index is simstatus.
Do you prefer us to use g_at_result_iter_next to handle the index ?
Or even to use "+CIEV: simstatus" as prefix in the register function ?


Okay, that makes sense now.  Gemalto should really fix their firmware as 
this syntax is not really correct, but nothing we can do about it now. 
I would stick with the current approach.



+    if (!g_at_result_iter_next_unquoted_string(, _str))
+    return;


Does Gemalto use some other syntax here?  If so, you might want to 
document a simple example above.

I've added a comment

+    ofono_sim_inserted_notify(sim, FALSE);
+    } else if(status == 1) {
+    ofono_sim_inserted_notify(sim, TRUE);
+    }


Okay, but simpler written as ofono_sim_inserted_notify(sim, status);
The thing is we don't only receive the status 0 and 1. We also have 4 
(ALS3) and

5 (ALS3 + PHS8P). Only the first two should be used.


In that case I would use a switch/case statement, add a case label 
/comment for the other possibilities and what they mean and simply use a 
'break' statement for those.


Regards,
-Denis
___
ofono mailing list
ofono@ofono.org
https://lists.ofono.org/mailman/listinfo/ofono


Re: [PATCH 4/6] gemalto: handle sim is inserted or removed URCs

2018-03-16 Thread Gabriel Lucas

Hi Denis,

On 15/03/2018 18:26, Denis Kenzior wrote:

Hi Gabriel,

On 03/15/2018 07:49 AM, Gabriel Lucas wrote:

From: Mariem Cherif 

+    g_at_result_iter_init(, result);
+
+    if (!g_at_result_iter_next(, "+CIEV:"))
+    return;
+


So generally +CIEV indication is an , syntax.

We receive this kind of signal: +CIEV: simstatus,.
In this code, Mariem is ensuring the index is simstatus.
Do you prefer us to use g_at_result_iter_next to handle the index ?
Or even to use "+CIEV: simstatus" as prefix in the register function ?

+    if (!g_at_result_iter_next_unquoted_string(, _str))
+    return;


Does Gemalto use some other syntax here?  If so, you might want to 
document a simple example above.

I've added a comment

+    ofono_sim_inserted_notify(sim, FALSE);
+    } else if(status == 1) {
+    ofono_sim_inserted_notify(sim, TRUE);
+    }


Okay, but simpler written as ofono_sim_inserted_notify(sim, status);
The thing is we don't only receive the status 0 and 1. We also have 4 
(ALS3) and

5 (ALS3 + PHS8P). Only the first two should be used.

Best regards,
Gabriel
___
ofono mailing list
ofono@ofono.org
https://lists.ofono.org/mailman/listinfo/ofono


Re: [PATCH 4/6] gemalto: handle sim is inserted or removed URCs

2018-03-15 Thread Denis Kenzior

Hi Gabriel,

On 03/15/2018 07:49 AM, Gabriel Lucas wrote:

From: Mariem Cherif 

---
  plugins/gemalto.c | 37 +
  1 file changed, 37 insertions(+)

diff --git a/plugins/gemalto.c b/plugins/gemalto.c
index 16ca463..c7fb783 100644
--- a/plugins/gemalto.c
+++ b/plugins/gemalto.c
@@ -497,6 +497,36 @@ static void gemalto_set_online(struct ofono_modem *modem, 
ofono_bool_t online,
g_free(cbd);
  }
  
+static void gemalto_ciev_notify(GAtResult *result, gpointer user_data)

+{
+   struct ofono_sim *sim = user_data;
+   const char *sim_status = "simstatus";
+   const char *ind_str;
+   int status;
+   GAtResultIter iter;
+
+   g_at_result_iter_init(, result);
+
+   if (!g_at_result_iter_next(, "+CIEV:"))
+   return;
+


So generally +CIEV indication is an , syntax.


+   if (!g_at_result_iter_next_unquoted_string(, _str))
+   return;


Does Gemalto use some other syntax here?  If so, you might want to 
document a simple example above.



+
+   if (!g_str_equal(sim_status, ind_str))
+   return;
+
+   if (!g_at_result_iter_next_number(, ))
+   return;
+
+   DBG("sim status %d", status);
+   if (status == 0) {
+   ofono_sim_inserted_notify(sim, FALSE);
+   } else if(status == 1) {
+   ofono_sim_inserted_notify(sim, TRUE);
+   }


Okay, but simpler written as ofono_sim_inserted_notify(sim, status);


+}
+
  static void gemalto_pre_sim(struct ofono_modem *modem)
  {
struct gemalto_data *data = ofono_modem_get_data(modem);
@@ -509,6 +539,13 @@ static void gemalto_pre_sim(struct ofono_modem *modem)
sim = ofono_sim_create(modem, OFONO_VENDOR_CINTERION, "atmodem",
data->app);
  
+	/* Register for specific sim status reports */

+   g_at_chat_register(data->app, "+CIEV:",
+   gemalto_ciev_notify, FALSE, sim, NULL);
+
+   g_at_chat_send(data->app, "AT^SIND=\"simstatus\",1", none_prefix,
+   NULL, NULL, NULL);
+
if (sim && data->have_sim == TRUE)
ofono_sim_inserted_notify(sim, TRUE);
  }



Regards,
-Denis
___
ofono mailing list
ofono@ofono.org
https://lists.ofono.org/mailman/listinfo/ofono


[PATCH 4/6] gemalto: handle sim is inserted or removed URCs

2018-03-12 Thread Gabriel Lucas
From: Mariem Cherif 

---
 plugins/gemalto.c | 37 +
 1 file changed, 37 insertions(+)

diff --git a/plugins/gemalto.c b/plugins/gemalto.c
index 16ca463..c7fb783 100644
--- a/plugins/gemalto.c
+++ b/plugins/gemalto.c
@@ -497,6 +497,36 @@ static void gemalto_set_online(struct ofono_modem *modem, 
ofono_bool_t online,
g_free(cbd);
 }
 
+static void gemalto_ciev_notify(GAtResult *result, gpointer user_data)
+{
+   struct ofono_sim *sim = user_data;
+   const char *sim_status = "simstatus";
+   const char *ind_str;
+   int status;
+   GAtResultIter iter;
+
+   g_at_result_iter_init(, result);
+
+   if (!g_at_result_iter_next(, "+CIEV:"))
+   return;
+
+   if (!g_at_result_iter_next_unquoted_string(, _str))
+   return;
+
+   if (!g_str_equal(sim_status, ind_str))
+   return;
+
+   if (!g_at_result_iter_next_number(, ))
+   return;
+
+   DBG("sim status %d", status);
+   if (status == 0) {
+   ofono_sim_inserted_notify(sim, FALSE);
+   } else if(status == 1) {
+   ofono_sim_inserted_notify(sim, TRUE);
+   }
+}
+
 static void gemalto_pre_sim(struct ofono_modem *modem)
 {
struct gemalto_data *data = ofono_modem_get_data(modem);
@@ -509,6 +539,13 @@ static void gemalto_pre_sim(struct ofono_modem *modem)
sim = ofono_sim_create(modem, OFONO_VENDOR_CINTERION, "atmodem",
data->app);
 
+   /* Register for specific sim status reports */
+   g_at_chat_register(data->app, "+CIEV:",
+   gemalto_ciev_notify, FALSE, sim, NULL);
+
+   g_at_chat_send(data->app, "AT^SIND=\"simstatus\",1", none_prefix,
+   NULL, NULL, NULL);
+
if (sim && data->have_sim == TRUE)
ofono_sim_inserted_notify(sim, TRUE);
 }
-- 
1.9.1

___
ofono mailing list
ofono@ofono.org
https://lists.ofono.org/mailman/listinfo/ofono


[PATCH 4/6] gemalto: handle sim is inserted or removed URCs

2018-03-12 Thread Gabriel Lucas
From: Mariem Cherif 

---
 plugins/gemalto.c | 37 +
 1 file changed, 37 insertions(+)

diff --git a/plugins/gemalto.c b/plugins/gemalto.c
index 16ca463..c7fb783 100644
--- a/plugins/gemalto.c
+++ b/plugins/gemalto.c
@@ -497,6 +497,36 @@ static void gemalto_set_online(struct ofono_modem *modem, 
ofono_bool_t online,
g_free(cbd);
 }
 
+static void gemalto_ciev_notify(GAtResult *result, gpointer user_data)
+{
+   struct ofono_sim *sim = user_data;
+   const char *sim_status = "simstatus";
+   const char *ind_str;
+   int status;
+   GAtResultIter iter;
+
+   g_at_result_iter_init(, result);
+
+   if (!g_at_result_iter_next(, "+CIEV:"))
+   return;
+
+   if (!g_at_result_iter_next_unquoted_string(, _str))
+   return;
+
+   if (!g_str_equal(sim_status, ind_str))
+   return;
+
+   if (!g_at_result_iter_next_number(, ))
+   return;
+
+   DBG("sim status %d", status);
+   if (status == 0) {
+   ofono_sim_inserted_notify(sim, FALSE);
+   } else if(status == 1) {
+   ofono_sim_inserted_notify(sim, TRUE);
+   }
+}
+
 static void gemalto_pre_sim(struct ofono_modem *modem)
 {
struct gemalto_data *data = ofono_modem_get_data(modem);
@@ -509,6 +539,13 @@ static void gemalto_pre_sim(struct ofono_modem *modem)
sim = ofono_sim_create(modem, OFONO_VENDOR_CINTERION, "atmodem",
data->app);
 
+   /* Register for specific sim status reports */
+   g_at_chat_register(data->app, "+CIEV:",
+   gemalto_ciev_notify, FALSE, sim, NULL);
+
+   g_at_chat_send(data->app, "AT^SIND=\"simstatus\",1", none_prefix,
+   NULL, NULL, NULL);
+
if (sim && data->have_sim == TRUE)
ofono_sim_inserted_notify(sim, TRUE);
 }
-- 
1.9.1

___
ofono mailing list
ofono@ofono.org
https://lists.ofono.org/mailman/listinfo/ofono


[PATCH 4/6] gemalto: handle sim is inserted or removed URCs

2018-03-12 Thread Gabriel Lucas
From: Mariem Cherif 

---
 plugins/gemalto.c | 37 +
 1 file changed, 37 insertions(+)

diff --git a/plugins/gemalto.c b/plugins/gemalto.c
index 16ca463..c7fb783 100644
--- a/plugins/gemalto.c
+++ b/plugins/gemalto.c
@@ -497,6 +497,36 @@ static void gemalto_set_online(struct ofono_modem *modem, 
ofono_bool_t online,
g_free(cbd);
 }
 
+static void gemalto_ciev_notify(GAtResult *result, gpointer user_data)
+{
+   struct ofono_sim *sim = user_data;
+   const char *sim_status = "simstatus";
+   const char *ind_str;
+   int status;
+   GAtResultIter iter;
+
+   g_at_result_iter_init(, result);
+
+   if (!g_at_result_iter_next(, "+CIEV:"))
+   return;
+
+   if (!g_at_result_iter_next_unquoted_string(, _str))
+   return;
+
+   if (!g_str_equal(sim_status, ind_str))
+   return;
+
+   if (!g_at_result_iter_next_number(, ))
+   return;
+
+   DBG("sim status %d", status);
+   if (status == 0) {
+   ofono_sim_inserted_notify(sim, FALSE);
+   } else if(status == 1) {
+   ofono_sim_inserted_notify(sim, TRUE);
+   }
+}
+
 static void gemalto_pre_sim(struct ofono_modem *modem)
 {
struct gemalto_data *data = ofono_modem_get_data(modem);
@@ -509,6 +539,13 @@ static void gemalto_pre_sim(struct ofono_modem *modem)
sim = ofono_sim_create(modem, OFONO_VENDOR_CINTERION, "atmodem",
data->app);
 
+   /* Register for specific sim status reports */
+   g_at_chat_register(data->app, "+CIEV:",
+   gemalto_ciev_notify, FALSE, sim, NULL);
+
+   g_at_chat_send(data->app, "AT^SIND=\"simstatus\",1", none_prefix,
+   NULL, NULL, NULL);
+
if (sim && data->have_sim == TRUE)
ofono_sim_inserted_notify(sim, TRUE);
 }
-- 
1.9.1

___
ofono mailing list
ofono@ofono.org
https://lists.ofono.org/mailman/listinfo/ofono