Using this little script:

    cat /dev/ttyS2 &
    echo "Testing"
    echo "1500 1500" >> /dev/ttyS2
    echo "1500 1500" >> /dev/ttyS2

...I can send data out via ttyS2, and get data back.  This works, repeatedly.
I also have a C program that opens /dev/ttyS2, writes to it, and reads from it, and that works.

That problem is that after I kill the C program with control-C, /dev/ttyS2 stops working.  If I run the script above, or just echo "foo" > /dev/ttyS2 at the command line, it just hangs.  No data is sent over the serial port (the robostix blinks an LED when it receives data) and the echo command never returns.  If I press control-C during the script, I get the following error message at the console:

    ./test-robostix: 11: cannot create /dev/ttyS2: Interrupted system call
    cat: /dev/ttyS2: Resource temporarily unavailable

Nothing interesting shows up in /var/log/messages or dmesg. I'm not sure what version of the buildroot I was using when I built my kernel, but it was built on Nov 19 so I'm guessing it's roughly 642.

So it seems that terminating my C program with the serial port open leaves /dev/ttyS2 in a broken state.   Is this a bug in the kernel, or should I add some code to detect the control-C and clean up as it exists?  Or, both? :)    Is there a way to reset the serial port, other than rebooting?

Any assistance would be much appreciated!

Nate Waddoups
Redmond WA USA   <== for nerds   <== for birds