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.
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user