summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorerin_yueh <erin_yueh@99fdad57-331a-0410-800a-d7fa5415bdb3>2008-02-21 11:41:29 +0000
committererin_yueh <erin_yueh@99fdad57-331a-0410-800a-d7fa5415bdb3>2008-02-21 11:41:29 +0000
commit7d514fad9af90ea6c12e4bcab41176f5dd9de282 (patch)
treedc4190a9ba9ee3a5aa23bc286232dc77360c6f43 /src
parentc46bd3cedb90dfc4c056ffa965cc3dbb2c358bd2 (diff)
gsmd: get the operator list 2nd try (Paulius Zaleckas)
git-svn-id: http://svn.openmoko.org/trunk/src/target/gsm@4101 99fdad57-331a-0410-800a-d7fa5415bdb3
Diffstat (limited to 'src')
-rw-r--r--src/gsmd/usock.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/gsmd/usock.c b/src/gsmd/usock.c
index 3d2d751..119ed56 100644
--- a/src/gsmd/usock.c
+++ b/src/gsmd/usock.c
@@ -921,6 +921,13 @@ static int network_opers_parse(const char *str, struct gsmd_msg_oper **out)
if (strncmp(str, "+COPS: ", 7))
return -EINVAL;
+ /*
+ * string ",," means the begginig of extended parameters and we
+ * don't want to scan them for operators.
+ */
+ ptr = strstr(str, ",,");
+ if(ptr)
+ ptr[0] = '\0';
ptr = (char *) str;
while (*str) {
@@ -958,7 +965,7 @@ static int network_opers_parse(const char *str, struct gsmd_msg_oper **out)
//extrsp_dump(er);
- if ( er->num_tokens == 4 &&
+ if ( er->num_tokens >= 4 &&
er->tokens[0].type == GSMD_ECMD_RTT_NUMERIC &&
er->tokens[1].type == GSMD_ECMD_RTT_STRING &&
er->tokens[2].type == GSMD_ECMD_RTT_STRING &&
@@ -1002,6 +1009,8 @@ static int network_opers_cb(struct gsmd_atcmd *cmd, void *ctx, char *resp)
int len, ret;
len = network_opers_parse(resp, &buf);
+ if(len < 0)
+ return len; /* error we got from network_opers_parse */
ret = gsmd_ucmd_submit(gu, GSMD_MSG_NETWORK, GSMD_NETWORK_OPER_LIST,
cmd->id, sizeof(*buf) * (len + 1), buf);
personal git repositories of Harald Welte. Your mileage may vary