mirror of git://git.sysmocom.de/ofono
atmodem: Add really nasty hack for Nokia AT+COPS bug
The Nokia modem returns an invalid response when trying to read the numeric value for MCC/MNC of the current network. Control:> AT+COPS?\r Control:< \r\n+COPS: 0,2,"26207,0\r\n\r\nOK\r\n The closing " is just missing and this confuses the AT parser. In case of a Nokia modem skip reading the numerical values for the network.
This commit is contained in:
parent
6ef3a35bb6
commit
3aa7e1b18e
|
@ -353,12 +353,24 @@ static void at_current_operator(struct ofono_netreg *netreg,
|
|||
|
||||
cbd->user = netreg;
|
||||
|
||||
ok = g_at_chat_send(nd->chat, "AT+COPS=3,2", none_prefix,
|
||||
NULL, NULL, NULL);
|
||||
/* Nokia modems have a broken return value for the string
|
||||
* returned for the numeric value. It misses a " at the end.
|
||||
* Trying to read this will stall the parser. So skip it. */
|
||||
if (nd->vendor == OFONO_VENDOR_NOKIA) {
|
||||
ok = g_at_chat_send(nd->chat, "AT+COPS=3,0", none_prefix,
|
||||
NULL, NULL, NULL);
|
||||
|
||||
if (ok)
|
||||
ok = g_at_chat_send(nd->chat, "AT+COPS?", cops_prefix,
|
||||
cops_numeric_cb, cbd, NULL);
|
||||
if (ok)
|
||||
ok = g_at_chat_send(nd->chat, "AT+COPS?", cops_prefix,
|
||||
cops_cb, cbd, NULL);
|
||||
} else {
|
||||
ok = g_at_chat_send(nd->chat, "AT+COPS=3,2", none_prefix,
|
||||
NULL, NULL, NULL);
|
||||
|
||||
if (ok)
|
||||
ok = g_at_chat_send(nd->chat, "AT+COPS?", cops_prefix,
|
||||
cops_numeric_cb, cbd, NULL);
|
||||
}
|
||||
|
||||
if (ok)
|
||||
return;
|
||||
|
|
Loading…
Reference in New Issue