I found similar problems when trying to use cat and redirection to communicate over /dev/ttyS2.  For reading data from /dev/ttyS2 and shoveling it over the network, I found the following loop worked well:

while [ 1 == 1 ]
do
    read < /dev/ttyS2
    [ 0 == $? ] && echo $REPLY | nc $SERVER_IP $SERVER_PORT
done;

I'm sure there's a cleaner way to do the loop, but that worked for me.

Cheers,

Mike

Fred Potter wrote:
Thanks Dave!  That makes perfect sense - I'll give that a shot.

Fred

On 2/5/06, Dave Hylands <dhylands@gmail.com> wrote:
  
Hi Fred,

    
My problem is that if I lower the baud rate (i.e. stty -F /dev/ttyS2
speed 9600) on both sides, the transmission is very unreliable.  If I
echo "blah" to /dev/ttyS2, on the PC end I'll usually see just "bl"
and I never see exactly what was sent.

Has anyone else experienced this or know a way to fix it?
      
I seem to recall that there is a problem with the serial port being
closed before all of the data is completely sent. At 115200 the serial
port is probably running fast enough that the data gets out before the
close actually happens. Try this instead:

(echo "blah"; sleep 1) > /dev/ttyS2

This causes a one second sleep after the echo but before the close.

--
Dave Hylands
Vancouver, BC, Canada
http://www.DaveHylands.com/


-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://sel.as-us.falkag.net/sel?cmdlnk&kid3432&bid#0486&dat1642
_______________________________________________
gumstix-users mailing list
gumstix-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gumstix-users

    


-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://sel.as-us.falkag.net/sel?cmd=k&kid3432&bid#0486&dat1642
_______________________________________________
gumstix-users mailing list
gumstix-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gumstix-users