r3264 - trunk/src/target/gsm/src/gsmd

tick at sita.openmoko.org tick at sita.openmoko.org
Thu Oct 25 12:25:46 CEST 2007


Author: tick
Date: 2007-10-25 12:25:43 +0200 (Thu, 25 Oct 2007)
New Revision: 3264

Modified:
   trunk/src/target/gsm/src/gsmd/sms_cb.c
Log:
Get a correct message index value on reading a SMS (Erin Yueh)


Modified: trunk/src/target/gsm/src/gsmd/sms_cb.c
===================================================================
--- trunk/src/target/gsm/src/gsmd/sms_cb.c	2007-10-25 01:09:17 UTC (rev 3263)
+++ trunk/src/target/gsm/src/gsmd/sms_cb.c	2007-10-25 10:25:43 UTC (rev 3264)
@@ -116,6 +116,7 @@
 	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 @@
 		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' &&





More information about the commitlog mailing list