old-www/LDP/nag2/x-087-2-serial.ttys.html

190 lines
4.1 KiB
HTML

<HTML
><HEAD
><TITLE
>Introduction to Serial Devices</TITLE
><META
NAME="GENERATOR"
CONTENT="Modular DocBook HTML Stylesheet Version 1.57"><LINK
REL="HOME"
TITLE="Linux Network Administrators Guide"
HREF="index.html"><LINK
REL="UP"
TITLE="Configuring the Serial Hardware"
HREF="x-087-2-serial.html"><LINK
REL="PREVIOUS"
TITLE="Communications Software
for Modem Links"
HREF="x-087-2-serial.software.html"><LINK
REL="NEXT"
TITLE="Accessing Serial Devices"
HREF="x-087-2-serial.devices.html"></HEAD
><BODY
CLASS="SECT1"
BGCOLOR="#FFFFFF"
TEXT="#000000"
LINK="#0000FF"
VLINK="#840084"
ALINK="#0000FF"
><DIV
CLASS="NAVHEADER"
><TABLE
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TH
COLSPAN="3"
ALIGN="center"
>Linux Network Administrators Guide</TH
></TR
><TR
><TD
WIDTH="10%"
ALIGN="left"
VALIGN="bottom"
><A
HREF="x-087-2-serial.software.html"
>Prev</A
></TD
><TD
WIDTH="80%"
ALIGN="center"
VALIGN="bottom"
>Chapter 4. Configuring the Serial Hardware</TD
><TD
WIDTH="10%"
ALIGN="right"
VALIGN="bottom"
><A
HREF="x-087-2-serial.devices.html"
>Next</A
></TD
></TR
></TABLE
><HR
ALIGN="LEFT"
WIDTH="100%"></DIV
><DIV
CLASS="SECT1"
><H1
CLASS="SECT1"
><A
NAME="X-087-2-SERIAL.TTYS"
>4.2. Introduction to Serial Devices</A
></H1
><P
>The Unix kernel provides devices for accessing serial hardware,
typically called <I
CLASS="EMPHASIS"
>tty</I
> devices (pronounced as it is
spelled: T-T-Y). This is an abbreviation for <I
CLASS="EMPHASIS"
>Teletype
device</I
>, which used to be one of the major manufacturers of
terminal devices in the early days of Unix. The term is used now for
any character-based data terminal. Throughout this chapter, we use the
term to refer exclusively to the Linux device files rather than the
physical terminal.</P
><P
>Linux provides three classes of tty devices: serial devices, virtual
terminals (all of which you can access in turn by pressing Alt-F1
through Alt-F<I
CLASS="EMPHASIS"
>nn</I
> on the local console), and
pseudo-terminals (similar to a two-way pipe, used by applications such
as X11). The former were called tty devices because the original
character-based terminals were connected to the Unix machine by a
serial cable or telephone line and modem. The latter two were
named after the tty device because they were created to behave in a
similar fashion from the programmer's perspective.</P
><P
>&#13; SLIP and PPP are most commonly
implemented in the kernel. The kernel doesn't really treat the
<I
CLASS="EMPHASIS"
>tty</I
> device as a network device that you can
manipulate like an Ethernet device, using commands such as
<B
CLASS="COMMAND"
>ifconfig</B
>. However, it does treat tty devices as
places where network devices can be bound. To do this, the kernel
changes what is called the &#8220;line discipline&#8221; of the tty
device. Both SLIP and PPP are line disciplines that may be enabled on
tty devices. The general idea is that the serial driver handles data
given to it differently, depending on the line discipline it is
configured for. In its default line discipline, the driver simply
transmits each character it is given in turn. When the SLIP or PPP
line discipline is selected, the driver instead reads a block of data,
wraps a special header around it that allows the remote end to
identify that block of data in a stream, and transmits the new data
block. It isn't too important to understand this yet; we'll cover both
SLIP and PPP in later chapters, and it all happens automatically for
you anyway.</P
></DIV
><DIV
CLASS="NAVFOOTER"
><HR
ALIGN="LEFT"
WIDTH="100%"><TABLE
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
><A
HREF="x-087-2-serial.software.html"
>Prev</A
></TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="index.html"
>Home</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
><A
HREF="x-087-2-serial.devices.html"
>Next</A
></TD
></TR
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
>Communications Software
for Modem Links</TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="x-087-2-serial.html"
>Up</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
>Accessing Serial Devices</TD
></TR
></TABLE
></DIV
></BODY
></HTML
>