[ale] found a bug in an open source API: It 'Broke' under linux.

Chris Fowler cfowler at outpostsentinel.com
Sat Feb 12 21:27:58 EST 2011


I found what I think is a bug in the tty interface for USB serial
devices but I've not had a chance to really dive into it.  It was
driving me mad when my C program was not working as I programmed it but
after an hour of looking and googling I decided to test it on a real
serial port and it work.

Apparently in the 2.6.X kernel when a USB dongle has DCD low this has no
effect on open(), or I/O on that port.  I was writing a program to
interface with a UPS over serial.  I had my netbook in my kitchen
because my office is filled with stuff.  The netbook does not have a
serial port but I do have very good SeaLevel USB serial adapters.  I was
using the DCD line as a way to know if the UPS is connected.  I checked
the status of the lines using TIOCMGET.  

In 2.4.X I ran into a problem with a USB modem where it appeared that
just enough of the tty driver was implemented to provide a raw
interface.  It made no difference what the tty settings were. No CRNL,
nothing.

The bottom line was that I had clocal turned off.  I opened the port in
blocking mode with no cable connected.  The open was successful!  That
shouldn't happened.  I used TIOCMGET to check the status of the lines
and DCD was not active.  Something is broken.




More information about the Ale mailing list