r3430 - in trunk/src/target/gsm: include/gsmd src/gsmd

tick at sita.openmoko.org tick at sita.openmoko.org
Fri Nov 16 09:55:14 CET 2007


Author: tick
Date: 2007-11-16 09:55:01 +0100 (Fri, 16 Nov 2007)
New Revision: 3430

Added:
   trunk/src/target/gsm/src/gsmd/machine_gta01.c
Modified:
   trunk/src/target/gsm/include/gsmd/atcmd.h
   trunk/src/target/gsm/include/gsmd/gsmd.h
   trunk/src/target/gsm/include/gsmd/machineplugin.h
   trunk/src/target/gsm/src/gsmd/Makefile.am
   trunk/src/target/gsm/src/gsmd/atcmd.c
   trunk/src/target/gsm/src/gsmd/gsmd.c
   trunk/src/target/gsm/src/gsmd/machine.c
   trunk/src/target/gsm/src/gsmd/machine_generic.c
   trunk/src/target/gsm/src/gsmd/machine_tihtc.c
   trunk/src/target/gsm/src/gsmd/sms_cb.c
   trunk/src/target/gsm/src/gsmd/usock.c
   trunk/src/target/gsm/src/gsmd/vendor_ti.c
   trunk/src/target/gsm/src/gsmd/vendor_tihtc.c
Log:
[gsmd] Adding timeout scheme, and merge gta01 wakeup scheme as machine plug-in with timeout. (L. Sean)



Modified: trunk/src/target/gsm/include/gsmd/atcmd.h
===================================================================
--- trunk/src/target/gsm/include/gsmd/atcmd.h	2007-11-16 01:30:09 UTC (rev 3429)
+++ trunk/src/target/gsm/include/gsmd/atcmd.h	2007-11-16 08:55:01 UTC (rev 3430)
@@ -7,11 +7,14 @@
 
 typedef int atcmd_cb_t(struct gsmd_atcmd *cmd, void *ctx, char *resp);
 
-extern struct gsmd_atcmd *atcmd_fill(const char *cmd, int rlen, atcmd_cb_t *cb, void *ctx, u_int16_t id);
+extern struct gsmd_atcmd *atcmd_fill(const char *cmd, int rlen, atcmd_cb_t *cb, void *ctx, u_int16_t id, 
+											   create_timer_t ct);
 extern int atcmd_submit(struct gsmd *g, struct gsmd_atcmd *cmd);
 extern int cancel_atcmd(struct gsmd *g, struct gsmd_atcmd *cmd);
 extern int atcmd_init(struct gsmd *g, int sockfd);
 extern void atcmd_drain(int fd);
+extern void atcmd_wake_pending_queue (struct gsmd *g);
+extern void atcmd_wait_pending_queue (struct gsmd *g); 
 
 #endif /* __GSMD__ */
 

Modified: trunk/src/target/gsm/include/gsmd/gsmd.h
===================================================================
--- trunk/src/target/gsm/include/gsmd/gsmd.h	2007-11-16 01:30:09 UTC (rev 3429)
+++ trunk/src/target/gsm/include/gsmd/gsmd.h	2007-11-16 08:55:01 UTC (rev 3430)
@@ -19,6 +19,7 @@
 #define LGSM_ATCMD_F_PARAM	0x02	/* as opposed to action */
 #define LGSM_ATCMD_F_LFCR	0x04	/* accept LFCR as a line terminator */
 
+typedef struct gsmd_timer * (create_timer_t)(struct gsmd *data);
 struct gsmd_atcmd {
 	struct llist_head list;
 	void *ctx;
@@ -28,6 +29,8 @@
 	u_int32_t buflen;
 	u_int16_t id;
 	u_int8_t flags;
+        struct gsmd_timer *timeout;
+	create_timer_t * create_timer_func;  
 	char *cur;
 	char buf[];
 };
@@ -67,7 +70,7 @@
 #define GSMD_FLAG_V0		0x0001	/* V0 responses to be expected from TA */
 #define GSMD_FLAG_SMS_FMT_TEXT	0x0002	/* TODO Use TEXT rather than PDU mode */
 
