Re: [MM] [PATCH v2] modem-helpers: handle the case when operator name is "Unknown"



On Thu, 2012-09-20 at 08:41 -0700, Ben Chan wrote:
> Some modems report "Unknown" as the operator name when failed to obtain
> the actual value:
> 
>     --> 'AT+COPS=3,0;+COPS?<CR>'
>     <-- '<CR><LF>+COPS: 0,0,"Unknown",0<CR><LF><CR><LF>OK<CR><LF>'
> 
> This patch prevents "Unknown" from being treated as a valid operator name.

Pushed to master, thanks!

Dan

> ---
>  src/mm-modem-helpers.c |   10 +++++++++-
>  1 files changed, 9 insertions(+), 1 deletions(-)
> 
> diff --git a/src/mm-modem-helpers.c b/src/mm-modem-helpers.c
> index db0bfbd..6692b6f 100644
> --- a/src/mm-modem-helpers.c
> +++ b/src/mm-modem-helpers.c
> @@ -1468,7 +1468,15 @@ mm_3gpp_parse_operator (const gchar *reply,
>           */
>          if (!g_utf8_validate (operator, -1, NULL)) {
>              g_free (operator);
> -            operator = NULL;
> +            return NULL;
> +        }
> +
> +        /* Some modems (Novatel LTE) return the operator name as "Unknown" when
> +         * it fails to obtain the operator name. Return NULL in such case.
> +         */
> +        if (g_ascii_strcasecmp (operator, "unknown") == 0) {
> +            g_free (operator);
> +            return NULL;
>          }
>      }
>  




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]