All of lore.kernel.org
 help / color / mirror / Atom feed
* Re: [PATCH_v3 1/3] atutil: Add destroyer in at_util_sim_state_query_new prototype
  2012-04-18 12:16 ` [PATCH_v3 1/3] atutil: Add destroyer in at_util_sim_state_query_new prototype Guillaume Zajac
@ 2012-04-18  9:10   ` Denis Kenzior
  0 siblings, 0 replies; 8+ messages in thread
From: Denis Kenzior @ 2012-04-18  9:10 UTC (permalink / raw)
  To: ofono

[-- Attachment #1: Type: text/plain, Size: 335 bytes --]

On 04/18/2012 07:16 AM, Guillaume Zajac wrote:
> ---
>  drivers/atmodem/atutil.c |    8 +++++++-
>  drivers/atmodem/atutil.h |    3 ++-
>  2 files changed, 9 insertions(+), 2 deletions(-)
> 

Patch has been applied, thanks.  I did amend the naming of data_destroy
to be more consistent with existing code.

Regards,
-Denis

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH_v3 2/3] plugins: Update new at_util_sim_state_query_new() prototype use
  2012-04-18 12:16 ` [PATCH_v3 2/3] plugins: Update new at_util_sim_state_query_new() prototype use Guillaume Zajac
@ 2012-04-18  9:11   ` Denis Kenzior
  0 siblings, 0 replies; 8+ messages in thread
From: Denis Kenzior @ 2012-04-18  9:11 UTC (permalink / raw)
  To: ofono

[-- Attachment #1: Type: text/plain, Size: 400 bytes --]

On 04/18/2012 07:16 AM, Guillaume Zajac wrote:
> ---
>  plugins/alcatel.c |    3 ++-
>  plugins/mbm.c     |    2 +-
>  plugins/samsung.c |    3 ++-
>  plugins/speedup.c |    3 ++-
>  plugins/zte.c     |    3 ++-
>  5 files changed, 9 insertions(+), 5 deletions(-)
> 

Patch has been applied, however I broke this patch into 5 and modified
the commit message slightly.

Regards,
-Denis

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH_v4] atmodem: Poll SIM state after having entered PIN
  2012-04-18 12:39   ` [PATCH_v4] " Guillaume Zajac
@ 2012-04-18  9:22     ` Denis Kenzior
  0 siblings, 0 replies; 8+ messages in thread
From: Denis Kenzior @ 2012-04-18  9:22 UTC (permalink / raw)
  To: ofono

