Messages in this thread | | | Date | Fri, 11 Jul 1997 00:37:03 -0400 | From | "Theodore Y. Ts'o" <> | Subject | Re: Serial Driver - How do I detect break, part II |
| |
From: tzeruch@ceddec.com Date: 10 Jul 1997 23:41:59 +0200
What am I doing wrong? /proc/tty/driver/serial shows the number of breaks incrementing (I am using minicom on a second system with a light box so I am generating breaks which are being detected in the statistics).
But in the program below, breaks is never incrementing, nor is anything returned by the read (other than a zero) when a break condition happens, and it detects characters properly. It also detects control-c causing sigint on the console (which does increment breaks).
BRKINT only sends a signal to the tty's foreground process group. This means that the (a) the tty has to be your controlling tty and (b) you have to be in the foreground process group in order to receive the break.
If you simply need to detect a break, try setting PARMRK and clearing BRKINT and IGNPAR. Then a break will be received as a \377, \0, \0. (And if the tty receives sends \377, it will be received by the process as \377, \377.)
- Ted
| |