-#define GSMD_MODEM_WAKEUP_TIMEOUT     3
+#define GSMD_ATCMD_TIMEOUT	60	/* If doesn get respond within 60 secs, discard */
 
 struct gsmd {
 	unsigned int flags;
@@ -86,7 +89,7 @@
 	unsigned char *mlbuf;		/* ml_parse buffer */
 	unsigned int mlbuf_len;
 	int mlunsolicited;
-        struct gsmd_timer *wakeup_timer;
+	int alive_responded;
 };
 
 struct gsmd_user {

Modified: trunk/src/target/gsm/include/gsmd/machineplugin.h
===================================================================
--- trunk/src/target/gsm/include/gsmd/machineplugin.h	2007-11-16 01:30:09 UTC (rev 3429)
+++ trunk/src/target/gsm/include/gsmd/machineplugin.h	2007-11-16 08:55:01 UTC (rev 3430)
@@ -11,6 +11,7 @@
 struct gsmd_machine_plugin {
 	struct llist_head list;
 	unsigned char *name;
+	int (*ex_submit)(struct gsmd *g);
 	int (*detect)(struct gsmd *g);
 	int (*init)(struct gsmd *g, int fd);
 };

Modified: trunk/src/target/gsm/src/gsmd/Makefile.am
===================================================================
--- trunk/src/target/gsm/src/gsmd/Makefile.am	2007-11-16 01:30:09 UTC (rev 3429)
+++ trunk/src/target/gsm/src/gsmd/Makefile.am	2007-11-16 08:55:01 UTC (rev 3430)
@@ -24,6 +24,7 @@
 
 plugin_LTLIBRARIES = libgsmd-machine_generic.la \
 		     libgsmd-machine_tihtc.la \
+		     libgsmd-machine_gta01.la \
 		     libgsmd-vendor_ti.la \
 		     libgsmd-vendor_tihtc.la \
 		     libgsmd-vendor_qc.la \
@@ -33,6 +34,8 @@
 libgsmd_machine_generic_la_LDFLAGS = -module
 libgsmd_machine_tihtc_la_SOURCES = machine_tihtc.c
 libgsmd_machine_tihtc_la_LDFLAGS = -module
+libgsmd_machine_gta01_la_SOURCES = machine_gta01.c
+libgsmd_machine_gta01_la_LDFLAGS = -module
 
 libgsmd_vendor_ti_la_SOURCES = vendor_ti.c
 libgsmd_vendor_ti_la_LDFLAGS = -module

Modified: trunk/src/target/gsm/src/gsmd/atcmd.c
===================================================================
--- trunk/src/target/gsm/src/gsmd/atcmd.c	2007-11-16 01:30:09 UTC (rev 3429)
+++ trunk/src/target/gsm/src/gsmd/atcmd.c	2007-11-16 08:55:01 UTC (rev 3430)
@@ -41,6 +41,7 @@
 #include <gsmd/unsolicited.h>
 
 static void *__atcmd_ctx;
+static int remove_timer(struct gsmd_atcmd * cmd);
 
 enum final_result_codes {
 	GSMD_RESULT_OK = 0,
@@ -200,12 +201,12 @@
 	return -1;
 }
 
-static inline void atcmd_wake_pending_queue (struct gsmd *g) 
+void atcmd_wake_pending_queue (struct gsmd *g) 
 {
         g->gfd_uart.when |= GSMD_FD_WRITE;
 }
 
-static inline void atcmd_wait_pending_queue (struct gsmd *g) 
+void atcmd_wait_pending_queue (struct gsmd *g) 
 {
         g->gfd_uart.when &= ~GSMD_FD_WRITE;
 }
@@ -214,6 +215,8 @@
 static int atcmd_done(struct gsmd *g, struct gsmd_atcmd *cmd, const char *buf)
 {
         int rc = 0;
+	/* remove timer if get respond before timeout */
+	remove_timer(cmd);
         if (!cmd->cb) {
                 gsmd_log(GSMD_NOTICE, "command without cb!!!\n");
         } else {
@@ -359,6 +362,8 @@
 			/* it might be a multiline response, so if there's a previous
 			   response, send out mlbuf and start afresh with an empty buffer */
 			if (g->mlbuf_len) {
+				/* remove timer if get respond before timeout */
+				remove_timer(cmd);
 				if (!cmd->cb) {
 					gsmd_log(GSMD_NOTICE, "command without cb!!!\n");
 				} else {
@@ -512,6 +517,8 @@
 			write(fd, "\r", 1);
 
 			if (!pos->buflen) {
+				/* success: create atcommand timeout timer */
+				pos->timeout = pos->create_timer_func(g);  
 				/* success: remove from global list of
 				 * to-be-sent atcmds */
 				llist_del(&pos->list);
@@ -536,9 +543,56 @@
 	return 0;
 }
 
+static void discard_timeout(struct gsmd_timer *tmr, void *data) 
+{
+        struct gsmd *g=data;
+        struct gsmd_atcmd *cmd=NULL;
+        DEBUGP("discard time out!!\n");
+        if (!llist_empty(&g->busy_atcmds)) {
+                cmd = llist_entry(g->busy_atcmds.next,struct gsmd_atcmd, list);
+        }
+        if (!cmd) { 
+                DEBUGP("ERROR!! busy_atcmds is NULL\n");
+                return;
+        }
+        if (cmd->timeout != tmr) {
+                DEBUGP("ERROR!! cmd->timeout != tmr\n");
+                return;
+        }
 
+        gsmd_timer_free(cmd->timeout);
+        cmd->timeout = NULL;
+
+	if (cmd->cb) {
+		cmd->resp = "Timeout";
+                cmd->cb(cmd, cmd->ctx, cmd->resp);
+	}
+	
+	// discard the timeout at command
+	llist_del(&cmd->list);
+	talloc_free(cmd);
+	
+	// pass the next pending at command
+	if (llist_empty(&g->busy_atcmds) && !llist_empty(&g->pending_atcmds)) {
+		atcmd_wake_pending_queue(g);
+	}
+}
+
+static struct gsmd_timer * discard_timer(struct gsmd *g)
+{
+        
+	struct timeval tv;
+	tv.tv_sec = GSMD_ATCMD_TIMEOUT;
+	tv.tv_usec = 0;
+         
+	DEBUGP("Create discard timer\n");
+	
+	return gsmd_timer_create(&tv, &discard_timeout, g);
+}
+
 struct gsmd_atcmd *atcmd_fill(const char *cmd, int rlen,
-			      atcmd_cb_t cb, void *ctx, u_int16_t id)
+			      atcmd_cb_t cb, void *ctx, u_int16_t id,
+			      create_timer_t ct)
 {
 	int buflen = strlen(cmd);
 	struct gsmd_atcmd *atcmd;
@@ -559,95 +613,48 @@
 	atcmd->cur = atcmd->buf;
 	atcmd->cb = cb;
 	atcmd->resp = NULL;
+	atcmd->timeout = NULL;
 	strncpy(atcmd->buf, cmd, buflen-1);
 
+	if (!ct)
+		atcmd->create_timer_func = discard_timer; 
+	else
+		atcmd->create_timer_func = ct;
+
 	return atcmd;
 }
 
-static int null_wakeup_cb(struct gsmd_atcmd *cmd, void *ctx, char *resp) 
+static int remove_timer(struct gsmd_atcmd * cmd)
 {
-        struct gsmd *g = ctx;
-        if (g->wakeup_timer) {
-                DEBUGP("modem is awake, remove timer!\n");
-                gsmd_timer_unregister(g->wakeup_timer);
-                gsmd_timer_free(g->wakeup_timer);
-                g->wakeup_timer=NULL;
-        } else {
-                DEBUGP("ERROR!! The wake up response comes too late!!\n");
-        }
-        return 0;
-}
+	if (cmd->timeout) {
+		DEBUGP("Get respond before timeout, remove timer!\n");
+		gsmd_timer_unregister(cmd->timeout);
+		gsmd_timer_free(cmd->timeout);
+		cmd->timeout = NULL;
+	} else {
+		DEBUGP("ERROR!! The %s response comes too late!!\n", cmd->buf);
+	}
 
-static void wakeup_timeout(struct gsmd_timer *tmr, void *data) 
-{
-        struct gsmd *g=data;
-        struct gsmd_atcmd *cmd=NULL;
-        DEBUGP("Wakeup time out!!\n");
-        if (g->wakeup_timer != tmr) {
-                DEBUGP("ERROR!! g->wakeup_timer != tmr\n");
-                return;
-        }
-        g->wakeup_timer = NULL;
-        gsmd_timer_free(tmr);
-        if (!llist_empty(&g->busy_atcmds)) {
-                cmd = llist_entry(g->busy_atcmds.next,struct gsmd_atcmd, list);
-        }
-        if (!cmd) { 
-                DEBUGP("ERROR!! busy_atcmds is NULL\n");
-                return;
-        }
-        // It's a wakeup command
-        if ( cmd->buf[0]==' ') {
-                llist_del(&cmd->list);
-                talloc_free(cmd);
-                // discard the wakeup command, and pass the real command.
-                if (llist_empty(&g->busy_atcmds) && !llist_empty(&g->pending_atcmds)) {
-                        atcmd_wake_pending_queue(g);
-                }
-        } else {
-                DEBUGP("ERROR!! Wakeup timeout and cmd->buf is not wakeup command!! %s\n",cmd->buf);
-        }
+	return 0;
 }
 
-void wakeup_timer (struct gsmd *g) 
-{
-        struct timeval tv;
-        struct gsmd_timer *timer;
-        tv.tv_sec = GSMD_MODEM_WAKEUP_TIMEOUT;
-        tv.tv_usec = 0;
-        timer=gsmd_timer_create(&tv,&wakeup_timeout,g);
-        g->wakeup_timer=timer;
-        
-}
 
-/// adding a null '\r' before real at command.
-struct gsmd_atcmd * atcmd_wakeup_modem(struct gsmd *g) 
-{
-        if (!g->wakeup_timer) {
-                DEBUGP("try to wake up\n");
-                struct gsmd_atcmd * cmd= atcmd_fill(" \r",2,null_wakeup_cb,g,0);
-                wakeup_timer(g);
-                if (llist_empty(&g->pending_atcmds)) {
-                        atcmd_wake_pending_queue(g);
-                }
-                llist_add_tail(&cmd->list, &g->pending_atcmds);
-        }
-}
-
-
-
 /* submit an atcmd in the global queue of pending atcmds */
 int atcmd_submit(struct gsmd *g, struct gsmd_atcmd *cmd)
 {
         int empty;
-        atcmd_wakeup_modem(g);
+
+	if (g->machinepl->ex_submit) {
+		DEBUGP("extra-submiting command\n");
+		g->machinepl->ex_submit(g);
+	}
 	DEBUGP("submitting command `%s'\n", cmd->buf);
 
-        empty = llist_empty(&g->pending_atcmds);
 	llist_add_tail(&cmd->list, &g->pending_atcmds);
-        if (empty) {
-                atcmd_wake_pending_queue(g);
-        }
+	if (llist_empty(&g->busy_atcmds) && !llist_empty(&g->pending_atcmds)) {
+		atcmd_wake_pending_queue(g);
+	}
+
 	return 0;
 }
 
@@ -701,7 +708,7 @@
 
 	g->mlbuf_len = 0;
 	g->mlunsolicited = 0;
-        g->wakeup_timer=NULL;
+	g->alive_responded = 0;
 
 	g->llp.cur = g->llp.buf;
 	g->llp.len = sizeof(g->llp.buf);

Modified: trunk/src/target/gsm/src/gsmd/gsmd.c
===================================================================
--- trunk/src/target/gsm/src/gsmd/gsmd.c	2007-11-16 01:30:09 UTC (rev 3429)
+++ trunk/src/target/gsm/src/gsmd/gsmd.c	2007-11-16 08:55:01 UTC (rev 3430)
@@ -56,29 +56,23 @@
  * either OK or ERROR is allowed since, both mean the modem still responds
  */
 
-
-struct gsmd_alive_priv {
-	struct gsmd *gsmd;
-	int alive_responded;
-};
-
 static int gsmd_alive_cb(struct gsmd_atcmd *cmd, void *ctx, char *resp)
 {
-	struct gsmd_alive_priv *alp = ctx;
+	struct gsmd *g = ctx;
 
 	if (!strcmp(resp, "OK") || !strcmp(resp, "ERROR") ||
-	    ((alp->gsmd->flags & GSMD_FLAG_V0) && resp[0] == '0'))
-		alp->alive_responded = 1;
+	    ((g->flags & GSMD_FLAG_V0) && resp[0] == '0'))
+		g->alive_responded = 1;
 	return 0;
 }
 
 static void alive_tmr_cb(struct gsmd_timer *tmr, void *data)
 {
-	struct gsmd_alive_priv *alp = data;
+	struct gsmd *g = data;
 
-	DEBUGP("gsmd_alive timer expired\n", alp);
+	DEBUGP("gsmd_alive timer expired\n");
 
-	if (alp->alive_responded == 0) {
+	if (g->alive_responded == 0) {
 		gsmd_log(GSMD_FATAL, "modem dead!\n");
 		exit(3);
 	} else
@@ -87,33 +81,29 @@
 	/* FIXME: update some global state */
 
 	gsmd_timer_free(tmr);
-	talloc_free(alp);
 }
 
+static struct gsmd_timer * alive_timer(struct gsmd *g)
+{
+ 	struct timeval tv;
+	tv.tv_sec = GSMD_ALIVE_TIMEOUT;
+	tv.tv_usec = 0;
+
+	return gsmd_timer_create(&tv, &alive_tmr_cb, g);
+}
+
 static int gsmd_modem_alive(struct gsmd *gsmd)
 {
 	struct gsmd_atcmd *cmd;
-	struct gsmd_alive_priv *alp;
-	struct timeval tv;
 
-	alp = talloc(gsmd_tallocs, struct gsmd_alive_priv);
-	if (!alp)
-		return -ENOMEM;
+	gsmd->alive_responded = 0;
 
-	alp->gsmd = gsmd;
-	alp->alive_responded = 0;
-
 	cmd = atcmd_fill(GSMD_ALIVECMD, strlen(GSMD_ALIVECMD)+1, 
-			 &gsmd_alive_cb, alp, 0);
+			 &gsmd_alive_cb, gsmd, 0, alive_timer);
 	if (!cmd) {
-		talloc_free(alp);
 		return -ENOMEM;
 	}
 
-	tv.tv_sec = GSMD_ALIVE_TIMEOUT;
-	tv.tv_usec = 0;
-	gsmd_timer_create(&tv, &alive_tmr_cb, alp);
-	
 	return atcmd_submit(gsmd, cmd);
 }
 
@@ -158,7 +148,7 @@
 int gsmd_simplecmd(struct gsmd *gsmd, char *cmdtxt)
 {
 	struct gsmd_atcmd *cmd;
-	cmd = atcmd_fill(cmdtxt, strlen(cmdtxt)+1, &gsmd_test_atcb, NULL, 0);
+	cmd = atcmd_fill(cmdtxt, strlen(cmdtxt)+1, &gsmd_test_atcb, NULL, 0, NULL);
 	if (!cmd)
 		return -ENOMEM;
 	
@@ -239,7 +229,7 @@
 	struct gsmd_atcmd *cmd;
 	struct timeval tv;
 
-	cmd = atcmd_fill("ATZ", strlen("ATZ")+1, &firstcmd_atcb, gsmd, 0);
+	cmd = atcmd_fill("ATZ", strlen("ATZ")+1, &firstcmd_atcb, gsmd, 0, NULL);
 	if (!cmd)
 		return -ENOMEM;
 

Modified: trunk/src/target/gsm/src/gsmd/machine.c
===================================================================
--- trunk/src/target/gsm/src/gsmd/machine.c	2007-11-16 01:30:09 UTC (rev 3429)
+++ trunk/src/target/gsm/src/gsmd/machine.c	2007-11-16 08:55:01 UTC (rev 3430)
@@ -94,8 +94,8 @@
 	char *machine;
 	char *vendor;
 } machines[] = {
-	{ "GTA01",		"generic",	"ti" },
-	{ "GTA02",		"generic",	"ti" },
+	{ "GTA01",		"gta01",	"ti" },
+	{ "GTA02",		"gta01",	"ti" },
 	{ "HTC Blueangel",	"tihtc",	"tihtc" },
 	{ "HTC Himalaya",	"tihtc",	"tihtc" },
 	{ "HTC Magician",	"tihtc",	"tihtc" },

Modified: trunk/src/target/gsm/src/gsmd/machine_generic.c
===================================================================
--- trunk/src/target/gsm/src/gsmd/machine_generic.c	2007-11-16 01:30:09 UTC (rev 3429)
+++ trunk/src/target/gsm/src/gsmd/machine_generic.c	2007-11-16 08:55:01 UTC (rev 3430)
@@ -56,6 +56,7 @@
 
 struct gsmd_machine_plugin gsmd_machine_plugin = {
 	.name = "generic",
+	.ex_submit = NULL,
 	.detect = &generic_detect,
 	.init = &generic_init,
 };

Added: trunk/src/target/gsm/src/gsmd/machine_gta01.c
===================================================================
--- trunk/src/target/gsm/src/gsmd/machine_gta01.c	2007-11-16 01:30:09 UTC (rev 3429)
+++ trunk/src/target/gsm/src/gsmd/machine_gta01.c	2007-11-16 08:55:01 UTC (rev 3430)
@@ -0,0 +1,109 @@
+#include <stdlib.h>
+#include <unistd.h>
+#include <string.h>
+#include <stdio.h>
+#include <errno.h>
+
+#include "gsmd.h"
+
+#include <gsmd/gsmd.h>
+#include <gsmd/usock.h>
+#include <gsmd/event.h>
+#include <gsmd/talloc.h>
+#include <gsmd/extrsp.h>
+#include <gsmd/machineplugin.h>
+#include <gsmd/atcmd.h>
+
+#define GSMD_MODEM_WAKEUP_TIMEOUT     3
+
+static int null_wakeup_cb(struct gsmd_atcmd *cmd, void *ctx, char *resp) 
+{
+	DEBUGP("The wake up callback!!\n");
+        return 0;
+}
+
+static void wakeup_timeout(struct gsmd_timer *tmr, void *data) 
+{
+        struct gsmd *g=data;
+        struct gsmd_atcmd *cmd=NULL;
+        DEBUGP("Wakeup time out!!\n");
+        if (!llist_empty(&g->busy_atcmds)) {
+                cmd = llist_entry(g->busy_atcmds.next,struct gsmd_atcmd, list);
+        }
+        if (!cmd) { 
+                DEBUGP("ERROR!! busy_atcmds is NULL\n");
+                return;
+        }
+
+        if (cmd->timeout != tmr) {
+                DEBUGP("ERROR!! cmd->timeout != tmr\n");
+                return;
+        }
+
+        gsmd_timer_free(cmd->timeout);
+        cmd->timeout = NULL;
+
+        // It's a wakeup command
+        if ( cmd->buf[0]==' ') {
+                llist_del(&cmd->list);
+                talloc_free(cmd);
+                // discard the wakeup command, and pass the real command.
+                if (llist_empty(&g->busy_atcmds) && !llist_empty(&g->pending_atcmds)) {
+                        atcmd_wake_pending_queue(g);
+                }
+        } else {
+                DEBUGP("ERROR!! Wakeup timeout and cmd->buf is not wakeup command!! %s\n",cmd->buf);
+        }
+}
+
+static struct gsmd_timer * wakeup_timer(struct gsmd *g)
+{
+        struct timeval tv;
+        tv.tv_sec = GSMD_MODEM_WAKEUP_TIMEOUT;
+        tv.tv_usec = 0;
+	DEBUGP("Create wake up timer\n");
+
+        return gsmd_timer_create(&tv,&wakeup_timeout,g);
+}
+
+/// adding a null '\r' before real at command.
+static int atcmd_wakeup_modem(struct gsmd *g) 
+{
+	DEBUGP("try to wake up\n");
+	struct gsmd_atcmd * cmd= atcmd_fill(" \r", 2, null_wakeup_cb, g, 0, wakeup_timer);
+
+	llist_add_tail(&cmd->list, &g->pending_atcmds);
+	if (llist_empty(&g->busy_atcmds) && !llist_empty(&g->pending_atcmds)) {
+		atcmd_wake_pending_queue(g);
+	}
+
+	return 0;
+}
+
+static int gta01_detect(struct gsmd *g)
+{
+	/* FIXME: do actual detection of machine if we have multiple machines */
+	return 1;
+}
+
+static int gta01_init(struct gsmd *g, int fd)
+{
+	int rc;
+
+	/*
+	 * We assume that the GSM chipset can take
+	 * input immediately, so we don't have to
+	 * wait for the "AT-Command Interpreter ready"
+	 * message before trying to send commands.
+	 */
+	g->interpreter_ready = 1;
+
+	return 0;
+}
+
+struct gsmd_machine_plugin gsmd_machine_plugin = {
+	.name = "TI Calypso / FIC firmware",
+	.ex_submit = &atcmd_wakeup_modem,
+	.detect = &gta01_detect,
+	.init = &gta01_init,
+};

Modified: trunk/src/target/gsm/src/gsmd/machine_tihtc.c
===================================================================
--- trunk/src/target/gsm/src/gsmd/machine_tihtc.c	2007-11-16 01:30:09 UTC (rev 3429)
+++ trunk/src/target/gsm/src/gsmd/machine_tihtc.c	2007-11-16 08:55:01 UTC (rev 3430)
@@ -66,6 +66,7 @@
 
 struct gsmd_machine_plugin gsmd_machine_plugin = {
 	.name = "TI Calypso / HTC firmware",
+	.ex_submit = NULL,
 	.detect = &tihtc_detect,
 	.init = &tihtc_init,
 };

Modified: trunk/src/target/gsm/src/gsmd/sms_cb.c
===================================================================
--- trunk/src/target/gsm/src/gsmd/sms_cb.c	2007-11-16 01:30:09 UTC (rev 3429)
+++ trunk/src/target/gsm/src/gsmd/sms_cb.c	2007-11-16 08:55:01 UTC (rev 3430)
@@ -320,7 +320,7 @@
 			atcmd_len = sprintf(buf, "AT+CMGL=%i", *stat);
 
 		cmd = atcmd_fill(buf, atcmd_len + 1,
-				&sms_list_cb, gu, gph->id);
+				&sms_list_cb, gu, gph->id, NULL);
 		break;
 
 	case GSMD_SMS_READ:
@@ -331,7 +331,7 @@
 		atcmd_len = sprintf(buf, "AT+CMGR=%i", *index);
 
 		cmd = atcmd_fill(buf, atcmd_len + 1,
-				&sms_read_cb, gu, gph->id);
+				&sms_read_cb, gu, gph->id, NULL);
 		break;
 
 	case GSMD_SMS_SEND:
@@ -353,7 +353,7 @@
 		buf[atcmd_len ++] = 26;	/* ^Z ends the message */
 		buf[atcmd_len ++] = 0;
 
-		cmd = atcmd_fill(buf, atcmd_len, &sms_send_cb, gu, gph->id);
+		cmd = atcmd_fill(buf, atcmd_len, &sms_send_cb, gu, gph->id, NULL);
 		break;
 
 	case GSMD_SMS_WRITE:
@@ -378,7 +378,7 @@
 		buf[atcmd_len ++] = 26;	/* ^Z ends the message */
 		buf[atcmd_len ++] = 0;
 
-		cmd = atcmd_fill(buf, atcmd_len, &sms_write_cb, gu, gph->id);
+		cmd = atcmd_fill(buf, atcmd_len, &sms_write_cb, gu, gph->id, NULL);
 		break;
 
 	case GSMD_SMS_DELETE:
@@ -390,11 +390,11 @@
 				gsd->index, gsd->delflg);
 
 		cmd = atcmd_fill(buf, atcmd_len + 1,
-				&sms_delete_cb, gu, gph->id);
+				&sms_delete_cb, gu, gph->id, NULL);
 		break;
 
 	case GSMD_SMS_GET_MSG_STORAGE:
-		cmd = atcmd_fill("AT+CPMS?", 8 + 1, usock_cpms_cb, gu, 0);
+		cmd = atcmd_fill("AT+CPMS?", 8 + 1, usock_cpms_cb, gu, 0, NULL);
 		break;
 
 	case GSMD_SMS_SET_MSG_STORAGE:
@@ -406,11 +406,11 @@
 				ts0705_memtype_name[storage[0]],
 				ts0705_memtype_name[storage[1]],
 				ts0705_memtype_name[storage[2]]);
-		cmd = atcmd_fill(buf, atcmd_len + 1, NULL, gu, gph->id);
+		cmd = atcmd_fill(buf, atcmd_len + 1, NULL, gu, gph->id, NULL);
 		break;
 
 	case GSMD_SMS_GET_SERVICE_CENTRE:
-		cmd = atcmd_fill("AT+CSCA?", 8 + 1, &usock_get_smsc_cb, gu, 0);
+		cmd = atcmd_fill("AT+CSCA?", 8 + 1, &usock_get_smsc_cb, gu, 0, NULL);
 		break;
 
 	case GSMD_SMS_SET_SERVICE_CENTRE:
@@ -419,7 +419,7 @@
 		ga = (struct gsmd_addr *) ((void *) gph + sizeof(*gph));
 		atcmd_len = sprintf(buf, "AT+CSCA=\"%s\",%i",
 				ga->number, ga->type);
