Hi, I have done some more testing:

orignal source code: never work with my phone

my orginal patch... works 90% of time.

this _NOT_ work:
  sleep(1)
  tty_write("+++",3);
  sleep(1);
  tty_write("\r\r",2);
  sleep(1);
  at_command_send(AT_GEN_INIT,NULL);

this works 50%:
  tty_write("+++",3);
  sleep(1);
  tty_write("\r",1);
  sleep(1);
  tty_write("\r",1);
  sleep(1);
  at_command_send(AT_GEN_INIT,NULL);

this one works 75% of time:
  tty_write("\r",1);
  sleep(1);
  tty_write("+++",3);
  sleep(1);
  tty_write("\r",1);
  sleep(1);
  tty_write("\r",1);
  sleep(1);
  at_command_send(AT_GEN_INIT,NULL);

this one never fail with my phone ..  
  tty_write("+++",3);
  sleep(1);
  tty_write("\r",1);
  sleep(1);
  tty_write("\r",1);
  sleep(1);
  at_command_send(AT_GEN_INIT,NULL);
  ack = at_read_line();
  if (at_line_type(ack,NULL,NULL) != AT_RET_OK) {
    mem_realloc(ack,0);
    ack = at_read_line();
    if (at_line_type(ack,NULL,NULL) != AT_RET_OK) {
      mem_realloc(ack,0);
      ack = at_read_line();
      if (at_line_type(ack,NULL,NULL) != AT_RET_OK) {
        retval = 0;
      }
    }
    mem_realloc(ack,0);
  }

I guess there are some old data in the read buffer, because of  what i
see in the debug output:
 Sending command: ATZ
 Received: ERROR
 Value matched ERROR. 
 Value matched ERROR.
 Received: CPM=
 Value matched nothing.
 Value matched nothing.
 Received: OK
 Value matched OK.
 Value matched OK.
 OK, a modem device is present.



On 7/1/05, Hendrik Sattler <[EMAIL PROTECTED]> wrote:
> Am Freitag, 1. Juli 2005 12:50 schrieb SDiZ:
> > tag: patch
> >
> > I have experience the same problem on My Sharp GZ100, the following
> > patch fix it.
> > I know it's ugly, but it works..
> >
> >
> > +++ scm-075/src/actions.c       2005-07-01 10:35:48.000000000 +0000
> > @@ -109,6 +109,15 @@
> >    char* ack;
> >
> >    tty_write("\r",1);
> > +  sleep(1);
> > +  tty_write("+",1);
> > +  sleep(1);
> > +  tty_write("+",1);
> > +  sleep(1);
> > +  tty_write("+",1);
> > +  sleep(1);
> > +  tty_write("\r",1);
> > +  sleep(1);
> >    at_command_send(AT_GEN_INIT,NULL);
> >    ack = at_read_line();
> >    if (at_line_type(ack,NULL,NULL) != AT_RET_OK) {
> 
> Are the sleeps really necessary? I'll never make a delay of 5 seconds a
> default!
> Did you try the --start-delay=5 parameter?
> 
> "+++" is to be issued to change from transparent mode to RCCP mode. The
> Siemens manual suggests (ms values are pauses):
> (>1000ms) '+' (<1000ms) '+' (<1000ms) '+' (>1000ms)
> 
> so a:
> usleep(1010*1000);
> tty_write("+++",3);
> usleep(1010*1000);
> _before_ sending the '\r' should be sufficient (but the '\r' must appear after
> that).
> That would still be  an approx. 2sec delay :-/
> 
> However, there's no command in SCMxx to leave RCCP mode. So if it stalls at
> random places _during_ --info, something else might be wrong.
> It may also be important what you used prior to using scmxx.
> 
> HS
> 
> --
> Mein GPG-Key ist auf meiner Homepage verfügbar: http://www.hendrik-sattler.de
>         oder über pgp.net
> 
> PingoS - Linux-User helfen Schulen: http://www.pingos.org
> 
> 
>

Reply via email to