From a4ee05b6942d5b82269a1a0ea453b5467e44b96e Mon Sep 17 00:00:00 2001 From: tick Date: Thu, 25 Oct 2007 10:25:43 +0000 Subject: Get a correct message index value on reading a SMS (Erin Yueh) git-svn-id: http://svn.openmoko.org/trunk/src/target/gsm@3264 99fdad57-331a-0410-800a-d7fa5415bdb3 --- src/gsmd/sms_cb.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/gsmd/sms_cb.c b/src/gsmd/sms_cb.c index 0ffe563..f205665 100644 --- a/src/gsmd/sms_cb.c +++ b/src/gsmd/sms_cb.c @@ -116,6 +116,7 @@ static int sms_read_cb(struct gsmd_atcmd *cmd, void *ctx, char *resp) struct gsmd_sms_list msg; int i, stat, len, cr; u_int8_t pdu[SMS_MAX_PDU_SIZE]; + const char *colon; if (cmd->ret) return 0; @@ -131,6 +132,11 @@ static int sms_read_cb(struct gsmd_atcmd *cmd, void *ctx, char *resp) return -EINVAL; msg.index = 0; + colon = strchr(cmd->buf, '='); + + /* get a correct message index value on reading a SMS */ + if (!strncmp(cmd->buf, "AT+CMGR", 7) && colon) + msg.index = atoi(colon+1); msg.stat = stat; msg.is_last = 1; for (i = 0; resp[cr] >= '0' && resp[cr + 1] >= '0' && -- cgit v1.2.3