Skip to contentSkip to conversation

Make function reset_available() return void

PATCH In review Yang Gu 3 participants 4 messages Aug 19, 2010 – Aug 23, 2010

lore
Share & tools
lore

Yang Gu

author
#0 lore raw

PATCH 1/2 Make function reset_available() return void

This change is to dispel compiler's complaint.

---
 src/network.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
src/network.c +1 -1
index f5b9a5e..190eba9 100644
@@ -1175,7 +1175,7 @@ static void notify_status_watches(struct ofono_netreg *netreg)
 	}
 }
 
-static gboolean reset_available(struct network_operator_data *old,
+static void reset_available(struct network_operator_data *old,
 				const struct ofono_network_operator *new)
 {
 	if (old == NULL)
Signature · 1 line
1.7.0.4
author
#1 lore raw

PATCH 2/2 sim: Read EFust and EFest

---
 src/sim.c     |   75 +++++++++++++++++++++++++++++++++++++++-
 src/simutil.c |   18 ++++++++++
 src/simutil.h |  105 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 196 insertions(+), 2 deletions(-)
src/sim.c +73 -2
index d2ed780..235f457 100644
@@ -95,6 +95,10 @@ struct ofono_sim {
 	void *driver_data;
 	struct ofono_atom *atom;
 	DBusMessage *pending;
+	unsigned char *efust;
+	unsigned char efust_length;
+	unsigned char *efest;
+	unsigned char efest_length;
 };
 
 struct msisdn_set_request {
@@ -1076,6 +1080,61 @@ static void sim_retrieve_imsi(struct ofono_sim *sim)
 	sim->driver->read_imsi(sim, sim_imsi_cb, sim);
 }
 
+static void sim_efest_read_cb(int ok, int length, int record,
+				const unsigned char *data,
+				int record_length, void *userdata)
+{
+	struct ofono_sim *sim = userdata;
+
+	if (!ok)
+		goto out;
+
+	if (length < 1) {
+		ofono_error("EFest shall contain@least one byte");
+		goto out;
+	}
+
+	sim->efest = g_memdup(data, length);
+	sim->efest_length = length;
+
+out:
+	sim_retrieve_imsi(sim);
+}
+
+static void sim_efust_read_cb(int ok, int length, int record,
+				const unsigned char *data,
+				int record_length, void *userdata)
+{
+	struct ofono_sim *sim = userdata;
+
+	if (!ok)
+		goto out;
+
+	if (length < 1) {
+		ofono_error("EFust shall contain@least one byte");
+		goto out;
+	}
+
+	sim->efust = g_memdup(data, length);
+	sim->efust_length = length;
+
+	ofono_sim_read(sim, SIM_EFEST_FILEID,
+		OFONO_SIM_FILE_STRUCTURE_TRANSPARENT,
+		sim_efest_read_cb, sim);
+
+	return;
+
+out:
+	sim_retrieve_imsi(sim);
+}
+
+static inline void sim_retrieve_efust(struct ofono_sim *sim)
+{
+	ofono_sim_read(sim, SIM_EFUST_FILEID,
+			OFONO_SIM_FILE_STRUCTURE_TRANSPARENT,
+			sim_efust_read_cb, sim);
+}
+
 static void sim_pin_query_cb(const struct ofono_error *error,
 				enum ofono_sim_password_type pin_type,
 				void *data)
@@ -1110,13 +1169,13 @@ static void sim_pin_query_cb(const struct ofono_error *error,
 
 checkdone:
 	if (pin_type == OFONO_SIM_PASSWORD_NONE)
-		sim_retrieve_imsi(sim);
+		sim_retrieve_efust(sim);
 }
 
 static void sim_pin_check(struct ofono_sim *sim)
 {
 	if (!sim->driver->query_passwd_state) {
-		sim_retrieve_imsi(sim);
+		sim_retrieve_efust(sim);
 		return;
 	}
 
@@ -1934,6 +1993,18 @@ static void sim_free_state(struct ofono_sim *sim)
 		g_strfreev(sim->language_prefs);
 		sim->language_prefs = NULL;
 	}
+
+	if (sim->efust) {
+		g_free(sim->efust);
+		sim->efust = NULL;
+		sim->efust_length = 0;
+	}
+
+	if (sim->efest) {
+		g_free(sim->efest);
+		sim->efest = NULL;
+		sim->efest_length = 0;
+	}
 }
 
 void ofono_sim_inserted_notify(struct ofono_sim *sim, ofono_bool_t inserted)
src/simutil.c +18 -0
index 4b49b00..2d0764c 100644
@@ -1416,3 +1416,21 @@ gboolean sim_parse_2g_get_response(const unsigned char *response, int len,
 
 	return TRUE;
 }
+
+gboolean sim_ust_is_available(unsigned char *efust, unsigned char len,
+						enum sim_ust_service index)
+{
+	if (index >= len * 8)
+		return FALSE;
+
+	return (efust[index / 8] >> (index % 8)) & 1;
+}
+
+gboolean sim_est_is_active(unsigned char *efest, unsigned char len,
+						enum sim_est_service index)
+{
+	if (index >= len * 8)
+		return FALSE;
+
+	return (efest[index / 8] >> (index % 8)) & 1;
+}
src/simutil.h +105 -0

123 lines not on this page · raw message

Signature · 1 line
1.7.0.4
#2 lore raw

Re: [PATCH 2/2] sim: Read EFust and EFest

Hi Yang,

Quoted 5 lines · Yang Gu
---
 src/sim.c     |   75 +++++++++++++++++++++++++++++++++++++++-
 src/simutil.c |   18 ++++++++++
 src/simutil.h |  105 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 196 insertions(+), 2 deletions(-)

This patch has now been applied. However, please send a follow on patch to support EFsst from 11.11 and 51.011. The file id is the same as EFust, however the structure is actually different.

Regards,
-Denis

#3 lore raw
In reply to Yang Gu

Hi Yang,

Quoted 4 lines

This change is to dispel compiler's complaint.

---
 src/network.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

I fixed this before I read your email. Thanks for the patch anyway.

Regards

Marcel