RE: [RFI+Patch] AT2 Modems.conf

Jörg Pommnitz <[email protected]>
Newsgroups gmane.comp.mobile.kannel.devel
Message-ID <[email protected]>
I just commited the following patch:

diff -u -r1.31 smsc_at2.c
--- gw/smsc_at2.c       13 Mar 2002 00:28:31 -0000      1.31
+++ gw/smsc_at2.c       13 Mar 2002 11:09:59 -0000
@@ -544,26 +544,34 @@
     if(ModemTypes[privdata->modemid].pin_support)
     {
         ret = at2_send_modem_command(privdata, "AT+CPIN?", 10, 0);
-        if(ret == -1)
-           return -1;
-        if(ret == 2)
-        {
-            if(privdata->pin == NULL)
-                return -1;
-            setpin = octstr_format("AT+CPIN=%s",
octstr_get_cstr(privdata->pin));
-           ret = at2_send_modem_command(privdata, octstr_get_cstr(setpin),
0, 0);
-           octstr_destroy(setpin);
-           if(ret !=0 )
-               return -1;
-        }
+
+       if (!privdata->pin_ready)
+       {
+           if(ret == 2)
+           {
+               if(privdata->pin == NULL)
+                   return -1;
+               setpin = octstr_format("AT+CPIN=%s",
octstr_get_cstr(privdata->pin));
+               ret = at2_send_modem_command(privdata,
octstr_get_cstr(setpin), 0, 0);
+               octstr_destroy(setpin);
+               if(ret !=0 )
+                   return -1;
+           } else if(ret == -1)
+               return -1;
+       }
+

        /* we have to wait until +CPIN: READY appears before issuing
        the next command. 10 sec should be suficient */
        if(!privdata->pin_ready)
        {
-          ret = at2_wait_modem_command(privdata,10, 0);
-          if(ret == -1) /* timeout */
-              return -1;
+          at2_wait_modem_command(privdata,10, 0);
+          if(!privdata->pin_ready) {
+              at2_send_modem_command(privdata, "AT+CPIN?", 10, 0);
+              if(!privdata->pin_ready) {
+                  return -1; /* give up */
+              }
+          }
        }
     }
     // Set the GSM SMS message center address if supplied

With this patch applied Wavecom works again for me. Please give it a try.

Regards
  Jörg

-----Original Message-----
From: Oded Arbel
To: Andreas Fink; Abd Rahman Johari
Cc: [email protected]
Sent: 3/13/02 10:12 AM
Subject: RE: [RFI+Patch] AT2 Modems.conf

> -----Original Message-----
> From: Andreas Fink [mailto:[email protected]]
> Sent: Wednesday, March 13, 2002 10:12 AM
> To: Abd Rahman Johari
> Cc: [email protected]
> Subject: Re: [RFI+Patch] AT2 Modems.conf
> 

> 
> I think what we see here is
> 
> --> AT+CPIN?
> <--- +CPIN: SIM PIN
> <--- OK
> 
> --> AT+CPIN=1234
> <--- waiting for +CPIN READY not appearing.
> 
> Oded what's your view of this?

No, I don't think so - a proper wavecom session will looks like this
(given propert timeout everywhere) :

--> AT+CPIN?
<-- +CPIN: SIM PIN

--> AT+CPIN="1234"
<-- OK 

--> AT+CPIN?
<-- +CPIN: READY

notice that wavecom does not send OK after +CPIN replys.

--
Oded Arbel
m-Wise Inc.
[email protected]

What on earth would a man do with himself if something did not stand in
his way?
		-- H.G. Wells
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.