Command - OK out of sync

Gert Doering (gert@greenie.muc.de)
Tue, 28 Oct 1997 17:57:03 +0100


Hi,

Gernot Zander wrote:
> I have the following strange problem.
> The modem sends OK if DTR goes high.
> This causes sendfax to think this is the reply of the first
> command, and it gets nice out of sync:
> 
> 10/27 03:28:30 yS1 fax_send: 'ATV1Q0'
> 10/27 03:28:30 yS1 fax_wait_for(OK)
> 10/27 03:28:31 yS1 fax_wait_for: string 'OK'** found **
> (This is the OK of DTR up!)
> 10/27 03:28:31 yS1 fax_send: 'ATZ'
> (I tried to add this, but...)
> 10/27 03:28:31 yS1 fax_wait_for(OK)
> 10/27 03:28:31 yS1 fax_wait_for: string 'ATV1Q0'
> 10/27 03:28:31 yS1 fax_wait_for: string 'OK'** found **

This modem is braindead ... *sigh*

> There should be the same as mgetty has, a wait for a few seconds
> of silence on the line (clean_line(something)). 
> So that the first OK (without command) is thrown away.

A few seconds might be a bit too long (that will delay everything...), but
a couple of milliseconds should do the job, and do no harm.

Problem with this is, clean_line() is in a C module that is not used from
sendfax.c [do_chat.o], and I don't really want to link it into sendfax.
So I will have to do some restructuring to integrate that cleanly.

For the time being, you can try to following:

At the end of "fax_open_device()" [just before the "return fd;"], add the
following code:

  delay(500);			/* give the modem time to settle */
  tio_flush_queue( fd, TIO_Q_BOTH );	/* clear junk out of the queue */

This should achieve the desired result, without needing changes anywhere
else. (Completely untested, but *should* work).

Please tell me whether it works now, then I'll integrate it into the
mainline sources.

gert


-- 
USENET is *not* the non-clickable part of WWW!
           //www.muc.de/~gert/
Gert Doering - Munich, Germany      gert@greenie.muc.de
fax: +49-89-3545980     gert.doering@physik.tu-muenchen.de
.