[-- Attachment #1: Type: text/plain, Size: 441 bytes --]

Hi Guillaume,

On 04/18/2012 07:39 AM, Guillaume Zajac wrote:
> We encountered the problem of CME ERROR 14: SIM busy on ZTE modems.
> ZTE modems don't use SIM notification to check SIM state.
> We poll SIM ready state before confirming PIN is entered.
> ---
>  drivers/atmodem/sim.c |   29 +++++++++++++++++++++++++++++
>  1 files changed, 29 insertions(+), 0 deletions(-)
> 

Patch has been applied, thanks.

Regards,
-Denis

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH_v3 0/3] Poll SIM state for ZTE modem when PIN is entered
@ 2012-04-18 12:16 Guillaume Zajac
  2012-04-18 12:16 ` [PATCH_v3 1/3] atutil: Add destroyer in at_util_sim_state_query_new prototype Guillaume Zajac
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: Guillaume Zajac @ 2012-04-18 12:16 UTC (permalink / raw)
  To: ofono

[-- Attachment #1: Type: text/plain, Size: 1007 bytes --]

Hi,

This set of patch contains:
	- at_util_sim_state_query_new() function improvement,
	  add possibility to add a user data destroyer.
	- update of plugins using this new function.
	- poll SIM state for ZTE modems using this new function.

N.B.: For the moment we noticed +CME ERROR 14: SIM busy error after
having entered PIN code only on ZTE modems.

Kind regards,
Guillaume

Guillaume Zajac (3):
  atutil: Add destroyer in at_util_sim_state_query_new prototype
  plugins: Update new at_util_sim_state_query_new() prototype use
  atmodem: Poll SIM state after having entered PIN

 drivers/atmodem/atutil.c |    8 +++++++-
 drivers/atmodem/atutil.h |    3 ++-
 drivers/atmodem/sim.c    |   29 +++++++++++++++++++++++++++++
 plugins/alcatel.c        |    3 ++-
 plugins/mbm.c            |    2 +-
 plugins/samsung.c        |    3 ++-
 plugins/speedup.c        |    3 ++-
 plugins/zte.c            |    3 ++-
 8 files changed, 47 insertions(+), 7 deletions(-)

-- 
1.7.5.4


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH_v3 1/3] atutil: Add destroyer in at_util_sim_state_query_new prototype
  2012-04-18 12:16 [PATCH_v3 0/3] Poll SIM state for ZTE modem when PIN is entered Guillaume Zajac
@ 2012-04-18 12:16 ` Guillaume Zajac
  2012-04-18  9:10   ` Denis Kenzior
  2012-04-18 12:16 ` [PATCH_v3 2/3] plugins: Update new at_util_sim_state_query_new() prototype use Guillaume Zajac
  2012-04-18 12:16 ` [PATCH_v3 3/3] atmodem: Poll SIM state after having entered PIN Guillaume Zajac
  2 siblings, 1 reply; 8+ messages in thread
From: Guillaume Zajac @ 2012-04-18 12:16 UTC (permalink / raw)
  To: ofono

[-- Attachment #1: Type: text/plain, Size: 1966 bytes --]

---
 drivers/atmodem/atutil.c |    8 +++++++-
 drivers/atmodem/atutil.h |    3 ++-
 2 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/drivers/atmodem/atutil.c b/drivers/atmodem/atutil.c
index 0c6aab4..7c46dc5 100644
--- a/drivers/atmodem/atutil.c
+++ b/drivers/atmodem/atutil.c
@@ -45,6 +45,7 @@ struct at_util_sim_state_query {
 	guint num_times;
 	at_util_sim_inserted_cb_t cb;
 	void *userdata;
+	GDestroyNotify data_destroy;
 };
 
 static gboolean cpin_check(gpointer userdata);
@@ -574,7 +575,8 @@ static gboolean cpin_check(gpointer userdata)
 struct at_util_sim_state_query *at_util_sim_state_query_new(GAtChat *chat,
 						guint interval, guint num_times,
 						at_util_sim_inserted_cb_t cb,
-						void *userdata)
+						void *userdata,
+						GDestroyNotify data_destroy)
 {
 	struct at_util_sim_state_query *req;
 
@@ -585,6 +587,7 @@ struct at_util_sim_state_query *at_util_sim_state_query_new(GAtChat *chat,
 	req->num_times = num_times;
 	req->cb = cb;
 	req->userdata = userdata;
+	req->data_destroy = data_destroy;
 
 	cpin_check(req);
 
@@ -599,5 +602,8 @@ void at_util_sim_state_query_free(struct at_util_sim_state_query *req)
 	if (req->cpin_poll_source > 0)
 		g_source_remove(req->cpin_poll_source);
 
+	if (req->data_destroy)
+		req->data_destroy(req->userdata);
+
 	g_free(req);
 }
diff --git a/drivers/atmodem/atutil.h b/drivers/atmodem/atutil.h
index 5046547..5ab9901 100644
--- a/drivers/atmodem/atutil.h
+++ b/drivers/atmodem/atutil.h
@@ -79,7 +79,8 @@ gboolean at_util_parse_attr(GAtResult *result, const char *prefix,
 struct at_util_sim_state_query *at_util_sim_state_query_new(GAtChat *chat,
 						guint interval, guint num_times,
 						at_util_sim_inserted_cb_t cb,
-						void *userdata);
+						void *userdata,
+						GDestroyNotify data_destroy);
 void at_util_sim_state_query_free(struct at_util_sim_state_query *req);
 
 struct cb_data {
-- 
1.7.5.4


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH_v3 2/3] plugins: Update new at_util_sim_state_query_new() prototype use
  2012-04-18 12:16 [PATCH_v3 0/3] Poll SIM state for ZTE modem when PIN is entered Guillaume Zajac
  2012-04-18 12:16 ` [PATCH_v3 1/3] atutil: Add destroyer in at_util_sim_state_query_new prototype Guillaume Zajac
