old-www/HOWTO/Serial-HOWTO-9.html

75 lines
3.0 KiB
HTML

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<HTML>
<HEAD>
<META NAME="GENERATOR" CONTENT="LinuxDoc-Tools 0.9.21">
<TITLE> Serial HOWTO: Configuring the Serial Driver (high-level) "stty"</TITLE>
<LINK HREF="Serial-HOWTO-10.html" REL=next>
<LINK HREF="Serial-HOWTO-8.html" REL=previous>
<LINK HREF="Serial-HOWTO.html#toc9" REL=contents>
</HEAD>
<BODY>
<A HREF="Serial-HOWTO-10.html">Next</A>
<A HREF="Serial-HOWTO-8.html">Previous</A>
<A HREF="Serial-HOWTO.html#toc9">Contents</A>
<HR>
<H2><A NAME="config_stty"></A> <A NAME="s9">9.</A> <A HREF="Serial-HOWTO.html#toc9">Configuring the Serial Driver (high-level) "stty"</A></H2>
<H2><A NAME="ss9.1">9.1</A> <A HREF="Serial-HOWTO.html#toc9.1">Overview</A>
</H2>
<P>See the section
<A HREF="Serial-HOWTO-11.html#stty_">Stty</A>. The "stty" command
sets many things such as flow control, speed, and parity. The only
one discussed in this section is flow control.</P>
<H2><A NAME="ss9.2">9.2</A> <A HREF="Serial-HOWTO.html#toc9.2">Flow Control</A>
</H2>
<P> Configuring Flow Control: Hardware Flow Control is Usually Best
See
<A HREF="Serial-HOWTO-4.html#flow_control">Flow Control</A> for an explanation of
it. It's usually better to use hardware flow control rather than
software flow control using Xon/Xoff. To use full hardware flow
control you must normally have two dedicated wires for it in the cable
between the serial port and the device. If the device is on a card or
the motherboard, then it should always be possible to use hardware
flow control.</P>
<P>Many applications (and the getty program) give you an option
regarding flow control and will set it as you specify or it might
enable hardware flow control by default if you don't set it. It must
be set both in the serial driver and in the hardware connected to the
serial port. How it's set into this hardware is hardware dependent.
Sometimes there is a certain "init string" you send to the hardware
device via the serial port from your PC. For a modem, the
communication program should set it in both places.</P>
<P>If a program you use doesn't set flow control in the serial driver,
then you may do it yourself using the <CODE>stty</CODE> command. Since the
driver doesn't remember the setting after you stop Linux, you could
put the stty command in a file that runs at start-up or when you login
(such as /etc/profile for the bash shell). Here's what you would add
for hardware flow control for port ttyS2:</P>
<P>
<BLOCKQUOTE><CODE>
<PRE>
stty -F /dev/ttyS2 crtscts
</PRE>
</CODE></BLOCKQUOTE>
or for old stty versions &lt; 1.17:
<BLOCKQUOTE><CODE>
<PRE>
stty crtscts &lt; /dev/ttyS2
</PRE>
</CODE></BLOCKQUOTE>
</P>
<P><CODE>crtscts</CODE> stands for a Control setting to use the RTS and CTS pins of
the serial port for hardware flow control. Note that RTS+CTS almost
spells: <CODE>crtscts</CODE> and the initial "c" means "control".</P>
<HR>
<A HREF="Serial-HOWTO-10.html">Next</A>
<A HREF="Serial-HOWTO-8.html">Previous</A>
<A HREF="Serial-HOWTO.html#toc9">Contents</A>
</BODY>
</HTML>