From cf2ba64872edb772160d9a2c9738b7509f0a002b Mon Sep 17 00:00:00 2001 From: Marcel Holtmann Date: Fri, 22 Oct 2010 01:00:58 +0200 Subject: [PATCH] =?UTF-8?q?atmodem:=20Parse=20optional=20PLMN=20parameter?= =?UTF-8?q?=20of=20AT+COPS=3D=3F=20result?= The Infineon modem adds an optional parameter after the access technology parameter . 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. --- drivers/atmodem/network-registration.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) 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;