All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/9] modem.c: Go to PRE_SIM modem state on OFONO_SIM_STATE_INSERTED.
@ 2011-02-15  7:58 Andrzej Zaborowski
  2011-02-15  7:58 ` [PATCH 2/9] sim: Implement basic Refresh Andrzej Zaborowski
                   ` (8 more replies)
  0 siblings, 9 replies; 20+ messages in thread
From: Andrzej Zaborowski @ 2011-02-15  7:58 UTC (permalink / raw)
  To: ofono

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

The assumption so far was that SIM state would only go from
NOT_PRESENT -> INSERTED -> READY -> NOT_PRESENT because there's
no method to unauthenticate from SIM without removing.  We need to
be able to switch to INSERTED when SIM is being reset,
reinitialised, etc. because going to NOT_PRESENT and then
immediately INSERTED would be logically wrong.
---
 src/modem.c |   12 ++++++++----
 1 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/src/modem.c b/src/modem.c
index 3c1bb52..d1c7905 100644
--- a/src/modem.c
+++ b/src/modem.c
@@ -517,7 +517,7 @@ static void common_online_cb(const struct ofono_error *error, void *data)
 	 *
 	 * Additionally, this process can be interrupted by the following
 	 * events:
-	 *	- Sim being removed
+	 *	- Sim being removed or reset
 	 *	- SetProperty(Powered, False) being called
 	 *	- SetProperty(Lockdown, True) being called
 	 *
@@ -531,7 +531,7 @@ static void common_online_cb(const struct ofono_error *error, void *data)
 		/* The powered operation is pending */
 		break;
 	case MODEM_STATE_PRE_SIM:
-		/* Go back offline if the sim was removed */
+		/* Go back offline if the sim was removed or reset */
 		modem->driver->set_online(modem, 0, NULL, NULL);
 		break;
 	case MODEM_STATE_ONLINE:
@@ -583,9 +583,13 @@ static void sim_state_watch(enum ofono_sim_state new_state, void *user)
 
 	switch (new_state) {
 	case OFONO_SIM_STATE_NOT_PRESENT:
-		modem_change_state(modem, MODEM_STATE_PRE_SIM);
-		break;
 	case OFONO_SIM_STATE_INSERTED:
+		if (modem->modem_state != MODEM_STATE_PRE_SIM) {
+			if (modem->modem_state == MODEM_STATE_ONLINE)
+				modem->get_online = TRUE;
+
+			modem_change_state(modem, MODEM_STATE_PRE_SIM);
+		}
 		break;
 	case OFONO_SIM_STATE_READY:
 		modem_change_state(modem, MODEM_STATE_OFFLINE);
-- 
1.7.1.86.g0e460.dirty


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

end of thread, other threads:[~2011-02-19  4:24 UTC | newest]

Thread overview: 20+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-02-15  7:58 [PATCH 1/9] modem.c: Go to PRE_SIM modem state on OFONO_SIM_STATE_INSERTED Andrzej Zaborowski
2011-02-15  7:58 ` [PATCH 2/9] sim: Implement basic Refresh Andrzej Zaborowski
2011-02-17 21:03   ` Denis Kenzior
2011-02-19  4:18     ` Andrzej Zaborowski
2011-02-15  7:58 ` [PATCH 3/9] sim: Watch for changes to relevant SIM files Andrzej Zaborowski
2011-02-17 21:08   ` Denis Kenzior
2011-02-19  4:24     ` Andrzej Zaborowski
2011-02-15  7:58 ` [PATCH 4/9] voicecall: " Andrzej Zaborowski
2011-02-17 21:08   ` Denis Kenzior
2011-02-15  7:58 ` [PATCH 5/9] network: " Andrzej Zaborowski
2011-02-17 21:09   ` Denis Kenzior
2011-02-15  7:58 ` [PATCH 6/9] cbs: " Andrzej Zaborowski
2011-02-17 21:10   ` Denis Kenzior
2011-02-15  7:58 ` [PATCH 7/9] message-waiting: " Andrzej Zaborowski
2011-02-17 20:54   ` Denis Kenzior
2011-02-15  7:58 ` [PATCH 8/9] call-forwarding: " Andrzej Zaborowski
2011-02-17 20:57   ` Denis Kenzior
2011-02-15  7:58 ` [PATCH 9/9] stk: Partially handle Refresh command Andrzej Zaborowski
2011-02-17 21:17   ` Denis Kenzior
2011-02-17 21:00 ` [PATCH 1/9] modem.c: Go to PRE_SIM modem state on OFONO_SIM_STATE_INSERTED 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.