@ 2012-04-18 12:16 ` Guillaume Zajac
  2012-04-18  9:11   ` Denis Kenzior
  2012-04-18 12:16 ` [PATCH_v3 3/3] atmodem: Poll SIM state after having entered PIN Guillaume Zajac
  2 siblings, 1 reply; 8+ messages in thread
From: Guillaume Zajac @ 2012-04-18 12:16 UTC (permalink / raw)
  To: ofono

[-- Attachment #1: Type: text/plain, Size: 2407 bytes --]

---
 plugins/alcatel.c |    3 ++-
 plugins/mbm.c     |    2 +-
 plugins/samsung.c |    3 ++-
 plugins/speedup.c |    3 ++-
 plugins/zte.c     |    3 ++-
 5 files changed, 9 insertions(+), 5 deletions(-)

diff --git a/plugins/alcatel.c b/plugins/alcatel.c
index fd0e4ec..8005170 100644
--- a/plugins/alcatel.c
+++ b/plugins/alcatel.c
@@ -157,7 +157,8 @@ static void cfun_enable(gboolean ok, GAtResult *result, gpointer user_data)
 	}
 
 	data->sim_state_query = at_util_sim_state_query_new(data->aux,
-						2, 20, sim_state_cb, modem);
+						2, 20, sim_state_cb, modem,
+						NULL);
 }
 
 static int alcatel_enable(struct ofono_modem *modem)
diff --git a/plugins/mbm.c b/plugins/mbm.c
index 32c7665..035f87e 100644
--- a/plugins/mbm.c
+++ b/plugins/mbm.c
@@ -164,7 +164,7 @@ done:
 	data->sim_state_query = at_util_sim_state_query_new(data->modem_port,
 								1, 5,
 								sim_state_cb,
-								modem);
+								modem, NULL);
 }
 
 static void cfun_enable(gboolean ok, GAtResult *result, gpointer user_data)
diff --git a/plugins/samsung.c b/plugins/samsung.c
index 8e0d360..68a9b0a 100644
--- a/plugins/samsung.c
+++ b/plugins/samsung.c
@@ -142,7 +142,8 @@ static void cfun_enable(gboolean ok, GAtResult *result, gpointer user_data)
 	}
 
 	data->sim_state_query = at_util_sim_state_query_new(data->chat,
-						1, 5, sim_state_cb, modem);
+						1, 5, sim_state_cb, modem,
+						NULL);
 }
 
 static int samsung_enable(struct ofono_modem *modem)
diff --git a/plugins/speedup.c b/plugins/speedup.c
index ca6ed13..ca33f48 100644
--- a/plugins/speedup.c
+++ b/plugins/speedup.c
@@ -174,7 +174,8 @@ static void cfun_enable(gboolean ok, GAtResult *result, gpointer user_data)
 	}
 
 	data->sim_state_query = at_util_sim_state_query_new(data->aux,
-						2, 20, sim_state_cb, modem);
+						2, 20, sim_state_cb, modem,
+						NULL);
 }
 
 static int speedup_enable(struct ofono_modem *modem)
diff --git a/plugins/zte.c b/plugins/zte.c
index 3a83c8b..53beefe 100644
--- a/plugins/zte.c
+++ b/plugins/zte.c
@@ -218,7 +218,8 @@ static void cfun_enable(gboolean ok, GAtResult *result, gpointer user_data)
 	}
 
 	data->sim_state_query = at_util_sim_state_query_new(data->aux,
-						2, 20, sim_state_cb, modem);
+						2, 20, sim_state_cb, modem,
+						NULL);
 }
 
 static int zte_enable(struct ofono_modem *modem)
-- 
1.7.5.4


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH_v3 3/3] atmodem: Poll SIM state after having entered PIN
  2012-04-18 12:16 [PATCH_v3 0/3] Poll SIM state for ZTE modem when PIN is entered Guillaume Zajac
  2012-04-18 12:16 ` [PATCH_v3 1/3] atutil: Add destroyer in at_util_sim_state_query_new prototype Guillaume Zajac
  2012-04-18 12:16 ` [PATCH_v3 2/3] plugins: Update new at_util_sim_state_query_new() prototype use Guillaume Zajac
@ 2012-04-18 12:16 ` Guillaume Zajac
  2012-04-18 12:39   ` [PATCH_v4] " Guillaume Zajac
  2 siblings, 1 reply; 8+ messages in thread
From: Guillaume Zajac @ 2012-04-18 12:16 UTC (permalink / raw)
  To: ofono

[-- Attachment #1: Type: text/plain, Size: 2111 bytes --]

We encountered the problem of CME ERROR 14: SIM busy on ZTE modems.
ZTE modems don't use SIM notification to check SIM state.
We poll SIM ready state before confirming PIN is entered.
---
 drivers/atmodem/sim.c |   29 +++++++++++++++++++++++++++++
 1 files changed, 29 insertions(+), 0 deletions(-)

diff --git a/drivers/atmodem/sim.c b/drivers/atmodem/sim.c
index c51b1d4..865d758 100644
--- a/drivers/atmodem/sim.c
+++ b/drivers/atmodem/sim.c
@@ -51,6 +51,7 @@ struct sim_data {
 	GAtChat *chat;
 	unsigned int vendor;
 	guint ready_id;
+	struct at_util_sim_state_query *sim_state_query;
 };
 
 static const char *crsm_prefix[] = { "+CRSM:", NULL };
@@ -972,6 +973,21 @@ static void at_epev_notify(GAtResult *result, gpointer user_data)
 	sd->ready_id = 0;
 }
 
+static void sim_state_cb(gboolean present, gpointer user_data)
+{
+	struct cb_data *cbd = user_data;
+	struct sim_data *sd = cbd->user;
+	ofono_sim_lock_unlock_cb_t cb = cbd->cb;
+
+	at_util_sim_state_query_free(sd->sim_state_query);
+	sd->sim_state_query = NULL;
+
+	if (present == 1)
+		CALLBACK_WITH_SUCCESS(cb, cbd->data);
+	else
+		CALLBACK_WITH_FAILURE(cb, cbd->data);
+}
+
 static void at_pin_send_cb(gboolean ok, GAtResult *result,
 				gpointer user_data)
 {
@@ -1005,6 +1021,16 @@ static void at_pin_send_cb(gboolean ok, GAtResult *result,
 		sd->ready_id = g_at_chat_register(sd->chat, "*EPEV",
 							at_epev_notify,
 							FALSE, cbd, g_free);
+	case OFONO_VENDOR_ZTE:
+		/*
+		 * On ZTE modems, after pin is entered, SIM state is check
+		 * by doing some polling as their modem doesn't use
+		 * notification.
+		 */
+	default:
+		sd->sim_state_query = at_util_sim_state_query_new(sd->chat,
+						2, 20, sim_state_cb, cbd,
+						g_free);
 		return;
 	}
 
@@ -1246,6 +1272,9 @@ static void at_sim_remove(struct ofono_sim *sim)
 {
 	struct sim_data *sd = ofono_sim_get_data(sim);
 
+	/* Cleanup potential SIM state polling */
+	at_util_sim_state_query_free(sd->sim_state_query);
+
 	ofono_sim_set_data(sim, NULL);
 
 	g_at_chat_unref(sd->chat);
-- 
1.7.5.4


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH_v4] atmodem: Poll SIM state after having entered PIN
  2012-04-18 12:16 ` [PATCH_v3 3/3] atmodem: Poll SIM state after having entered PIN Guillaume Zajac
