Hi, 

I have tried you patches, it worked only once out of five trials...
Maybe the tcflush() function never works with my IrDA dongle?

  nsc-ircc, Found dongle: HP HSDL-1100/HSDL-2100

[EMAIL PROTECTED]:/tmp$ scmxx -i -vvv
Accessing device /dev/ircomm0...done
Using "UTF-8" as system character set.

Sending command: ATZ
Received: +++
Value matched nothing.
Value matched nothing.
Received: ERROR
Value matched ERROR.
Value matched ERROR.
Error: cannot communicate with device.
[EMAIL PROTECTED]:/tmp$ scmxx -i -vvv
Accessing device /dev/ircomm0...done
Using "UTF-8" as system character set.

Sending command: ATZ
Received: +++
Value matched nothing.
Value matched nothing.
Received: ERROR
Value matched ERROR.
Value matched ERROR.
Error: cannot communicate with device.
[EMAIL PROTECTED]:/tmp$ scmxx -i -vvv
Accessing device /dev/ircomm0...done
Using "UTF-8" as system character set.

Sending command: ATZ
Received: ERROR
Value matched ERROR.
Value matched ERROR.
Received: OK
Value matched OK.
Value matched OK.
OK, a modem device is present.

[.........]

[EMAIL PROTECTED]:/tmp$ scmxx -i -vvv
Accessing device /dev/ircomm0...done
Using "UTF-8" as system character set.

Sending command: ATZ
Received: +++
Value matched nothing.
Value matched nothing.
Received: ERROR
Value matched ERROR.
Value matched ERROR.
Error: cannot communicate with device.

[EMAIL PROTECTED]:/tmp$ scmxx -i --start-delay=1 -vvv
Accessing device /dev/ircomm0...done
Waiting for 1 seconds as requested...
Using "UTF-8" as system character set.

Sending command: ATZ
Received: +++
Value matched nothing.
Value matched nothing.
Received: ERROR
Value matched ERROR.
Value matched ERROR.
Error: cannot communicate with device.

[EMAIL PROTECTED]:/tmp$ scmxx -i --start-delay=5 -vvv
Accessing device /dev/ircomm0...done
Waiting for 5 seconds as requested...
Using "UTF-8" as system character set.

Sending command: ATZ
Received: ERROR
Value matched ERROR.
Value matched ERROR.
Received: Z
Value matched nothing.
Value matched nothing.
Error: cannot communicate with device.


On 7/2/05, Hendrik Sattler <[EMAIL PROTECTED]> wrote:
> Am Freitag, 1. Juli 2005 17:39 schrieb SDiZ:
> > 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.
> 
> Then maybe the order is wrong. Currently (and with your patch), we open the
> device and flush the buffers. However, the switch to RCCP mode is done after
> flushing the buffers.
> The patch for my suggestion looks like this:
> --- actions.c   8 Jun 2005 17:49:17 -0000       1.30
> +++ actions.c   1 Jul 2005 15:57:13 -0000
> @@ -108,6 +108,10 @@
>    int retval = 1;
>    char* ack;
> 
> +  /* asume that we previously waited the 1000ms */
> +  tty_write("+++",3);
> +  usleep(1010*1000);
> +  tty_flush();
>    tty_write("\r",1);
>    at_command_send(AT_GEN_INIT,NULL);
>    ack = at_read_line();
> --- ttyaccess.c 8 Jun 2005 17:49:18 -0000       1.25
> +++ ttyaccess.c 1 Jul 2005 15:57:13 -0000
> @@ -69,6 +69,10 @@
>  }
>  #endif
> 
> +void tty_flush () {
> +  tcflush(tty_portfd, TCIOFLUSH); //clear serial tty
> +}
> +
>  #define NONBLOCK_OPEN 1
>  void tty_open(struct port_args_t* args) {
>  #ifdef OS2
> @@ -195,7 +199,7 @@
>      newtio.c_cc[VMIN]=0; //return after timeout, even with nothing
>    }
>    newtio.c_cc[VTIME]=args->timeout; //try reading for this amount of time (in
> deciseconds)
> -  tcflush(tty_portfd, TCIOFLUSH); //clear serial tty
> +  tty_flush();
>    if(tcsetattr(tty_portfd,TCSANOW,&newtio) < 0){ //set now
>      fprintf(stderr,"%s: %s\n",_("Error in setting port
> attributes"),strerror(errno));
>      exit(EXIT_FAILURE);
> --- ttyaccess.h 10 Jun 2005 10:08:40 -0000      1.6
> +++ ttyaccess.h 1 Jul 2005 15:57:13 -0000
> @@ -45,6 +45,7 @@
> 
>  int  tty_write (const char* data, size_t count);
>  char* tty_read_line (int (*stop_condition)(const char*,const size_t));
> +void tty_flush ();
> 
>  // \x1a represents Ctrl-Z (represents end of data stream)
>  #define tty_write_data(data,count) (tty_write(data,count) &&
> tty_write("\x1a",1))
> 
> 
> I'm somewhat convinced that there is no need to send '\r' twice.
> The "+++" should tell the phone to stop sending _immediately_ but we all know
> buggy things ;)
> 
> HS
>

Reply via email to