Open Source Telephony
 help / color / mirror / Atom feed
From: Marcel Holtmann <marcel@holtmann.org>
To: ofono@ofono.org
Subject: Re: [PATCH v4 3/7] stemodem: Add polling for SIM ready.
Date: Tue, 17 Aug 2010 00:08:27 +0200	[thread overview]
Message-ID: <1281996507.23399.53.camel@localhost.localdomain> (raw)
In-Reply-To: <1281993134-3926-3-git-send-email-sjurbren@gmail.com>

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

Hi Sjur,

> Interim solution until support for SIM 'ready' notification is supported.
> ---
> Changes:
>  o Fixed style issues (tabs and newlines)
> 
>  plugins/ste.c |   55 ++++++++++++++++++++++++++++++++++++++++++++++++++++---
>  1 files changed, 52 insertions(+), 3 deletions(-)
> 
> diff --git a/plugins/ste.c b/plugins/ste.c
> index f9875fd..5fecd5e 100644
> --- a/plugins/ste.c
> +++ b/plugins/ste.c
> @@ -60,8 +60,13 @@
>  #include <drivers/stemodem/caif_socket.h>
>  #include <drivers/stemodem/if_caif.h>
>  
> +static const char *cpin_prefix[] = { "+CPIN:", NULL };
> +
>  struct ste_data {
>  	GAtChat *chat;
> +	guint cpin_poll_source;
> +	guint cpin_poll_count;
> +	gboolean have_sim;
>  };
>  
>  static int ste_probe(struct ofono_modem *modem)
> @@ -88,6 +93,10 @@ static void ste_remove(struct ofono_modem *modem)
>  	ofono_modem_set_data(modem, NULL);
>  
>  	g_at_chat_unref(data->chat);
> +
> +	if (data->cpin_poll_source > 0)
> +		g_source_remove(data->cpin_poll_source);
> +
>  	g_free(data);
>  }
>  
> @@ -96,16 +105,55 @@ static void ste_debug(const char *str, void *user_data)
>  	ofono_info("%s", str);
>  }
>  
> +static gboolean init_simpin_check(gpointer user_data);
> +
> +static void simpin_check(gboolean ok, GAtResult *result, gpointer user_data)
> +{
> +	struct ofono_modem *modem = user_data;
> +	struct ste_data *data = ofono_modem_get_data(modem);
> +
> +	/* Modem returns +CME ERROR: 10 if SIM is not ready. */
> +	if (!ok && result->final_or_pdu &&
> +			!strcmp(result->final_or_pdu, "+CME ERROR: 10") &&
> +			data->cpin_poll_count++ < 5) {
> +		data->cpin_poll_source =
> +			g_timeout_add_seconds(1, init_simpin_check, modem);
> +		return;
> +	}
> +
> +	data->cpin_poll_count = 0;
> +
> +	/* Modem returns ERROR if there is no SIM in slot. */
> +	data->have_sim = ok;
> +
> +	ofono_modem_set_powered(modem, TRUE);
> +}
> +
> +static gboolean init_simpin_check(gpointer user_data)
> +{
> +	struct ofono_modem *modem = user_data;
> +	struct ste_data *data = ofono_modem_get_data(modem);
> +
> +	data->cpin_poll_source = 0;
> +
> +	g_at_chat_send(data->chat, "AT+CPIN?", cpin_prefix,
> +			simpin_check, modem, NULL);
> +
> +	return FALSE;
> +}
> +
>  static void cfun_enable(gboolean ok, GAtResult *result, gpointer user_data)
>  {
>  	struct ofono_modem *modem = user_data;
>  
>  	DBG("");
>  
> -	if (!ok)
> +	if (!ok) {
>  		ofono_modem_set_powered(modem, FALSE);
> +		return;
> +	}
>  
> -	ofono_modem_set_powered(modem, TRUE);
> +	init_simpin_check(modem);
>  }

I am fine with this if Denis is as well.
 
