All of lore.kernel.org
 help / color / mirror / Atom feed
From: Denis Kenzior <denkenz@gmail.com>
To: ofono@ofono.org
Subject: Re: [PATCH v0] Read EF_ICCID property of SIM
Date: Mon, 26 Apr 2010 12:11:54 -0500	[thread overview]
Message-ID: <201004261211.54532.denkenz@gmail.com> (raw)
In-Reply-To: <20100426153824.GA19346@aao-dell>

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

Hi Daniel,

> Read out Intergrated Cicruit Card Identifier from SIM.
> ---
>  v0: initial version
> 
>  doc/sim-api.txt |    5 +++++
>  include/types.h |    2 ++
>  src/sim.c       |   29 +++++++++++++++++++++++++++++
>  src/simutil.h   |    1 +
>  4 files changed, 37 insertions(+), 0 deletions(-)
> 
> diff --git a/doc/sim-api.txt b/doc/sim-api.txt
> index fd02396..d608205 100644
> --- a/doc/sim-api.txt
> +++ b/doc/sim-api.txt
> @@ -115,3 +115,8 @@ Properties	string SubscriberIdentity [readonly,
>  optional]
> 
>  			The list contains elements of the same format as the
>  			PinRequired property.
> +
> +		string IntegratedCircuitCardIdentifier [readonly]

I'd like to name this CardIdentifier, ICCID is too ugly and the full name is 
just too long.

> +static void sim_iccid_read_cb(const struct ofono_error *error,
> +				const unsigned char *data, int len, void *user)
> +{
> +	struct ofono_sim *sim = user;
> +	char number[OFONO_MAX_ICCID_LENGTH+ 1];
> +
> +	if (!error || error->type != OFONO_ERROR_TYPE_NO_ERROR || len != 10)
> +		return;

No need to check for error being NULL, we don't allow that.

> +
> +	extract_bcd_number(data, len, number);
> +	number[OFONO_MAX_ICCID_LENGTH] = '\0';
> +	sim->iccid = g_strdup(number);
> +
> +	DBG("ICCID %s", sim->iccid);
> +}
> +

You might want to emit the property changed signal with the new ICCID value 
here.

>  static void sim_efphase_read_cb(const struct ofono_error *error,
>  				const unsigned char *data, int len, void *user)
>  {
> @@ -1320,6 +1341,9 @@ static void sim_determine_phase(struct ofono_sim
>  *sim)
> 
>  static void sim_initialize(struct ofono_sim *sim)
>  {
> +	sim->driver->read_file_transparent(sim, SIM_EF_ICCID_FILEID, 0, 10,
> +					   sim_iccid_read_cb, sim);
> +

Please use the sim file queue like EFpl does, no need to invent your own 
solution.  The phase check is a very specific case because we cache SIM files by 
phase of the SIM, so it needs to be known / guessed before the rest of sim file 
queue runs.

Regards,
-Denis

  reply	other threads:[~2010-04-26 17:11 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-04-26 15:38 [PATCH v0] Read EF_ICCID property of SIM Daniel Wagner
2010-04-26 17:11 ` Denis Kenzior [this message]
2010-04-27  6:36   ` Daniel Wagner
2010-04-27  8:09     ` Daniel Wagner
2010-04-27 14:21       ` Denis Kenzior
2010-04-27 15:43         ` Daniel Wagner
2010-04-27 15:46           ` Daniel Wagner
2010-04-27 15:53             ` Denis Kenzior
2010-04-27 16:06               ` Daniel Wagner
2010-04-27 16:19                 ` Denis Kenzior

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=201004261211.54532.denkenz@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.