summaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorMarcel Holtmann <marcel@holtmann.org>2010-08-20 03:00:49 +0200
committerMarcel Holtmann <marcel@holtmann.org>2010-08-20 03:00:49 +0200
commit3aa7e1b18e267549503913faba0f1a6ac5cb4376 (patch)
tree9a26818ac47aaafa1363d1520d08b70dc648a6b5 /drivers
parent6ef3a35bb634c60256e82bf2f1dbcd8e9d275398 (diff)
downloadofono-3aa7e1b18e267549503913faba0f1a6ac5cb4376.tar.bz2
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.
Diffstat (limited to 'drivers')
-rw-r--r--drivers/atmodem/network-registration.c22
1 files changed, 17 insertions, 5 deletions
diff --git a/drivers/atmodem/network-registration.c b/drivers/atmodem/network-registration.c
index f5cf12fc..065b5d9b 100644
--- a/drivers/atmodem/network-registration.c
+++ b/drivers/atmodem/network-registration.c
@@ -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_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)
+ ok = g_at_chat_send(nd->chat, "AT+COPS?", cops_prefix,
+ cops_numeric_cb, cbd, NULL);
+ }
if (ok)
return;