>  static int ste_enable(struct ofono_modem *modem)
> @@ -168,7 +216,8 @@ static int ste_enable(struct ofono_modem *modem)
>  	if (getenv("OFONO_AT_DEBUG"))
>  		g_at_chat_set_debug(data->chat, ste_debug, NULL);
>  
> -	g_at_chat_send(data->chat, "ATE0 +CMEE=1", NULL, NULL, NULL, NULL);
> +	g_at_chat_send(data->chat, "AT&F E0 V1 X4 &C1 +CMEE=1",
> +			NULL, NULL, NULL, NULL);
>  	g_at_chat_send(data->chat, "AT+CFUN=1", NULL, cfun_enable, modem, NULL);

Why this change? If so, it does not belong in this commit. Or you need
to add a comment why it does indeed.

Regards

Marcel



  parent reply	other threads:[~2010-08-16 22:08 UTC|newest]

Thread overview: 53+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-08-16 13:54 [PATCHv2 0/7] Resubmitting STE Driver patches Sjur =?unknown-8bit?q?Br=C3=A6ndeland?=
2010-08-16 13:54 ` [PATCHv2 1/7] stemodem: Add support for STK by including MBM implementation Sjur =?unknown-8bit?q?Br=C3=A6ndeland?=
2010-08-16 14:01   ` Marcel Holtmann
2010-08-16 16:21     ` Sjur =?unknown-8bit?q?Br=C3=A6ndeland?=
2010-08-16 13:54 ` [PATCHv2 2/7] atmodem: Enable STE usage of AT*EPEV and AT*EPEE for PIN handling Sjur =?unknown-8bit?q?Br=C3=A6ndeland?=
2010-08-16 14:03   ` Marcel Holtmann
2010-08-16 13:54 ` [PATCHv2 3/7] stemodem: Add polling for SIM ready Sjur =?unknown-8bit?q?Br=C3=A6ndeland?=
2010-08-16 13:54 ` [PATCHv2 4/7] stemodem: Add Radio Settings to STE Modem Sjur =?unknown-8bit?q?Br=C3=A6ndeland?=
2010-08-16 14:05   ` Marcel Holtmann
2010-08-16 16:29     ` Sjur =?unknown-8bit?q?Br=C3=A6ndeland?=
2010-08-16 16:36       ` Marcel Holtmann
2010-08-16 13:54 ` [PATCHv2 5/7] plugins/ste: Add Radio-Settings Sjur =?unknown-8bit?q?Br=C3=A6ndeland?=
2010-08-16 13:54 ` [PATCHv2 6/7] stemodem: Use RTNL for creating CAIF interface Sjur =?unknown-8bit?q?Br=C3=A6ndeland?=
2010-08-16 13:54 ` [PATCHv2 7/7] plugins/ste: Use SOCK_STREAM for CAIF and enable interface specification Sjur =?unknown-8bit?q?Br=C3=A6ndeland?=
2010-08-16 20:35 ` [PATCH v3 1/7] plugins/ste: Include STK support from MBM driver Sjur =?unknown-8bit?q?Br=C3=A6ndeland?=
2010-08-16 20:35   ` [PATCH v3 2/7] plugins/ste: SIM - STE registers as MBM to utilize mbm quirks Sjur =?unknown-8bit?q?Br=C3=A6ndeland?=
2010-08-16 20:35     ` [PATCH v3 3/7] stemodem: Add polling for SIM ready Sjur =?unknown-8bit?q?Br=C3=A6ndeland?=
2010-08-16 20:35       ` [PATCH v3 4/7] stemodem: Add Radio Settings to STE Modem Sjur =?unknown-8bit?q?Br=C3=A6ndeland?=
2010-08-16 20:35         ` [PATCH v3 5/7] plugins/ste: Add Radio-Settings Sjur =?unknown-8bit?q?Br=C3=A6ndeland?=
2010-08-16 20:35           ` [PATCH v3 6/7] stemodem: Use RTNL for creating CAIF interface Sjur =?unknown-8bit?q?Br=C3=A6ndeland?=
2010-08-16 20:35             ` [PATCH v3 7/7] plugins/ste: Use SOCK_STREAM for CAIF and enable interface specification Sjur =?unknown-8bit?q?Br=C3=A6ndeland?=
2010-08-16 20:45     ` [PATCH v3 2/7] plugins/ste: SIM - STE registers as MBM to utilize mbm quirks Marcel Holtmann
2010-08-16 20:44   ` [PATCH v3 1/7] plugins/ste: Include STK support from MBM driver Marcel Holtmann
2010-08-16 21:12 ` [PATCH v4 " Sjur =?unknown-8bit?q?Br=C3=A6ndeland?=
2010-08-16 21:12   ` [PATCH v4 2/7] plugins/ste: SIM - STE registers as MBM to utilize mbm quirks Sjur =?unknown-8bit?q?Br=C3=A6ndeland?=
2010-08-16 21:12     ` [PATCH v4 3/7] stemodem: Add polling for SIM ready Sjur =?unknown-8bit?q?Br=C3=A6ndeland?=
2010-08-16 21:12       ` [PATCH v4 4/7] stemodem: Add Radio Settings to STE Modem Sjur =?unknown-8bit?q?Br=C3=A6ndeland?=
2010-08-16 21:12         ` [PATCH v4 5/7] plugins/ste: Add Radio-Settings Sjur =?unknown-8bit?q?Br=C3=A6ndeland?=
2010-08-16 21:12           ` [PATCH v4 6/7] stemodem: Use RTNL for creating CAIF interface Sjur =?unknown-8bit?q?Br=C3=A6ndeland?=
2010-08-16 21:12             ` [PATCH v4 7/7] plugins/ste: Use SOCK_STREAM for CAIF and enable interface specification Sjur =?unknown-8bit?q?Br=C3=A6ndeland?=
2010-08-16 22:12               ` Marcel Holtmann
2010-08-16 22:11             ` [PATCH v4 6/7] stemodem: Use RTNL for creating CAIF interface Marcel Holtmann
2010-08-16 22:05         ` [PATCH v4 4/7] stemodem: Add Radio Settings to STE Modem Marcel Holtmann
2010-08-16 22:08       ` Marcel Holtmann [this message]
2010-08-16 22:06     ` [PATCH v4 2/7] plugins/ste: SIM - STE registers as MBM to utilize mbm quirks Marcel Holtmann
2010-08-16 21:58   ` [PATCH v4 1/7] plugins/ste: Include STK support from MBM driver Marcel Holtmann
2010-08-17 12:22 ` [PATCH v5 0/8] Resubmitting STE Driver Patches Sjur =?unknown-8bit?q?Br=C3=A6ndeland?=
2010-08-17 12:22   ` [PATCH v5 1/8] plugins/ste: SIM - STE registers as MBM to utilize mbm quirks Sjur =?unknown-8bit?q?Br=C3=A6ndeland?=
2010-08-17 12:43     ` Marcel Holtmann
2010-08-17 12:22   ` [PATCH v5 2/8] stemodem: Add polling for SIM ready Sjur =?unknown-8bit?q?Br=C3=A6ndeland?=
2010-08-17 12:58     ` Marcel Holtmann
2010-08-17 12:22   ` [PATCH v5 3/8] plugins/ste: Add AT Channel configurations Sjur =?unknown-8bit?q?Br=C3=A6ndeland?=
2010-08-17 12:43     ` Marcel Holtmann
2010-08-17 12:22   ` [PATCH v5 4/7] stemodem: Add Radio Settings to STE Modem Sjur =?unknown-8bit?q?Br=C3=A6ndeland?=
2010-08-17 12:43     ` Marcel Holtmann
2010-08-17 12:22   ` [PATCH v5 5/8] plugins/ste: Add Radio-Settings Sjur =?unknown-8bit?q?Br=C3=A6ndeland?=
2010-08-17 12:43     ` Marcel Holtmann
2010-08-17 12:22   ` [PATCH v5 6/8] plugins/modemconf.c add support for Interface for STE plugin Sjur =?unknown-8bit?q?Br=C3=A6ndeland?=
2010-08-17 12:51     ` Marcel Holtmann
2010-08-17 12:22   ` [PATCH v5 7/8] plugins/ste: Use SOCK_STREAM for CAIF and enable interface specification Sjur =?unknown-8bit?q?Br=C3=A6ndeland?=
2010-08-17 12:46     ` Marcel Holtmann
2010-08-17 12:22   ` [PATCH v5 8/8] plugins: Add STE sample to modem.conf Sjur =?unknown-8bit?q?Br=C3=A6ndeland?=
2010-08-17 12:51     ` Marcel Holtmann

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=1281996507.23399.53.camel@localhost.localdomain \
    --to=marcel@holtmann.org \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox