summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarcel Holtmann <marcel@holtmann.org>2010-10-22 01:00:58 +0200
committerMarcel Holtmann <marcel@holtmann.org>2010-10-22 01:00:58 +0200
commitcf2ba64872edb772160d9a2c9738b7509f0a002b (patch)
tree8e8ac4168d71949814c1caf7e74d697720c89971
parent27311fc4a875e29467ba3207bf5fe4ea3869eb7a (diff)
downloadofono-cf2ba64872edb772160d9a2c9738b7509f0a002b.tar.bz2
atmodem: Parse optional PLMN parameter of AT+COPS=? result
The Infineon modem adds an optional <plmn_list> parameter after the access technology parameter <AcT>. It is not always present, but when present it makes the operator listing fail. +COPS: (2,"T-Mobile D","TMO D","26201",0,0),(3,"E-Plus","E-Plus","26203",0,),(3,"Vodafone.de","Vodafone.de","26202",0,),(3,"o2 - de","o2 - de","26207",0,) Not all networks have this parameter and maybe only the home network has it anyway. And so far this feature seems to be Infineon specific, but just in case, parse the parameter if present to make sure the operator listing is available.
-rw-r--r--drivers/atmodem/network-registration.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/drivers/atmodem/network-registration.c b/drivers/atmodem/network-registration.c
index 1fa0a7d6..653ba768 100644
--- a/drivers/atmodem/network-registration.c
+++ b/drivers/atmodem/network-registration.c
@@ -418,7 +418,7 @@ static void cops_list_cb(gboolean ok, GAtResult *result, gpointer user_data)
g_at_result_iter_init(&iter, result);
while (g_at_result_iter_next(&iter, "+COPS:")) {
- int status, tech;
+ int status, tech, plmn;
const char *l, *s, *n;
gboolean have_long = FALSE;
@@ -459,6 +459,9 @@ static void cops_list_cb(gboolean ok, GAtResult *result, gpointer user_data)
list[num].tech = tech;
+ if (!g_at_result_iter_next_number(&iter, &plmn))
+ plmn = 0;
+
if (!g_at_result_iter_close_list(&iter))
break;