All of lore.kernel.org
 help / color / mirror / Atom feed
From: Gustavo F. Padovan <padovan@profusion.mobi>
To: ofono@ofono.org
Subject: Re: [PATCH] zte: poll sim before sim_inserted_notify
Date: Thu, 16 Dec 2010 16:45:05 -0200	[thread overview]
Message-ID: <20101216184505.GD5927@vigoh> (raw)
In-Reply-To: <1292524599-17114-1-git-send-email-Pekka.Pessi@nokia.com>

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

Hi Pekka,

* Pekka.Pessi(a)nokia.com <Pekka.Pessi@nokia.com> [2010-12-16 20:36:39 +0200]:

> From: Pekka Pessi <Pekka.Pessi@nokia.com>
> 
> Ensure that SIM is ready before calling ofono_sim_inserted_notify().
> ---
>  plugins/zte.c |   57 ++++++++++++++++++++++++++++++++++++++++++++++++++++-----
>  1 files changed, 52 insertions(+), 5 deletions(-)
> 
> diff --git a/plugins/zte.c b/plugins/zte.c
> index 82f322a..50f6280 100644
> --- a/plugins/zte.c
> +++ b/plugins/zte.c
> @@ -55,6 +55,9 @@ struct zte_data {
>  	GAtChat *aux;
>  	struct ofono_gprs *gprs;
>  	struct ofono_gprs_context *gc;
> +	struct ofono_sim *sim;
> +	guint poll_source;
> +	guint poll_count;
>  };
>  
>  static int zte_probe(struct ofono_modem *modem)
> @@ -221,6 +224,13 @@ static int zte_disable(struct ofono_modem *modem)
>  	if (data->aux == NULL)
>  		return 0;
>  
> +	data->sim = NULL;
> +
> +	if (data->poll_source) {
> +		g_source_remove(data->poll_source);
> +		data->poll_source = 0;
> +	}
> +
>  	g_at_chat_cancel_all(data->aux);
>  	g_at_chat_unregister_all(data->aux);
>  	g_at_chat_send(data->aux, "AT+CFUN=0", none_prefix,
> @@ -262,19 +272,56 @@ error:
>  	CALLBACK_WITH_FAILURE(cb, cbd->data);
>  }
>  
> +static gboolean poll_sim(gpointer user_data);

Why not moving the whole function to here instead adding a its declaration
here.

> +
> +static void sim_poll_result(gboolean ok, GAtResult *result, gpointer user_data)
> +{
> +	struct ofono_modem *modem = user_data;
> +	struct zte_data *data = ofono_modem_get_data(modem);
> +
> +	DBG("%p", modem);
> +
> +	if (ok) {
> +		ofono_sim_inserted_notify(data->sim, ok);
> +		return;
> +	}
> +
> +	if (++data->poll_count > 5)
> +		/* Give up after 5 seconds - there is probably no SIM */

s/seconds/times/ ?

-- 
Gustavo F. Padovan
http://profusion.mobi

      reply	other threads:[~2010-12-16 18:45 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-12-16 18:36 [PATCH] zte: poll sim before sim_inserted_notify Pekka.Pessi
2010-12-16 18:45 ` Gustavo F. Padovan [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=20101216184505.GD5927@vigoh \
    --to=padovan@profusion.mobi \
    --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.