Open Source Telephony
 help / color / mirror / Atom feed
From: Denis Kenzior <denkenz@gmail.com>
To: ofono@ofono.org
Subject: Re: [PATCH 3/6] gemalto: acquire the network technology
Date: Thu, 15 Mar 2018 12:19:27 -0500	[thread overview]
Message-ID: <5ecb1ebc-55e5-6bca-5686-69a9deeebff1@gmail.com> (raw)
In-Reply-To: <1521118170-23722-4-git-send-email-gabriel.lucas@smile.fr>

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

Hi Gabriel,

On 03/15/2018 07:49 AM, Gabriel Lucas wrote:
> From: Mariem Cherif <mariem.cherif@ardia.com.tn>
> 
> ---
>   drivers/atmodem/network-registration.c | 45 ++++++++++++++++++++++++++++++++++
>   1 file changed, 45 insertions(+)
> 
> diff --git a/drivers/atmodem/network-registration.c b/drivers/atmodem/network-registration.c
> index a5e2af3..aec9c2d 100644
> --- a/drivers/atmodem/network-registration.c
> +++ b/drivers/atmodem/network-registration.c
> @@ -48,6 +48,7 @@ static const char *cops_prefix[] = { "+COPS:", NULL };
>   static const char *csq_prefix[] = { "+CSQ:", NULL };
>   static const char *cind_prefix[] = { "+CIND:", NULL };
>   static const char *cmer_prefix[] = { "+CMER:", NULL };
> +static const char *smoni_prefix[] = { "^SMONI:", "", NULL };

Is there a reason why "" is added?  Is the modem sending lines not 
prefixed by '^SMONI:' in the response?

>   static const char *zpas_prefix[] = { "+ZPAS:", NULL };
>   static const char *option_tech_prefix[] = { "_OCTI:", "_OUWCTI:", NULL };
>   
> @@ -178,6 +179,32 @@ static int option_parse_tech(GAtResult *result)
>   	return tech;
>   }
>   
> +static int cinterion_parse_tech(GAtResult *result)
> +{
> +	int tech = -1;
> +	GAtResultIter iter;
> +	GSList *l;

new line here please

> +	g_at_result_iter_init(&iter, result);
> +	l = result->lines;

What does the output look like?

> +	if (strstr(l->data, "^SMONI: ") != NULL) {

Generally we use g_at_result_iter_next("^SMONI:");

> +		gchar **body = g_strsplit(l->data, "^SMONI: ", 2);
> +		if (*body != NULL) {
> +			gchar **data = g_strsplit(body[1], ",", 20);
> +			if (*data != NULL) {
> +				if (g_strcmp0(data[0], "2G") == 0) {
> +					tech = ACCESS_TECHNOLOGY_GSM;
> +				} else if (g_strcmp0 (data[0], "3G") == 0) {
> +					tech = ACCESS_TECHNOLOGY_UTRAN;
> +				} else if (g_strcmp0 (data[0], "4G") == 0) {
> +					tech = ACCESS_TECHNOLOGY_EUTRAN;
> +				}
> +			}

Are you leaking data?  Have you run this through valgrind?

> +			g_strfreev(body);

It seems all of this can be accomplished with 
g_at_result_iter_next_unquoted_string.

> +		}
> +	}
> +	return tech;
> +}
> +
>   static void at_creg_cb(gboolean ok, GAtResult *result, gpointer user_data)
>   {
>   	struct cb_data *cbd = user_data;
> @@ -205,6 +232,18 @@ static void at_creg_cb(gboolean ok, GAtResult *result, gpointer user_data)
>   	cb(&error, status, lac, ci, tech, cbd->data);
>   }
>   
> +static void cinterion_query_tech_cb(gboolean ok, GAtResult *result,
> +                                              gpointer user_data)
> +{
> +	struct tech_query *tq = user_data;
> +	int tech;
> +
> +	tech = cinterion_parse_tech(result);
> +
> +	ofono_netreg_status_notify(tq->netreg,
> +			tq->status, tq->lac, tq->ci, tech);
> +}
> +
>   static void zte_tech_cb(gboolean ok, GAtResult *result, gpointer user_data)
>   {
>   	struct cb_data *cbd = user_data;
> @@ -1518,6 +1557,12 @@ static void creg_notify(GAtResult *result, gpointer user_data)
>   					option_query_tech_cb, tq, g_free) > 0)
>   			return;
>   		break;
> +    case OFONO_VENDOR_CINTERION:
> +              if (g_at_chat_send(nd->chat, "AT^SMONI",
> +                                      smoni_prefix,
> +                                      cinterion_query_tech_cb, tq, g_free) > 0)
> +                      return;
> +              break;
>   	}
>   
>   	g_free(tq);
> 

Regards,
-Denis

  reply	other threads:[~2018-03-15 17:19 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 [this message]
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
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:12 Gabriel Lucas
2018-03-12 12:57 [PATCH 0/6] gemalto's ALS3 and PHS8P support Gabriel Lucas
2018-03-12 12:57 ` [PATCH 3/6] gemalto: acquire the network technology 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=5ecb1ebc-55e5-6bca-5686-69a9deeebff1@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox