summaryrefslogtreecommitdiff
path: root/src/gsmd
diff options
context:
space:
mode:
authorerin_yueh <erin_yueh@99fdad57-331a-0410-800a-d7fa5415bdb3>2008-01-10 05:14:53 +0000
committererin_yueh <erin_yueh@99fdad57-331a-0410-800a-d7fa5415bdb3>2008-01-10 05:14:53 +0000
commitfbc0b497567fecd2818f4a497843f62d1be6d70c (patch)
treea08697bc3dcd3dbe25df196c19c788aa8bb8a6c5 /src/gsmd
parent9567f52dbf14097d8e19d0d858594d971aa725ec (diff)
gsmd: eliminate gcc warnings (Erin Yueh)
git-svn-id: http://svn.openmoko.org/trunk/src/target/gsm@3807 99fdad57-331a-0410-800a-d7fa5415bdb3
Diffstat (limited to 'src/gsmd')
-rw-r--r--src/gsmd/atcmd.c16
-rw-r--r--src/gsmd/ext_response.c3
-rw-r--r--src/gsmd/gsmd.c16
-rw-r--r--src/gsmd/machine.c4
-rw-r--r--src/gsmd/machine_generic.c2
-rw-r--r--src/gsmd/sms_cb.c19
-rw-r--r--src/gsmd/timer.c7
-rw-r--r--src/gsmd/unsolicited.c28
-rw-r--r--src/gsmd/usock.c13
-rw-r--r--src/gsmd/vendor_bcm.c9
-rw-r--r--src/gsmd/vendor_qc.c12
-rw-r--r--src/gsmd/vendor_ti.c20
-rw-r--r--src/gsmd/vendor_tihtc.c23
13 files changed, 84 insertions, 88 deletions
diff --git a/src/gsmd/atcmd.c b/src/gsmd/atcmd.c
index 356b637..8d71268 100644
--- a/src/gsmd/atcmd.c
+++ b/src/gsmd/atcmd.c
@@ -49,12 +49,14 @@ enum final_result_codes {
NUM_FINAL_RESULTS,
};
+#if 0
static const char *final_results[] = {
"OK",
"ERROR",
"+CME ERROR:",
"+CMS ERROR:",
};
+#endif
/* we basically implement a parse that can deal with
* - receiving and queueing commands from higher level of libgmsd
@@ -188,6 +190,7 @@ static int llparse_init(struct llparser *llp)
return 0;
}
+#if 0
/* mid-level parser */
static int parse_final_result(const char *res)
@@ -200,6 +203,7 @@ static int parse_final_result(const char *res)
return -1;
}
+#endif
void atcmd_wake_pending_queue (struct gsmd *g)
{
@@ -224,10 +228,10 @@ static int atcmd_done(struct gsmd *g, struct gsmd_atcmd *cmd, const char *buf)
/* send final result code if there is no information
* response in mlbuf */
if (g->mlbuf_len) {
- cmd->resp = g->mlbuf;
+ cmd->resp = (char *) g->mlbuf;
g->mlbuf[g->mlbuf_len] = 0;
} else {
- cmd->resp = buf;
+ cmd->resp = (char *) buf;
}
rc = cmd->cb(cmd, cmd->ctx, cmd->resp);
DEBUGP("Clearing mlbuf\n");
@@ -367,7 +371,7 @@ static int ml_parse(const char *buf, int len, void *ctx)
gsmd_log(GSMD_NOTICE, "command without cb!!!\n");
} else {
DEBUGP("Calling cmd->cb()\n");
- cmd->resp = g->mlbuf;
+ cmd->resp = (char *) g->mlbuf;
rc = cmd->cb(cmd, cmd->ctx, cmd->resp);
DEBUGP("Clearing mlbuf\n");
memset(g->mlbuf, 0, MLPARSE_BUF_SIZE);
@@ -429,8 +433,8 @@ static int ml_parse(const char *buf, int len, void *ctx)
g->mlbuf_len += len;
if (g->mlunsolicited) {
- rc = unsolicited_parse(g, g->mlbuf, g->mlbuf_len,
- strchr(g->mlbuf, ':') + 1);
+ rc = unsolicited_parse(g, (const char*) g->mlbuf, (int) g->mlbuf_len,
+ strchr((const char*)g->mlbuf, ':') + 1);
if (rc == -EAGAIN) {
/* The parser wants one more line of
* input. Wait for the next line, concatenate
@@ -464,6 +468,7 @@ static int atcmd_prompt(void *data)
struct gsmd *g = data;
atcmd_wake_pending_queue(g);
+ return 0;
}
/* callback to be called if [virtual] UART has some data for us */
@@ -642,7 +647,6 @@ static int remove_timer(struct gsmd_atcmd * cmd)
/* submit an atcmd in the global queue of pending atcmds */
int atcmd_submit(struct gsmd *g, struct gsmd_atcmd *cmd)
{
- int empty;
if (g->machinepl->ex_submit) {
DEBUGP("extra-submiting command\n");
diff --git a/src/gsmd/ext_response.c b/src/gsmd/ext_response.c
index f2a94a7..e8b2ab3 100644
--- a/src/gsmd/ext_response.c
+++ b/src/gsmd/ext_response.c
@@ -67,7 +67,6 @@ struct gsm_extrsp *extrsp_parse(const void *ctx, const char *input)
{
const char *cur = input;
struct gsm_extrsp *er;
- int cur_tok = 0;
enum parser_state state = IDLE;
char buf[512];
char *cur_buf = buf;
@@ -166,6 +165,8 @@ struct gsm_extrsp *extrsp_parse(const void *ctx, const char *input)
/* ERROR */
}
break;
+ default:
+ break;
}
cur++;
}
diff --git a/src/gsmd/gsmd.c b/src/gsmd/gsmd.c
index 53b43a8..c83deff 100644
--- a/src/gsmd/gsmd.c
+++ b/src/gsmd/gsmd.c
@@ -44,6 +44,8 @@
#include <gsmd/usock.h>
#include <gsmd/vendorplugin.h>
#include <gsmd/talloc.h>
+#include <gsmd/sms.h>
+#include <gsmd/unsolicited.h>
#define GSMD_ALIVECMD "AT"
#define GSMD_ALIVE_INTERVAL 5*60
@@ -157,7 +159,7 @@ int gsmd_simplecmd(struct gsmd *gsmd, char *cmdtxt)
static int gsmd_initsettings2(struct gsmd *gsmd)
{
- int rc;
+ int rc = 0;
/* echo on, verbose */
rc |= gsmd_simplecmd(gsmd, "ATE0V1");
@@ -215,19 +217,10 @@ static int firstcmd_atcb(struct gsmd_atcmd *cmd, void *ctx, char *resp)
return gsmd_initsettings2(gsmd);
}
-static void firstcmd_tmr_cb(struct gsmd_timer *tmr, void *data)
-{
- if (firstcmd_response == 0) {
- gsmd_log(GSMD_FATAL, "No response from GSM Modem");
- exit(4);
- }
- gsmd_timer_free(tmr);
-}
int gsmd_initsettings(struct gsmd *gsmd)
{
struct gsmd_atcmd *cmd;
- struct timeval tv;
cmd = atcmd_fill("ATZ", strlen("ATZ")+1, &firstcmd_atcb, gsmd, 0, NULL);
if (!cmd)
@@ -366,7 +359,6 @@ int main(int argc, char **argv)
int bps = 115200;
int hwflow = 0;
char *device = NULL;
- char *logfile = "syslog";
char *vendor_name = NULL;
char *machine_name = NULL;
int wait = -1;
@@ -475,7 +467,7 @@ int main(int argc, char **argv)
exit(1);
}
- write(fd,'\r',1);
+ write(fd,"\r",1);
atcmd_drain(fd);
if (usock_init(&g) < 0) {
diff --git a/src/gsmd/machine.c b/src/gsmd/machine.c
index 0909928..33551b2 100644
--- a/src/gsmd/machine.c
+++ b/src/gsmd/machine.c
@@ -117,7 +117,7 @@ int gsmd_machine_plugin_init(struct gsmd *g, char *machine_name, char *vendor_na
buf[sizeof(buf)-1] = '\0';
line = strtok(buf, "\n");
- while (line = strtok(NULL, "\n")) {
+ while ((line = strtok(NULL, "\n"))) {
if (strncmp(line, "Hardware\t: ", 11) == 0) {
hw = line+11;
break;
@@ -138,7 +138,7 @@ int gsmd_machine_plugin_init(struct gsmd *g, char *machine_name, char *vendor_na
if (vendor_name)
DEBUGP("wanring: auto-detected vendor '%s', "
- "but user override to '%s'\m",
+ "but user override to '%s'\n",
machines[i].vendor, vendor_name);
else
vendor_name = machines[i].vendor;
diff --git a/src/gsmd/machine_generic.c b/src/gsmd/machine_generic.c
index 536192d..b46c118 100644
--- a/src/gsmd/machine_generic.c
+++ b/src/gsmd/machine_generic.c
@@ -41,8 +41,6 @@ static int generic_detect(struct gsmd *g)
static int generic_init(struct gsmd *g, int fd)
{
- int rc;
-
/*
* We assume that the GSM chipset can take
* input immediately, so we don't have to
diff --git a/src/gsmd/sms_cb.c b/src/gsmd/sms_cb.c
index ea622fc..0e97749 100644
--- a/src/gsmd/sms_cb.c
+++ b/src/gsmd/sms_cb.c
@@ -38,6 +38,7 @@
#include <gsmd/usock.h>
#include <gsmd/unsolicited.h>
#include <gsmd/sms.h>
+#include <gsmd/talloc.h>
static const char *ts0705_memtype_name[] = {
[GSM0705_MEMTYPE_NONE] = "NONE",
@@ -402,7 +403,8 @@ int usock_rcv_cb(struct gsmd_user *gu, struct gsmd_msg_hdr *gph, int len)
}
/* Unsolicited messages related to SMS / CB */
-static int cmti_parse(char *buf, int len, const char *param, struct gsmd *gsmd)
+static int cmti_parse(const char *buf, int len, const char *param,
+ struct gsmd *gsmd)
{
char memstr[3];
struct gsmd_evt_auxdata *aux;
@@ -424,7 +426,8 @@ static int cmti_parse(char *buf, int len, const char *param, struct gsmd *gsmd)
return usock_evt_send(gsmd, ucmd, GSMD_EVT_IN_SMS);
}
-static int cmt_parse(char *buf, int len, const char *param, struct gsmd *gsmd)
+static int cmt_parse(const char *buf, int len, const char *param,
+ struct gsmd *gsmd)
{
/* TODO: TEXT mode */
u_int8_t pdu[SMS_MAX_PDU_SIZE];
@@ -474,7 +477,8 @@ static int cmt_parse(char *buf, int len, const char *param, struct gsmd *gsmd)
return usock_evt_send(gsmd, ucmd, GSMD_EVT_IN_SMS);
}
-static int cbmi_parse(char *buf, int len, const char *param, struct gsmd *gsmd)
+static int cbmi_parse(const char *buf, int len, const char *param,
+ struct gsmd *gsmd)
{
char memstr[3];
struct gsmd_evt_auxdata *aux;
@@ -496,7 +500,8 @@ static int cbmi_parse(char *buf, int len, const char *param, struct gsmd *gsmd)
return usock_evt_send(gsmd, ucmd, GSMD_EVT_IN_CBM);
}
-static int cbm_parse(char *buf, int len, const char *param, struct gsmd *gsmd)
+static int cbm_parse(const char *buf, int len, const char *param,
+ struct gsmd *gsmd)
{
/* TODO: TEXT mode */
u_int8_t pdu[CBM_MAX_PDU_SIZE];
@@ -541,7 +546,8 @@ static int cbm_parse(char *buf, int len, const char *param, struct gsmd *gsmd)
return usock_evt_send(gsmd, ucmd, GSMD_EVT_IN_CBM);
}
-static int cdsi_parse(char *buf, int len, const char *param, struct gsmd *gsmd)
+static int cdsi_parse(const char *buf, int len, const char *param,
+ struct gsmd *gsmd)
{
char memstr[3];
struct gsmd_evt_auxdata *aux;
@@ -563,7 +569,8 @@ static int cdsi_parse(char *buf, int len, const char *param, struct gsmd *gsmd)
return usock_evt_send(gsmd, ucmd, GSMD_EVT_IN_DS);
}
-static int cds_parse(char *buf, int len, const char *param, struct gsmd *gsmd)
+static int cds_parse(const char *buf, int len, const char *param,
+ struct gsmd *gsmd)
{
/* TODO: TEXT mode */
u_int8_t pdu[SMS_MAX_PDU_SIZE];
diff --git a/src/gsmd/timer.c b/src/gsmd/timer.c
index 5200690..648676f 100644
--- a/src/gsmd/timer.c
+++ b/src/gsmd/timer.c
@@ -37,12 +37,13 @@
static LLIST_HEAD(gsmd_timers);
static void *__tmr_ctx;
+#if 0
static void tv_normalize(struct timeval *out)
{
out->tv_sec += (out->tv_usec / 1000000);
out->tv_usec = (out->tv_usec % 1000000);
}
-
+#endif
/* subtract two struct timevals */
static int tv_sub(struct timeval *res, const struct timeval *from,
const struct timeval *sub)
@@ -57,7 +58,7 @@ static int tv_sub(struct timeval *res, const struct timeval *from,
return 0;
}
-
+#if 0
static int tv_add(struct timeval *res, const struct timeval *a1,
const struct timeval *a2)
{
@@ -68,7 +69,7 @@ static int tv_add(struct timeval *res, const struct timeval *a1,
tv_normalize(res);
}
-
+#endif
static int tv_later(const struct timeval *expires, const struct timeval *now)
{
if (expires->tv_sec < now->tv_sec)
diff --git a/src/gsmd/unsolicited.c b/src/gsmd/unsolicited.c
index 8c99183..537e16a 100644
--- a/src/gsmd/unsolicited.c
+++ b/src/gsmd/unsolicited.c
@@ -35,6 +35,7 @@
#include <gsmd/ts0707.h>
#include <gsmd/unsolicited.h>
#include <gsmd/talloc.h>
+#include <gsmd/sms.h>
struct gsmd_ucmd *usock_build_event(u_int8_t type, u_int8_t subtype, u_int16_t len)
{
@@ -147,7 +148,7 @@ static void state_ringing_update(struct gsmd *gsmd)
&state_ringing_timeout, gsmd);
}
-static int ring_parse(char *buf, int len, const char *param,
+static int ring_parse(const char *buf, int len, const char *param,
struct gsmd *gsmd)
{
struct gsmd_ucmd *ucmd;
@@ -167,7 +168,7 @@ static int ring_parse(char *buf, int len, const char *param,
return usock_evt_send(gsmd, ucmd, GSMD_EVT_IN_CALL);
}
-static int cring_parse(char *buf, int len, const char *param, struct gsmd *gsmd)
+static int cring_parse(const char *buf, int len, const char *param, struct gsmd *gsmd)
{
struct gsmd_ucmd *ucmd = usock_build_event(GSMD_MSG_EVENT, GSMD_EVT_IN_CALL,
sizeof(struct gsmd_evt_auxdata));
@@ -201,7 +202,7 @@ static int cring_parse(char *buf, int len, const char *param, struct gsmd *gsmd)
}
/* Chapter 7.2, network registration */
-static int creg_parse(char *buf, int len, const char *param,
+static int creg_parse(const char *buf, int len, const char *param,
struct gsmd *gsmd)
{
const char *comma = strchr(param, ',');
@@ -250,7 +251,7 @@ static int creg_parse(char *buf, int len, const char *param,
}
/* Chapter 7.11, call waiting */
-static int ccwa_parse(char *buf, int len, const char *param,
+static int ccwa_parse(const char *buf, int len, const char *param,
struct gsmd *gsmd)
{
struct gsmd_evt_auxdata *aux;
@@ -309,7 +310,7 @@ static int ccwa_parse(char *buf, int len, const char *param,
}
/* Chapter 7.14, unstructured supplementary service data */
-static int cusd_parse(char *buf, int len, const char *param,
+static int cusd_parse(const char *buf, int len, const char *param,
struct gsmd *gsmd)
{
/* FIXME: parse */
@@ -317,7 +318,7 @@ static int cusd_parse(char *buf, int len, const char *param,
}
/* Chapter 7.15, advise of charge */
-static int cccm_parse(char *buf, int len, const char *param,
+static int cccm_parse(const char *buf, int len, const char *param,
struct gsmd *gsmd)
{
/* FIXME: parse */
@@ -325,7 +326,7 @@ static int cccm_parse(char *buf, int len, const char *param,
}
/* Chapter 10.1.13, GPRS event reporting */
-static int cgev_parse(char *buf, int len, const char *param,
+static int cgev_parse(const char *buf, int len, const char *param,
struct gsmd *gsmd)
{
/* FIXME: parse */
@@ -333,7 +334,7 @@ static int cgev_parse(char *buf, int len, const char *param,
}
/* Chapter 10.1.14, GPRS network registration status */
-static int cgreg_parse(char *buf, int len, const char *param,
+static int cgreg_parse(const char *buf, int len, const char *param,
struct gsmd *gsmd)
{
/* FIXME: parse */
@@ -341,7 +342,7 @@ static int cgreg_parse(char *buf, int len, const char *param,
}
/* Chapter 7.6, calling line identification presentation */
-static int clip_parse(char *buf, int len, const char *param,
+static int clip_parse(const char *buf, int len, const char *param,
struct gsmd *gsmd)
{
struct gsmd_ucmd *ucmd = usock_build_event(GSMD_MSG_EVENT, GSMD_EVT_IN_CLIP,
@@ -369,7 +370,7 @@ static int clip_parse(char *buf, int len, const char *param,
}
/* Chapter 7.9, calling line identification presentation */
-static int colp_parse(char *buf, int len, const char *param,
+static int colp_parse(const char *buf, int len, const char *param,
struct gsmd *gsmd)
{
struct gsmd_ucmd *ucmd = usock_build_event(GSMD_MSG_EVENT, GSMD_EVT_OUT_COLP,
@@ -395,7 +396,7 @@ static int colp_parse(char *buf, int len, const char *param,
return usock_evt_send(gsmd, ucmd, GSMD_EVT_OUT_COLP);
}
-static int ctzv_parse(char *buf, int len, const char *param,
+static int ctzv_parse(const char *buf, int len, const char *param,
struct gsmd *gsmd)
{
struct gsmd_ucmd *ucmd = usock_build_event(GSMD_MSG_EVENT, GSMD_EVT_TIMEZONE,
@@ -419,7 +420,7 @@ static int ctzv_parse(char *buf, int len, const char *param,
return usock_evt_send(gsmd, ucmd, GSMD_EVT_TIMEZONE);
}
-static int copn_parse(char *buf, int len, const char *param,
+static int copn_parse(const char *buf, int len, const char *param,
struct gsmd *gsmd)
{
struct gsm_extrsp *er = extrsp_parse(gsmd_tallocs, param);
@@ -468,11 +469,10 @@ static const struct gsmd_unsolicit gsm0707_unsolicit[] = {
static struct gsmd_unsolicit unsolicit[256] = {{ 0, 0 }};
/* called by midlevel parser if a response seems unsolicited */
-int unsolicited_parse(struct gsmd *g, char *buf, int len, const char *param)
+int unsolicited_parse(struct gsmd *g, const char *buf, int len, const char *param)
{
struct gsmd_unsolicit *i;
int rc;
- struct gsmd_vendor_plugin *vpl = g->vendorpl;
/* call unsolicited code parser */
for (i = unsolicit; i->prefix; i ++) {
diff --git a/src/gsmd/usock.c b/src/gsmd/usock.c
index a45a6b0..fffe7a2 100644
--- a/src/gsmd/usock.c
+++ b/src/gsmd/usock.c
@@ -43,7 +43,7 @@
#include <gsmd/ts0707.h>
#include <gsmd/sms.h>
-static void *__ucmd_ctx, *__gu_ctx, *__pb_ctx;
+static void *__ucmd_ctx, *__gu_ctx;
struct gsmd_ucmd *ucmd_alloc(int extra_size)
{
@@ -112,6 +112,7 @@ static int usock_rcv_event(struct gsmd_user *gu, struct gsmd_msg_hdr *gph, int l
return -EINVAL;
gu->subscriptions = *evtmask;
+ return 0;
}
static int voicecall_get_stat_cb(struct gsmd_atcmd *cmd, void *ctx, char *resp)
@@ -222,7 +223,6 @@ static int voicecall_fwd_stat_cb(struct gsmd_atcmd *cmd, void *ctx, char *resp)
struct gsmd_user *gu = ctx;
struct gsm_extrsp *er;
struct gsmd_call_fwd_stat gcfs;
- int ret = 0;
DEBUGP("resp: %s\n", resp);
@@ -955,7 +955,7 @@ static int usock_rcv_network(struct gsmd_user *gu, struct gsmd_msg_hdr *gph,
case GSMD_NETWORK_REGISTER:
if ((*oper)[0])
cmdlen = sprintf(buffer, "AT+COPS=1,2,\"%.*s\"",
- sizeof(gsmd_oper_numeric), oper);
+ sizeof(gsmd_oper_numeric), (char *)oper);
else
cmdlen = sprintf(buffer, "AT+COPS=0");
cmd = atcmd_fill(buffer, cmdlen + 1, &null_cmd_cb, gu, 0, NULL);
@@ -996,7 +996,7 @@ static int usock_rcv_network(struct gsmd_user *gu, struct gsmd_msg_hdr *gph,
break;
case GSMD_NETWORK_PREF_ADD:
cmdlen = sprintf(buffer, "AT+CPOL=,2,\"%.*s\"",
- sizeof(gsmd_oper_numeric), oper);
+ sizeof(gsmd_oper_numeric), (char *)oper);
cmd = atcmd_fill(buffer, cmdlen + 1, &null_cmd_cb, gu, 0, NULL);
break;
case GSMD_NETWORK_PREF_SPACE:
@@ -1253,9 +1253,8 @@ static int usock_rcv_phonebook(struct gsmd_user *gu,
struct gsmd_phonebook_readrg *gpr;
struct gsmd_phonebook *gp;
struct gsmd_phonebook_find *gpf;
- struct gsmd_phonebooks *cur, *cur2;
- int *index, *num;
- int atcmd_len, i, ret;
+ int *index;
+ int atcmd_len;
char *storage;
char buf[1024];
diff --git a/src/gsmd/vendor_bcm.c b/src/gsmd/vendor_bcm.c
index 9bcfa1a..6ccc2e2 100644
--- a/src/gsmd/vendor_bcm.c
+++ b/src/gsmd/vendor_bcm.c
@@ -35,7 +35,7 @@
#include <gsmd/vendorplugin.h>
#include <gsmd/unsolicited.h>
-static int mrdy_parse(char *buf, int len, const char *param,
+static int mrdy_parse(const char *buf, int len, const char *param,
struct gsmd *g)
{
int status = atoi(param);
@@ -70,11 +70,9 @@ static int mrdy_parse(char *buf, int len, const char *param,
return 0;
}
-static int mtsmenu_parse(char *buf, int len, const char *param,
+static int mtsmenu_parse(const char *buf, int len, const char *param,
struct gsmd *g)
{
- char *tok, *param_tmp;
- struct mtsmenu *mtsmenu;
DEBUGP("mtsmenu_parse param=`%s'\n", param);
return 0;
@@ -95,8 +93,7 @@ static int bcm_detect(struct gsmd *g)
static int bcm_initsettings(struct gsmd *g)
{
- int rc;
- struct gsmd_atcmd *cmd;
+ int rc = 0;
/* bcm sometimes sends LFCR instead of CRLF (eg *MTSMENU message) */
g->llp.flags |= LGSM_ATCMD_F_LFCR;
diff --git a/src/gsmd/vendor_qc.c b/src/gsmd/vendor_qc.c
index 7b2f44b..98ed9d8 100644
--- a/src/gsmd/vendor_qc.c
+++ b/src/gsmd/vendor_qc.c
@@ -36,10 +36,9 @@
#include <gsmd/vendorplugin.h>
#include <gsmd/unsolicited.h>
-static int htccsq_parse(char *buf, int len, const char *param,
+static int htccsq_parse(const char *buf, int len, const char *param,
struct gsmd *gsmd)
{
- char *tok;
struct gsmd_evt_auxdata *aux;
struct gsmd_ucmd *ucmd = usock_build_event(GSMD_MSG_EVENT, GSMD_EVT_SIGNAL,
sizeof(*aux));
@@ -63,13 +62,9 @@ static int htccsq_parse(char *buf, int len, const char *param,
usock_evt_send(gsmd, ucmd, GSMD_EVT_SIGNAL);
return 0;
-
-out_free_io:
- free(ucmd);
- return -EIO;
}
-static int wcdma_parse(char *buf, int len, const char *param,
+static int wcdma_parse(const char *buf, int len, const char *param,
struct gsmd *gsmd)
{
return 0;
@@ -96,8 +91,7 @@ static int qc_detect(struct gsmd *g)
static int qc_initsettings(struct gsmd *g)
{
- int rc;
- struct gsmd_atcmd *cmd;
+ int rc = 0;
/* enable @HTCCSQ: signal quality reports */
rc |= gsmd_simplecmd(g, "AT@HTCCSQ=1");
diff --git a/src/gsmd/vendor_ti.c b/src/gsmd/vendor_ti.c
index e34cbaf..219f23e 100644
--- a/src/gsmd/vendor_ti.c
+++ b/src/gsmd/vendor_ti.c
@@ -38,7 +38,7 @@
#include <gsmd/unsolicited.h>
-static int csq_parse(char *buf, int len, const char *param,
+static int csq_parse(const char *buf, int len, const char *param,
struct gsmd *gsmd)
{
struct gsmd_evt_auxdata *aux;
@@ -63,11 +63,13 @@ out_free_io:
return -EIO;
}
-static int cpri_parse(char *buf, int len, const char *param, struct gsmd *gsmd)
+static int cpri_parse(const char *buf, int len, const char *param, struct gsmd *gsmd)
{
char *tok1, *tok2;
-
- tok1 = strtok(buf, ",");
+ char tx_buf[20];
+
+ strcpy(tx_buf, buf);
+ tok1 = strtok(tx_buf, ",");
if (!tok1)
return -EIO;
@@ -103,7 +105,7 @@ static int cpri_parse(char *buf, int len, const char *param, struct gsmd *gsmd)
return 0;
}
-static int ctzv_parse(char *buf, int len, const char *param, struct gsmd *gsmd)
+static int ctzv_parse(const char *buf, int len, const char *param, struct gsmd *gsmd)
{
/* FIXME: decide what to do with it. send as event to clients? or keep
* locally? Offer option to sync system RTC? */
@@ -111,14 +113,16 @@ static int ctzv_parse(char *buf, int len, const char *param, struct gsmd *gsmd)
}
/* Call Progress Information */
-static int cpi_parse(char *buf, int len, const char *param, struct gsmd *gsmd)
+static int cpi_parse(const char *buf, int len, const char *param, struct gsmd *gsmd)
{
char *tok;
struct gsmd_evt_auxdata *aux;
struct gsmd_ucmd *ucmd = usock_build_event(GSMD_MSG_EVENT,
GSMD_EVT_OUT_STATUS,
sizeof(*aux));
-
+ char tx_buf[64];
+
+ strcpy(tx_buf, buf);
DEBUGP("entering cpi_parse param=`%s'\n", param);
if (!ucmd)
return -EINVAL;
@@ -128,7 +132,7 @@ static int cpi_parse(char *buf, int len, const char *param, struct gsmd *gsmd)
/* Format: cId, msgType, ibt, tch, dir,[mode],[number],[type],[alpha],[cause],line */
/* call ID */
- tok = strtok(buf, ",");
+ tok = strtok(tx_buf, ",");
if (!tok)
goto out_free_io;
diff --git a/src/gsmd/vendor_tihtc.c b/src/gsmd/vendor_tihtc.c
index 7e51851..b7c284c 100644
--- a/src/gsmd/vendor_tihtc.c
+++ b/src/gsmd/vendor_tihtc.c
@@ -52,10 +52,9 @@ int gsmd_simplecmd(struct gsmd *gsmd, char *cmdtxt)
return atcmd_submit(gsmd, cmd);
}
-static int htccsq_parse(char *buf, int len, const char *param,
+static int htccsq_parse(const char *buf, int len, const char *param,
struct gsmd *gsmd)
{
- char *tok;
struct gsmd_evt_auxdata *aux;
struct gsmd_ucmd *ucmd = usock_build_event(GSMD_MSG_EVENT, GSMD_EVT_SIGNAL,
sizeof(*aux));
@@ -79,17 +78,15 @@ static int htccsq_parse(char *buf, int len, const char *param,
usock_evt_send(gsmd, ucmd, GSMD_EVT_SIGNAL);
return 0;
-
-out_free_io:
- free(ucmd);
- return -EIO;
}
-static int cpri_parse(char *buf, int len, const char *param, struct gsmd *gsmd)
+static int cpri_parse(const char *buf, int len, const char *param, struct gsmd *gsmd)
{
char *tok1, *tok2;
-
- tok1 = strtok(buf, ",");
+ char tx_buf[20];
+
+ strcpy(tx_buf, buf);
+ tok1 = strtok(tx_buf, ",");
if (!tok1)
return -EIO;
@@ -126,14 +123,16 @@ static int cpri_parse(char *buf, int len, const char *param, struct gsmd *gsmd)
}
/* Call Progress Information */
-static int cpi_parse(char *buf, int len, const char *param, struct gsmd *gsmd)
+static int cpi_parse(const char *buf, int len, const char *param, struct gsmd *gsmd)
{
char *tok;
struct gsmd_evt_auxdata *aux;
struct gsmd_ucmd *ucmd = usock_build_event(GSMD_MSG_EVENT,
GSMD_EVT_OUT_STATUS,
sizeof(*aux));
+ char tx_buf[64];
+ strcpy(tx_buf, buf);
DEBUGP("entering cpi_parse param=`%s'\n", param);
if (!ucmd)
return -EINVAL;
@@ -143,7 +142,7 @@ static int cpi_parse(char *buf, int len, const char *param, struct gsmd *gsmd)
/* Format: cId, msgType, ibt, tch, dir,[mode],[number],[type],[alpha],[cause],line */
/* call ID */
- tok = strtok(buf, ",");
+ tok = strtok(tx_buf, ",");
if (!tok)
goto out_free_io;
@@ -248,7 +247,7 @@ static int tihtc_detect(struct gsmd *g)
static int tihtc_initsettings(struct gsmd *g)
{
- int rc;
+ int rc = 0;
struct gsmd_atcmd *cmd;
/* use %CGREG */
personal git repositories of Harald Welte. Your mileage may vary