summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authortick <tick@99fdad57-331a-0410-800a-d7fa5415bdb3>2007-10-25 10:25:43 +0000
committertick <tick@99fdad57-331a-0410-800a-d7fa5415bdb3>2007-10-25 10:25:43 +0000
commita4ee05b6942d5b82269a1a0ea453b5467e44b96e (patch)
treea7cb01e1a59138f6584989d6259a70db12ae0422 /src
parentda0eabc5ece6512079f90e9fb90de146f67dd4bc (diff)
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
Diffstat (limited to 'src')
-rw-r--r--src/gsmd/sms_cb.c6
1 files changed, 6 insertions, 0 deletions
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' &&
personal git repositories of Harald Welte. Your mileage may vary