-		cmd = atcmd_fill(buf, atcmd_len + 1, NULL, gu, gph->id);
+		cmd = atcmd_fill(buf, atcmd_len + 1, NULL, gu, gph->id, NULL);
 		break;
 
 	default:
@@ -440,10 +440,10 @@
 
 	switch (gph->msg_subtype) {
 	case GSMD_CB_SUBSCRIBE:
-		cmd = atcmd_fill("AT+CSCB=1", 9 + 1, NULL, gu->gsmd, 0);
+		cmd = atcmd_fill("AT+CSCB=1", 9 + 1, NULL, gu->gsmd, 0, NULL);
 		break;
 	case GSMD_CB_UNSUBSCRIBE:
-		cmd = atcmd_fill("AT+CSCB=0", 9 + 1, NULL, gu->gsmd, 0);
+		cmd = atcmd_fill("AT+CSCB=0", 9 + 1, NULL, gu->gsmd, 0, NULL);
 		break;
 	default:
 		return -ENOSYS;
@@ -681,7 +681,7 @@
 
 	/* If text mode, set the encoding */
 	if (gsmd->flags & GSMD_FLAG_SMS_FMT_TEXT) {
-		atcmd = atcmd_fill("AT+CSCS=\"IRA\"", 13 + 1, NULL, gsmd, 0);
+		atcmd = atcmd_fill("AT+CSCS=\"IRA\"", 13 + 1, NULL, gsmd, 0, NULL);
 		if (!atcmd)
 			return -ENOMEM;
 		atcmd_submit(gsmd, atcmd);
@@ -692,7 +692,7 @@
 				"AT+CMGF=%i",
 				(gsmd->flags & GSMD_FLAG_SMS_FMT_TEXT) ?
 				GSMD_SMS_FMT_TEXT : GSMD_SMS_FMT_PDU) + 1,
-			NULL, gsmd, 0);
+			NULL, gsmd, 0, NULL);
 	if (!atcmd)
 		return -ENOMEM;
 

