From bba162cb3e66b58e1cb7470fd9cb136a22df7f25 Mon Sep 17 00:00:00 2001 From: laforge Date: Sun, 15 Apr 2007 09:57:12 +0000 Subject: parse numeric responses for RING, NO CARRIER and BUSY (Philip Zabel) git-svn-id: http://svn.openmoko.org/trunk/src/target/gsm@1766 99fdad57-331a-0410-800a-d7fa5415bdb3 --- src/gsmd/atcmd.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/gsmd/atcmd.c b/src/gsmd/atcmd.c index 53a7501..27c0a41 100644 --- a/src/gsmd/atcmd.c +++ b/src/gsmd/atcmd.c @@ -269,7 +269,8 @@ static int ml_parse(const char *buf, int len, void *ctx) memcpy(cmd->buf, buf, len); } } else { - if (!strcmp(buf, "RING")) { + if (!strcmp(buf, "RING") || + ((g->flags & GSMD_FLAG_V0) && buf[0] == '2')) { /* this is the only non-extended unsolicited return * code, part of Case 'B' */ return unsolicited_parse(g, buf, len, NULL); @@ -285,8 +286,8 @@ static int ml_parse(const char *buf, int len, void *ctx) goto final_cb; } - if (!strncmp(buf, "OK", 2) - || ((g->flags & GSMD_FLAG_V0) && buf[0] == '0')) { + if (!strncmp(buf, "OK", 2) || + ((g->flags & GSMD_FLAG_V0) && buf[0] == '0')) { /* Part of Case 'C' */ if (cmd) cmd->ret = 0; @@ -296,13 +297,15 @@ static int ml_parse(const char *buf, int len, void *ctx) /* FIXME: handling of those special commands in response to * ATD / ATA */ - if (!strncmp(buf, "NO CARRIER", 11)) { + if (!strncmp(buf, "NO CARRIER", 11) || + ((g->flags & GSMD_FLAG_V0) && buf[0] == '3')) { /* Part of Case 'D' */ final = 1; goto final_cb; } - if (!strncmp(buf, "BUSY", 4)) { + if (!strncmp(buf, "BUSY", 4) || + ((g->flags & GSMD_FLAG_V0) && buf[0] == '7')) { /* Part of Case 'D' */ final = 1; goto final_cb; -- cgit v1.2.3