All of lore.kernel.org
 help / color / mirror / Atom feed
From: Denis Kenzior <denkenz@gmail.com>
To: ofono@ofono.org
Subject: Re: [PATCH 4/6] gemalto: handle sim is inserted or removed URCs
Date: Thu, 15 Mar 2018 12:26:21 -0500	[thread overview]
Message-ID: <9a9cd20d-6877-08bd-0ba9-7b4facc6c91e@gmail.com> (raw)
In-Reply-To: <1521118170-23722-5-git-send-email-gabriel.lucas@smile.fr>

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

Hi Gabriel,

On 03/15/2018 07:49 AM, Gabriel Lucas wrote:
> From: Mariem Cherif <mariem.cherif@ardia.com.tn>
> 
> ---
>   plugins/gemalto.c | 37 +++++++++++++++++++++++++++++++++++++
>   1 file changed, 37 insertions(+)
> 
> diff --git a/plugins/gemalto.c b/plugins/gemalto.c
> index 16ca463..c7fb783 100644
> --- a/plugins/gemalto.c
> +++ b/plugins/gemalto.c
> @@ -497,6 +497,36 @@ static void gemalto_set_online(struct ofono_modem *modem, ofono_bool_t online,
>   	g_free(cbd);
>   }
>   
> +static void gemalto_ciev_notify(GAtResult *result, gpointer user_data)
> +{
> +	struct ofono_sim *sim = user_data;
> +	const char *sim_status = "simstatus";
> +	const char *ind_str;
> +	int status;
> +	GAtResultIter iter;
> +
> +	g_at_result_iter_init(&iter, result);
> +
> +	if (!g_at_result_iter_next(&iter, "+CIEV:"))
> +		return;
> +

So generally +CIEV indication is an <index>,<value> syntax.

> +	if (!g_at_result_iter_next_unquoted_string(&iter, &ind_str))
> +		return;

Does Gemalto use some other syntax here?  If so, you might want to 
document a simple example above.

> +
> +	if (!g_str_equal(sim_status, ind_str))
> +		return;
> +
> +	if (!g_at_result_iter_next_number(&iter, &status))
> +		return;
> +
> +	DBG("sim status %d", status);
> +	if (status == 0) {
> +		ofono_sim_inserted_notify(sim, FALSE);
> +	} else if(status == 1) {
> +		ofono_sim_inserted_notify(sim, TRUE);
> +	}

Okay, but simpler written as ofono_sim_inserted_notify(sim, status);

> +}
> +
>   static void gemalto_pre_sim(struct ofono_modem *modem)
>   {
>   	struct gemalto_data *data = ofono_modem_get_data(modem);
> @@ -509,6 +539,13 @@ static void gemalto_pre_sim(struct ofono_modem *modem)
>   	sim = ofono_sim_create(modem, OFONO_VENDOR_CINTERION, "atmodem",
>   						data->app);
>   
> +	/* Register for specific sim status reports */
> +	g_at_chat_register(data->app, "+CIEV:",
> +			gemalto_ciev_notify, FALSE, sim, NULL);
> +
> +	g_at_chat_send(data->app, "AT^SIND=\"simstatus\",1", none_prefix,
> +			NULL, NULL, NULL);
> +
>   	if (sim && data->have_sim == TRUE)
>   		ofono_sim_inserted_notify(sim, TRUE);
>   }
> 

Regards,
-Denis

  reply	other threads:[~2018-03-15 17:26 UTC|newest]

Thread overview: 39+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-03-15 12:49 [PATCH 0/6] gemalto's ALS3 and PHS8P support Gabriel Lucas
2018-03-15 12:49 ` [PATCH 1/6] gemalto: add detection of ALS3 modem Gabriel Lucas
2018-03-15 17:22   ` Denis Kenzior
2018-03-15 12:49 ` [PATCH 2/6] gemalto: support ALS3 in gemalto's plugin Gabriel Lucas
2018-03-15 17:11   ` Denis Kenzior
2018-03-16 10:30     ` Gabriel Lucas
2018-03-16 14:23       ` Denis Kenzior
2018-03-16 15:53         ` Gabriel Lucas
2018-03-16 15:59           ` Gabriel Lucas
2018-03-16 16:08             ` Gabriel Lucas
2018-03-16 16:08             ` Denis Kenzior
2018-03-19  9:45               ` Gabriel Lucas
2018-03-19 13:50                 ` Denis Kenzior
2018-03-19 15:15                   ` Gabriel Lucas
2018-03-19 15:24                     ` Denis Kenzior
2018-03-15 12:49 ` [PATCH 3/6] gemalto: acquire the network technology Gabriel Lucas
2018-03-15 17:19   ` Denis Kenzior
2018-03-16 12:04     ` Gabriel Lucas
2018-03-16 12:59     ` Gabriel Lucas
2018-03-16 14:27       ` Denis Kenzior
2018-03-16 15:30         ` Gabriel LUCAS
2018-03-15 12:49 ` [PATCH 4/6] gemalto: handle sim is inserted or removed URCs Gabriel Lucas
2018-03-15 17:26   ` Denis Kenzior [this message]
2018-03-16 13:28     ` Gabriel Lucas
2018-03-16 14:03       ` Denis Kenzior
2018-03-19 15:57         ` Gabriel Lucas
2018-03-19 16:08           ` Denis Kenzior
2018-03-19 16:26             ` Gabriel Lucas
2018-03-19 17:10               ` Denis Kenzior
2018-03-20  8:37                 ` Gabriel Lucas
2018-03-15 12:49 ` [PATCH 5/6] sim: give access to the driver Gabriel Lucas
2018-03-15 17:27   ` Denis Kenzior
2018-03-15 12:49 ` [PATCH 6/6] gemalto: fix sim reinsertion issue Gabriel Lucas
2018-03-15 17:29   ` Denis Kenzior
2018-03-16 13:30     ` Gabriel Lucas
2018-03-19 16:01     ` Gabriel Lucas
  -- strict thread matches above, loose matches on Subject: below --
2018-03-12 13:19 [PATCH 3/6] gemalto: acquire the network technology Gabriel Lucas
2018-03-12 13:19 ` [PATCH 4/6] gemalto: handle sim is inserted or removed URCs Gabriel Lucas
2018-03-12 13:12 [PATCH 3/6] gemalto: acquire the network technology Gabriel Lucas
2018-03-12 13:12 ` [PATCH 4/6] gemalto: handle sim is inserted or removed URCs Gabriel Lucas
2018-03-12 12:57 [PATCH 0/6] gemalto's ALS3 and PHS8P support Gabriel Lucas
2018-03-12 12:57 ` [PATCH 4/6] gemalto: handle sim is inserted or removed URCs Gabriel Lucas

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=9a9cd20d-6877-08bd-0ba9-7b4facc6c91e@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.