Subject: pppd/chat and a cell phone
To: None <netbsd-help@netbsd.org>
From: None <brook@biology.nmsu.edu>
List: netbsd-help
Date: 11/30/2004 23:05:50
I am trying to set up pppd with a cell phone/modem via a serial port.
I am using a chat script to control the modem; however, chat hangs at
the first attempt to read() from stdin.

For background, kermit will connect just fine, communicates correctly
with the phone, and can establish connections to other modems.  It
reports the following about the communication parameters:

     Communications Parameters:
      Line: /dev/tty00, speed: 4800, mode: local, modem: none
      Parity: none, stop-bits: (default) (8N1)
      Duplex: full, flow: rts/cts, handshake: none
      Carrier-watch: off, close-on-disconnect: off
      Lockfile: /var/spool/lock/LCK..tty00
      Terminal bytesize: 8, escape character: 28 (^\)

      Carrier Detect      (CD):  Off
      Dataset Ready       (DSR): On
      Clear To Send       (CTS): On
      Ring Indicator      (RI):  Off
      Data Terminal Ready (DTR): On
      Request To Send     (RTS): On

I have used the 'local' command within my ppp script to have it ignore
the missing CD line.  Within the get_char() function of chat, just
prior to the read() function call that never returns, I have queried
the state of stdin:

     ioctl (0, TIOCMGET):    00000007
     ioctl (0, TIOCGFLAGS):  00000000
     ioctl (0, TIOCGETA):  termios state
       c_iflag:              00000025
       c_oflag:              00000003
       c_cflag:              0000cb00
       c_lflag:              00000000
       c_ispeed:             4800
       c_ospeed:             4800

I am not familiar enough with serial ports and the tty drivers to
fully understand this.  However, based on what kermit reports I
expected the TIOCMGET ioctl() to indicate all of the following bits to
be set: TIOCM_DTR, TIOCM_RTS, TIOCM_DSR, and TIOCM_CTS.  Only the
first two seem to be set.  I presume the lack of the others could hang
the read() function call as it waits for the assertion of the modem
lines.  However, the CLOCAL bit is set in c_cflag, so the modem lines
should be ignored.  I must be confused.

This leaves me with several questions:

- Am I interpreting the above information correctly?

- What additional information is necessary to understand this case?

- What is responsible for causing the read() function call to hang?

- How can I configure this to overcome that problem?

I appreciate any help you can give.  Thank you very much.

Cheers,
Brook