gnokii-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: smsd problem with AT model - Part II


From: Daniele Forsi
Subject: Re: smsd problem with AT model - Part II
Date: Thu, 5 Oct 2006 13:41:03 +0200
User-agent: KMail/1.9.4

Romain Parmantier:

> First, I have read the thread with the same subject and apply the patch
> that Daniele Forsi posts (thanks again for this patch).

my pleasure,

> 02 41 54 2b 43 50 4d 53 3f 0d 0d 0a 2b 43 50 4d |  AT+CPMS?   +CPM
> 53 3a 20 22 53 4d 22 2c 33 30 2c 33 30 2c 22 53 | S: "SM",30,30,"S
> 4d 22 2c 33 30 2c 33 30 0d 0a 0d 0a 4f 4b 0d    | M",30,30    OK
> Received message type 12
> GN_OP_GetSMSStatus at line 400 in file lowlevel.c returns error 1

this is the error *before* the patch?

> Maybe I have forgotten something ?

did you change AT_SetSMSMemoryType() by hand as I suggested on September 1st 
in the same thread?

Anyway, here is a different patch including both changes that should be 
compatible with both systems but I could test it only with a phone that 
accepts the "old style"

--- atgen.c.orig     2006-10-05 12:35:55.000000000 +0200
+++ atgen.c      2006-10-05 12:29:49.000000000 +0200
@@ -568,8 +568,12 @@ gn_error AT_SetSMSMemoryType(gn_memory_t
                sprintf(req, "AT+CPMS=\"%s\",\"%s\",\"%s\"\r", 
memorynames[mt], memorynames[mt],
                        memorynames[data.sms_status->new_message_store]);
                ret = sm_message_send(23, GN_OP_Init, req, state);
-               if (ret != GN_ERR_NONE)
-                       return GN_ERR_NOTREADY;
+               if (ret != GN_ERR_NONE) {
+                       sprintf(req, "AT+CPMS=\"%s\",\"%s\"\r", 
memorynames[mt], memorynames[mt]);
+                       ret = sm_message_send(23, GN_OP_Init, req, state);
+                       if (ret != GN_ERR_NONE)
+                               return ret;
+               }
                ret = sm_block_no_retry(GN_OP_Init, &data, state);
                if (ret == GN_ERR_NONE)
                        drvinst->smsmemorytype = mt;
@@ -1469,7 +1473,9 @@ static gn_error ReplyGetSMSStatus(int me

        if (sscanf(buf.line2, "+CPMS: \"%*c%*c\",%d,%*d,\"%*c%*c\",%*d,%*d,
\"%c%c\",%*d,%*d",
                   &data->sms_status->number, &store[0], &store[1]) != 3)
-               return GN_ERR_FAILED;
+               if (sscanf(buf.line2, "+CPMS: \"%c%c\",%d,%*d,\"%*c%*c\",%*d,
%*d",
+                  &store[0], &store[1], &data->sms_status->number) != 3)
+                       return GN_ERR_FAILED;

        data->sms_status->unread = 0;
        data->sms_status->changed = 0;


There is a comment in the source that prevented me to apply this patch to the 
official version but now I think it would not matter since you cannot change 
<mem3> on your modem anyway:
> * To avoid confusing the user by changing <mem3> we set it to the current
> * setting.

Pawel what do you think? Is there a better way to take care of these firmwares 
that only accepts two arguments like
AT+CPMS="SM","SM"
and reject three
AT+CPMS="SM","SM","SM"

-- 
Daniele




reply via email to

[Prev in Thread] Current Thread [Next in Thread]