stty < /dev/modem blocks???

Paul Mackerras paulus at cs.anu.edu.au
Fri Sep 17 10:36:58 EST 1999


Michel Lanners <mlan at cpu.lu> wrote:

> OK, this sounds right, but how do you explain that I can get at the tty
> settings with
> 
> stty -a < /dev/ttySx
> 
> for both of my serial ports, with absolutely nothing connected to them?

It depends on the state of the CLOCAL flag.  If it's set, which is
the default on boot, you can open it without waiting.  If it's clear,
an open will normally block until the CD (carrier detect) input is
asserted.  (To open it without waiting when CLOCAL is clear, you put
O_NONBLOCK in the flags on the open system call.)

When you run pppd, it will normally clear the CLOCAL flag (unless you
give it the `local' option), so that it can tell when the modem hangs
up.  It tries to restore the settings on exit, but this can fail if
the modem has already hung up, since after a hangup, the linux tty
driver won't let you do anything at all with the fd you had open to
the tty except close it.

Paul.

** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/





More information about the Linuxppc-dev mailing list