Serial Port Madness

OK, This was asked before on this list but never really answered.
I have a system where there is a device initially connected to a
serial port. Everything works OK, until it the device on the serial
port is removed. The next write then hangs the task writing to the
serial port. Anyway to get around this. I am opening the serial port
with the O_RDWR | O_NOCTTY flags. If I try adding the O_NONBLOCK, it
appears that the open then waits forever. Any ideas / suggestions.

TIA
Bill Faulkner

I have used this function with no problems. What I have done is open the
serial port using two file descriptors. 1 for read and one for write. I
set the O_RDONLY for read and O_WRONLY for write, then use tcflush on
both file descriptors at initialize time. Using this method, I can
connect &/or disconnect a live device from the serial port with the task
running.
I also make sure to use triggers on the device when reading,so that when
data is available the proxy activates. (IE bitesread = dev_read (fdIn,
&charbuf, 1, 0,0,0, proxy, &armed))
Hope this helps.

Holly Barkwell-Holland

William Faulkner wrote:

OK, This was asked before on this list but never really answered.
I have a system where there is a device initially connected to a
serial port. Everything works OK, until it the device on the serial
port is removed. The next write then hangs the task writing to the
serial port. Anyway to get around this. I am opening the serial port
with the O_RDWR | O_NOCTTY flags. If I try adding the O_NONBLOCK, it
appears that the open then waits forever. Any ideas / suggestions.

TIA
Bill Faulkner