Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 9 Dec 1997 18:12:41 +0800
From:      Greg Lehey <grog@lemis.com>
To:        mlduke@concentric.net
Cc:        questions@FreeBSD.ORG
Subject:   Re: Serial Terminal
Message-ID:  <19971209181241.01704@lemis.com>
In-Reply-To: <Pine.BSF.3.96.971208215719.661B-100000@mlduke.concentric.net>; from mlduke@concentric.net on Mon, Dec 08, 1997 at 10:00:50PM -0900
References:  <Pine.BSF.3.96.971208215719.661B-100000@mlduke.concentric.net>

next in thread | previous in thread | raw e-mail | index | archive | help
On Mon, Dec 08, 1997 at 10:00:50PM -0900, mlduke@concentric.net wrote:
> I would like to attach a serial terminal to my FreeBSD2.2.2-RELEASE
> box. Can anyone help?

:-)

It's pretty straightforward.  Plug it in to a serial port, and set the
line in /etc/ttys accordingly.  For example, if you were plugging in
to the second serial port (/dev/ttyd1), look for a line like this in
/etc/ttys:

ttyd1   "/usr/libexec/getty std.9600"   unknown off secure

Change it to:

ttyd1   "/usr/libexec/getty std.9600"   unknown on  secure

Then enter:

# kill -1 1

This will tell init to re-read the /etc/ttys.  After that, you should
see a process like this:

# ps aux | grep getty
root     145  0.0  0.0   180    0  v1  Is+  Mon09AM   0:00.07 /usr/libexec/getty std.9600 ttyd1

At the same time, you should get a prompt on the terminal.  If you
don't, press Enter a couple of times.

One problem you might have is the bit rate of the terminal.  The
example assumes 9600 bps, no parity, 8 bit bytes (I think).  You can
check that with stty:

# stty -f /dev/ttyd1 -a
speed 9600 baud; 0 rows; 0 columns;
lflags: -icanon -isig -iexten -echo -echoe -echok -echoke -echonl
        -echoctl -echoprt -altwerase -noflsh -tostop -flusho -pendin
        -nokerninfo -extproc
iflags: -istrip -icrnl -inlcr -igncr -ixon -ixoff -ixany -imaxbel -ignbrk
        -brkint -inpck -ignpar -parmrk
oflags: -opost -onlcr -oxtabs
cflags: cread cs8 -parenb -parodd hupcl -clocal -cstopb -crtscts -dsrflow
        -dtrflow -mdmbuf
cchars: discard = ^O; dsusp = ^Y; eof = ^D; eol = <undef>;
        eol2 = <undef>; erase = ^?; intr = ^C; kill = ^U; lnext = ^V;
        min = 1; quit = ^\; reprint = ^R; start = ^Q; status = ^T;
        stop = ^S; susp = ^Z; time = 0; werase = ^W;

cs8 says 8 bit characters; -parenb means that parity isn't enabled.

The only other thing you need to know is what kind of terminal you
have.  You'll have to set the TERM environment variable accordingly;
if your terminal isn't in the list in /etc/termcap, you should at
least know what kind of terminal it's emulating.  The terminal will
work OK without the TERM variable, but if you don't have it set
correctly, things like vi either won't work at all, or will produce
complete nonsense on the screen.

Greg




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?19971209181241.01704>