There is a function, tcdrain(fd) that will wait for all i/o to complete before continuing.


Dave Hylands wrote:
Hi Chris,

I have a Basix and a STUART waysmall.  I can't get /dev/ttyS2 to
work when using a C program.  I can do at the prompt ...
#stty -F /dev/ttyS2
   speed 9600 baud;
    -brkint -imaxbel
#echo "foobar" > /dev/ttyS2

and have foobar show up on another computer.  then doing....

# cat /proc/tty/driver/PXA\ serial
2: uart:STUART mmio:0x40700000 irq:13 tx:89 rx:0

verifies that character were actually sent.  the only odd thing is that
the echo will send the characters and then hang the prompt for about
30 seconds ????

I think that there's a bug in uClibc. Try addng a sleep before the
close. It takes time for the characters to actually leave the serial
port. Closing the file descriptor is supposed to wait until the data
is actually written, but for some reason it doesn't.

Dave Hylands
Vancouver, BC, Canada

Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
gumstix-users mailing list