All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] sim: allow access to IMSI only when SIM is ready
@ 2010-08-23 16:57 Pekka.Pessi
  0 siblings, 0 replies; only message in thread
From: Pekka.Pessi @ 2010-08-23 16:57 UTC (permalink / raw)
  To: ofono

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

From: Pekka Pessi <Pekka.Pessi@nokia.com>

The IMSI was emitted and got available slightly before sim got
ready (while CPHS-support bits were read).
---
 src/sim.c |   17 +++++++++--------
 1 files changed, 9 insertions(+), 8 deletions(-)

diff --git a/src/sim.c b/src/sim.c
index d2ed780..955452a 100644
--- a/src/sim.c
+++ b/src/sim.c
@@ -309,7 +309,7 @@ static DBusMessage *sim_get_properties(DBusConnection *conn,
 		ofono_dbus_dict_append(&dict, "CardIdentifier",
 					DBUS_TYPE_STRING, &sim->iccid);
 
-	if (sim->imsi)
+	if (sim->imsi && sim->state == OFONO_SIM_STATE_READY)
 		ofono_dbus_dict_append(&dict, "SubscriberIdentity",
 					DBUS_TYPE_STRING, &sim->imsi);
 
@@ -1043,8 +1043,6 @@ static void sim_imsi_cb(const struct ofono_error *error, const char *imsi,
 		void *data)
 {
 	struct ofono_sim *sim = data;
-	DBusConnection *conn = ofono_dbus_get_connection();
-	const char *path = __ofono_atom_get_path(sim->atom);
 
 	if (error->type != OFONO_ERROR_TYPE_NO_ERROR) {
 		ofono_error("Unable to read IMSI, emergency calls only");
@@ -1053,11 +1051,6 @@ static void sim_imsi_cb(const struct ofono_error *error, const char *imsi,
 
 	sim->imsi = g_strdup(imsi);
 
-	ofono_dbus_signal_property_changed(conn, path,
-						OFONO_SIM_MANAGER_INTERFACE,
-						"SubscriberIdentity",
-						DBUS_TYPE_STRING, &sim->imsi);
-
 	/* Read CPHS-support bits, this is still part of the SIM
 	 * initialisation but no order is specified for it.  */
 	ofono_sim_read(sim, SIM_EF_CPHS_INFORMATION_FILEID,
@@ -2004,6 +1997,8 @@ enum ofono_sim_state ofono_sim_get_state(struct ofono_sim *sim)
 
 static void sim_set_ready(struct ofono_sim *sim)
 {
+	DBusConnection *conn = ofono_dbus_get_connection();
+	const char *path;
 	GSList *l;
 	ofono_sim_state_event_notify_cb_t notify;
 
@@ -2015,6 +2010,12 @@ static void sim_set_ready(struct ofono_sim *sim)
 
 	sim->state = OFONO_SIM_STATE_READY;
 
+	path = __ofono_atom_get_path(sim->atom);
+	ofono_dbus_signal_property_changed(conn, path,
+						OFONO_SIM_MANAGER_INTERFACE,
+						"SubscriberIdentity",
+						DBUS_TYPE_STRING, &sim->imsi);
+
 	for (l = sim->state_watches->items; l; l = l->next) {
 		struct ofono_watchlist_item *item = l->data;
 		notify = item->notify;
-- 
1.7.0.4


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2010-08-23 16:57 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-08-23 16:57 [PATCH] sim: allow access to IMSI only when SIM is ready Pekka.Pessi

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.