I've noticed that every time a serial port is opened, the
serial.c driver (among others), resets the UART (flushing
FIFOs, set baud rate, etc.). Why is this done even when the
device is already open?
Doing so results in some odd behavior. For example with a
loopback plug connected to /dev/ttyS1, do the following from
two terminals:
Terminal 1 Terminal 2
--------------------- --------------------------
(stty 2400 -echo raw -ixon -ixoff -crtscts;cat)</dev/ttyS1
ls -l >/dev/ttySI1
[output from ls scrolls by]
[press ctrl-C in middle of data and do
another command while data is still
being written to port]
(stty 2400 -echo raw -ixon -ixoff -crtscts;cat)</dev/ttyS1
[nothing displayed. after data stops
and port is closed by other terminal,
remaining data appears all at once.]
If an a serial driver's open is called when the port is already
open and the tty struct is the same one already in use, why not
just increment use counters and return? Wouldn't this be more
policy neutral regarding multiple opens?
--
Grant Edwards grante Yow! Ask me the DIFFERENCE
at between PHIL SILVERS and
visi.com ALEXANDER HAIG!!