Modified: trunk/src/target/gsm/src/gsmd/usock.c
===================================================================
--- trunk/src/target/gsm/src/gsmd/usock.c	2007-11-16 01:30:09 UTC (rev 3429)
+++ trunk/src/target/gsm/src/gsmd/usock.c	2007-11-16 08:55:01 UTC (rev 3430)
@@ -90,7 +90,7 @@
 static int usock_rcv_passthrough(struct gsmd_user *gu, struct gsmd_msg_hdr *gph, int len)
 {
 	struct gsmd_atcmd *cmd;
-	cmd = atcmd_fill((char *)gph+sizeof(*gph), gph->len, &usock_cmd_cb, gu, gph->id);
+	cmd = atcmd_fill((char *)gph+sizeof(*gph), gph->len, &usock_cmd_cb, gu, gph->id, NULL);
 	if (!cmd)
 		return -ENOMEM;
 
@@ -127,7 +127,7 @@
 		ga = (struct gsmd_addr *) ((void *)gph + sizeof(*gph));
 		ga->number[GSMD_ADDR_MAXLEN] = '\0';
 		cmd = atcmd_fill("ATD", 5 + strlen(ga->number),
-				 &usock_cmd_cb, gu, gph->id);
+				 &usock_cmd_cb, gu, gph->id, NULL);
 		if (!cmd)
 			return -ENOMEM;
 		sprintf(cmd->buf, "ATD%s;", ga->number);
