From 3026b93e266558671bd361b6c07546f8174974bc Mon Sep 17 00:00:00 2001 From: laforge Date: Sat, 10 Mar 2007 22:05:17 +0000 Subject: * include stdio from talloc.h * add new generic extended-response parser * add operator cache, using ext-resp-parser * add proper detection of supported %CPI modes and select highest available one * add %CTZV to vendor_ti init string git-svn-id: http://svn.openmoko.org/trunk/src/target/gsm@1316 99fdad57-331a-0410-800a-d7fa5415bdb3 --- src/gsmd/vendor_ti.c | 44 ++++++++++++++++++++++++++++++++++++++------ 1 file changed, 38 insertions(+), 6 deletions(-) (limited to 'src/gsmd/vendor_ti.c') diff --git a/src/gsmd/vendor_ti.c b/src/gsmd/vendor_ti.c index 6617edf..0cc0783 100644 --- a/src/gsmd/vendor_ti.c +++ b/src/gsmd/vendor_ti.c @@ -23,6 +23,7 @@ #include #include #include +#include #include #include "gsmd.h" @@ -30,6 +31,9 @@ #include #include #include +#include +#include +#include #include #include @@ -214,7 +218,7 @@ out_send: return 0; out_free_io: - free(ucmd); + talloc_free(ucmd); return -EIO; } @@ -237,7 +241,26 @@ static const struct gsmd_unsolicit ticalypso_unsolicit[] = { static int cpi_detect_cb(struct gsmd_atcmd *cmd, void *ctx, char *resp) { + struct gsmd *g = ctx; + struct gsm_extrsp *er; + + if (strncmp(resp, "%CPI: ", 6)) + return -EINVAL; + resp += 6; + er = extrsp_parse(cmd, resp); + if (!er) + return -EINVAL; + + if (extrsp_supports(er, 0, 3)) + return gsmd_simplecmd(g, "AT%CPI=3"); + else if (extrsp_supports(er, 0, 2)) + return gsmd_simplecmd(g, "AT%CPI=2"); + else + DEBUGP("Call Progress Indication mode 2 or 3 not supported!!\n"); + + talloc_free(er); + return 0; } static int ticalypso_detect(struct gsmd *g) @@ -249,16 +272,25 @@ static int ticalypso_detect(struct gsmd *g) static int ticalypso_initsettings(struct gsmd *g) { int rc; + struct gsmd_atcmd *cmd; + /* use +CTZR: to report time zone changes */ rc |= gsmd_simplecmd(g, "AT+CTZR=1"); - /* enable %CPI: call progress indication */ - rc = gsmd_simplecmd(g, "AT\%CPI=3"); + /* use %CTZV: Report time and date */ + rc |= gsmd_simplecmd(g, "AT%CTZV=1"); + /* use %CGREG */ + //rc |= gsmd_simplecmd(g, "AT%CGREG=3"); /* enable %CPRI: ciphering indications */ - rc |= gsmd_simplecmd(g, "AT\%CPRI=1"); + rc |= gsmd_simplecmd(g, "AT%CPRI=1"); /* enable %CSQ: signal quality reports */ - rc |= gsmd_simplecmd(g, "AT\%CSQ=1"); + rc |= gsmd_simplecmd(g, "AT%CSQ=1"); /* send unsolicited commands at any time */ - rc |= gsmd_simplecmd(g, "AT\%CUNS=0"); + rc |= gsmd_simplecmd(g, "AT%CUNS=0"); + + /* enable %CPI: call progress indication */ + cmd = atcmd_fill("AT%CPI=?", 9, &cpi_detect_cb, g, 0); + if (cmd) + atcmd_submit(g, cmd); return rc; } -- cgit v1.2.3