@ 2012-04-18 12:39   ` Guillaume Zajac
  2012-04-18  9:22     ` Denis Kenzior
  0 siblings, 1 reply; 8+ messages in thread
From: Guillaume Zajac @ 2012-04-18 12:39 UTC (permalink / raw)
  To: ofono

[-- Attachment #1: Type: text/plain, Size: 2062 bytes --]

We encountered the problem of CME ERROR 14: SIM busy on ZTE modems.
ZTE modems don't use SIM notification to check SIM state.
We poll SIM ready state before confirming PIN is entered.
---
 drivers/atmodem/sim.c |   29 +++++++++++++++++++++++++++++
 1 files changed, 29 insertions(+), 0 deletions(-)

diff --git a/drivers/atmodem/sim.c b/drivers/atmodem/sim.c
index c51b1d4..1c9a7f3 100644
--- a/drivers/atmodem/sim.c
+++ b/drivers/atmodem/sim.c
@@ -51,6 +51,7 @@ struct sim_data {
 	GAtChat *chat;
 	unsigned int vendor;
 	guint ready_id;
+	struct at_util_sim_state_query *sim_state_query;
 };
 
 static const char *crsm_prefix[] = { "+CRSM:", NULL };
@@ -972,6 +973,21 @@ static void at_epev_notify(GAtResult *result, gpointer user_data)
 	sd->ready_id = 0;
 }
 
+static void sim_state_cb(gboolean present, gpointer user_data)
+{
+	struct cb_data *cbd = user_data;
+	struct sim_data *sd = cbd->user;
+	ofono_sim_lock_unlock_cb_t cb = cbd->cb;
+
+	at_util_sim_state_query_free(sd->sim_state_query);
+	sd->sim_state_query = NULL;
+
+	if (present == 1)
+		CALLBACK_WITH_SUCCESS(cb, cbd->data);
+	else
+		CALLBACK_WITH_FAILURE(cb, cbd->data);
+}
+
 static void at_pin_send_cb(gboolean ok, GAtResult *result,
 				gpointer user_data)
 {
@@ -1006,6 +1022,16 @@ static void at_pin_send_cb(gboolean ok, GAtResult *result,
 							at_epev_notify,
 							FALSE, cbd, g_free);
 		return;
+	case OFONO_VENDOR_ZTE:
+		/*
+		 * On ZTE modems, after pin is entered, SIM state is check
+		 * by doing some polling as their modem doesn't use
+		 * notification.
+		 */
+		sd->sim_state_query = at_util_sim_state_query_new(sd->chat,
+						2, 20, sim_state_cb, cbd,
+						g_free);
+		return;
 	}
 
 done:
@@ -1246,6 +1272,9 @@ static void at_sim_remove(struct ofono_sim *sim)
 {
 	struct sim_data *sd = ofono_sim_get_data(sim);
 
+	/* Cleanup potential SIM state polling */
+	at_util_sim_state_query_free(sd->sim_state_query);
+
 	ofono_sim_set_data(sim, NULL);
 
 	g_at_chat_unref(sd->chat);
-- 
1.7.5.4


^ permalink raw reply related	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2012-04-18 12:39 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-04-18 12:16 [PATCH_v3 0/3] Poll SIM state for ZTE modem when PIN is entered Guillaume Zajac
2012-04-18 12:16 ` [PATCH_v3 1/3] atutil: Add destroyer in at_util_sim_state_query_new prototype Guillaume Zajac
2012-04-18  9:10   ` Denis Kenzior
2012-04-18 12:16 ` [PATCH_v3 2/3] plugins: Update new at_util_sim_state_query_new() prototype use Guillaume Zajac
2012-04-18  9:11   ` Denis Kenzior
2012-04-18 12:16 ` [PATCH_v3 3/3] atmodem: Poll SIM state after having entered PIN Guillaume Zajac
2012-04-18 12:39   ` [PATCH_v4] " Guillaume Zajac
2012-04-18  9:22     ` 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.