@@ -135,7 +135,7 @@
 		break;
 	case GSMD_VOICECALL_HANGUP:
 		/* ATH0 is not supported by QC, we hope ATH is supported by everone */
-		cmd = atcmd_fill("ATH", 4, &usock_cmd_cb, gu, gph->id);
+		cmd = atcmd_fill("ATH", 4, &usock_cmd_cb, gu, gph->id, NULL);
                 
                 /* This command is special because it needs to be sent to
                 * the MS even if a command is currently executing.  */
@@ -144,7 +144,7 @@
                 }
 		break;
 	case GSMD_VOICECALL_ANSWER:
-		cmd = atcmd_fill("ATA", 4, &usock_cmd_cb, gu, gph->id);
+		cmd = atcmd_fill("ATA", 4, &usock_cmd_cb, gu, gph->id, NULL);
 		break;
 	case GSMD_VOICECALL_DTMF:
 		if (len < sizeof(*gph) + sizeof(*gd))
@@ -160,7 +160,7 @@
 
 		atcmd_len = 1 + strlen("AT+VTS=") + (gd->len * 2);
 		cmd = atcmd_fill("AT+VTS=", atcmd_len, &usock_cmd_cb,
-				 gu, gph->id);
+				 gu, gph->id, NULL);
 		if (!cmd)
 			return -ENOMEM;
 
@@ -224,7 +224,7 @@
 	}
 
 	cmd = atcmd_fill("AT+CPIN=\"", 9+GSMD_PIN_MAXLEN+3+GSMD_PIN_MAXLEN+2,
-			 &pin_cmd_cb, gu, 0);
+			 &pin_cmd_cb, gu, 0, NULL);
 	if (!cmd)
 		return -ENOMEM;
 
@@ -271,12 +271,12 @@
 	switch (gph->msg_subtype) {
 	case GSMD_PHONE_POWERUP:
 		cmd = atcmd_fill("AT+CFUN=1", 9+1,
-				 &phone_powerup_cb, gu, 0);
+				 &phone_powerup_cb, gu, 0, NULL);
 		break;
 
 	case GSMD_PHONE_POWERDOWN:
 		cmd = atcmd_fill("AT+CFUN=0", 9+1,
-				 &null_cmd_cb, gu, 0);
+				 &null_cmd_cb, gu, 0, NULL);
 		gu->gsmd->dev_state.on = 0;
 		break;
 	default:
