Subject: Issues in monitoring serial port status lines
To: None <tech-kern@netbsd.org>
From: Mahendra M <mahendra.m@gmail.com>
List: tech-kern
Date: 06/01/2007 15:16:29
Hi,
I was trying out monitoring for a modem disconnect, by having the
application receive a SIGHUP when the serial cable is pulled out. As
per the termios documentation [termios(4)], to monitor for serial port
status lines, I disabled the flags CLOCAL and MDMBUF.
This did not work because the kernel always forces CLOCAL and !HUPCL
on /dev/console (sys/dev/ic/com.c - comparam() ). It works (sort of)
when this code was removed.
After the changes and on disconnecting and reconnecting the cable in
quick succession, the following was observed : The tty driver sends a
SIGHUP (disconnect) and on reconnect it wakes up the processes.
However, the above sequence happens twice in succession.
I presume, that the above were triggered from the serial driver port
status change. Though the first set of SIGHUP and wakeup is expected,
I am a bit confused about the need/occurrence for the second sequence.
Details :
Serial Device: ns16550a UART device, with Netbsd 2.0
com0 at isa0 port 0x3f8-0x3ff irq 4: ns16550a, working fifo
com0: console
com1 at isa0 port 0x2f8-0x2ff irq 3: ns16550a, working fifo
Is this sort of behaviour correct or expected?
Regards,
Mahendra