Re: [PATCH] icera: improve parsing of access technologies in %NWSTATE response
- From: Aleksander Morgado <aleksander lanedo com>
- To: Ben Chan <benchan chromium org>
- Cc: networkmanager-list gnome org
- Subject: Re: [PATCH] icera: improve parsing of access technologies in %NWSTATE response
- Date: Tue, 16 Oct 2012 09:49:19 +0200
I pushed this patch as is, but then I realized that the report of
current access technologies is supposed to give which is the *current*
access technology being active. We allow reporting more than one for the
cases where several access technologies are given simultaneously (e.g.
cdma1x + evdo + lte). So not sure if there is much benefit in giving
e.g. 4 different technologies like "umts, hsdpa, hsupa, hspa" when the
modem reports "3G-HSDPA-HSUPA". In this example, umts shouldn't really
be given I guess, and also we know that HSPA is just HSDPA+HSUPA, so
giving HSPA only was enough... so... should I revert the patch? :-/
On 16/10/12 08:48, Ben Chan wrote:
> ---
> plugins/icera/mm-broadband-modem-icera.c | 40 +++++++++++++++---------------
> 1 files changed, 20 insertions(+), 20 deletions(-)
>
> diff --git a/plugins/icera/mm-broadband-modem-icera.c b/plugins/icera/mm-broadband-modem-icera.c
> index db70252..8267ba6 100644
> --- a/plugins/icera/mm-broadband-modem-icera.c
> +++ b/plugins/icera/mm-broadband-modem-icera.c
> @@ -322,27 +322,27 @@ ipdpact_received (MMAtSerialPort *port,
> static MMModemAccessTechnology
> nwstate_to_act (const gchar *str)
> {
> + MMModemAccessTechnology technologies = 0;
> +
> /* small 'g' means CS, big 'G' means PS */
> - if (!strcmp (str, "2g"))
> - return MM_MODEM_ACCESS_TECHNOLOGY_GSM;
> - else if (!strcmp (str, "2G-GPRS"))
> - return MM_MODEM_ACCESS_TECHNOLOGY_GPRS;
> - else if (!strcmp (str, "2G-EDGE"))
> - return MM_MODEM_ACCESS_TECHNOLOGY_EDGE;
> - else if (!strcmp (str, "3G"))
> - return MM_MODEM_ACCESS_TECHNOLOGY_UMTS;
> - else if (!strcmp (str, "3g"))
> - return MM_MODEM_ACCESS_TECHNOLOGY_UMTS;
> - else if (!strcmp (str, "R99"))
> - return MM_MODEM_ACCESS_TECHNOLOGY_UMTS;
> - else if (!strcmp (str, "3G-HSDPA") || !strcmp (str, "HSDPA"))
> - return MM_MODEM_ACCESS_TECHNOLOGY_HSDPA;
> - else if (!strcmp (str, "3G-HSUPA") || !strcmp (str, "HSUPA"))
> - return MM_MODEM_ACCESS_TECHNOLOGY_HSUPA;
> - else if (!strcmp (str, "3G-HSDPA-HSUPA") || !strcmp (str, "HSDPA-HSUPA"))
> - return MM_MODEM_ACCESS_TECHNOLOGY_HSPA;
> -
> - return MM_MODEM_ACCESS_TECHNOLOGY_UNKNOWN;
> + if (strstr (str, "2g") || strstr (str, "2G"))
> + technologies |= MM_MODEM_ACCESS_TECHNOLOGY_GSM;
> + if (strstr (str, "GPRS"))
> + technologies |= MM_MODEM_ACCESS_TECHNOLOGY_GPRS;
> + if (strstr (str, "EDGE"))
> + technologies |= MM_MODEM_ACCESS_TECHNOLOGY_EDGE;
> + if (strstr (str, "3g") || strstr (str, "3G") || strstr (str, "R99"))
> + technologies |= MM_MODEM_ACCESS_TECHNOLOGY_UMTS;
> + if (strstr (str, "HSDPA-HSUPA") || strstr (str, "HSUPA-HSDPA"))
> + technologies |= MM_MODEM_ACCESS_TECHNOLOGY_HSPA;
> + if (strstr (str, "HSDPA"))
> + technologies |= MM_MODEM_ACCESS_TECHNOLOGY_HSDPA;
> + if (strstr (str, "HSUPA"))
> + technologies |= MM_MODEM_ACCESS_TECHNOLOGY_HSUPA;
> + if (strstr (str, "HSPA+"))
> + technologies |= MM_MODEM_ACCESS_TECHNOLOGY_HSPA_PLUS;
> +
> + return technologies;
> }
>
> static void
>
--
Aleksander
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]