@@ -592,7 +592,7 @@
 		num->service = GSMD_SERVICE_UNKNOWN;
 	num->name[len] = 0;
 	num->addr.type = type;
-	num->is_last = (cmd->ret == 0);
+	num->is_last = (cmd->ret == 0, NULL);
 
 	usock_cmd_enqueue(ucmd, gu);
 
@@ -615,52 +615,52 @@
 					sizeof(gsmd_oper_numeric), oper);
 		else
 			cmdlen = sprintf(buffer, "AT+COPS=0");
-		cmd = atcmd_fill(buffer, cmdlen + 1, &null_cmd_cb, gu, 0);
+		cmd = atcmd_fill(buffer, cmdlen + 1, &null_cmd_cb, gu, 0, NULL);
 		break;
 	case GSMD_NETWORK_DEREGISTER:
-		cmd = atcmd_fill("AT+COPS=2", 9+1, &null_cmd_cb, gu, 0);
+		cmd = atcmd_fill("AT+COPS=2", 9+1, &null_cmd_cb, gu, 0, NULL);
 		break;
 	case GSMD_NETWORK_VMAIL_GET:
-		cmd = atcmd_fill("AT+CSVM?", 8+1, &network_vmail_cb, gu, 0);
+		cmd = atcmd_fill("AT+CSVM?", 8+1, &network_vmail_cb, gu, 0, NULL);
 		break;
 	case GSMD_NETWORK_VMAIL_SET:
-		cmd = atcmd_fill("AT+CSVM=", 8+1, &network_vmail_cb, gu, 0);
+		cmd = atcmd_fill("AT+CSVM=", 8+1, &network_vmail_cb, gu, 0, NULL);
 		break;
 	case GSMD_NETWORK_SIGQ_GET:
-		cmd = atcmd_fill("AT+CSQ", 6+1, &network_sigq_cb, gu, 0);
+		cmd = atcmd_fill("AT+CSQ", 6+1, &network_sigq_cb, gu, 0, NULL);
 		break;
 	case GSMD_NETWORK_OPER_GET:
 		/* Set long alphanumeric format */
 		atcmd_submit(gu->gsmd, atcmd_fill("AT+COPS=3,0", 11+1,
-					&null_cmd_cb, gu, 0));
-		cmd = atcmd_fill("AT+COPS?", 8+1, &network_oper_cb, gu, 0);
+					&null_cmd_cb, gu, 0, NULL));
+		cmd = atcmd_fill("AT+COPS?", 8+1, &network_oper_cb, gu, 0, NULL);
 		break;
 	case GSMD_NETWORK_OPER_LIST:
-		cmd = atcmd_fill("AT+COPS=?", 9+1, &network_opers_cb, gu, 0);
+		cmd = atcmd_fill("AT+COPS=?", 9+1, &network_opers_cb, gu, 0, NULL);
 		break;
 	case GSMD_NETWORK_PREF_LIST:
 		/* Set long alphanumeric format */
 		atcmd_submit(gu->gsmd, atcmd_fill("AT+CPOL=,0", 10 + 1,
-					&null_cmd_cb, gu, 0));
+					&null_cmd_cb, gu, 0, NULL));
 		cmd = atcmd_fill("AT+CPOL?", 8 + 1,
-				&network_pref_opers_cb, gu, 0);
+				&network_pref_opers_cb, gu, 0, NULL);
 		break;
 	case GSMD_NETWORK_PREF_DEL:
 		cmdlen = sprintf(buffer, "AT+CPOL=%i", *(int *) gph->data);
-		cmd = atcmd_fill(buffer, cmdlen + 1, &null_cmd_cb, gu, 0);
+		cmd = atcmd_fill(buffer, cmdlen + 1, &null_cmd_cb, gu, 0, NULL);
 		break;
 	case GSMD_NETWORK_PREF_ADD:
 		cmdlen = sprintf(buffer, "AT+CPOL=,2,\"%.*s\"",
 				sizeof(gsmd_oper_numeric), oper);
-		cmd = atcmd_fill(buffer, cmdlen + 1, &null_cmd_cb, gu, 0);
+		cmd = atcmd_fill(buffer, cmdlen + 1, &null_cmd_cb, gu, 0, NULL);
 		break;
 	case GSMD_NETWORK_PREF_SPACE:
 		cmd = atcmd_fill("AT+CPOL=?", 9 + 1,
-				&network_pref_num_cb, gu, 0);
+				&network_pref_num_cb, gu, 0, NULL);
 		break;
 	case GSMD_NETWORK_GET_NUMBER:
 		cmd = atcmd_fill("AT+CNUM", 7 + 1,
-				&network_ownnumbers_cb, gu, 0);
+				&network_ownnumbers_cb, gu, 0, NULL);
 		break;
 	default:
 		return -EINVAL;
@@ -987,7 +987,7 @@
 	case GSMD_PHONEBOOK_LIST_STORAGE:
 		cmd = atcmd_fill("AT+CPBS=?", 9 + 1,
 				&phonebook_list_storage_cb,
-				gu, gph->id);
+				gu, gph->id, NULL);
 		break;
 	case GSMD_PHONEBOOK_SET_STORAGE:
 		if (len < sizeof(*gph) + 3)
@@ -998,7 +998,7 @@
 		/* ex. AT+CPBS="ME" */
 		atcmd_len = 1 + strlen("AT+CPBS=\"") + 2 + strlen("\"");
 		cmd = atcmd_fill("AT+CPBS=\"", atcmd_len,
-				&usock_cmd_cb, gu, gph->id);
+				&usock_cmd_cb, gu, gph->id, NULL);
 
 		if (!cmd)
 			return -ENOMEM;
