Hi

On Sun, 15 Apr 2007 16:06:42 +0530
"Mahesh T. Pai" <[EMAIL PROTECTED]> wrote:

> Sending the log file created in /tmp/ as per the message.
> 
> Willing to provide more info, if you tell me how to find it.

Can you please rebuild gammu with attached patch and test, whether it
will work?

-- 
        Michal Čihař | http://cihar.com | http://blog.cihar.com
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 478)
+++ ChangeLog	(working copy)
@@ -53,6 +53,7 @@
 [-] * Increse limits for SMS backups (this requires dynamic allocation).
 [!] * Development switched to Subversion, see README for details.
 [-] * Detect Motorola Bluetooth port (Daniel Gimpelevich).
+[-] * Fixup AT driver to work with Samsung SGH X160.
 
 20070403 - 1.10.2
 [-] * Fixed crash on LMB export/import (bug #261).
Index: common/phone/at/atgen.c
===================================================================
--- common/phone/at/atgen.c	(revision 474)
+++ common/phone/at/atgen.c	(working copy)
@@ -1717,7 +1717,39 @@
 	switch (Priv->ReplyState) {
 	case AT_Reply_OK:
 		smprintf(s, "SMS status received\n");
-		start = strstr(msg.Buffer, "+CPMS: ") + 7;
+		start = strstr(msg.Buffer, "+CPMS: ");
+		/*
+		 * Samsung formats this different way, sample response:
+		 * 1 "AT+CPMS="SM","SM""
+		 * 2 "+CPMS:"SM",3,30,"SM",3,30,"SM",3,30"
+		 * 3 "OK"
+		 */
+		if (start == NULL) {
+			start = strstr(msg.Buffer, "+CPMS:\"") + 6;
+			current+=ATGEN_ExtractOneParameter(start+current, buffer);
+			if (strcmp(buffer, "\"ME\"") == 0) {
+				current+=ATGEN_ExtractOneParameter(start+current, buffer);
+				SMSStatus->PhoneUsed = atoi(buffer);
+				current+=ATGEN_ExtractOneParameter(start+current, buffer);
+				SMSStatus->PhoneSize = atoi(buffer);
+				smprintf(s, "Used : %i\n",SMSStatus->PhoneUsed);
+				smprintf(s, "Size : %i\n",SMSStatus->PhoneSize);
+				return ERR_NONE;
+			} else if (strcmp(buffer, "\"SM\"") == 0) {
+				current+=ATGEN_ExtractOneParameter(start+current, buffer);
+				SMSStatus->SIMUsed = atoi(buffer);
+				current+=ATGEN_ExtractOneParameter(start+current, buffer);
+				SMSStatus->SIMSize = atoi(buffer);
+				smprintf(s, "Used : %i\n",SMSStatus->SIMUsed);
+				smprintf(s, "Size : %i\n",SMSStatus->SIMSize);
+				return ERR_NONE;
+			} else {
+				smprintf(s, "Unknown memory: %s\n", buffer);
+				return ERR_UNKNOWNRESPONSE;
+			}
+		}
+		/* Skip +CPMS: */
+		start += 7;
 		if (strstr(msg.Buffer,"ME")!=NULL) {
 			SMSStatus->PhoneUsed 	= atoi(start);
 			current+=ATGEN_ExtractOneParameter(start+current, buffer);
@@ -3991,6 +4023,8 @@
             return ATGEN_HandleCMSError(s);
 	case AT_Reply_CMEError:
 	        return ATGEN_HandleCMEError(s);
+	case AT_Reply_Error:
+		return ERR_NOTSUPPORTED;
         default:
             break;
 	}

Attachment: signature.asc
Description: PGP signature

Reply via email to