From: Denis Kenzior <denkenz@gmail.com>
To: ofono@ofono.org
Subject: Re: [PATCH v2 1/1] sim: Read EFsst
Date: Mon, 30 Aug 2010 17:49:43 -0500 [thread overview]
Message-ID: <4C7C3587.40800@gmail.com> (raw)
In-Reply-To: <1283071901-24385-1-git-send-email-yang.gu@intel.com>
[-- Attachment #1: Type: text/plain, Size: 6276 bytes --]
Hi Yang,
On 08/29/2010 03:51 AM, Yang Gu wrote:
> ---
> src/sim.c | 34 ++++++++++++++++++++++++++++--
> src/simutil.c | 18 ++++++++++++++++
> src/simutil.h | 63 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++
> 3 files changed, 112 insertions(+), 3 deletions(-)
>
> diff --git a/src/sim.c b/src/sim.c
> index f8884a2..6cbb2eb 100644
> --- a/src/sim.c
> +++ b/src/sim.c
> @@ -101,6 +101,8 @@ struct ofono_sim {
> unsigned char efust_length;
> unsigned char *efest;
> unsigned char efest_length;
> + unsigned char *efsst;
> + unsigned char efsst_length;
> };
>
> struct msisdn_set_request {
> @@ -1072,6 +1074,27 @@ static void sim_retrieve_imsi(struct ofono_sim *sim)
> sim->driver->read_imsi(sim, sim_imsi_cb, sim);
> }
>
> +static void sim_efsst_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 < 2) {
> + ofono_error("EFsst shall contain at least two bytes");
> + goto out;
> + }
> +
> + sim->efsst = g_memdup(data, length);
Has this been run through valgrind? Where's the g_free?
> + sim->efsst_length = length;
> +
> +out:
> + sim_retrieve_imsi(sim);
> +}
> +
> static void sim_efest_read_cb(int ok, int length, int record,
> const unsigned char *data,
> int record_length, void *userdata)
> @@ -1192,9 +1215,14 @@ static void sim_initialize_after_pin(struct ofono_sim *sim)
> sim_cphs_information_read_cb, sim);
>
> /* Also retrieve the GSM service table */
> - ofono_sim_read(sim, SIM_EFUST_FILEID,
> - OFONO_SIM_FILE_STRUCTURE_TRANSPARENT,
> - sim_efust_read_cb, sim);
> + if (sim->phase >= OFONO_SIM_PHASE_3G)
> + ofono_sim_read(sim, SIM_EFUST_FILEID,
> + OFONO_SIM_FILE_STRUCTURE_TRANSPARENT,
> + sim_efust_read_cb, sim);
> + else
> + ofono_sim_read(sim, SIM_EFSST_FILEID,
> + OFONO_SIM_FILE_STRUCTURE_TRANSPARENT,
> + sim_efsst_read_cb, sim);
> }
>
> static void sim_pin_query_cb(const struct ofono_error *error,
> diff --git a/src/simutil.c b/src/simutil.c
> index ac054ae..4af6810 100644
> --- a/src/simutil.c
> +++ b/src/simutil.c
> @@ -1434,3 +1434,21 @@ gboolean sim_est_is_active(unsigned char *efest, unsigned char len,
>
> return (efest[index / 8] >> (index % 8)) & 1;
> }
> +
> +gboolean sim_sst_is_available(unsigned char *efsst, unsigned char len,
> + enum sim_sst_service index)
> +{
> + if (index >= len * 4u)
> + return FALSE;
> +
> + return (efsst[index / 4] >> ((index % 4) * 2)) & 1;
> +}
> +
> +gboolean sim_sst_is_active(unsigned char *efsst, unsigned char len,
> + enum sim_sst_service index)
> +{
> + if (index >= len * 4u)
> + return FALSE;
> +
> + return (efsst[index / 4] >> (((index % 4) * 2) + 1)) & 1;
> +}
> diff --git a/src/simutil.h b/src/simutil.h
> index 65e651a..0a94c67 100644
> --- a/src/simutil.h
> +++ b/src/simutil.h
> @@ -28,6 +28,7 @@ enum sim_fileid {
> SIM_EF_CPHS_INFORMATION_FILEID = 0x6f16,
> SIM_EF_CPHS_MBDN_FILEID = 0x6f17,
> SIM_EFUST_FILEID = 0x6f38,
> + SIM_EFSST_FILEID = 0x6f38, /* same as EFust */
> SIM_EFMSISDN_FILEID = 0x6f40,
> SIM_EFSPN_FILEID = 0x6f46,
> SIM_EFSDN_FILEID = 0x6f49,
> @@ -154,6 +155,64 @@ enum sim_est_service {
> SIM_EST_SERVICE_ACL = 2
> };
>
> +/* 51.011 Section 10.3.7 */
> +enum sim_sst_service {
> + SIM_SST_SERVICE_CHV1_DISABLE = 0,
> + SIM_SST_SERVICE_ADN = 1,
> + SIM_SST_SERVICE_FDN = 2,
> + SIM_SST_SERVICE_SMS = 3,
> + SIM_SST_SERVICE_AOC = 4,
> + SIM_SST_SERVICE_CCP = 5,
> + SIM_SST_SERVICE_PLMN_SELECTOR = 6,
> + SIM_SST_SERVICE_MSISDN = 8,
> + SIM_SST_SERVICE_EXT_1 = 9,
> + SIM_SST_SERVICE_EXT_2 = 10,
> + SIM_SST_SERVICE_SMSP = 11,
> + SIM_SST_SERVICE_LND = 12,
> + SIM_SST_SERVICE_CBS_ID = 13,
> + SIM_SST_SERVICE_GROUP_ID_LEVEL_1 = 14,
> + SIM_SST_SERVICE_GROUP_ID_LEVEL_2 = 15,
> + SIM_SST_SERVICE_PROVIDER_NAME = 16,
> + SIM_SST_SERVICE_SDN = 17,
> + SIM_SST_SERVICE_EXT_3 = 18,
> + SIM_SST_SERVICE_EFVGCS_EFVGCSS = 20,
> + SIM_SST_SERVICE_EFVBS_EFVBSS = 21,
> + SIM_SST_SERVICE_PRECEDENCE_PREEMPTION = 22,
> + SIM_SST_SERVICE_EMLPP = 23,
> + SIM_SST_SERVICE_DATA_DOWNLOAD_SMS_CB = 24,
> + SIM_SST_SERVICE_DATA_DOWNLOAD_SMS_PP = 25,
> + SIM_SST_SERVICE_MENU_SELECTION = 26,
> + SIM_SST_SERVICE_CALL_CONTROL = 27,
> + SIM_SST_SERVICE_PROACTIVE_SIM = 28,
> + SIM_SST_SERVICE_CBS_ID_RANGE = 29,
> + SIM_SST_SERVICE_BDN = 30,
> + SIM_SST_SERVICE_EXT_4 = 31,
> + SIM_SST_SERVICE_DEPERSONALISATION_CTRL_KEY = 32,
> + SIM_SST_SERVICE_NETWORK_LIST = 33,
> + SIM_SST_SERVICE_SMSR = 34,
> + SIM_SST_SERVICE_NIA = 35,
> + SIM_SST_SERVICE_MO_SMS_SIM = 36,
> + SIM_SST_SERVICE_GPRS = 37,
> + SIM_SST_SERVICE_IMG = 38,
> + SIM_SST_SERVICE_SOLSA = 39,
> + SIM_SST_SERVICE_USSD_CALL_CONTROL = 40,
> + SIM_SST_SERVICE_RUN_AT_COMMAND = 41,
> + SIM_SST_SERVICE_USER_PLMN = 42,
> + SIM_SST_SERVICE_OPERATOR_PLMN = 43,
> + SIM_SST_SERVICE_HPLMN = 44,
> + SIM_SST_SERVICE_CPBCCH = 45,
> + SIM_SST_SERVICE_INVESTIGATION_SCAN = 46,
> + SIM_SST_SERVICE_EXT_CCP = 47,
> + SIM_SST_SERVICE_MEXE = 48,
> + SIM_SST_SERVICE_RPLMN = 49,
> + SIM_SST_SERVICE_PLMN_NETWORK_NAME = 50,
> + SIM_SST_SERVICE_OPERATOR_PLMN_LIST = 51,
> + SIM_SST_SERVICE_MAILBOX_DIALLING_NUMBERS = 52,
> + SIM_SST_SERVICE_MWIS = 53,
> + SIM_SST_SERVICE_CFIS = 54,
> + SIM_SST_SERVICE_PROVIDER_DISPLAY_INFO = 55
> +};
> +
> #define SIM_EFSPN_DC_HOME_PLMN_BIT 0x1
> #define SIM_EFSPN_DC_ROAMING_SPN_BIT 0x2
>
> @@ -372,3 +431,7 @@ 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);
> +gboolean sim_sst_is_available(unsigned char *service_sst, unsigned char len,
> + enum sim_sst_service index);
> +gboolean sim_sst_is_active(unsigned char *service_sst, unsigned char len,
> + enum sim_sst_service index);
Rest looks good.
Regards,
-Denis
prev parent reply other threads:[~2010-08-30 22:49 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-08-29 8:51 [PATCH v2 1/1] sim: Read EFsst Yang Gu
2010-08-30 22:49 ` Denis Kenzior [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4C7C3587.40800@gmail.com \
--to=denkenz@gmail.com \
--cc=ofono@ofono.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.