@@ -1013,7 +1013,7 @@
 		atcmd_len = 1 + strlen("AT+CPBF=\"") +
 			strlen(gpf->findtext) + strlen("\"");
 		cmd = atcmd_fill("AT+CPBF=\"", atcmd_len,
-				 &phonebook_find_cb, gu, gph->id);
+				 &phonebook_find_cb, gu, gph->id, NULL);
 		if (!cmd)
 			return -ENOMEM;
 		sprintf(cmd->buf, "AT+CPBF=\"%s\"", gpf->findtext);
@@ -1029,7 +1029,7 @@
 		/* ex, AT+CPBR=23 */
 		atcmd_len = 1 + strlen("AT+CPBR=") + strlen(buf);
 		cmd = atcmd_fill("AT+CPBR=", atcmd_len,
-				 &phonebook_read_cb, gu, gph->id);
+				 &phonebook_read_cb, gu, gph->id, NULL);
 		if (!cmd)
 			return -ENOMEM;
 		sprintf(cmd->buf, "AT+CPBR=%d", *index);
@@ -1044,7 +1044,7 @@
 		/* ex, AT+CPBR=1,100 */
 		atcmd_len = 1 + strlen("AT+CPBR=") + strlen(buf);
 		cmd = atcmd_fill("AT+CPBR=", atcmd_len,
-				 &phonebook_readrg_cb, gu, gph->id);
+				 &phonebook_readrg_cb, gu, gph->id, NULL);
 		if (!cmd)
 			return -ENOMEM;
 		sprintf(cmd->buf, "AT+CPBR=%s", buf);
@@ -1059,7 +1059,7 @@
 
 		atcmd_len = 1 + strlen("AT+CPBW=") + strlen(buf);
 		cmd = atcmd_fill("AT+CPBW=", atcmd_len,
-				 &phonebook_write_cb, gu, gph->id);
+				 &phonebook_write_cb, gu, gph->id, NULL);
 		if (!cmd)
 			return -ENOMEM;
 		sprintf(cmd->buf, "AT+CPBW=%s", buf);
@@ -1074,14 +1074,14 @@
 		/* ex, AT+CPBW=3*/
 		atcmd_len = 1 + strlen("AT+CPBW=") + strlen(buf);
 		cmd = atcmd_fill("AT+CPBW=", atcmd_len,
-				 &phonebook_delete_cb, gu, gph->id);
+				 &phonebook_delete_cb, gu, gph->id, NULL);
 		if (!cmd)
 			return -ENOMEM;
 		sprintf(cmd->buf, "AT+CPBW=%s", buf);
 		break;	
 	case GSMD_PHONEBOOK_GET_SUPPORT:
 		cmd = atcmd_fill("AT+CPBR=?", 9+1,
-				 &phonebook_get_support_cb, gu, gph->id);
+				 &phonebook_get_support_cb, gu, gph->id, NULL);
 		break;
 	case GSMD_PHONEBOOK_RETRIEVE_READRG:
 		if (len < sizeof(*gph) + sizeof(int))
@@ -1145,7 +1145,7 @@
 		break;
         
 	case GSMD_PHONEBOOK_GET_IMSI:
-		cmd = atcmd_fill("AT+CIMI", 7 + 1, &get_imsi_cb, gu, 0);
+		cmd = atcmd_fill("AT+CIMI", 7 + 1, &get_imsi_cb, gu, 0, NULL);
 		break;
 
 	default:

Modified: trunk/src/target/gsm/src/gsmd/vendor_ti.c
===================================================================
--- trunk/src/target/gsm/src/gsmd/vendor_ti.c	2007-11-16 01:30:09 UTC (rev 3429)
+++ trunk/src/target/gsm/src/gsmd/vendor_ti.c	2007-11-16 08:55:01 UTC (rev 3430)
@@ -262,7 +262,7 @@
 		return -EINVAL;
 	
 	/* retrieve voicemail number */
-	cmd = atcmd_fill("AT%CPMB=1", 10, &cpmb_detect_cb, g, 0);
+	cmd = atcmd_fill("AT%CPMB=1", 10, &cpmb_detect_cb, g, 0, NULL);
 	if (cmd)
 		atcmd_submit(g, cmd);
 	
@@ -304,7 +304,7 @@
 	rc |= gsmd_simplecmd(g, "AT%CPHS=1");
 	
 	/* enable %CPI: call progress indication */
-	cmd = atcmd_fill("AT%CPI=?", 9, &cpi_detect_cb, g, 0);
+	cmd = atcmd_fill("AT%CPI=?", 9, &cpi_detect_cb, g, 0, NULL);
 	if (cmd)
 		atcmd_submit(g, cmd);
 

Modified: trunk/src/target/gsm/src/gsmd/vendor_tihtc.c
===================================================================
--- trunk/src/target/gsm/src/gsmd/vendor_tihtc.c	2007-11-16 01:30:09 UTC (rev 3429)
+++ trunk/src/target/gsm/src/gsmd/vendor_tihtc.c	2007-11-16 08:55:01 UTC (rev 3430)
@@ -45,7 +45,7 @@
 int gsmd_simplecmd(struct gsmd *gsmd, char *cmdtxt)
 {
 	struct gsmd_atcmd *cmd;
-	cmd = atcmd_fill(cmdtxt, strlen(cmdtxt)+1, &gsmd_test_atcb, NULL, 0);
+	cmd = atcmd_fill(cmdtxt, strlen(cmdtxt)+1, &gsmd_test_atcb, NULL, 0, NULL);
 	if (!cmd)
 		return -ENOMEM;
 
@@ -261,7 +261,7 @@
 	rc |= gsmd_simplecmd(g, "AT%CUNS=0");
 
 	/* enable %CPI: call progress indication */
-	cmd = atcmd_fill("AT%CPI=?", 9, &cpi_detect_cb, g, 0);
+	cmd = atcmd_fill("AT%CPI=?", 9, &cpi_detect_cb, g, 0, NULL);
 	if (cmd)
 		atcmd_submit(g, cmd);
 





More information about the commitlog mailing list