All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] avoid stk atom is removed when sim pin is blocked
@ 2013-09-11 17:51 caiwen.zhang
  2013-09-11 17:41 ` Denis Kenzior
  0 siblings, 1 reply; 5+ messages in thread
From: caiwen.zhang @ 2013-09-11 17:51 UTC (permalink / raw)
  To: ofono

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

From: Caiwen Zhang <caiwen.zhang@intel.com>

When sim pin is blocked after input wrong pin code three times,
modem will change to pre-sim status, at this time, STK function
should be available. stk atoms shouldn't be removed.
---
 src/modem.c |    7 ++++++-
 src/stk.c   |    4 ++++
 2 files changed, 10 insertions(+), 1 deletion(-)

diff --git a/src/modem.c b/src/modem.c
index 01b0e35..7124d53 100644
--- a/src/modem.c
+++ b/src/modem.c
@@ -196,7 +196,12 @@ struct ofono_atom *__ofono_modem_add_atom(struct ofono_modem *modem,
 	atom = g_new0(struct ofono_atom, 1);
 
 	atom->type = type;
-	atom->modem_state = modem->modem_state;
+	/* to avoid STK is removed when modem change to
+		MODEM_STATE_PRE_SIM status */
+	if (type == OFONO_ATOM_TYPE_STK)
+		atom->modem_state = MODEM_STATE_PRE_SIM;
+	else
+		atom->modem_state = modem->modem_state;
 	atom->destruct = destruct;
 	atom->data = data;
 	atom->modem = modem;
diff --git a/src/stk.c b/src/stk.c
index 01c95b5..a00a425 100644
--- a/src/stk.c
+++ b/src/stk.c
@@ -3196,6 +3196,10 @@ struct ofono_stk *ofono_stk_create(struct ofono_modem *modem,
 	if (driver == NULL)
 		return NULL;
 
+	/* STK may already exist, in the case that restore from pin blocked */
+	if (__ofono_modem_find_atom(modem, OFONO_ATOM_TYPE_STK) != NULL)
+		return NULL;
+
 	stk = g_try_new0(struct ofono_stk, 1);
 
 	if (stk == NULL)
-- 
1.7.9.5


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

end of thread, other threads:[~2013-09-16 12:33 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-09-11 17:51 [PATCH] avoid stk atom is removed when sim pin is blocked caiwen.zhang
2013-09-11 17:41 ` Denis Kenzior
2013-09-12  1:14   ` Zhang, Caiwen
2013-09-12 13:32     ` Denis Kenzior
2013-09-16 12:33       ` Zhang, Caiwen

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.