Open Source Telephony
 help / color / mirror / Atom feed
* [PATCH 1/2] Make function reset_available() return void
@ 2010-08-19  6:05 Yang Gu
  2010-08-19  6:05 ` [PATCH 2/2] sim: Read EFust and EFest Yang Gu
  2010-08-19  8:15 ` [PATCH 1/2] Make function reset_available() return void Marcel Holtmann
  0 siblings, 2 replies; 4+ messages in thread
From: Yang Gu @ 2010-08-19  6:05 UTC (permalink / raw)
  To: ofono

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

This change is to dispel compiler's complaint.
---
 src/network.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/src/network.c b/src/network.c
index f5b9a5e..190eba9 100644
--- a/src/network.c
+++ b/src/network.c
@@ -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)
-- 
1.7.0.4


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

* [PATCH 2/2] sim: Read EFust and EFest
  2010-08-19  6:05 [PATCH 1/2] Make function reset_available() return void Yang Gu
@ 2010-08-19  6:05 ` Yang Gu
  2010-08-23 19:31   ` Denis Kenzior
  2010-08-19  8:15 ` [PATCH 1/2] Make function reset_available() return void Marcel Holtmann
  1 sibling, 1 reply; 4+ messages in thread
From: Yang Gu @ 2010-08-19  6:05 UTC (permalink / raw)
  To: ofono

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

---
 src/sim.c     |   75 +++++++++++++++++++++++++++++++++++++++-
 src/simutil.c |   18 ++++++++++
 src/simutil.h |  105 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 196 insertions(+), 2 deletions(-)

diff --git a/src/sim.c b/src/sim.c
index d2ed780..235f457 100644
--- a/src/sim.c
+++ b/src/sim.c
@@ -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)
diff --git a/src/simutil.c b/src/simutil.c
index 4b49b00..2d0764c 100644
--- a/src/simutil.c
+++ b/src/simutil.c
@@ -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;
+}
diff --git a/src/simutil.h b/src/simutil.h
index 29194ca..4db950b 100644
--- a/src/simutil.h
+++ b/src/simutil.h
@@ -26,9 +26,11 @@ enum sim_fileid {
 	SIM_EF_CPHS_MWIS_FILEID = 0x6f11,
 	SIM_EF_CPHS_INFORMATION_FILEID = 0x6f16,
 	SIM_EF_CPHS_MBDN_FILEID = 0x6f17,
+	SIM_EFUST_FILEID = 0x6f38,
 	SIM_EFMSISDN_FILEID = 0x6f40,
 	SIM_EFSPN_FILEID = 0x6f46,
 	SIM_EFSDN_FILEID = 0x6f49,
+	SIM_EFEST_FILEID = 0x6f56,
 	SIM_EFAD_FILEID = 0x6fad,
 	SIM_EFPHASE_FILEID = 0x6fae,
 	SIM_EFPNN_FILEID = 0x6fc5,
@@ -53,6 +55,104 @@ enum sim_file_access {
 	SIM_FILE_ACCESS_NEVER = 15,
 };
 
+/* 131.102 Section 4.2.8 */
+enum sim_ust_service {
+	SIM_UST_SERVICE_LOCAL_PHONE_BOOK		= 0,
+	SIM_UST_SERVICE_FDN				= 1,
+	SIM_UST_SERVICE_EXT_2				= 2,
+	SIM_UST_SERVICE_SDN				= 3,
+	SIM_UST_SERVICE_EXT_3				= 4,
+	SIM_UST_SERVICE_BDN				= 5,
+	SIM_UST_SERVICE_EXT_4				= 6,
+	SIM_UST_SERVICE_OCI_OCT				= 7,
+	SIM_UST_SERVICE_ICI_ICT				= 8,
+	SIM_UST_SERVICE_SMS				= 9,
+	SIM_UST_SERVICE_SMSR				= 10,
+	SIM_UST_SERVICE_SMSP				= 11,
+	SIM_UST_SERVICE_AOC				= 12,
+	SIM_UST_SERVICE_CCP2				= 13,
+	SIM_UST_SERVICE_CBS_ID				= 14,
+	SIM_UST_SERVICE_CBS_ID_RANGE			= 15,
+	SIM_UST_SERVICE_GROUP_ID_LEVEL_1		= 16,
+	SIM_UST_SERVICE_GROUP_ID_LEVEL_2		= 17,
+	SIM_UST_SERVICE_PROVIDER_NAME			= 18,
+	SIM_UST_SERVICE_USER_PLMN			= 19,
+	SIM_UST_SERVICE_MSISDN				= 20,
+	SIM_UST_SERVICE_IMG				= 21,
+	SIM_UST_SERVICE_SOLSA				= 22,
+	SIM_UST_SERVICE_PRECEDENCE_PREEMPTION		= 23,
+	SIM_UST_SERVICE_EMLPP				= 24,
+	SIM_UST_SERVICE_GSM_ACCESS			= 26,
+	SIM_UST_SERVICE_DATA_DOWNLOAD_SMS_PP		= 27,
+	SIM_UST_SERVICE_DATA_DOWNLOAD_SMS_CB		= 28,
+	SIM_UST_SERVICE_CALL_CONTROL_USIM		= 29,
+	SIM_UST_SERVICE_MO_SMS_USIM			= 30,
+	SIM_UST_SERVICE_RUN_AT_COMMAND			= 31,
+	SIM_UST_SERVICE_ENABLED_SERVICE_TABLE		= 33,
+	SIM_UST_SERVICE_ACL				= 34,
+	SIM_UST_SERVICE_DEPERSONALISATION_CTRL_KEY	= 35,
+	SIM_UST_SERVICE_NETWORK_LIST			= 36,
+	SIM_UST_SERVICE_GSM_SECURITY_CONTEXT		= 37,
+	SIM_UST_SERVICE_CPBCCH				= 38,
+	SIM_UST_SERVICE_INVESTIGATION_SCAN		= 39,
+	SIM_UST_SERVICE_MEXE				= 40,
+	SIM_UST_SERVICE_OPERATOR_PLMN			= 41,
+	SIM_UST_SERVICE_HPLMN				= 42,
+	SIM_UST_SERVICE_EXT_5				= 43,
+	SIM_UST_SERVICE_PLMN_NETWORK_NAME		= 44,
+	SIM_UST_SERVICE_OPERATOR_PLMN_LIST		= 45,
+	SIM_UST_SERVICE_MAILBOX_DIALLING_NUMBERS	= 46,
+	SIM_UST_SERVICE_MWIS				= 47,
+	SIM_UST_SERVICE_CFIS				= 48,
+	SIM_UST_SERVICE_PROVIDER_DISPLAY_INFO		= 50,
+	SIM_UST_SERVICE_MMS				= 51,
+	SIM_UST_SERVICE_EXT_8				= 52,
+	SIM_UST_SERVICE_CALL_CONTROL_GPRS_USIM		= 53,
+	SIM_UST_SERVICE_MMS_USER_CONN_PARAM		= 54,
+	SIM_UST_SERVICE_NIA				= 55,
+	SIM_UST_SERVICE_EFVGCS_EFVGCSS			= 56,
+	SIM_UST_SERVICE_EFVBS_EFVBSS			= 57,
+	SIM_UST_SERVICE_PSEUDONYM			= 58,
+	SIM_UST_SERVICE_USER_PLMN_I_WLAN		= 59,
+	SIM_UST_SERVICE_OPERATOR_PLMN_I_WLAN		= 60,
+	SIM_UST_SERVICE_USER_WSID			= 61,
+	SIM_UST_SERVICE_OPERATOR_WSID			= 62,
+	SIM_UST_SERVICE_VGCS_SECURITY			= 63,
+	SIM_UST_SERVICE_VBS_SECURITY			= 64,
+	SIM_UST_SERVICE_WLAN_REAUTH_ID			= 65,
+	SIM_UST_SERVICE_MMS_STORAGE			= 66,
+	SIM_UST_SERVICE_GBA				= 67,
+	SIM_UST_SERVICE_MBMS_SECURITY			= 68,
+	SIM_UST_SERVICE_USSD_APPLICATION_MODE		= 69,
+	SIM_UST_SERVICE_EQUIVALENT_HPLMN		= 70,
+	SIM_UST_SERVICE_ADDITIONAL_TERMINAL_PROFILE	= 71,
+	SIM_UST_SERVICE_EQUIVALENT_HPLMN_IND		= 72,
+	SIM_UST_SERVICE_LAST_RPLMN_IND			= 73,
+	SIM_UST_SERVICE_OMA_BCAST_SC_PROFILE		= 74,
+	SIM_UST_SERVICE_BGA_LOCAL_KEY			= 75,
+	SIM_UST_SERVICE_TERMINAL_APPLICATIONS		= 76,
+	SIM_UST_SERVICE_PROVIDER_NAME_ICON		= 77,
+	SIM_UST_SERVICE_PLMN_NETWORK_NAME_ICON		= 78,
+	SIM_UST_SERVICE_CONN_PARAM_USIM_IP		= 79,
+	SIM_UST_SERVICE_HOME_I_WLAN_ID_LIST		= 80,
+	SIM_UST_SERVICE_I_WLAN_EQUIVALENT_HPLMN_IND	= 81,
+	SIM_UST_SERVICE_I_WLAN_HPLMN_PRIORITY_IND	= 82,
+	SIM_UST_SERVICE_I_WLAN_LAST_PLMN		= 83,
+	SIM_UST_SERVICE_EPS_INFO			= 84,
+	SIM_UST_SERVICE_CSG_IND				= 85,
+	SIM_UST_SERVICE_CALL_CONTROL_EPS_PDN_USIM	= 86,
+	SIM_UST_SERVICE_HPLMN_DIRECT_ACCESS		= 87,
+	SIM_UST_SERVICE_ECALL_DATA			= 88,
+	SIM_UST_SERVICE_OPERATOR_CSG			= 89
+};
+
+/* 131.102 Section 4.2.47 */
+enum sim_est_service {
+	SIM_EST_SERVICE_FDN				= 0,
+	SIM_EST_SERVICE_BDN				= 1,
+	SIM_EST_SERVICE_ACL				= 2
+};
+
 #define SIM_EFSPN_DC_HOME_PLMN_BIT 0x1
 #define SIM_EFSPN_DC_ROAMING_SPN_BIT 0x2
 
@@ -266,3 +366,8 @@ gboolean sim_parse_3g_get_response(const unsigned char *data, int len,
 gboolean sim_parse_2g_get_response(const unsigned char *response, int len,
 					int *file_len, int *record_len,
 					int *structure, unsigned char *access);
+
+gboolean sim_ust_is_available(unsigned char *service_ust, unsigned char len,
+						enum sim_ust_service index);
+gboolean sim_est_is_active(unsigned char *service_est, unsigned char len,
+						enum sim_est_service index);
-- 
1.7.0.4


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

* Re: [PATCH 1/2] Make function reset_available() return void
  2010-08-19  6:05 [PATCH 1/2] Make function reset_available() return void Yang Gu
  2010-08-19  6:05 ` [PATCH 2/2] sim: Read EFust and EFest Yang Gu
@ 2010-08-19  8:15 ` Marcel Holtmann
  1 sibling, 0 replies; 4+ messages in thread
From: Marcel Holtmann @ 2010-08-19  8:15 UTC (permalink / raw)
  To: ofono

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

Hi Yang,

> 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



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

* Re: [PATCH 2/2] sim: Read EFust and EFest
  2010-08-19  6:05 ` [PATCH 2/2] sim: Read EFust and EFest Yang Gu
@ 2010-08-23 19:31   ` Denis Kenzior
  0 siblings, 0 replies; 4+ messages in thread
From: Denis Kenzior @ 2010-08-23 19:31 UTC (permalink / raw)
  To: ofono

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

Hi Yang,

On 08/19/2010 01:05 AM, Yang Gu wrote:
> ---
>  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

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

end of thread, other threads:[~2010-08-23 19:31 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-08-19  6:05 [PATCH 1/2] Make function reset_available() return void Yang Gu
2010-08-19  6:05 ` [PATCH 2/2] sim: Read EFust and EFest Yang Gu
2010-08-23 19:31   ` Denis Kenzior
2010-08-19  8:15 ` [PATCH 1/2] Make function reset_available() return void Marcel Holtmann

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox