[haiku-development] Re: Device file for COM1?

  • From: Michael Crawford <mdcrawford@xxxxxxxxx>
  • To: haiku-development@xxxxxxxxxxxxx
  • Date: Tue, 15 Dec 2009 01:50:24 -0800

I think I have a bad serial port on my Linux box.

If I give the following command on my Linux box:

( stty 9600 -parenb -cstopb cs8 ; cat ) > /dev/ttyS0

and this on a BeOS 5 Pro box:

( stty 9600 -parenb -cstopb cs8 ; cat ) < /dev/ports/serial1

... then I can type text into the Linux window, which goes through the
standard input of the cat command and sent out its standard output to
the serial port.  Going from Linux to BeOS, the text appears correctly
in the BeOS Terminal.

But if I go the other way (reverse the redirection on both sides) and
type into the BeOS Terminal, some garbled characters appear in my
Linux window, but I've been unable to get the characters to appear
correctly.

Usually garbled characters from a serial port indicate that the stty
settings are incorrect, but you can see that I took care to make them
the same on both sides.

Sadly that Linux serial port is integrated into my motherboard.

However I also have a PCI serial port that I'm not using.  I'll see if
I can get that to work.

The parameters to the stty commands above mean:

9600 - 9600 Baud

-parenb - disable parity (or "N")

-cstopb - one stop bit

cs8 - eight bits per character

These parameters are often given as 9600 8 N 1.

stty takes some study to learn how to use; try "stty --help | less"

Mike
-- 
Michael David Crawford
mdcrawford at gmail dot com

   GoingWare's Bag of Programming Tricks
      http://www.goingware.com/tips/

Other related posts: