From: Denis Kenzior <denkenz@gmail.com>
To: ofono@ofono.org
Subject: Re: [PATCH 6/6] SIMCOM: add a quirk to retrieve network technology used
Date: Mon, 22 Jul 2013 16:08:53 -0500 [thread overview]
Message-ID: <51ED9F65.4010206@gmail.com> (raw)
In-Reply-To: <1374240940-30892-6-git-send-email-viallard@syscom-instruments.com>
[-- Attachment #1: Type: text/plain, Size: 3656 bytes --]
Hi Anthony,
On 07/19/2013 08:35 AM, Anthony Viallard wrote:
> Use CNSMOD command to get network technology and monitor
> changes.
> ---
> drivers/atmodem/network-registration.c | 76 ++++++++++++++++++++++++++++++++++
> 1 file changed, 76 insertions(+)
>
> diff --git a/drivers/atmodem/network-registration.c b/drivers/atmodem/network-registration.c
> index 8cc04b7..d634dbb 100644
> --- a/drivers/atmodem/network-registration.c
> +++ b/drivers/atmodem/network-registration.c
> @@ -239,6 +239,14 @@ static void at_registration_status(struct ofono_netreg *netreg,
> cbd->user = nd;
>
> switch (nd->vendor) {
> + case OFONO_VENDOR_SIMCOM:
> + /*
> + * Send +CNSMOD? to find out the current tech, it will be
> + * intercepted in simcom_cnsmod_notify
> + */
> + g_at_chat_send(nd->chat, "AT+CNSMOD?", none_prefix,
> + NULL, NULL, NULL);
> + break;
> case OFONO_VENDOR_MBM:
> /*
> * Send *ERINFO to find out the current tech, it will be
> @@ -1329,6 +1337,66 @@ static int cnti_to_tech(const char *cnti)
> return -1;
> }
>
> +static void simcom_cnsmod_notify(GAtResult *result, gpointer user_data)
> +{
> + struct ofono_netreg *netreg = user_data;
> + struct netreg_data *nd = ofono_netreg_get_data(netreg);
> + GAtResultIter iter;
> + int n1,
> + n2,
> + mode;
This is not according to our coding style ;)
> +
> + g_at_result_iter_init(&iter, result);
> +
> + if (g_at_result_iter_next(&iter, "+CNSMOD:") == FALSE)
> + return;
> +
> + if (g_at_result_iter_next_number(&iter, &n1) == FALSE)
> + return;
> +
> + if (g_at_result_iter_next_number(&iter, &n2) == FALSE)
> + n2 = -1;
> +
> + if (n2 != -1)
> + mode = n2;
> + else
> + mode = n1;
> +
> + switch (mode) {
> + case 1:
> + case 2:
> + /* GSM, GPRS */
> + nd->tech = ACCESS_TECHNOLOGY_GSM;
> + break;
> + case 3:
> + /* EDGE */
> + nd->tech = ACCESS_TECHNOLOGY_GSM_EGPRS;
> + break;
> + case 4:
> + /* WCDMA */
> + nd->tech = ACCESS_TECHNOLOGY_UTRAN;
> + break;
> + case 5:
> + /* HSDPA */
> + nd->tech = ACCESS_TECHNOLOGY_UTRAN_HSDPA;
> + break;
> + case 6:
> + /* HSUPA */
> + nd->tech = ACCESS_TECHNOLOGY_UTRAN_HSUPA;
> + break;
> + case 7: /* HSUPA and HSDPA */
> + nd->tech = ACCESS_TECHNOLOGY_UTRAN_HSDPA_HSUPA;
> + break;
> + default:
> + case 0:
> + /* no service */
> + nd->tech = -1;
> + break;
> + }
> +
> + ofono_netreg_tech_notify(netreg, nd->tech);
> +}
> +
> static void gobi_cnti_notify(GAtResult *result, gpointer user_data)
> {
> struct ofono_netreg *netreg = user_data;
> @@ -1760,6 +1828,14 @@ static void at_creg_set_cb(gboolean ok, GAtResult *result, gpointer user_data)
>
> g_at_chat_register(nd->chat, "+CSQ:",
> csq_notify, FALSE, netreg, NULL);
> +
> + /* Register for network technology change */
> + g_at_chat_register(nd->chat, "+CNSMOD:",
> + simcom_cnsmod_notify, FALSE, netreg, NULL);
> +
> + g_at_chat_send(nd->chat, "AT+CNSMOD=1", none_prefix,
> + NULL, NULL, NULL);
> +
Does CNSMOD refer to the current Bearer or the current supported
technology of the cell? If it is the latter, then generally any change
in technology would also involve the change in the cell id as well.
Look at how we handle similar hardware behavior in creg_notify.
Do you have any AT logs showing how +CNSMOD works? e.g. do you see it
changing without a corresponding CREG change? Does it matter whether
you have an active GPRS context or not?
> break;
> case OFONO_VENDOR_PHONESIM:
> g_at_chat_register(nd->chat, "+CSQ:",
>
Regards,
-Denis
next prev parent reply other threads:[~2013-07-22 21:08 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-07-19 13:35 [PATCH 1/6] Add SIMCOM support Anthony Viallard
2013-07-19 13:35 ` [PATCH 2/6] SIMCOM: add a quirk for AT+CNMI command building Anthony Viallard
2013-07-22 20:49 ` Denis Kenzior
2013-07-19 13:35 ` [PATCH 3/6] SIMCOM: add a quirk for signal strength reporting Anthony Viallard
2013-07-22 20:49 ` Denis Kenzior
2013-07-19 13:35 ` [PATCH 4/6] SIMCOM: add a quirk to fix crsm request Anthony Viallard
2013-07-22 20:51 ` Denis Kenzior
2013-07-19 13:35 ` [PATCH 5/6] Add a function to be able to report network technology change Anthony Viallard
2013-07-22 20:57 ` Denis Kenzior
2013-07-19 13:35 ` [PATCH 6/6] SIMCOM: add a quirk to retrieve network technology used Anthony Viallard
2013-07-22 21:08 ` Denis Kenzior [this message]
2013-07-22 20:45 ` [PATCH 1/6] Add SIMCOM support Denis Kenzior
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=51ED9F65.4010206@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.