summaryrefslogtreecommitdiff
path: root/src/gsmd/vendor_ti.c
diff options
context:
space:
mode:
authorlaforge <laforge@99fdad57-331a-0410-800a-d7fa5415bdb3>2007-03-10 22:05:17 +0000
committerlaforge <laforge@99fdad57-331a-0410-800a-d7fa5415bdb3>2007-03-10 22:05:17 +0000
commit3026b93e266558671bd361b6c07546f8174974bc (patch)
treec579158bc0641847851a1369382d3dc250268ebc /src/gsmd/vendor_ti.c
parent2797211645d452446cb7b329ee9d3d3a923f8520 (diff)
* 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
Diffstat (limited to 'src/gsmd/vendor_ti.c')
-rw-r--r--src/gsmd/vendor_ti.c44
1 files changed, 38 insertions, 6 deletions
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 <stdlib.h>
#include <unistd.h>
#include <string.h>
+#include <stdio.h>
#include <errno.h>
#include "gsmd.h"
@@ -30,6 +31,9 @@
#include <gsmd/gsmd.h>
#include <gsmd/usock.h>
#include <gsmd/event.h>
+#include <gsmd/talloc.h>
+#include <gsmd/extrsp.h>
+#include <gsmd/atcmd.h>
#include <gsmd/vendorplugin.h>
#include <gsmd/unsolicited.h>
@@ -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;
}
personal git repositories of Harald Welte. Your mileage may vary