diff options
author | Ben Chan <benchan@chromium.org> | 2012-09-20 08:41:30 -0700 |
---|---|---|
committer | Dan Williams <dcbw@redhat.com> | 2012-09-20 12:02:06 -0500 |
commit | 6124022ab38222d1b9a239b3f21ec6c8a6eced0f (patch) | |
tree | 4943715967fd4eb1d2143c4791c0906a38027703 /src | |
parent | 6995300ecd8534e99539ca2a9974c2fb7236484f (diff) |
modem-helpers: handle the case when operator name is "Unknown"
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.
Diffstat (limited to 'src')
-rw-r--r-- | 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 db0bfbdf..6692b6fd 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; } } |