Open Source Telephony
 help / color / mirror / Atom feed
From: Marcel Holtmann <marcel@holtmann.org>
To: ofono@ofono.org
Subject: Re: [PATCH v2 2/3] network-registration.c: implement CIND forTelit UC864-G
Date: Wed, 25 May 2011 12:08:04 -0700	[thread overview]
Message-ID: <1306350484.2681.38.camel@aeonflux> (raw)
In-Reply-To: <1306329265-12066-2-git-send-email-Bernhard.Guillon@hale.at>

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

Hi Bernhard,

> *UC864 has an incompatible CIND
> *add a Telit specific check for "not measurable" strength
> 
> Co-authored-by: Christopher Vogl <Christopher.Vogl@hale.at>
> ---
>  drivers/atmodem/network-registration.c |   40 +++++++++++++++++++++++++++++--
>  1 files changed, 37 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/atmodem/network-registration.c b/drivers/atmodem/network-registration.c
> index b3aa511..984e85e 100644
> --- a/drivers/atmodem/network-registration.c
> +++ b/drivers/atmodem/network-registration.c
> @@ -666,7 +666,20 @@ static void ciev_notify(GAtResult *result, gpointer user_data)
>  	if (!g_at_result_iter_next_number(&iter, &strength))
>  		return;
>  
> -	strength = (strength * 100) / (nd->signal_max - nd->signal_min);
> +	switch (nd->vendor) {
> +	case OFONO_VENDOR_TELIT:
> +		/* Check for "signal not measurable" */
> +		if (strength == 99)
> +			strength = 0;
> +		else
> +			strength = (strength * 100) / (nd->signal_max -
> +						nd->signal_min);
> +		break;
> +	default:
> +		strength = (strength * 100) / (nd->signal_max - nd->signal_min);
> +		break;
> +	}
> +

this is something that does not look like vendor quirk. The 99 is always
a special value and we should just do this for all modems.

Denis, any thoughts?

>  	ofono_netreg_strength_notify(netreg, strength);
>  }
>  
> @@ -798,8 +811,19 @@ static void cind_cb(gboolean ok, GAtResult *result, gpointer user_data)
>  
>  	g_at_result_iter_next_number(&iter, &strength);
>  
> -	strength = (strength * 100) / (nd->signal_max - nd->signal_min);
> -
> +	switch (nd->vendor) {
> +	case OFONO_VENDOR_TELIT:
> +		/* Check for "signal not measurable" */
> +		if (strength == 99)
> +			strength = 0;
> +		else
> +			strength = (strength * 100) / (nd->signal_max -
> +						nd->signal_min);
> +		break;
> +	default:
> +		strength = (strength * 100) / (nd->signal_max - nd->signal_min);
> +		break;
> +	}
>  	cb(&error, strength, cbd->data);
>  }

If we really need quirks, then this code should be extracted into its
own function. However right now I would say to just treat 99 special for
all modems.

> @@ -1302,6 +1326,16 @@ static void at_creg_set_cb(gboolean ok, GAtResult *result, gpointer user_data)
>  	case OFONO_VENDOR_NOKIA:
>  		/* Signal strength reporting via CIND is not supported */
>  		break;
> +	case OFONO_VENDOR_TELIT:
> +		/* Use RSSI instead of signal.*/
> +		nd->signal_index = 9;
> +		nd->signal_min = 0;
> +		nd->signal_max = 5;
> +		g_at_chat_send(nd->chat, "AT+CIND=1", cind_prefix,
> +						NULL, NULL, NULL);
> +		g_at_chat_register(nd->chat, "+CIEV:", ciev_notify,
> +					FALSE, netreg, NULL);
> +		break;
>  	default:
>  		g_at_chat_send(nd->chat, "AT+CIND=?", cind_prefix,
>  				cind_support_cb, netreg, NULL);

Regards

Marcel



  reply	other threads:[~2011-05-25 19:08 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-05-25 13:14 [PATCH v2 1/3] Add basic Telit UC864-G support: Bernhard.Guillon
2011-05-25 13:14 ` [PATCH v2 2/3] network-registration.c: implement CIND forTelit UC864-G Bernhard.Guillon
2011-05-25 19:08   ` Marcel Holtmann [this message]
2011-05-24  7:18     ` Denis Kenzior
2011-06-07 12:01       ` [PATCH v2 2/3] network-registration.c: implement CIND forTelitUC864-G Bernhard Guillon
2011-06-07 12:04       ` [PATCH] network-registration.c: enhance CIND=? support Bernhard.Guillon
2011-06-06  5:24         ` Denis Kenzior
2011-06-07 12:12         ` Bernhard Guillon
2011-05-25 13:14 ` [PATCH v2 3/3] udev: add Telit UC864-G and update udev rules Bernhard.Guillon
2011-05-25 19:10   ` Marcel Holtmann
2011-05-25 19:04 ` [PATCH v2 1/3] Add basic Telit UC864-G support: 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=1306350484.2681.38.camel@aeonflux \
    --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