\documentclass[letterpaper]{article}
\nonstopmode
\akai
\usepackage{linuxdoc-sgml}
\usepackage{qwertz}
\usepackage{url}
\usepackage[latin1]{inputenc}
\usepackage{t1enc}
\usepackage[english]{babel}
\usepackage{epsfig}
\usepackage{null}
\def\addbibtoc{
\addcontentsline{toc}{section}{\numberline{\mbox{}}\relax\bibname}
}%end-preamble
\setcounter{page}{1}
\title{Linux Serial HOWTO ÖÐÒë°æ}
\author{×÷Õß: Greg Hankins {\ttfamily \onlynameurl{greg.hankins@cc.gatech.edu}}\\ 
ÒëÕß: \onlynameurl{Asd L. Chen} \&
      \onlynameurl{C.W.Huang}}
\date{v1.11, 15 November 1997
·­ÒëÈÕÆÚ: 18 November 1997}
\abstract{Õâ·ÝÎÄ¼þÐðÊöÈçºÎÔÚ Linux »úÆ÷ÉÏÉè¶¨´®ÁÐÍ¨Ñ¶Éè±¸£®}


\begin{document}
\maketitle
\tableofcontents

\section{¼ò½é}

ÕâÊÇ Linux Serial HOWTO£®°üº¬¹Øì¶ÈçºÎÔÚ Linux ÏÂÉè¶¨Êý¾Ý»úÒÔ¼°ÖÕ¶Ë»úµÄËùÓÐÏ¸½Ú£¬»¹ÓÐÒ»Ð©Ê¹ÓÃ´®ÁÐµÄ¾÷ÇÏ£¬ÒÔ¼°¹ÊÕÏÅÅ³ýµÄ×ÊÁÏ£®
Õâ·ÝÎÄ¼þÖøÖØÔÚ Intel x86 Ó²ÌåÉÏÖ´ÐÐµÄ Linux£¬ËäÈ»ÔÚÆäËüÆ½Ì¨ÉÏÒ²ÐíÒ²ÄÜÔË×÷£®  




\subsection{°æÈ¨ÉùÃ÷}

±¾ÎÄ°æÈ¨ÊÇÊôì¶ Greg Hankins(copyright (C) 1993 - 1997)£®±¾ÎÄ¼þ¿ÉÒÔÔÚ LDP µÄ°æÈ¨Ðí¿ÉÏÂÉ¢²¼: 
{\ttfamily \onlynameurl{http://sunsite.unc.edu/LDP/COPYRIGHT.html}}.
±¾ÎÄÔÚÎ´¾­×÷ÕßÐí¿ÉÏÂ²»µÃÒÔÐÞ¸ÄµÄÐÎÊ½É¢²¼£®



{\bfseries Ô­ÎÄ}

Copyright (c) 1993 - 1997 by Greg Hankins.  This document may be
distributed under the terms set forth in the LDP license at
{\ttfamily \onlynameurl{http://sunsite.unc.edu/LDP/COPYRIGHT.html}}.
This document may not be distibuted in modified form without
consent of the author.




\subsection{Õâ·ÝÎÄ¼þµÄ×îÐÂ°æ±¾}

ÐÂ°æµÄ Serial HOWTO »á·Åµ½\\ 
{\ttfamily \onlynameurl{ftp://sunsite.unc.edu/pub/Linux/docs/HOWTO/Serial-HOWTO}}
ÒÔ¼°Ó³Éä½Úµã£®ÓÐÒ»Ð©ÆäËüÏñÊÇ  Postscript  ÒÔ¼° DVI ¸ñÊ½µÄ°æ±¾·ÅÔÚ {\ttfamily other-formats} Ä¿Â¼Àï£®
ÕâÒ»·Ý Serial HOWTO Ò²¿ÉÔÚ
{\ttfamily \onlynameurl{http://sunsite.unc.edu/LDP/HOWTO/Serial-HOWTO.html}}
È¡µÃ£®ËüÒ²»áÃ¿ÔÂ¶¨ÆÚµÄÌùµ½ {\ttfamily \onlynameurl{comp.os.linux.answers}}£®




\subsection{»ØÀ¡}

Çë½«ÈÎºÎµÄÎÊÌâ£¬ÆÀÂÛ£¬½¨Òé»ò²¹³äÄÚÈÝ¼ÄËÍ¸øÎÒ£®ÎÒÓÀÔ¶¿ÊÍûÌýµ½Äã¶ÔÕâ·Ý HOWTO  µÄÏë·¨£®
ÎÒÒ²×ÜÊÇÐ¡ÐÄµØ×¢Òâ¸Ä½ø! È·ÊµµØ¸æËßÎÒÄãÓÐÊ²÷á²»¶®µÄµØ·½£¬»òÕßÊÇÓÐÊ²÷áµØ·½¿ÉÒÔÐ´µÃ¸üÇå³þ£®
Äã¿ÉÒÔ¾­ÓÉÕâ¸öµç×ÓÓÊ¼þÎ»Ö· {\ttfamily \onlynameurl{greg.hankins@cc.gatech.edu}} ÓëÎÒÁ¬Ïµ£®
ËùÓÐµÄÓÊ¼þÎÒ¶¼»á»Ø¸²£¬²»¹ý¿ÉÄÜÒª»¨Ò»¸öÐÇÆÚ»ò¸ü³¤µÄÊ±¼ä£¬¿´ÎÒ¶àÃ¦¶ø¶¨£®
ÎÒÊÕµ½Ò»´ó¶ÑÀ´×Ô {\ttfamily root} ¼°´íÎóÉè¶¨µÄÕ¾Ì¨£®
ÇëÒÔÕæÊµÉí·Ý¼ÄÐÅ¸øÎÒ£¬²¢ÇÒÈ·¶¨ÄãµÄµç×ÓÓÊ¼þÏµÍ³ÊÇÕý³£ÔË×÷Ê¹µÃÎÒÄÜ¹»»ØÐÅ¸øÄã£®
Èç¹ûÁ½¸öÐÇÆÚÖ®ÄÚÄã»¹Ã»ÊÕµ½ÎÒµÄ»ØÒô£¬Çë³¢ÊÔÔÙ¼ÄÒ»´Î£®

Ò²¿ÉÒÔ½åÓÉÏÂÃæµÄµØÖ·ÒÔ³Ù»ºµÄ´«Í³ÐÅ¼þÁªÂçÎÒ:\\ 
Greg Hankins\\ 
College of Computing\\ 
801 Atlantic Drive\\ 
Atlanta, GA 30332-0280\\ 
ÒÔ¼°¾­ÓÉÈ«Çò×ÊÑ¶Íøµ½ÎÒµÄÍøÒ³\\ 
{\ttfamily \onlynameurl{http://www.cc.gatech.edu/staff/h/Greg.Hankins/}}.

×«Ð´Ê±Çë½« Serial HOWTO ÎÄ¼þµÄ°æ±¾±àºÅº¬Èë£¬Õâ·ÝÊÇ 1.11 °æ£®




\subsection{ÃâÔðÉùÃ÷}

ÄãµÄ×´¿ö¿ÉÄÜºÜ²»Ò»Ñù£®ÕâÀïµÄ»Ø´ð¿ÉÄÜÎÞ·¨ÔÚËùÓÐµÄÏµÍ³¼°¸÷ÖÖÉè¶¨µÄ×éºÏÏÂÔË×÷£®




\section{ÒÑ¾­Ö§Ô®µÄ´®ÁÐÓ²Ìå}

ÒÔÖª Linux ¿ÉÒÔÓëÏÂÁÐµÄ´®ÁÐÓ²ÌåÅäºÏÔË×÷£®




\subsection{±ê×¼ PC ´®ÁÐ²º}

\begin{itemize}
\item ±ê×¼ PC ´®ÁÐ²º (COM1 - COM4)£¬ÄÜ¹»ÈÃÍâ½ÓµÄ´®ÁÐ×°ÖÃ(Êý¾Ý»ú£¬´®ÁÐ»¬ÊóµÈ)Á¬½ÓµÄ
\item ±ê×¼ PC ÄÚ½ÓÊ½Êý¾Ý»ú (COM1 - COM4)
\item Quickpath Systems Port-Folio 550e (¿ÉÓÃµÄ IRQ Îª
3, 4, 5, 9, 10, 11, 12, ¼° 15)
\end{itemize}




×¢Òâ: ÓÉì¶Î»Ö·³åÍ»£¬Äã²»ÄÜÍ¬Ê±Ê¹ÓÃ COM4 ¼° IBM8514 ÊÓÑ¶¿¨£®ÕâÊÇ IBM8514 ÊÓÑ¶¿¨µÄÒ»¸ö bug£®




\subsection{¼´²å¼´ÓÃÐÍ(PnP)Êý¾Ý»ú}

¼´²å¼´ÓÃÐÍÊý¾Ý»úÄÜ¹»ÔÚ Linux ÉÏÔË×÷£®È»¶ø£¬ÎÒ²»½¨ÒéÊ¹ÓÃËüÃÇ£¬ÒòÎªÓÐÀ§ÄÑ£®
ÄãÓÐºÃ¶àÊÂÇéÒªÊÔ:
\begin{itemize}
\item ÊÔÖø¹ØµôÄãµçÄÔ BIOS ¼°Êý¾Ý»úÉÏµÄ PnP ¹¦ÄÜ£®
\item Æô¶¯ Windows 95£¬Éè¶¨Êý¾Ý»ú£¬È»áá¿´¿´ÔÚÄãÆô¶¯ Linux ááÕâÐ©Éè¶¨ÄÜ·ñ±£ÁôÏÂÀ´£®
Èç¹û²»ÐÐµÄ»°£¬ÔÙÀ´:
\item Æô¶¯ Windows 95£¬Éè¶¨Êý¾Ý»ú£¬È»ááÊ¹ÓÃ{\itshape Å¯¿ª»ú\/}Æô¶¯ Linux ÒÔ±ãÈÃÉè¶¨ÄÜ±£ÁôÏÂÀ´£®
Äã¿ÉÒÔÊ¹ÓÃ {\ttfamily loadlin} ÔØÈëÆ÷À´Æô¶¯£®
\item ´Ó {\ttfamily \onlynameurl{http://www.redhat.com/linux-info/pnp}} È¡»Ø PnP ¹¤¾ß£®
\item È»ááÄã¾ÍÓÐ¸ö¿ÉÓÃµÄÊý¾Ý»ú£®
\end{itemize}





\subsection{Ò»°ã¶à²º´®ÁÐ¿¨(¸½ 8250/16450/16550A UART ¾§Æ¬)}

\begin{itemize}
\item AST FourPort and clones (4 ports)
\item Accent Async-4 (4 ports)
\item Arnet Multiport-8 (8 ports)
\item Bell Technologies HUB6 (6 ports)
\item Boca BB-1004 (4 ports), BB-1008 (8 ports), BB-2016 (16 ports)
\item Boca IOAT66 (6 ports)
\item Boca 2by4 (4 serial ports, 2 parallel ports)
\item Computone ValuePort V4-ISA (AST FourPort compatible)
\item Digi PC/8 (8 ports)
\item GTEK BBS-550 (8 ports)
\item Longshine LCS-8880, Longshine LCS-8880+ (AST FourPort compatible)
\item Moxa C104, Moxa C104+ (AST FourPort compatible)
\item PC-COMM (4 ports)
\item \onlynameurl{Sealevel Systems} COMM-2 (2 ports), COMM-4 (4 ports) and COMM-8 (8 ports)
\item SIIG I/O Expander 2S IO1812 (4 ports)
\item STB-4COM (4 ports)
\item Twincom ACI/550
\item Usenet Serial Board II (4 ports)
\end{itemize}


Ò»°ãÀ´Ëµ£¬ Linux ÄÜ¹»Ö§Ô®ËùÓÐÊ¹ÓÃ 8250, 16450, 16550, 16550A£¨»òÓëÆäÏàÈÝ£©UART ¾§Æ¬µÄ´®ÁÐ¿¨£¬
»òÕßÊÇÄÜ¹»ÃþÄâÉÏÁÐ UARTs Ö®Ò»µÄÄÚ½ÓÊ½Êý¾Ý»ú£®

×¢Òâ: BB-1004 ÒÔ¼° BB-1008£¬ËüÃÇ²¢²»Ö§Ô® DCD ¼° RI ÏßÂ·£¬Òò¶øÎÞ·¨ÈÃ½ÓÊÜ²¦½ÓµÄÊý¾Ý»úÊ¹ÓÃ£®
ËüÃÇÔÚÆäËüÓÃÍ¾ÉÏÔò±íÏÖÕý³££®




\subsection{ÖÇ»ÛÐÍ¶à²º´®ÁÐ¿¨}

\begin{itemize}
\item Comtrol RocketPort (36MHz ASIC; 4, 8, 16 or 32 ports)\\ 
contact: {\ttfamily \onlynameurl{info@comtrol.com}} or
{\ttfamily \onlynameurl{http://www.comtrol.com}}\\  
driver status: supported by Comtrol\\ 
driver location: {\ttfamily \onlynameurl{ftp://tsx-11.mit.edu/pub/linux/packages/comtrol}}
\item Computone IntelliPort II (16MHz 80186; 4, 8, or 16 ports),\\ 
IntelliPort II EXpandable (20MHz 80186; 16 - 64 ports)\\ 
contact: Michael H. Warfield, {\ttfamily \onlynameurl{mhw@wittsend.atl.ga.us}}\\ 
driver status: pre-ALPHA
\item Cyclades Cyclom-Y (Cirrus Logic CD1400 UARTs; 8 - 32 ports),\\ 
Cyclom-Z (25MHz MIPS R3000; 8 - 128 ports)\\ 
contact: {\ttfamily \onlynameurl{sales@cyclades.com}} or
{\ttfamily \onlynameurl{http://www.cyclades.com}}\\ 
driver status: supported by Cyclades\\ 
driver location: {\ttfamily \onlynameurl{ftp://ftp.cyclades.com/pub/cyclades}} and included in Linux 
kernel since version 1.1.75
\item Decision PCCOM8 (8 ports)\\ 
contact: {\ttfamily \onlynameurl{pccom8@signum.se}}\\ 
driver location: {\ttfamily \onlynameurl{ftp://ftp.signum.se/pub/pccom8}}
\item Digi PC/Xi (12.5MHz 80186; 4, 8, or 16 ports),\\ 
PC/Xe (12.5/16MHz 80186; 2, 4, or 8 ports),\\ 
PC/Xr (16MHz IDT3041; 4 or 8 ports),\\ 
PC/Xem (20MHz IDT3051; 8 - 64 ports)\\ 
contact: {\ttfamily \onlynameurl{mailto:sales@dgii.com}} or {\ttfamily \onlynameurl{http://www.dgii.com}}\\ 
driver status: supported by Digi\\ 
driver location: {\ttfamily \onlynameurl{ftp://ftp.dgii.com/drivers/linux}} and 
included in Linux kernel since version 2.0
\item Digi COM/Xi (10MHz 80188; 4 or 8 ports)\\ 
contact: Simon Park, {\ttfamily \onlynameurl{si@wimpol.demon.co.uk}}\\ 
driver status: ALPHA\\ 
note: Simon is often away from email for months at a time due to
his job.  Mark Hatle, {\ttfamily \onlynameurl{fray@krypton.mankato.msus.edu}} has graciously 
volunteered to make the driver available if you need it.  Mark
is not maintaining or supporting the driver.
\item Equinox SuperSerial Technology (30MHz ASIC; 2 - 128 ports)\\ 
contact: {\ttfamily \onlynameurl{sales@equinox.com}} or {\ttfamily \onlynameurl{http://www.equinox.com}}\\ 
driver status: supported by Equinox\\ 
driver location: {\ttfamily \onlynameurl{ftp://ftp.equinox.com/library/sst}}
\item GTEK Cyclone (16C654 UARTs; 6, 16 and 32 ports),\\ 
SmartCard (24MHz Dallas DS80C320; 8 ports),\\ 
BlackBoard-8A (16C654 UARTs; 8 ports),\\ 
PCSS (15/24MHz 8032; 8 ports)\\ 
contact: {\ttfamily \onlynameurl{spot@gtek.com}} or {\ttfamily \onlynameurl{http://www.gtek.com}}\\ 
driver status: supported by GTEK\\ 
driver location: {\ttfamily \onlynameurl{ftp://ftp.gtek.com/pub}}
\item Hayes ESP (COM-bic; 1 - 8 ports)\\  
contact: Andrew J. Robinson, {\ttfamily \onlynameurl{arobinso@nyx.net}} or
{\ttfamily \onlynameurl{http://www.nyx.net/\~{}arobinso}}\\ 
driver status: supported by author\\ 
driver location: {\ttfamily \onlynameurl{http://www.nyx.net/\~{}arobinso}} and included in Linux 
kernel since version 2.1.15
\item Maxpeed SS (Toshiba; 4, 8 and 16 ports)\\ 
contact: {\ttfamily \onlynameurl{info@maxpeed.com}} or
{\ttfamily \onlynameurl{http://www.maxpeed.com}}\\ 
driver status: supported by Maxpeed\\ 
driver location: {\ttfamily \onlynameurl{ftp://maxpeed.com/pub/ss}}
\item Moxa C218 (12MHz 80286; 8 ports),\\  
Moxa C320 (40MHz TMS320; 8 - 32 ports)\\ 
contact: {\ttfamily \onlynameurl{info@moxa.com.tw}} or
{\ttfamily \onlynameurl{http://www.moxa.com.tw}}\\ 
driver status: supported by Moxa\\ 
driver location: {\ttfamily \onlynameurl{ftp://ftp.moxa.com.tw/drivers/c218-320/linux}}
\item SDL RISCom/8 (Cirrus Logic CD180; 8 ports)\\ 
contact: {\ttfamily \onlynameurl{sales@sdlcomm.com}} or {\ttfamily \onlynameurl{http://www.sdlcomm.com}}\\ 
driver status: supported by SDL\\ 
driver location: {\ttfamily \onlynameurl{ftp://ftp.sdlcomm.com/pub/drivers}}
\item Specialix SIO (20MHz Zilog Z280; 4 - 32 ports),\\ 
XIO (25MHz Zilog Z280; 4 - 32 ports)\\ 
contact: Simon Allen, {\ttfamily \onlynameurl{simonallen@cix.compulink.co.uk}}\\ 
driver status: BETA\\ 
driver location: {\ttfamily \onlynameurl{ftp://sunsite.unc.edu/pub/Linux/kernel/patches/serial}}
\item Stallion EasyIO-4 (4 ports), EasyIO-8 (8 ports), and\\ 
EasyConnection (8 - 32 ports) - each with 
Cirrus Logic CD1400 UARTs,\\ 
Stallion (8MHz 80186 CPU; 8 or 16 ports),\\ 
Brumby (10/12 MHz 80186 CPU; 4, 8 or 16 ports),\\ 
ONboard (16MHz 80186 CPU; 4, 8, 12, 16 or 32 ports),\\ 
EasyConnection 8/64 (25MHz 80186 CPU; 8 - 64 ports)\\ 
contact: {\ttfamily \onlynameurl{sales@stallion.com}} or
{\ttfamily \onlynameurl{http://www.stallion.com}}\\ 
driver status: supported by Stallion\\ 
driver location: {\ttfamily \onlynameurl{ftp://ftp.stallion.com/drivers/ata5/Linux}} and
included in linux kernel since 1.3.27
\end{itemize}
                 

ÆäÖÐ Comtrol, Cyclades, Digi, ¼° Stallion µÄ²úÆ·ÔÚ 1995 ÄêÁùÔÂ·ÝµÄ {\itshape Linux Journal\/} ÉÏÓÐÆª»Ø¹ËÎÄÕÂ£®
ÕâÆªÎÄÕÂ¿ÉÔÚ {\ttfamily \onlynameurl{http://www.ssc.com/lj/issue14}} ÕÒµ½£®




\subsection{²»Ö§Ô®µÄ´®ÁÐÓ²Ìå}

Ðû³Æ``Winmodems''µÄÊý¾Ý»ú£¬ÀýÈç USR Sportster Winmodem ¼° IBM Aptiva MWAVE£¬
{\itshape ÎÞ·¨\/}ÔÚ Linux ÉÏÊ¹ÓÃ£®ÕâÐ©Êý¾Ý»ú¾ßÓÐ×¨ÃÅµÄÉè¼ÆÐèÒªÌØ±ðµÄ Windows Çý¶¯³ÌÊ½£®
±ÜÃâÊ¹ÓÃÕâÑùµÄÊý¾Ý»ú£®³ý´ËÖ®Íâ£¬»ùì¶ÏàÍ¬ÀíÓÉÒ²±ðÊ¹ÓÃÐèÒª Rockwell RPI Çý¶¯³ÌÊ½µÄÊý¾Ý»ú£® 

Ã»ÓÐ Linux ËùÐèÇý¶¯³ÌÊ½µÄÖÇ»ÛÐÍ´®ÁÐ²ºÒ²²»ÄÜÊ¹ÓÃ£®




\section{´®ÁÐ²ºµÄÃû³ÆÊÇÊ²÷á?}

Ò»¸öÊä³ö/Èë(I/O)²ºÊÇÓÃÀ´½«×ÊÁÏËÍÈëµçÄÔ¼°´ÓµçÄÔÈ¡³öµÄÍ¨Â·£®
ÓÐÐí¶àÖÖÀàµÄÊä³ö/Èë²º£¬ÀýÈç´®ÁÐ²º£¬Æ½ÐÐ²º£¬´Åµú¿ØÖÆÆ÷£¬ÒÒÌ«ÍøÂ·¿¨µÈµÈ£®
ÎÒÃÇÒª´¦ÀíµÄÊÇ´®ÁÐ²º£¬ÒòÎªÊý¾Ý»ú¼°ÖÕ¶Ë»úÊÇ´®ÁÐ×°ÖÃ£®
Ã¿Ò»¸ö´®ÁÐ²º±ØÐëÓÐÒ»¸öÊä³ö/ÈëÎ»Ö·£¬ÒÔ¼°Ò»¸ö²å¶ÏºÅÂë(IRQ)£®
ÓÐËÄ¸ö´®ÁÐÉè±¸¶ÔÓ¦µ½ COM1 - COM4:
\begin{tscreen}
\begin{verbatim}
ttyS0 (COM1) address 0x3f8 IRQ 4
ttyS1 (COM2) address 0x2f8 IRQ 3
ttyS2 (COM3) address 0x3e8 IRQ 4
ttyS3 (COM4) address 0x2e8 IRQ 3
\end{verbatim}
\end{tscreen}

Èç¹û Linux Æô¶¯Ê±Ã»ÓÐÕì²âµ½ÈÎºÎ´®ÁÐ×°ÖÃ£¬ÇëÈ·¶¨ÔÚ±àÒëºËÐÄÊ±ÓÐ¼ÓÈë´®ÁÐÖ§Ô®£®
ÔÚÕâ·ÝÎÄ¼þÖÐ£¬ÎÒÊÇÒÔ {\ttfamily ttyS0} ²ÎÕÕ COM1£¬{\ttfamily ttyS1} ²ÎÕÕ COM2£¬ÒÔ {\ttfamily ttyS2} ²ÎÕÕ COM3 £¬¶øÒÔ {\ttfamily ttyS3} ²ÎÕÕ COM4£®
×¢ÒâÕâÐ©×°ÖÃÔ¤ÉèµÄ IRQ ÊÇÖØµþµÄ£®ÄãÎÞ·¨ÓÉÕâÐ©Ô¤ÉèÖµÊ¹ÓÃËùÓÐµÄ´®ÁÐ²º£¬Äã±ØÐëÖØÐÂÖ¸¶¨²»Í¬µÄ IRQ£®
²Î¼û \ref{irqaddr} {(ÎÒÄÜÊ¹ÓÃ³¬¹ýÁ½¸öµÄ´®ÁÐ×°ÖÃÂð?)} Ò»½ÚËµÃ÷ÈçºÎÉè¶¨ IRQ£®

Ä³Ð©°²×°·½Ê½»á½¨Á¢Á½¸ö¶îÍâµÄÉè±¸£¬¸øÄãÊý¾Ý»úÊ¹ÓÃµÄ {\ttfamily /dev/modem} ÒÔ¼°¸øÄã»¬ÊóÊ¹ÓÃµÄ {\ttfamily /dev/mouse}£®
ËüÃÇ¶¼ÊÇÁ´½áµ½ÄãÔÚ°²×°Ê±ËùÖ¸¶¨ÊÊµ± {\ttfamily /dev} ÀïµÄÉè±¸µÄ·ûºÅÁ´½á£¨³ý·ÇÄãÓÃµÄÊÇ»ãÁ÷ÅÅ»¬Êó(bus mouse) £¬ÄÇ÷á {\ttfamily /dev/mouse} ½«»áÖ¸µ½»ãÁ÷ÅÅ»¬ÊóÕâ¸öÉè±¸£©£®

ÒÑ¾­ÓÐÐ©¹Øì¶Ê¹ÓÃ {\ttfamily /dev/mouse} ÒÔ¼° {\ttfamily /dev/modem} ÓÅÈ±µãµÄÌÖÂÛ£®
ÎÒ{\itshape Ç¿ÁÒµØ\/}·´¶ÔÊ¹ÓÃÕâÐ©Á´½á£¬Èç¹ûÄã´òËãÓÃÄãµÄÊý¾Ý»ú½ÓÊÜ²¦½ÓµÄ»°£¬ÒªÊÇÄãÊ¹ÓÃÁË {\ttfamily /dev/modem} ÄÇ÷áÄã½«»áÒòÎªËø¶¨µµ°¸(lock files)ÎÞ·¨ÕýÈ·ÔË×÷¶øÔâÓöµ½À§ÄÑ£®
Èç¹ûÄãÏ²»¶ËüÃÇµÄ»°¾ÍÓÃ°É£¬µ«ÊÇ{\itshape ÒªÈ·¶¨ËüÃÇÖ¸ÏòÕýÈ·µÄÉè±¸\/}£®
È»¶ø£¬Èç¹ûÄã¸Ä±ä»ò³ýÈ¥Õâ¸öÁ¬½á£¬Ä³Ð©Ó¦ÓÃ³ÌÊ½(ÀýÈç {\ttfamily minicom})¿ÉÄÜÒªÖØÐÂÉè¶¨£®




\subsection{ÔÚ {\ttfamily /dev} ÀïµÄ´®ÁÐÉè±¸¼°Ö÷ÒªºÍ´ÎÒªºÅÂë}

\begin{tscreen}
\begin{verbatim}
/dev/ttyS0 major 4, minor 64    /dev/cua0 major 5, minor 64
/dev/ttyS1 major 4, minor 65    /dev/cua1 major 5, minor 65
/dev/ttyS2 major 4, minor 66    /dev/cua2 major 5, minor 66
/dev/ttyS3 major 4, minor 67    /dev/cua3 major 5, minor 67
\end{verbatim}
\end{tscreen}

Òª×¢Òâµ½ËùÓÐµÄ·¢ÐÐÌ×¼þ¶¼Ó¦¸ÃÒÑ¾­ÕýÈ·µØ½¨Á¢ÁËÕâÐ©Éè±¸£®
Äã¿ÉÒÔÓÃÏÂ·¨¼ì²é:
\begin{tscreen}
\begin{verbatim}
linux% ls -l /dev/cua*
linux% ls -l /dev/ttyS*
\end{verbatim}
\end{tscreen}





\subsubsection{ÔÚ {\ttfamily /dev} ÖÐ½¨Á¢Éè±¸\label{dev}}

Èç¹ûÄãÃ»ÓÐÆäÖÐµÄÒ»¸öÉè±¸£¬Äã±ØÐë×Ô¼ºÓÃ {\ttfamily mknod} Ö¸Áî½¨Á¢Ëü£®
ÀýÈç£¬¼Ù¶¨ÄãÐèÒª½¨Á¢ {\ttfamily ttyS0} Éè±¸£º
\begin{tscreen}
\begin{verbatim}
linux# mknod -m 666 /dev/cua0 c 5 64
linux# mknod -m 666 /dev/ttyS0 c 4 64
\end{verbatim}
\end{tscreen}

ÄãÒ²¿ÉÒÔÊ¹ÓÃ {\ttfamily MAKEDEV} Õâ¸öÖ¸Áî¸å£¬ÔÚ {\ttfamily /dev} ÏÂÓ¦¸Ã»áÓÐ£®
Õâ¼ò»¯ÁËÉè±¸µÄ½¨Á¢£®ÀýÈç£¬Èç¹ûÄãÐèÒª½¨Á¢ {\ttfamily ttyS0} Éè±¸ÔòÓ¦¸ÃÊäÈë£º
\begin{tscreen}
\begin{verbatim}
linux# cd /dev
linux# ./MAKEDEV ttyS0
\end{verbatim}
\end{tscreen}

Õâ½«»á´¦Àí¹Øì¶Á¬Ïß½øÀ´ÒÔ¼°Á¬Ïß³öÈ¥µÄÉè±¸Ö®½¨Á¢£¬²¢Éè¶¨ÕýÈ·µÄÈ¨ÏÞ£®




\subsection{Ò»°ã¶à²º°åµÄ×¢ÒâÊÂÏî}

ÄãµÄ¶à²º°åËùÊ¹ÓÃµÄÉè±¸ÊÓÄãÊ¹ÓÃÄÇÒ»ÖÖ¶à²º°å¶ø¶¨£®
ÕâÐ©Ï¸½ÚÏêÏ¸ÁÐÔÚËæ¸½ì¶ {\ttfamily setserial} ³ÌÊ½µÄ {\ttfamily rc.serial} ÀïÃæ£®
Èç¹ûÄã³¢ÊÔÊ¹ÓÃ¶à²º°åµÄ»°ÎÒÇ¿ÁÒ½¨ÒéÄãÈ¡µÃ×îÐÂ°æ±¾µÄ {\ttfamily setserial}£®
Äã¿ÉÄÜ»áÐèÒª½¨Á¢ÕâÐ©Éè±¸£®ÎÞÂÛÊÇÓÃ {\ttfamily mknod} Ö¸Áî»òÊÇ {\ttfamily MAKEDEV} Ö¸Áî¸å¶¼¿ÉÒÔ£®
¶à²º°åËùÓÃÉè±¸ÊÇÒÔ¼ÓÉÏ ``64 + ²ººÅ'' À´½¨Á¢µÄ£®ËùÒÔ£¬Èç¹ûÄãÏëÎª {\ttfamily ttyS17} ½¨Á¢Éè±¸£¬ÄãÓ¦¸ÃÊäÈë£º
\begin{tscreen}
\begin{verbatim}
linux# mknod -m 666 /dev/cua17 c 5 81
linux# mknod -m 666 /dev/ttyS17 c 4 81
\end{verbatim}
\end{tscreen}

Òª×¢Òâµ½ ''64 + 17 = 81''£®Ê¹ÓÃ {\ttfamily MAKEDEV} Ö¸Áî¸åµÄ»°£¬ÄãÓ¦¸ÃÊäÈë£º
\begin{tscreen}
\begin{verbatim}
linux# cd /dev
linux# ./MAKEDEV ttyS17
\end{verbatim}
\end{tscreen}


×¢Òâ: SIIG µÄ IO1812 ÊÖ²áÉÏÁÐ³öµÄ COM5-COM8 ÊÇ´íµÄ£®ËüÃÇÓ¦¸ÃÊÇ COM5=0x250, COM6=0x258, COM7=0x260, ÒÔ¼°     COM8=0x268£®

×¢Òâ: Digi PC/8 Interrupt Status Register ÊÇ 0x140£®

×¢Òâ: ¶Ôì¶ AST Fourport£¬Äã±ØÐëÔÚ {\ttfamily rc.serial} ÖÐÖ¸¶¨ {\ttfamily skip\_test}£®




\subsection{ÖÇ»ÛÐÍ¶à²º°åµÄ×¢ÒâÊÂÏî}

ÔÄ¶ÁËæ¸½Çý¶¯³ÌÊ½¶øÀ´µÄ×ÊÑ¶£®
ÕâÐ©°åÊ¹ÓÃÁËÌØÊâµÄ×°ÖÃ£¬¶ø·Ç±ê×¼µÄ£®ÕâÐ©×ÊÑ¶ÊÓÄãµÄÓ²Ìå¶ø¶¨£®




\section{ÄãÓ¦ÖªµÀµÄÓÐÈ¤³ÌÊ½}


\subsection{Ê²÷áÊÇ {\ttfamily getty}?}

{\ttfamily getty} ÊÇÔÚÄãÇ©Èë Unix »úÆ÷µÄÊ±ºò´¦ÀíÇ©Èë³ÌÐòµÄÒ»Ö§³ÌÊ½£®
Èç¹ûÄãÏ£ÍûÄãµÄ Linux »úÆ÷ÄÜ¹»Ê¹ÓÃÊý¾Ý»ú²¦ÈëµÄ»°Äã»áÐèÒª {\ttfamily getty}£®
Èç¹ûÄãÖ»ÐèÒªÓÃÊý¾Ý»ú²¦³öµÄ»°Äã²»ÐèÒªÓÃ {\ttfamily getty}£®
ÓÐÈýÖÖ¾­³£ÅäºÏ Linux Ê¹ÓÃµÄ°æ±¾: {\ttfamily getty\_ps}, {\ttfamily mgetty} ÒÔ¼° {\ttfamily agetty}£®
ÕâÐ©³ÌÊ½µÄÓï·¨ÊÇ²»Í¬µÄ£¬ËùÒÔ²»ÂÛÄãÓÃÊ²÷á {\ttfamily getty} ÇëÈ·¶¨ÄãÊ¹ÓÃÁËÕýÈ·µÄÓï·¨£®




\subsubsection{¹Øì¶ {\ttfamily getty\_ps}}

        
´ó²¿·Ö Linux  °²×°Ì×¼þ¶¼°²×°ÁË {\ttfamily getty\_ps} Ì×¼þ£®Ëü°üº¬ÁËÁ½¸ö³ÌÊ½:
{\ttfamily getty} ÊÇÓÉÖ÷¿ØÌ¨£¬ÒÔ¼°ÖÕ¶Ë»úÉè±¸ËùÊ¹ÓÃ£¬¶ø {\ttfamily uugetty} ÔòÊÇÓÉÊý¾Ý»úËùÊ¹ÓÃµÄ£®
ÒòÎªÎÒ±¾ÉíÊÇÊ¹ÓÃÕâ¸ö°æ±¾µÄ {\ttfamily getty}£¬ËùÒÔÔÚÕâ·ÝÎÄ¼þÖÐÎÒ½«»áÖøÖØì¶´ËÌ×¼þ£®




\subsubsection{¹Øì¶ {\ttfamily mgetty}}

{\ttfamily mgetty} ÊÇÒ»¸öÔÚÊý¾Ý»úÉÏÊ¹ÓÃµÄ {\ttfamily getty} °æ±¾£®
³ýÁËÄÜ¹»ÔÊÐíÇ©ÈëÖ®Íâ£¬ {\ttfamily mgetty} Ò²Ìá¹©´«Õæ(FAX)Ö§Ô®¼°×Ô¶¯ PPP Õì²â£®
ÕâÌ× {\ttfamily mgetty} µÄÎÄ¼þÐ´µÃÏàµ±µØºÃ£¬Òò¶ø²»ÐèÒªÔÙ²¹³äÊ²÷á£®Çë²Î¿¼ËüµÄ°²×°ËµÃ÷£®
ÄãÒ²¿ÉÒÔÔÚ {\ttfamily \onlynameurl{http://www.leo.org/\~{}doering/mgetty/}} ÕÒµ½ {\ttfamily mgetty} µÄ×îÐÂ×ÊÑ¶£®




\subsubsection{¹Øì¶ {\ttfamily agetty}}

{\ttfamily agetty} ÊÇµÚÈýÖÖ {\ttfamily getty} ±äÐÍ£®
ËüÊÇ {\ttfamily getty} Ò»¸ö¼òµ¥µÄ£¬ÍêÕûµÄ¹¦ÄÜÊµ×÷£¬ÊÊºÏÓÃÔÚÐéÄâÖ÷¿ØÌ¨»òÖÕ¶Ë»ú¶ø·ÇÊý¾Ý»úÉÏ£®




\subsection{Ê²÷áÊÇ {\ttfamily setserial}?}

{\ttfamily setserial} ÊÇÒ»Ö§¿ÉÒÔÈÃÄã²é¿´²¢ÐÞ¸Ä´®ÁÐÉè±¸¸÷ÖÖÊôÐÔµÄ³ÌÊ½£¬°üÀ¨ËüÃÇËùÊ¹ÓÃµÄ²ºÎ»Ö·£¬ÖÐ¶Ï£¬ÒÔ¼°ÆäËü´®ÁÐ²ºÑ¡Ïî£®
Äã¿ÉÒÔ½åÓÉÖ´ÐÐ²»¼Ó²ÎÊýµÄ {\ttfamily setserial} À´»ñÈ¡°æ±¾Ñ¶Ï¢£®

ÔÚÄãµÄ  Linux ÏµÍ³Æô¶¯Ê±£¬Ö»ÓÐ {\ttfamily ttyS$\{$0-3$\}$} »áÒÔÔ¤ÉèµÄ IRQ 4 ÒÔ¼° 3 À´½øÐÐÅäÖÃ£®
ËùÒÔ£¬Èç¹ûÄãÓÐÈÎºÎÓÉÆäËü½çÃæ¿¨Ìá¹©µÄ´®ÁÐ²º»òÊÇ {\ttfamily ttyS$\{$0-3$\}$} Ê¹ÓÃ·Ç±ê×¼µÄÓ²ÌåÖÐ¶Ï(IRQ)µÄ»°£¬
Äã{\itshape ±ØÐë\/}ÓÃÕâÖ§³ÌÊ½À´ÅäÖÃÕâÐ©´®ÁÐ²º£®ÒªÖªµÀËùÓÐµÄÑ¡ÏîÇë²Î¿¼ÏßÉÏÊÖ²á£®




\section{ÎÒÔõ÷áÓÃÊý¾Ý»ú²¦ºÅ³öÈ¥?\label{dialout}}


\subsection{Ó²ÌåÐèÇó}

Ê×ÏÈ£¬ÒªÈ·¶¨ÄãÓµÓÐÕýÈ·µÄÁ¬½ÓÏß£®ÄãµÄÊý¾Ý»úÐèÒªÒ»ÌõÖ±½ÓµÄ (straight through) Á¬½ÓÏß£¬Ã»ÓÐÈÎºÎÌøÏß (no pins crossed)£®
ÈÎºÎÒ»¼ÒµçÄÔÉÌµê¶¼ÓÐ£®ÒªÈ·¶¨½ÓÍ·µÄÐÎÊ½ÊÇ¶ÔµÄ£®Èç¹ûÄãÊ¹ÓÃµÄÊÇ DB25 ´®ÁÐ²º£¬ËüÓ¦¸ÃÊÇ¹«µÄ DB25 ½ÓÍ·£®
°ÑÄãµÄÊý¾Ý»ú½Óµ½ÆäÖÐÒ»¸ö´®ÁÐ²ºÉÏ£®Èç¹ûÄãÐèÒª¹Øì¶Õâ¸ö¶¯×÷µÄ¸¨ÖúËµÃ÷Çë²Î¿¼ÄãµÄÊý¾Ý»úÊÖ²á£®




\subsubsection{ÄÚ½ÓÊ½Êý¾Ý»ú×¢ÒâÊÂÏî}

¶Ôì¶ÄÚ½ÓÊ½Êý¾Ý»ú¶øÑÔ£¬Äã²»ÐèÒªÁ¬½ÓÏß£®ÄÚ½ÓÊ½Êý¾Ý»ú²»ÐèÒª´®ÁÐ²º£¬Ëü×Ô¼ºÓÐÄÚ½¨Ò»¸ö£®
ÄãÖ»ÒªÅäÖÃÒ»¸öÃ»ÓÐ±»Ê¹ÓÃµÄÓ²ÌåÖÐ¶Ï¸øËü£¬²¢ÇÒÅäÖÃ¸Ã²ºµÄÊä³öÈëÎ»Ö·£®Èç¹ûÄã¿¨ÔÚÄ³¸öÎÊÌâÉÏÇë²Î¿¼ÄãµÄÊý¾Ý»úÊÖ²á£®
Í¬Ñù£¬Èç¹ûÄãÐèÒª¹Øì¶Ñ¡ÔñÖÐ¶ÏÒÔ¼°Î»Ö·ÉÏµÄ°ïÖú£¬²ÎÔÄ \ref{irqaddr} {(ÎÒÄÜÊ¹ÓÃ³¬¹ýÁ½¸öµÄ´®ÁÐ×°ÖÃÂð?)} Ò»½ÚµÄËµÃ÷£®

ÔÚÄ³Ð©Ö÷»ú°åÉÏÄã±ØÐë¹Øµô±»Êý¾Ý»úÈ¡´úµÄ´®ÁÐ²ºÒÔ±ÜÃâ³åÍ»£®
Õâ¿É¾­ÓÉÌøÏß»ò BIOS µÄÉè¶¨À´°ìµ½£¬ÊÓÄãµÄÖ÷»ú°å¶ø¶¨£®²éÔÄÄãµÄÖ÷»ú°åÊÖ²á£®

ÓÉì¶ IBM8514 ÊÓÑ¶¿¨µÄÒ»¸ö´íÎó£¬Èç¹ûÄãÏëÒª½«ÄãµÄÄÚ½ÓÊ½Êý¾Ý»úÉèÔÚ {\ttfamily ttyS3} µÄ»°¿ÉÄÜ»áÔâÓöÒ»Ð©ÎÊÌâ£®
Èç¹û Linux Ã»ÓÐÕì²âµ½ÄãÉèÔÚ {\ttfamily ttyS3} ÉÏµÄÄÚ½ÓÊ½Êý¾Ý»ú£¬Äã¿ÉÒÔÊ¹ÓÃ {\ttfamily setserial} ³ÌÊ½À´Éè¶¨È»ááÊý¾Ý»ú½«»áÕý³£ÔË×÷£®
ÉèÔÚ {\ttfamily ttyS$\{$0-2$\}$} ÉÏµÄÄÚ½ÓÊ½Êý¾Ý»úÔÚÕì²âÉÏÓ¦¸Ã²»»áÓÐÈÎºÎÎÊÌâ£®
ÓÉì¶´ËÊÓÑ¶¿¨µÄ´íÎó Linux ÔÚ {\ttfamily ttyS3} Ã»ÓÐÈÎºÎ×Ô¶¯Õì²âµÄ¶¯×÷£®




\subsection{ÓëÄãµÄÊý¾Ý»ú½»Ì¸}

ÔÚÄãÊ¹ÓÃ¸´ÔÓµÄÍ¨Ñ¶³ÌÊ½Èç SLIP »ò PPP Ö®Ç°ÏÈÒÔ {\ttfamily kermit} »òÆäËü¼òµ¥µÄÍ¨Ñ¶³ÌÊ½À´²âÊÔÕâÐ©Éè¶¨£®
Äã¿ÉÒÔ´Ó {\ttfamily \onlynameurl{http://www.columbia.edu/kermit/}} ÒÔ¼°Ó³Éä½ÚµãÉÏÕÒµ½×îÐÂµÄ {\ttfamily kermit} °æ±¾£®
ÀýÈç£¬ÒªÊÇÄãµÄÊý¾Ý»úÉèÔÚ {\ttfamily ttyS3} ÉÏ£¬¶øÇÒ¿ÉÒÔ½ÓÊÜ 115200 bps µÄ»°£¬Äã¿ÉÒÔÕâÑù×ö:
\begin{tscreen}
\begin{verbatim}
linux# kermit
C-Kermit 6.0.192, 6 Sep 96, for Linux
 Copyright (C) 1985, 1996,
  Trustees of Columbia University in the City of New York.
Default file-transfer mode is BINARY
Type ? or HELP for help.
C-Kermit>set line /dev/ttyS3
C-Kermit>set carrier-watch off
C-Kermit>set speed 115200
/dev/ttyS3, 115200 bps
C-Kermit>c
Connecting to /dev/ttyS3, speed 115200.
The escape character is Ctrl-\ (ASCII 28, FS)
Type the escape character followed by C to get back,
or followed by ? to see other options.
ATE1Q0V1                           ; ÕâÊÇÄã¼üÈëµÄ²¢°´ÏÂ Enter ¼ü
OK                                 ; Êý¾Ý»úÓ¦¸Ã»ØÓ¦Õâ¸ö
\end{verbatim}
\end{tscreen}


Èç¹ûÄãµÄÊý¾Ý»ú¶Ô {\ttfamily AT} Ö¸ÁîÈºÓÐ»ØÓ¦£¬ÄÇ÷áÄã¿ÉÒÔ¼Ù¶¨ÄãµÄÊý¾Ý»úÔÚ Linux ÕâÒ»¶ËÄÜÕýÈ·ÔË×÷£®
ÏÖÔÚÊÔÖø²¦¸øÁíÒ»Ì¨Êý¾Ý»ú:
\begin{tscreen}
\begin{verbatim}
ATDT7654321
\end{verbatim}
\end{tscreen}

ÆäÖÐ 7654321 ÊÇÒ»¸öµç»°ºÅÂë£®Èç¹ûÄãµÄÊÇÂö³åÏßÂ·(pulse line)µÄ»°ÓÃ ATDP ¶ø²»ÊÇ ATDT£®
Èç¹û¿ÉÒÔ²¦µÃ³öÈ¥£¬ÄãµÄÊý¾Ý»ú¾Í¿ÉÕý³£ÔË×÷£®



»Øµ½ {\ttfamily kermit} µÄÌáÊ¾·ûºÅÏÂ£¬°´×¡ Ctrl ¼ü£¬°´ÏÂ $\backslash$ (backslash) Â¼£¬È»áá·Å¿ª Ctrl Â¼£¬ÔÙ°´ÏÂ C ¼ü:
\begin{tscreen}
\begin{verbatim}
Ctrl-\-C
(Back at linux)
C-Kermit>quit
linux#
\end{verbatim}
\end{tscreen}


Õâ¸ö²»¹ýÊÇÓÃ"ÊÖ¶¯"·½Ê½µÄ²¦ºÅ²âÊÔ£®Õý³£µÄ·½·¨ÊÇÈÃ {\ttfamily kermit} ÓÃËüÄÚ½¨µÄÊý¾Ý»ú×ÊÁÏ¿â×Ô¶¯ÎªÄã²¦ºÅ£¬ÀýÈç£¬Ê¹ÓÃ US Robotics (USR) modem:

\begin{tscreen}
\begin{verbatim}
linux# kermit
C-Kermit 6.0.192, 6 Sep 1997, for Linux
 Copyright (C) 1985, 1996,
  Trustees of Columbia University in the City of New York.
Default file-transfer mode is BINARY
Type ? or HELP for help
C-Kermit>set modem type usr        ; Ñ¡ÔñÊý¾Ý»úÐÍÊ½
C-Kermit>set line /dev/ttyS3       ; Ñ¡ÔñÍ¨Ñ¶×°ÖÃ
C-Kermit>set speed 115200          ; Éè¶¨Í¨Ñ¶ËÙ¶È
C-Kermit>dial 7654321              ; ²¦ºÅ
 Number: 7654321
 Device=/dev/ttyS3, modem=usr, speed=115200
 Call completed.<BEEP>
Connecting to /dev/ttyS3, speed 115200
The escape character is Ctrl-\ (ASCII 28, FS).
Type the escape character followed by C to get back,
or followed by ? to see other options.

Welcome to ...

login:
\end{verbatim}
\end{tscreen}


Èç¹ûÄãÐèÒªÒ»Ð©Ö¸Òý£¬²éÔÄÓÐ¹Ø \ref{comms} {(Í¨Ñ¶ÈíÌå)} Ò»½ÚËµÃ÷£®



µ±ÄãÓÃÄãµÄÊý¾Ý»ú²¦ºÅ³öÈ¥Ê±£¬½«ÄãµÄÊý¾Ý»úÉèµ½ËüËùÄÜÖ§Ô®µÄ×î¸ßËÙ¶È£®
Linux µÄ {\ttfamily libc} 5.x °æÒÔÉÏÒÑ¾­Ö§Ô®µ½ 115200 bps£®
{\ttfamily libc} Í¨³£·ÅÔÚ {\ttfamily /lib}£¬Òò´Ëµ½ÄÇÀï¿´Ò»ÏÂÄãÓÃÊ²÷á°æ±¾£®
Èç¹û Linux ÎÞ·¨ÈÏµÃ 57600 »ò 115200 bps£¬ÄÇ÷áÄã±ØÐëÓÃ {\ttfamily setserial} ³ÌÊ½À´½«ÄãµÄ´®ÁÐ²ºÉèµ½¸ü¸ßµÄËÙ¶È£®
¹Øì¶ÒªÔõ÷áÉè¶¨²ÎÔÄ \ref{spdhi} {(ÈçºÎ½«ÎÒµÄ´®ÁÐ²ºÉè¶¨Îª¸ü¸ßËÙ¶È?)} ¸Ã½ÚËµÃ÷£®
È»ááÔÚÍ¨Ñ¶³ÌÊ½Àï½«ËÙ¶ÈÉèµ½ 38400 bps£®




\subsection{²¦³öÓÃµÄÊý¾Ý»úÅäÖÃ}

Ö»Òª²¦ºÅ³öÈ¥µÄ»°£¬Äã¿ÉÒÔÈÎÒâÒÔÄãÏëÒªµÄ·½Ê½ÅäÖÃÄãµÄÊý¾Ý»ú£®
Èç¹ûÄã¼Æ»­ÓÃÄãµÄÊý¾Ý»úÀ´½ÓÊÜ²¦½Ó£¬ÄÇ÷áÄã{\itshape ±ØÐë\/}½«ÄãµÄÊý¾Ý»úÅäÖÃ³ÉÓëÄãÏëÒªÖ´ÐÐµÄ {\ttfamily getty} ÔÚÏàÍ¬ËÙ¶ÈÉè¶¨ÏÂ£®
ËùÒÔ£¬Èç¹ûÄãÏëÒªÔÚ 38400 bps µÄËÙ¶ÈÏÂÖ´ÐÐ {\ttfamily getty} µÄ»°£¬ÔÚÅäÖÃÄãÊý¾Ý»úµÄÊ±ºò½«ËÙ¶ÈÉè³É 38400 bps£®
ÕâÑù×öÊÇÎªÁË±ÜÃâÄãµÄµçÄÔÓëÊý¾Ý»úÖ®¼äµÄËÙ¶ÈÎÞ·¨ÅäºÏ£®
Ò»°ãÀ´Ëµ£¬¿ªÆô´íÎóÐ£Õý¼°Ó²ÌåÁ÷Á¿¿ØÖÆµÄ³ö³§Éè¶¨ÖµÊÇ×îÊÊºÏ²¦³öÓÃµÄÊý¾Ý»ú£¬ÕâÐ©Éè¶¨Öµ¿É²éÔÄÄãµÄÊý¾Ý»úÊÖ²á£®




\subsection{Ó²ÌåÁ÷Á¿¿ØÖÆ}

Èç¹ûÄãµÄÊý¾Ý»úÖ§Ô®Ó²ÌåÁ÷Á¿¿ØÖÆ(RTS/CTS)µÄ»°£¬ ÎÒÇ¿ÁÒµØ½¨ÒéÄãÈ¥Ê¹ÓÃËü£®
Õâ¶Ôì¶Ö§Ô®×ÊÁÏÑ¹ËõµÄÊý¾Ý»ú½«¸ñÍâÖØÒª£®Ê×ÏÈ£¬Äã±ØÐëÔÚ´®ÁÐ²º±¾ÉíÉÏÃæÆô¶¯ RTS/CTS Á÷Á¿¿ØÖÆ¹¦ÄÜ£®
Õâ×îºÃÊÇÔÚÆô¶¯ÏµÍ³µÄÊ±ºò×ö£¬ÏñÊÇ·ÅÔÚ {\ttfamily /etc/rc.d/rc.local} »òÊÇ {\ttfamily /etc/rc.d/rc.serial} ÀïÃæ£®
ÒªÈ·¶¨ÕâÐ©µµ°¸»á±»Ö÷ÒªµÄ {\ttfamily rc.sysinit} µµ°¸Ö´ÐÐ£¡ÄãÐèÒª¶ÔÃ¿Ò»¸öÄãÏëÒªÆô¶¯Ó²ÌåÁ÷Á¿¿ØÖÆµÄ´®ÁÐ²ºÖ´ÐÐÏÂÁÐ²Ù×÷£º
\begin{tscreen}
\begin{verbatim}
stty crtscts < /dev/ttyS3
\end{verbatim}
\end{tscreen}
 
ÄãÒ²±ØÐëÔÚÄãµÄÊý¾Ý»úÉÏÆô¶¯ RTC/CTS  Á÷Á¿¿ØÖÆ£®ÒªÔõ÷á×öÇë²Î¿¼ÄãµÄÊý¾Ý»úÊÖ²á£¬ÒòÎªÕâÔÚ²»Í¬µÄÊý¾Ý»úÖÆÔìÉÌÖ®¼äÊÇ²»Í¬µÄ£®
Èç¹ûÄãµÄÊý¾Ý»úÖ§Ô®Éè¶¨´¢´æµÄ»°ÔòÒªÈ·¶¨½«ÅäÖÃ´æÈëÄãµÄÊý¾Ý»ú£®




\section{ÎÒÒªÔõ÷áÑùÓÃÊý¾Ý»úÒÔ {\ttfamily getty\_ps} ²¦Èë¼°²¦³ö?}

ÈÃÄãµÄÊý¾Ý»úÄÜ¹»ÕýÈ·µØ²¦ºÅ³öÈ¥£®Èç¹ûÄã»¹Ã»ÓÐ¶Á¹ý \ref{dialout} {(ÎÒÔõ÷áÓÃÊý¾Ý»ú²¦ºÅ³öÈ¥)} Ò»½ÚµÄ»°{\itshape ÏÖÔÚÈ¥¶Á\/}£¡
Ëü°üº¬ÓÐ{\itshape ·Ç³£\/}ÖØÒªµÄÉè¶¨×ÊÑ¶£®Èç¹ûÄãÖ»ÏëÓÃÊý¾Ý»úÀ´{\itshape ²¦³ö\/}µÄ»°Äã{\itshape ²»ÐèÒª\/}¶Á´Ë½Ú£®




\subsection{²¦Èë¼°²¦³öµÄÊý¾Ý»úÅäÖÃ}

ÒªÓÃÀ´½ÓÊÜ²¦½ÓÒÔ¼°²¦ºÅ³öÈ¥µÄ»°£¬ÄÇ÷áÄã{\itshape ±ØÐë\/}È·ÊµµØÉè¶¨ÄãµÄÊý¾Ý»ú£¨ÔÙÒ»´Î¶ÔÄãµÄÊý¾Ý»úÊ¹ÓÃ {\ttfamily AT} Ö¸ÁîÈº£©£º
\begin{tscreen}
\begin{verbatim}
E1       ±¾µØ»ØÓ¦Ö¸Áî
Q0       »Ø±¨½á¹û»ØÓ¦
V1       ¿ªÆôÈß³¤Ä£Ê½
S0=0     ²»Òª½ÓÌý (uugetty ÒÔ WAITFOR Ñ¡ÏîÀ´´¦Àí)
\end{verbatim}
\end{tscreen}

Èç¹ûÄãÃ»ÓÐÕýÈ·µØÉè¶¨£¬·ÅÔÚÄãÅäÖÃµµÀïµÄÆðÊ¼({\ttfamily INIT})×Ö´®¿ÉÄÜ»áÊ§°Ü£¬Òò¶øÍ£×¡Õû¸ö³ÌÐò£®
µ«ÊÇ£¬ÏÂÃæÓÐ¸ü¶àÅäÖÃµµµÄÑ¡Ïî...
\begin{tscreen}
\begin{verbatim}
&C1     DCD Ö»ÓÐÔÚÁ¬ÏßÒÔáá²Å¿ªÆô
&S0     DSR ÓÀÔ¶Îª¿ªÆô
        DTR ¿ªÆô/¹Ø±Õ ÖØÖÃÊý¾Ý»ú£¨ÊÇÊý¾Ý»úÖÆÔìÉÌ¶ø¶¨ - RTFM)
\end{verbatim}
\end{tscreen}

ÕâÐ©»áÓ°ÏìÄãÊý¾Ý»úÓÐ¹Ø¿ªÊ¼ÒÔ¼°½áÊø²¦ºÅµÄ¶¯×÷£®

Èç¹ûÄãµÄÊý¾Ý»ú²»Ö§Ô®´¢´æÉè¶¨£¬Äã¿ÉÒÔÍ¸¹ýÔÚÄãÅäÖÃµµÀïµÄÆðÊ¼×Ö´®À´Éè¶¨ÕâÐ©¶«Î÷£®
²ÎÔÄÏÂÃæËùÊö£®ÓÐÒ»Ð©Êý¾Ý»úÊÇÒÔ DIP ¿ª¹ØÀ´Ó°ÏìÔÝ´æÆ÷µÄÉè¶¨£¬Ò²ÒªÈ·¶¨ÕâÐ©Éè¶¨ÊÇÕýÈ·µÄ£®

ÎÒÒÑ¾­¿ªÊ¼ÖøÊÖÊÕ¼¯²»Í¬ÖÖÀàÊý¾Ý»úµÄÉè¶¨£®
µ½Ä¿Ç°ÎªÖ¹£¬ÎÒ»¹Ö»ÓÐËüÃÇµÄÒ»Ð¡²¿·Ö£¬Èç¹ûÄãÏëÒª¼ÄËÍ¸øÎÒÄãÄ¿Ç°ËùÓÃÅäÖÃ£¬·Ç³£»¶Ó­!
Äã¿ÉÒÔ´ÓÕâÐ©È¡µÃÉèÐ©Éè¶¨: {\ttfamily \onlynameurl{ftp://ftp.cc.gatech.edu/pub/people/gregh/modem-configs}}£®

×¢Òâ: ÎªÁËÈÃÎÒµÄ USR Courier V.34 Êý¾Ý»úÔÚ DTR Ñ¶ºÅµôÏÂÈ¥ááÕý³£µØÖØÖÃ£¬ÎÒ±ØÐëÉè¶¨ {\ttfamily \&D2} ¼° {\ttfamily S13=1}(ÕâÊÇÉè¶¨ÔÝ´æÆ÷ S13 µÄ bit 0)£®ÕâÈ·¶¨ÄÜÔÚ USR Sportster V.34 ÉÏÔË×÷Õý³££®

×¢Òâ: Ä³Ð© Supra Êý¾Ý»ú´¦Àí DCD Ñ¶ºÅµÄ·½Ê½Òìì¶ÆäËüµÄÊý¾Ý»ú£®
Èç¹ûÄãÔÚÓÃ Supra Êý¾Ý»ú£¬ÊÔÖøÉè¶¨Îª {\ttfamily \&C0} ¶ø{\itshape ²»ÊÇ\/} {\ttfamily \&C1}£®
ÄãÒ²±ØÐëÉè¶¨ {\ttfamily \&D2} Ê¹Ö®Õý³£µØ´¦Àí DTR Ñ¶ºÅ£®




\subsection{°²×° {\ttfamily getty\_ps}}

´Ó {\ttfamily \onlynameurl{ftp://sunsite.unc.edu/pub/Linux/system/serial}} ×îÐÂµÄ°æ±¾£®
ÌØ±ðµØ£¬Èç¹ûÄãÏëÊ¹ÓÃ¸ßËÙÍ¨Ñ¶(57600 »ò 115200 bps)£¬Äã±ØÐëÈ¡µÃ 2.0.7j »òÒÔááµÄ°æ±¾£®
ÄãÒ²±ØÐëÓÐ libc 5.x »òÖ®ááµÄ°æ±¾£®

ÒÀÕÕÔ¤ÉèÖµ£¬{\ttfamily getty\_ps} ½«»áÕÕ Linux µÄµµ°¸ÏµÍ³±ê×¼(FSSTND, File System Standard)À´ÅäÖÃ£¬Õâ¸öÒâË¼ÊÇ¶þ½øÎ»Âë½«»á·ÅÔÚ {\ttfamily /sbin} ÏÂ£¬¶øÅäÖÃµµ½«»áÒÔ {\ttfamily /etc/conf.$\{$uu$\}$getty.ttyS}{\itshape N\/} À´ÃüÃû£®
Õâµã²¢²»ÄÜ´ÓÎÄ¼þÐðÊöÖÐÕÒµ½£¡ËüÒ²»á¼Ù¶¨ lock files ½«µÃÒª·Åµ½ {\ttfamily /var/lock} Ä¿Â¼Àï£®ÒªÈ·¶¨ÄãÓÐ {\ttfamily /var/lock} Õâ¸öÄ¿Â¼£®

Èç¹ûÄã²»ÏëÒÀÕÕ FSSTND µÄ»°£¬¶þ½øÎ»Âë½«»á·Åµ½ {\ttfamily /etc} ÀïÃæ£¬¶øÅäÖÃµµ½«»á·Åµ½ {\ttfamily /etc/default/$\{$uu$\}$getty.ttyS}{\itshape N\/} ÀïÃæ£¬¶ø lock files Ôò½«»á·Åµ½ {\ttfamily /usr/spool/uucp} ÀïÃæ£®
Èç¹ûÄãÓÐÊ¹ÓÃ UUCP µÄ»°ÄÇ÷áÎÒ½¨ÒéÕâÑù×ö£¬ÒòÎªÈç¹ûÄã°Ñ lock files °áµ½ UUCP ÎÞ·¨ÕÒµ½µÄµØ·½È¥ÄÇ÷áËü½«»á³öÎÊÌâµÄ£®

{\ttfamily getty\_ps} Ò²¿ÉÊ¹ÓÃ {\ttfamily syslogd} À´¼ÇÂ¼Ñ¶Ï¢£®Èç¹ûÄãÄ¿Ç°Ã»ÓÐÖ´ÐÐËüµÄ»°£¬²ÎÔÄ {\ttfamily syslogd(1)} ÒÔ¼° {\ttfamily syslog.conf(5)} µÄÏßÉÏÊÖ²áÀ´Éè¶¨ {\ttfamily syslogd}£®
Ñ¶Ï¢»áÓÅÏÈÒÔ LOG\_AUTH ¼ÇÂ¼£¬´íÎóÊ¹ÓÃ LOG\_ERR ¼ÇÂ¼£¬¶ø³ý´íÊ¹ÓÃ LOG\_DEBUG£®
Èç¹ûÄã²»ÏëÊ¹ÓÃ syslogd µÄ»°ÄÇ÷áÄã¿ÉÒÔ±à¼­ÔÚ {\ttfamily getty\_ps} Ô­Ê¼µµ°¸ÀïµÄ {\ttfamily tune.h} ÓÃÒ»¸ö¼ÇÂ¼µµÀ´È¡´ú£¬Ô¤ÉèµµÃûÎª {\ttfamily /var/adm/getty.log}£®

        
¾ö¶¨ºÃÊÇ·ñÒªÒÀÕÕ FSSTND ÒÔ¼°Ê¹ÓÃ syslog£®ÄãÒ²¿ÉÒÔÑ¡ÔñÁ½ÕßµÄ×éºÏ£®
±à¼­ {\ttfamily Makefile}£¬{\ttfamily tune.h} ÒÔ¼° {\ttfamily config.h} À´·´Ó¦ÄãËù×÷µÄ¾ö¶¨£®
È»áá£¬¸ù¾ÝÌ×¼þÀïµÄËµÃ÷±àÒë¼°°²×°£®

        

´ÓÏÖÔÚÆð£¬ËùÓÐÌ¸µ½ {\ttfamily getty} µÄµØ·½¶¼ÊÇÖ¸ {\ttfamily getty\_ps} ¶øÑÔ£®
Ì¸µ½ {\ttfamily uugetty} ÔòÊÇÖ¸ {\ttfamily getty\_ps} Ì×¼þÀïµÄ {\ttfamily uugetty} ¶øÑÔ£®
ÕâÐ©Ö¸ÁîÔÚ {\ttfamily mgetty} »ò {\ttfamily agetty} ÉÏ½«²»ÄÜÔË×÷£®




\subsection{Éè¶¨ {\ttfamily uugetty}}

ÎªÁËÒªÄÜ´ÓÄãµÄÊý¾Ý»ú²¦Èë¼°²¦³ö£¬ÎÒÃÇÏëÒªÓÃ {\ttfamily uugetty}£®uugetty Ö´ÐÐºÜÖØÒªµÄ lock file ¼ì²é£®
Èç¹ûÃ»ÓÐµÄ»°¸üÐÂ {\ttfamily /etc/gettydefs} ÒÔ±ãÎªÊý¾Ý»úÔö¼ÓÏîÄ¿(×¢Òâµ½ÕâÀïµÄÏîÄ¿»¥Ïà²Î¿¼£¬ËüÃÇ²¢·Ç¹Ì¶¨ËÙ¶È - Ã¿¸öÏîÄ¿Ö®¼äµÄ¿Õ°×ÐÐÊÇ±ØÒªµÄ):
\begin{tscreen}
\begin{verbatim}
# Modem entries
115200# B115200 CS8 # B115200 SANE -ISTRIP HUPCL #@S @L @B login: #57600

57600# B57600 CS8 # B57600 SANE -ISTRIP HUPCL #@S @L @B login: #38400

38400# B38400 CS8 # B38400 SANE -ISTRIP HUPCL #@S @L @B login: #19200

19200# B19200 CS8 # B19200 SANE -ISTRIP HUPCL #@S @L @B login: #9600

9600# B9600 CS8 # B9600 SANE -ISTRIP HUPCL #@S @L @B login: #2400

2400# B2400 CS8 # B2400 SANE -ISTRIP HUPCL #@S @L @B login: #115200
\end{verbatim}
\end{tscreen}


Èç¹ûÄãÓÐ 9600 bps »ò¸ü¿ìÇÒ¾ß×ÊÁÏÑ¹Ëõ¹¦ÄÜµÄÊý¾Ý»ú£¬Äã¿ÉÒÔËø¶¨ÄãµÄ´®ÁÐ²ºËÙ¶È¶øÈÃÊý¾Ý»úÈ¥´¦Àí´«ÊäµÄÆäËüËÙ¶È£®
È»áá£¬²»ÏñÉÏÃæÔÚ {\ttfamily /etc/gettydefs} ÀïµÄÒ»Á¬´®ÁÐ±í£¬Ö»ÐèÎªÊý¾Ý»ú¼ÓÉÏÒ»ÐÐ£¬ÀýÈç:
\begin{tscreen}
\begin{verbatim}
# 115200 fixed speed
F115200# B115200 CS8 # B115200 SANE -ISTRIP HUPCL #@S @L @B login: #F115200
\end{verbatim}
\end{tscreen}


        
Èç¹ûÄã½«ÄãµÄÊý¾Ý»úÉè³É RTS/CTS Ö´ÐÐÓ²ÌåÁ÷Á¿¿ØÖÆµÄ»°£¬ÄÇ÷áÄã¿ÉÒÔ½« {\ttfamily CRTSCTS} ¼Óµ½ÕâÐ©ÏîÄ¿Àï£º
\begin{tscreen}
\begin{verbatim}
# 115200 fixed speed with hardware flow control
F115200# B115200 CS8 CRTSCTS # B115200 SANE -ISTRIP HUPCL CRTSCTS #@S @L @B login: #F115200
\end{verbatim}
\end{tscreen}


Èç¹ûÄãÒªµÄ»°£¬Äã¿ÉÒÔÈÃ {\ttfamily uugetty} ÔÚÇ©ÈëÊ±µÄ±êÌâÉÏÓ¡³öÐ©ÓÐÈ¤µÄ¶«Î÷£®
ÔÚÎÒµÄÀý×ÓÀï£¬ÎÒÓ¡³öÏµÍ³Ãû³Æ£¬´®ÁÐÏßÂ·£¬ÒÔ¼°Ä¿Ç°µÄÃ¿ÃëÎ»Ôª´«ÊäÂÊ£®
Äã¿ÉÒÔ¼ÓÈëÆäËüµÄ¶«Î÷£º
\begin{tscreen}
\begin{verbatim}
       @B    Ä¿Ç°µÄÃ¿ÃëÎ»Ôª´«ÊäÂÊ(bps, ÔÚ¿´µ½ @B Ê±¹À¼ÆµÄ)£®
       @D    ÏÖÔÚÈÕÆÚ, ¸ñÊ½ MM/DD/YY£®
       @L    getty ËùÁ¬½ÓµÄ´®ÁÐÏßÂ·£®
       @S    ÏµÍ³Ãû³Æ£®
       @T    ÏÖÔÚÊ±¼ä£¬¸ñÊ½ HH:MM:SS (24 Ð¡Ê±ÖÆ)£®
       @U    Ä¿Ç°Ç©ÈëµÄÊ¹ÓÃÕß£®ÕâÊÇÔÚ /etc/utmp µµÖÐ·Ç¿Õ ut_name À¸Î»ÏîÄ¿µÄ¼ÆÊýÖµ£®
       @V    °æ±¾Öµ£¬ÔÚÔ¤ÉèµµÖÐ¸ø¶¨µÄ£®
       Èç¹ûÒªÏÔÊ¾ '@' ·ûºÅµÄ»°£¬ÓÃ '\@' »ò '@@'£®
\end{verbatim}
\end{tscreen}


½ÓÏÂÀ´£¬È·¶¨ÄãÊý¾Ý»úËù½ÓµÄ´®ÁÐ²ºÓÐÊä³ö¼°ÊäÈëµÄÉè±¸£®
Èç¹ûÄãµÄÊý¾Ý»úÉèÔÚ {\ttfamily ttyS3} µÄ»°Äã½«»áÐèÒª {\ttfamily /dev/cua3}£¬ÒÔ¼° {\ttfamily /dev/ttyS3} ÕâÁ½¸öÉè±¸£®
Èç¹ûÄãÃ»ÓÐÕýÈ·µÄÉè±¸£¬²ÎÔÄ \ref{dev} {(ÔÚ /dev ÖÐ½¨Á¢Éè±¸)} ¸Ã½ÚËµÃ÷ÈçºÎ½¨Á¢Éè±¸£¬²¢ÇÒ½¨Á¢ÕâÐ©Éè±¸£®
Èç¹ûÄãÏ£ÍûÔÚÄãµÄ {\ttfamily uugetty} ÕýÔÚ¼àÊÓÕâ¸ö´®ÁÐ²ºÊÇ·ñÓÐÈËÇ©ÈëÊ±»¹ÄÜ¹»ÓÃÊý¾Ý»ú²¦³öµÄ»°£¬ÓÃ {\ttfamily /dev/cua}{\itshape N\/} Éè±¸¶ø²»ÒªÓÃ {\ttfamily /dev/ttyS}{\itshape N\/}£®

µ±ÄãÕýÔÚ±à¼­ {\ttfamily /etc/gettydefs} Ê±£¬Äã¿ÉÒÔÕâÑùÀ´¼ì²éËüµÄÓï·¨ÊÇ·ñÕýÈ·:   
\begin{tscreen}
\begin{verbatim}
linux# getty -c /etc/gettydefs
\end{verbatim}
\end{tscreen}





\subsection{×Ô¶© {\ttfamily uugetty}}

ÄãÓÐÐí¶à²ÎÊý¿ÉÒÔÓÃÀ´¸Ä±äÄãËùÓµÓÐµÄÃ¿Ò»¸ö²º£®ÕâÐ©ÊÇÒÔ·Ö±ð¶ÔÃ¿Ò»¸ö²ºÊ¹ÓÃ²»Í¬ÅäÖÃµµµÄ·½Ê½À´Êµ×÷µÄ£®
Õâ¸ö {\ttfamily /etc/conf.uugetty} µµ°¸»á±»{\itshape ËùÓÐ\/}µÄ {\ttfamily uugetty} ÐÐ³ÌËùÊ¹ÓÃ£¬¶ø {\ttfamily /etc/conf.uugetty.ttyS}{\itshape N\/} Ö»ÓÉÄÇ¸ö²ºÊ¹ÓÃ£®
Ô¤ÉèµÄÅäÖÃµµ¡õÀý¿ÉÒÔÔÚ {\ttfamily getty\_ps} µÄÔ­Ê¼µµ°¸ÀïÕÒµ½£¬ÕâÔÚ¾ø´ó²¿·ÖµÄ Linux ·¢ÐÐÌ×¼þÀïÃæ¶¼»áÓÐ£®
ÒòÎªÆª·ùµÄ¿¼Á¿£¬Ã»ÓÐ°ÑËüÃÇÁÐÔÚÕâÀï£®
Òª×¢ÒâµÄÊÇÈç¹ûÄãÓÃµÄÊÇ±È½Ï¾ÉµÄ {\ttfamily getty} °æ±¾(±È 2.0.7e °æ»¹¾É)£¬»òÕßÊÇÄãÃ»ÓÐÒÀÕÕ FSSTND µÄ»°£¬ÄÇ÷áÔ¤ÉèµÄµµ°¸½«»áÊÇ {\ttfamily /etc/default/uugetty.ttyS}{\itshape N\/}£®
ÎÒµÄ {\ttfamily /etc/conf.uugetty.ttyS3} ¿´ÆðÀ´ÏñÕâÑù:
\begin{tscreen}
\begin{verbatim}
# sample uugetty configuration file for a Hayes compatible modem to allow
# incoming modem connections
#
# alternate lock file to check... if this lock file exists, then uugetty is
# restarted so that the modem is re-initialized
ALTLOCK=cua3
ALTLINE=cua3
# line to initialize
INITLINE=cua3
# timeout to disconnect if idle...
TIMEOUT=60
# modem initialization string... 
# format: <expect> <send> ... (chat sequence)
INIT="" AT\r OK\r\n
WAITFOR=RING
CONNECT="" ATA\r CONNECT\s\A
# this line sets the time to delay before sending the login banner
DELAY=1
#DEBUG=010
\end{verbatim}
\end{tscreen}


½«ÏÂÃæÄÇÒ»ÐÐ¼Óµ½ÄãµÄ {\ttfamily /etc/inittab} ÀïÈ¥£¬ÄÇ÷á {\ttfamily uugetty} ¾Í»áÔÚÄãµÄ´®ÁÐ²ºÉÏÖ´ÐÐ(ÓÃÄã»·¾³µÄÕýÈ·×ÊÑ¶À´È¡´ú - ÅäÖÃµµµÄÎ»ÖÃ£¬´®ÁÐ²ºÃû£¬ËÙ¶È£¬¼°Ô¤ÉèÖÕ¶Ë»úÐÎÊ½):
\begin{tscreen}
\begin{verbatim}
S3:456:respawn:/sbin/uugetty -d /etc/default/uugetty.ttyS3 ttyS3 F115200 vt100
\end{verbatim}
\end{tscreen}

ÖØÐÂÆô¶¯ {\ttfamily init}:
\begin{tscreen}
\begin{verbatim}
linux# init q 
\end{verbatim}
\end{tscreen}

¶Ôì¶ÔÚÄã {\ttfamily /etc/inittab} ÀïÃæµÄËÙ¶È²ÎÊý£¬Äã»áÏ£ÍûÊ¹ÓÃÄãÊý¾Ý»úËùÄÜÖ§Ô®µÄ×î¸ßÃ¿ÃëÎ»Ôª´«ÊäÂÊ£®

ÏÖÔÚ Linux ½«»áËæÊ±¼àÊÓÄãµÄ´®ÁÐ²ºÊÇ·ñÓÐÁ¬Ïß£®´Ó±ðµÄµØ·½²¦ºÅ²¢Ç©ÈëÄãµÄ Linux »úÆ÷£®

{\ttfamily uugetty} »¹ÓÐ¸ü¶àµÄÑ¡Ïî£¬²ÎÔÄ getty (lm) ÏßÉÏÊÖ²á»ñµÃ¸üÍêÕûµÄÐðÊö£®
±ðµÄ²»ÌáËü»¹ÓÐÅÅ³Ì(scheduling)µÄ¹¦ÄÜ£¬ÒÔ¼°»Ø²¦µÄÄÜÁ¦£®




\section{ÎÒÔõ÷áÉè¶¨ÖÕ¶Ë»úÁ¬Ïßµ½ÎÒµÄ PC ÉÏ?}

±¾½ÚµÄÖ¸Ê¾ÄÜÈÃÖÕ¶Ë»ú¼°ÆäËüµçÄÔÁ¬ÉÏÄãµÄ Linux »úÆ÷µÄ´®ÁÐ²º£®




\subsection{Ó²ÌåÐèÇó}

ÒªÈ·¶¨ÄãÓÐÒ»ÌõÕýÈ·µÄÁ¬½ÓÏß£®ÔÚµçÄÔÉÌµêÂòµÄ null modem Á¬½ÓÏß¾Í¿ÉÒÔÊ¤ÈÎ£®
µ«ÊÇËüÒ»¶¨µÃÒªÊÇÒ»Ìõ {\itshape null modem\/} Ïß£¡Ðí¶àµÄµçÄÔÕ¾½«ÕâÀàµÄÁ¬½ÓÏßËµ³ÉÊÇ´®ÁÐÓ¡±í½ÓÏß£®
È·¶¨ÄãÊÇÊ¹ÓÃÄãµÄ´®ÁÐ²º£¬¹«µÄ DB25 »òÊÇ DB9 ½ÓÍ·£¬¶ø²»ÊÇÄãµÄ²¢ÁÐ²º(Ä¸µÄ DB25 »ò centronics)£®

        
¶Ô DB-25 ½ÓÍ·¶øÑÔ£¬ÖÁÉÙÄãµÃÒªÓÐ:
\begin{verbatim}
 
        PC male DB25                            Terminal DB25
        TxD   Transmit Data         2 --> 3     RxD   Receive Data
        RxD   Receive Data          3 <-- 2     TxD   Transmit Data
        SG    Signal Ground         7 --- 7     SG    Signal Ground
\end{verbatim}


Èç¹ûÄãÏëÒªÓµÓÐÁ÷Á¿¿ØÖÆÒÔ¼°Ó²ÌåÁ¬ÏßÐ­ÉÌ(handshaking)µÄ»°£¬Äã±ØÐëÒªÓÐÒ»ÌõÍêÕûµÄ null modem ½ÓÏß£º
\begin{verbatim}
        PC male DB25                            Terminal DB25
        TxD   Transmit Data         2 --> 3     RxD   Receive Data
        RxD   Receive Data          3 <-- 2     TxD   Transmit Data
        RTS   Request To Send       4 --> 5     CTS   Clear To Send
        CTS   Clear To Send         5 <-- 4     RTS   Request To Send
        DSR   Data Set Ready        6
                                    |
        DCD   Carrier Detect        8 <-- 20    DTR   Data Terminal Ready
        SG    Signal Ground         7 --- 7     SG    Signal Ground
                                          6     DSR   Data Set Ready
                                          |
        DTR   Data Terminal Ready  20 --> 8     DCD   Carrier Detect
\end{verbatim}


Èç¹ûÄãµÄ´®ÁÐ²ºÉÏÓÐÒ»¸ö DB9 µÄ½ÓÍ·£¬ÊÔÊÔ¿´ÏÂÃæÕâ¸ö:
\begin{verbatim}
        PC DB9                                  Terminal DB25 
        RxD   Receive Data          2 <-- 2     TxD   Transmit Data
        TxD   Transmit Data         3 --> 3     RxD   Receive Data
        SG    Signal Ground         5 --- 7     SG    Signal Ground
\end{verbatim}


»òÕß£¬Ò»ÌõÍêÕûµÄ DB9 ¶Ô DB25 null modem Á¬½ÓÏß£º
\begin{verbatim}
        PC DB9                                  Terminal DB25
        RxD   Receive Data          2 <-- 2     TxD   Transmit Data
        TxD   Transmit Data         3 --> 3     RxD   Receive Data
                                          6     DSR   Data Set Ready
                                          |
        DTR   Data Terminal Ready   4 --> 8     DCD   Carrier Detect
        GND   Signal Ground         5 --- 7     GND   Signal Ground
        DCD   Carrier Detect        1
                                    |
        DSR   Data Set Ready        6 <-- 20    DTR   Data Terminal Ready
        RTS   Request To Send       7 --> 5     CTS   Clear To Send
        CTS   Clear To Send         8 <-- 4     RTS   Request To Send
        (RI   Ring Indicator        9 not needed)
\end{verbatim}

(Ã»´í! µÚ¶þÖ§¼°µÚÈýÖ§½ÅÔÚ DB9 Á¬½ÓÍ·ÉÏ{\itshape È·Êµ\/}ºÍ DB25 ½ÓÍ·ÒâÒåÏà·´!)

Èç¹ûÊ¹ÓÃµÄ²¢²»ÊÇÍêÕûµÄ null modem  Á¬½ÓÏßµÄ»°£¬Äã¿ÉÄÜµÃÒª×öÏÂÃæÕâ¸öÆÛÆ­µÄ¼¼ÇÉ:
ÔÚÄãµçÄÔÕâ±ßµÄ½ÓÍ·ÉÏ£¬°Ñ RTS ¸ú CTS ½ÓÔÚÒ»Æð£¬¶øÇÒÒ²°Ñ DSR, DCD ÒÔ¼° DTR ½ÓÔÚÒ»Æð£®
ÓÃÕâ¸ö·½·¨£¬µ±µçÄÔÒªÇóÒ»¸öÕýÈ·µÄÓ²ÌåÁ¬ÏßÐ­ÉÌÐÅºÅÊ±£¬Ëü¾Í¿ÉÒÔµÃµ½(´ÓËü×Ô¼º·¢³öµÄ)£®

ÏÖÔÚÄãÒÑ¾­ÓÐÕýÈ·µÄÁ¬½ÓÏß£¬°ÑÄãµÄÖÕ¶Ë»úÁ¬½Óµ½ÄãµÄµçÄÔÉÏ£®
Èç¹ûÄã¿ÉÒÔµÄ»°£¬¸æËßÄãµÄÖÕ¶Ë»úºöÂÔÊý¾Ý»ú¿ØÖÆÐÅºÅ£®
ÊÔÊÔ¿´ÓÃ 9600 bps, 8 data bits, 1 stop bit, no parity bits À´Éè¶¨ÖÕ¶Ë»ú£®




\subsection{Éè¶¨ {\ttfamily getty}}

ÔÚ {\ttfamily /etc/gettydefs} ÀïÃæÔö¼ÓÒ»¸ö¸ø {\ttfamily getty} ÓÃÀ´Á¬½ÓÄãÖÕ¶Ë»úÏîÄ¿£¬Èç¹û»¹Ã»ÓÐÕâÏîµÄ»°:
\begin{tscreen}
\begin{verbatim}
# 38400 bps Dumb Terminal entry
DT38400# B38400 CS8 CLOCAL # B38400 SANE -ISTRIP CLOCAL #@S @L login: #DT38400

# 19200 bps Dumb Terminal entry
DT19200# B19200 CS8 CLOCAL # B19200 SANE -ISTRIP CLOCAL #@S @L login: #DT19200

# 9600 bps Dumb Terminal entry
DT9600# B9600 CS8 CLOCAL # B9600 SANE -ISTRIP CLOCAL #@S @L login: #DT9600
\end{verbatim}
\end{tscreen}


Èç¹ûÄãÒªµÄ»°£¬Äã¿ÉÒÔÈÃ {\ttfamily getty} ÔÚÇ©ÈëµÄ±êÌâÉÏÓ¡³öÒ»Ð©ÓÐÈ¤µÄ¶«Î÷£®
ÔÚÎÒµÄÀý×ÓÀï£¬ÎÒÓ¡³öÏµÍ³Ãû³ÆÒÔ¼°´®ÁÐÏßÂ·£®Äã¿ÉÒÔ¼ÓÈëÆäËüµÄ¶«Î÷:
\begin{tscreen}
\begin{verbatim}
@B    Ä¿Ç°µÄÃ¿ÃëÎ»Ôª´«ÊäÂÊ(bps, ÔÚ¿´µ½ @B Ê±¹À¼ÆµÄ)£®
@D    ÏÖÔÚÈÕÆÚ, ¸ñÊ½ MM/DD/YY£®
@L    getty ËùÁ¬½ÓµÄ´®ÁÐÏßÂ·£®
@S    ÏµÍ³Ãû³Æ£®
@T    ÏÖÔÚÊ±¼ä£¬¸ñÊ½ HH:MM:SS (24 Ð¡Ê±ÖÆ)£®
@U    Ä¿Ç°Ç©ÈëµÄÊ¹ÓÃÕß£®ÕâÊÇÔÚ /etc/utmp µµÖÐ·Ç¿Õ ut_name À¸Î»ÏîÄ¿µÄ¼ÆÊýÖµ£®
@V    °æ±¾Öµ£¬ÔÚÔ¤ÉèµµÖÐ¸ø¶¨µÄ£®
Èç¹ûÒªÏÔÊ¾ '@' ·ûºÅµÄ»°£¬ÓÃ '\@' »ò '@@'£®
\end{verbatim}
\end{tscreen}


µ±ÄãÕýÔÚ±à¼­ {\ttfamily /etc/gettydefs} Ê±£¬Äã¿ÉÒÔÕâÑùÀ´¼ì²éËüµÄÓï·¨ÊÇ·ñÕýÈ·:   
\begin{tscreen}
\begin{verbatim}
linux# getty -c /etc/gettydefs
\end{verbatim}
\end{tscreen}




È·¶¨Ã»ÓÐ {\ttfamily getty} »ò {\ttfamily uugetty} µÄÉè¶¨µµ({\ttfamily /etc/default/$\{$uu$\}$getty.ttyS}{\itshape N\/} »ò {\ttfamily /etc/conf.$\{$uu$\}$getty.ttyS}{\itshape N\/})ÔÚÄãµÄÖÕ¶Ë»úÁ¬½ÓµÄ´®ÁÐ²ºÉÏ£¬
ÒòÎªÕâÒ²Ðí»á¸ÉÈÅµ½ÔÚÖÕ¶Ë»úÉÏÖ´ÐÐµÄ {\ttfamily getty}£®Èç¹ûÓÐµÄ»°ÇëÒÆ³ýËü£®

±à¼­ÄãµÄ {\ttfamily /etc/inittab} ÈÃ {\ttfamily getty} ÔÚÄãµÄ´®ÁÐ²ºÉÏÖ´ÐÐ(ÓÃÄã»·¾³µÄÕýÈ·×ÊÑ¶À´È¡´ú - ÅäÖÃµµµÄÎ»ÖÃ£¬´®ÁÐ²ºÃû£¬ËÙ¶È£¬¼°Ô¤ÉèÖÕ¶Ë»úÐÎÊ½):
\begin{tscreen}
\begin{verbatim}
S1:456:respawn:/sbin/getty ttyS1 DT9600 vt100
\end{verbatim}
\end{tscreen}

ÖØÐÂÆðÊ¼ {\ttfamily init}:
\begin{tscreen}
\begin{verbatim}
linux# init q 
\end{verbatim}
\end{tscreen}


ÏÖÔÚÄãÓ¦¸Ã»áÔÚÄãµÄÖÕ¶Ë»úÉÏ¿´µ½Ç©ÈëÌáÊ¾£®Ò²ÐíÄãµÃ°´·µ»Ø¼ü(return)¼¸´ÎÈÃÖÕ¶Ë»ú×¢Òâµ½£®




\subsection{½« PC Éè¶¨³ÉÖÕ¶Ë»úµÄ×¢ÒâÊÂÏî}

Ðí¶àÈË½«ÆäËü PC Éè¶¨³ÉÖÕ¶Ë»úÁ¬½Óµ½ Linux »úÆ÷ÉÏ£®ÀýÈç£¬¾ÉµÄ 8088 »òÊÇ 286 PC ·Ç³£ÊÊºÏÕâ¸öÓÃÍ¾£®
ÄãÐèÒªµÄÖ»ÊÇÒ»ÕÅ°üº¬ÊÊºÏÈÃÄãµÄÖÕ¶Ë»ú-¸öÈËµçÄÔ (Terminal-PC) Ê¹ÓÃµÄ DOS ´ÅÆ¬£¬ÒÔ¼°ÈÃÄãµÄÖÕ¶Ë»ú-¸öÈËµçÄÔÖ´ÐÐµÄÍ¨Ñ¶³ÌÊ½£®
{\ttfamily kermit} ÔÚÕâ¸öÓÃÍ¾ÉÏ±íÏÖµÃ·Ç³£ºÃ£®
Äã¿ÉÒÔÔÚÕâÌ¨»úÆ÷ {\ttfamily \onlynameurl{http://www.columbia.edu/kermit/}} ÉÏÕÒµ½¼¸ºõ¿ÉÒÔÈÃÈÎºÎÏÖ´æµÄ×÷ÒµÏµÍ³Ê¹ÓÃµÄÒÑ±àÒëµÄ {\ttfamily kermit} °æ±¾£®
ÆäËüÁ÷ÐÐµÄ DOS Í¨Ñ¶³ÌÊ½ÏñÊÇ {\ttfamily telix} ÒÔ¼° {\ttfamily procomm} Ò²½«»áÓÐÒ»ÑùºÃµÄ±íÏÖ£®
ÒªÈ·¶¨ÊäÈëÕýÈ·µÄ´®ÁÐ²º×ÊÑ¶µ½ÄãÖÕ¶Ë»ú-¸öÈËµçÄÔµÄÍ¨Ñ¶Éè¶¨ÀïÈ¥£®




\section{ÎÒÄÜÊ¹ÓÃ³¬¹ýÁ½¸öµÄ´®ÁÐ×°ÖÃÂð?\label{irqaddr}}

Äã²»ÐèÒªÔÄ¶ÁÕâÒ»½Ú£¬³ý·ÇÄãÏëÒªÊ¹ÓÃÈý¸ö»ò¸ü¶àµÄ´®ÁÐÉè±¸...(¼Ù¶¨ÄãÃ»ÓÐ¶à²º¿¨µÄ»°)£®

¼ÙÈçÄãÓÐÁíÒ»¸ö¶àâÅµÄ´®ÁÐ²º£¬ÊÇµÄ£¬Äã¿ÉÒÔ£®
Äã¿ÉÒÔÊ¹ÓÃµÄ´®ÁÐ²ºÊýÄ¿ÊÜÏÞì¶ÎÒÃÇ±ØÐëÊ¹ÓÃµÄÓ²ÌåÖÐ¶ÏÒªÇóÒÔ¼°²ºÊä³öÈëÎ»Ö·µÄÊýÄ¿£®
Õâ²¢²»ÊÇ Linux µÄÏÞÖÆ£¬¶øÊÇ PC »ãÁ÷ÅÅµÄÏÞÖÆ£®±ØÐëÖ¸¶¨ÖÐ¶Ï¸úÎ»Ö·¸øÃ¿Ò»¸ö´®ÁÐÉè±¸£®
´®ÁÐÉè±¸¿ÉÒÔÊÇ´®ÁÐ²º£¬ÄÚ½ÓÊ½Êý¾Ý»ú»òÊÇ¶à²º¿¨£®

¶à²º¿¨ÊÇÎªÁËÓµÓÐÐí¶à¸ö´®ÁÐ²ºÀ´·ÖÏí¿¨ÉÏËùÓÐ´®ÁÐ²ºËùÊ¹ÓÃµÄÏàÍ¬ IRQ ¶øÌØ±ðÉè¼ÆµÄ£®
Linux ¶Ô¿¨ÉÏµÄÃ¿Ò»¸ö²ºÊ¹ÓÃ²»Í¬µÄÊä³öÈëÎ»Ö·ÒÔ±ã´ÓËüÃÇ»ñÈ¡×ÊÁÏ£®




\subsection{Ñ¡Ôñ´®ÁÐÉè±¸µÄÖÐ¶ÏÎ»Ö·}

ÄãµÄ PC Ò»°ã»á½« {\ttfamily ttyS0} ÒÔ¼° {\ttfamily ttyS2} ÉèÔÚ IRQ 4 ¶ø½« {\ttfamily ttyS1} ÒÔ¼° {\ttfamily ttyS3} ÉèÔÚ IRQ 3£®
¾­ÓÉ¼ìÊÓ {\ttfamily /proc/interrupts} Äã¿ÉÒÔÖªµÀÄÇÐ© IRQs Õý±»Ê¹ÓÃ£®
ÒªÊ¹ÓÃÁ½¸öÒÔÉÏµÄ´®ÁÐÉè±¸µÄ»°£¬Äã±ØÐëÖØÐÂÖ¸¶¨Ò»¸öÖÐ¶Ï£®
Ò»¸öºÃÑ¡ÔñÊÇ´ÓÄãµÄ²¢ÁÐ²ºÄÇ±ßÖØÐÂÖ¸¶¨Ò»¸öÖÐ¶Ï£®ÄãµÄ PC Ò»°ã»áÉè¶¨ IRQ5 »òÊÇ IRQ7 µ±ÄãµÄ²¢ÁÐ²º£¬µ«ÊÇºÜÉÙÈË»áÊ¹ÓÃÁ½¸ö²¢ÁÐ²º£®
Äã¿ÉÒÔÖØÐÂÖ¸¶¨ÆäÖÐÒ»¸öÖÐ¶Ï¸ø´®ÁÐÉè±¸£¬²¢¶øÈÔÈ»ÄÜË³ÀûµØÊ¹ÓÃÒ»¸ö²¢ÁÐ²º£®
Äã½«»áÐèÒªÓÃµ½ {\ttfamily setserial} ³ÌÊ½À´×öÕâ¼þÊÂ£®´ËÍâ£¬Äã±ØÐëµ÷ÕûÄã°å×ÓÉÏµÄÌø½ÓÉè¶¨(Jumpers)£¬²é¿´ÄãÖ÷»ú°åµÄËµÃ÷ÎÄ¼þ£®
Ìø½ÓÄãÏëÒª¸øÃ¿¸ö²ºÊ¹ÓÃµÄ IRQ£®

Äã½«µÃÒª×öÐ©Éè¶¨ÈÃÃ¿¸ö´®ÁÐÉè±¸¶¼ÓÐÒ»¸ö£¬²¢ÇÒÊÇÎ¨Ò»µÄÒ»¸öÖÐ¶Ï£®
ÕâÀïÊÇÎÒÔÚ {\ttfamily /etc/rc.d/rc.local} ÀïËùÓÃµÄÉè¶¨ - ÄãÓ¦¸ÃÔÚÆô¶¯ÏµÍ³Ê±µÄÄ³¸öµØ·½×öÕâ¼þÊÂ£®
\begin{tscreen}
\begin{verbatim}
        /sbin/setserial /dev/ttyS0 irq 3        # my serial mouse
        /sbin/setserial /dev/ttyS1 irq 4        # my Wyse dumb terminal
        /sbin/setserial /dev/ttyS2 irq 5        # my Zoom modem 
        /sbin/setserial /dev/ttyS3 irq 9        # my USR modem
\end{verbatim}
\end{tscreen}


±ê×¼µÄ IRQ Ö¸¶¨:
\begin{verbatim}
              IRQ  0    Timer channel 0
              IRQ  1    Keyboard
              IRQ  2    Cascade for controller 2
              IRQ  3    Serial port 2
              IRQ  4    Serial port 1
              IRQ  5    Parallel port 2
              IRQ  6    Floppy diskette
              IRQ  7    Parallel port 1
              IRQ  8    Real-time clock
              IRQ  9    Redirected to IRQ2
              IRQ 10    not assigned 
              IRQ 11    not assigned
              IRQ 12    not assigned
              IRQ 13    Math coprocessor
              IRQ 14    Hard disk controller 1
              IRQ 15    Hard disk controller 2
\end{verbatim}


ÔÚÑ¡ÔñÖÐ¶ÏÊ±ÕæµÄÃ»ÓÐÊ²÷áÕýÈ·µÄ£®Ö»ÒªÈ·¶¨Ëü²»ÊÇÒÑ¾­±»Ö÷»ú°å£¬»òÊÇÆäËü½çÃæ¿¨ËùÊ¹ÓÃ£®
2, 3, 4, 5 »òÊÇ 7 ÊÇºÃÑ¡Ôñ£®``not assigned''µÄÒâË¼ÊÇÄ¿Ç°²¢Ã»ÓÐÊ²÷á¶«Î÷ÔÚ±ê×¼Çé¿öÏÂ»á¹Ì¶¨Ê¹ÓÃÕâÐ©Ó²ÌåÖÐ¶ÏÒªÇó£®
Ò²Òª×¢Òâµ½ IRQ 2 ¸ú IRQ 9 ÊÇÒ»ÑùµÄ£®Äã¿ÉÒÔ³ÆËüÎª 2 »ò 9£¬´®ÁÐÇý¶¯³ÌÊ½·Ç³£ÁË½âÕâÒ»µã£®
Èç¹ûÄãÓÐÒ»¿é 16-bit »ãÁ÷ÅÅÁ¬½ÓÍ·µÄ´®ÁÐ¿¨£¬ÄãÒ²¿ÉÒÔÊ¹ÓÃ IRQ 10, 11, 12 »ò 15£®

Ö»ÒªÈ·¶¨ÄãÊ¹ÓÃµÄ²¢·ÇÊÇ IRQ 0, 1, 6, 8, 13 »òÊÇ 14! ËüÃÇÊÇÓÉÄãµÄÖ÷»ú°åËùÊ¹ÓÃµÄ£®
Èç¹ûÄãÄÃ×ßËýµÄ IRQs µÄ»°£¬»áÊ¹µÃËýºÜ²»¸ßÐË£®
Íê³ÉÖ®áá£¬ÔÙ´Î¼ì²é {\ttfamily /proc/interrupts} ÒÔÈ·¶¨Ã»ÓÐ³åÍ»·¢Éú£®




\subsection{Éè¶¨´®ÁÐÉè±¸µÄÎ»Ö·}

½ÓÏÂÀ´£¬Äã±ØÐëÉè²ºÎ»Ö·£®²é¿´ÄãÖ÷»ú°åÊÖ²áµÄÌø½ÓÉè¶¨£®¾ÍÏñÖÐ¶Ï£¬Ã¿¸öÎ»Ö·Ö»ÄÜÓÐÒ»¸ö´®ÁÐÉè±¸£®
ÄãµÄ²ºÍ¨³£»áÅäÖÃ³ÉÏñÏÂÃæÕâÑù£º
\begin{tscreen}
\begin{verbatim}
        ttyS0 address 0x3f8
        ttyS1 address 0x2f8
        ttyS2 address 0x3e8
        ttyS3 address 0x2e8
\end{verbatim}
\end{tscreen}


Ñ¡ÔñÄãÏëÒª¸øÃ¿Ò»¸ö´®ÁÐÉè±¸Ê¹ÓÃµÄÎ»Ö·²¢ÇÒÒÀ´ËÀ´Éè¶¨Ìø½Ó£®
ÎÒ½«ÎÒµÄÊý¾Ý»úÉèÔÚ {\ttfamily ttyS3} £¬ÎÒµÄ»¬ÊóÔÚ {\ttfamily ttyS0}£¬¶øÎÒµÄÖÕ¶Ë»úÔÚ {\ttfamily ttyS2}£®

µ±ÄãÖØÐÂÆô¶¯Ê±£¬ Linux Ó¦¸Ã»áÔÚÄãËùÉè¶¨µÄÎ»Ö·¿´µ½ÄãµÄ´®ÁÐ²º£®
Linux Ëù¿´µ½µÄ IRQ ¿ÉÄÜ²»»á¸úÄãÌø½ÓÉè¶¨µÄÏà·û£®
²»±Øµ£ÐÄÕâÒ»µã£® Linux ÔÚËüÆô¶¯µÄÊ±ºò²¢Ã»ÓÐ×öÈÎºÎµÄ IRQ Õì²â£¬
ÒòÎª IRQ Õì²âÊÇÎ£ÏÕ²¢ÇÒÓÐ¿ÉÄÜ±»ÆÛÆ­µÄ£®Ê¹ÓÃ {\ttfamily setserial} À´¸æËß Linux ÄÇ¸ö²ºÊ¹ÓÃÄÇ¸ö IRQ£®
ÄãÒ²¿ÉÒÔ¼ì²é {\ttfamily /proc/ioports} À´¿´¿´ÔÚ Linux Æô¶¯ááÄÇÐ©Êä³öÊäÈë²ºÎ»Ö·±»Ê¹ÓÃ£®




\section{ÎÒÔõÑù½«ÎÒµÄ´®ÁÐ²ºÉèµ½½Ï¸ßµÄËÙ¶È? ÎÒµÄÊý¾Ý»úÓÖÓ¦¸ÃÊ¹ÓÃÊ²÷áÑùµÄËÙ¶È?\label{spdhi}}

ÕâÒ»½ÚÓ¦¸Ã¿ÉÒÔ°ïÄãÕÒ³öµ±ÄãÍ¸¹ýÍ¨Ñ¶³ÌÊ½£¬»òÊÇ {\ttfamily getty} ³ÌÊ½Ê¹ÓÃÄãµÄÊý¾Ý»úÊ±Ó¦¸ÃÊ¹ÓÃÊ²÷áËÙ¶È£®
\begin{itemize}
\item Èç¹ûÄãËùÓÐµÄÊÇ±È 9600 bps (V.32) Êý¾Ý»ú»¹ÒªÂýµÄ¶«Î÷£¬½«ÄãµÄËÙ¶ÈÉèµ½ÄãµÄÊý¾Ý»úËùÄÜÖ§Ô®µÄ×î¸ßËÙ¶È£®
ÀýÈç 300 (V.21/Bell 103), 1200 (V.22/Bell 212A), »ò 2400 bps (V.22bis)£®
\item Èç¹ûÄãÓÐ 9600 bps (V.32) µÄÊý¾Ý»ú£¬²¢ÇÒÖ§Ô® V.42bis ×ÊÁÏÑ¹Ëõ£¬Ê¹ÓÃ 38400 À´µ±×÷ÄãµÄËÙ¶È£®
V.42bis Ñ¹Ëõ¾ßÓÐ 4:1 µÄ{\itshape ÀíÂÛÖµ\/}£¬Ò²¾ÍÊÇ``4 * 9600 = 38400''£®
\item Èç¹ûÄãÓÐ 14400 bps (V.32bis) µÄÊý¾Ý»ú£¬²¢ÇÒÖ§Ô® V.42bis ×ÊÁÏÑ¹Ëõ¹¦ÄÜµÄ»°£¬Ê¹ÓÃ {\ttfamily setserial} ³ÌÊ½£¬¼ÓÉÏ {\ttfamily spd\_hi} Æì±ê½«ÄãµÄ´®ÁÐ²ºÅäÖÃ³ÉÊ¹ÓÃ 57600 bps (4 * 14400 = 57600) µÄËÙ¶È£®
Èç¹ûÄãÓÐ 28800 »ò 33600 bps (V.FC »òÊÇ V.34) µÄÊý¾Ý»úÔòÊ¹ÓÃ {\ttfamily spd\_vhi} Æì±ê (4 * 28800 = 115200)£®

È»áá£¬ÔÚÄãµÄÍ¨Ñ¶³ÌÊ½£¬»òÊÇ {\ttfamily /etc/inittab} ÀïÊ¹ÓÃ 38400 µ±×÷ËÙ¶ÈÉè¶¨£®
ÕâÊÇÏÖÔÚÄãÄÜÉèµÄ×î¸ßËÙ¶È£®ÒªÈ·¶¨ÄãÓÐ 16550A Í¨ÓÃ·ÇÍ¬²½½ÓÊÕ×ª»»Æ÷(UART)£®

Èç¹ûÄãµÄ libc °æ±¾ÖÁÉÙÊÇ 5.x£¬ÄÇ÷á»áÓÐ½Ð×ö 57600 ¼° 115200 µÄËÙ¶È£®
{\ttfamily libc} ·ÅÔÚ {\ttfamily /lib}£¬ËùÒÔÔÚÄÇÀï¿´Ò»ÏÂÄãÓÃµÄ°æ±¾ÊÇÊ²÷á£®
Èç¹ûÄãµÄÓ¦ÓÃ³ÌÊ½ÒÑ¾­±àÒëÒÔÈ¡ÓÃ´ËÓÅµã£¬Äã¿ÉÒÔÖ±½ÓÊ¹ÓÃËüÃÇ(²»±ØÓÃ {\ttfamily setserial})£¬
Ðí¶àµÄÌ×¼þ¶¼ÒÑ¾­ÓÐÁË£¬Òò´ËÈç¹ûÄãÓÐ×î½ü°æ±¾µÄ Linux Ì×¼þ£¬×îºÃµÄ·½·¨¾ÍÊÇ³¢ÊÔÊ¹ÓÃÕâÐ©¸ü¸ßµÄËÙ¶È£®

\end{itemize}


ÏÈÔÚÃüÁîÁÐÏÂÓÃ {\ttfamily setserial} Ö¸Áî²âÊÔ£¬È»ááÔÚÄãÈ·¶¨ËüÃÇ¿ÉÒÔÔË×÷áá£¬½«ÄãËù×÷µÄÐÞ¸Ä·Å½ø {\ttfamily /etc/rc.d/rc.serial} »ò {\ttfamily /etc/rc.d/rc.local} ÒÔ±ãÔÚÏµÍ³Æô¶¯Ö´ÐÐËüÃÇ£®
ÔÚÎÒµÄ {\ttfamily /etc/rc.d/rc.local} Àï£¬ÎÒÊÇÕâÑùÉè¶¨ÎÒµÄ {\ttfamily ttyS3} µ½ 115200 bps µÄ:
\begin{tscreen}
\begin{verbatim}
/sbin/setserial /dev/ttyS3 spd_vhi
\end{verbatim}
\end{tscreen}


È·¶¨ÄãÒÔºÏ·¨µÄÂ·¾¶Ê¹ÓÃ {\ttfamily setserial}£¬ÒÔ¼°ºÏ·¨µÄ×°ÖÃÃû³Æ£®
Äã¿ÉÒÔÏÂ·¨¼ì²éÒ»¸ö´®ÁÐ²ºµÄÉè¶¨:
\begin{tscreen}
\begin{verbatim}
setserial -a /dev/ttyS3
\end{verbatim}
\end{tscreen}





\section{Í¨Ñ¶³ÌÊ½¼°¹¤¾ß\label{comms}}

ÕâÀïÓÐÒ»¸öÍ¨Ñ¶³ÌÊ½µÄÁÐ±í£¬Èç¹ûÄãËùÊ¹ÓÃµÄ·¢ÐÐÌ×¼þÀïÍ·²¢Ã»ÓÐµÄ»°£¬ÕâÐ©¶¼¿ÉÒÔÔÚÒ»°ãµÄ FTP Õ¾ÕÒµ½£®

\begin{itemize}
\item {\ttfamily ecu} - Ò»Ì×Í¨Ñ¶³ÌÊ½
\item \nameurl{http://www.columbia.edu/kermit/}{C-Kermit} - 
¿ÉÐ¯µÄ£¬¿É³ÌÐò»¯µÄ´®ÁÐ¼° TCP/IP Í¨Ñ¶³ÌÊ½£¬°üº¬´«µµ¼°×ÖÍê×ª»»¹¦ÄÜ
\item {\ttfamily minicom} - ÀàËÆ {\ttfamily telix} µÄÍ¨Ñ¶³ÌÊ½
\item {\ttfamily procomm} - °üº¬ zmodem£¬ÀàËÆ {\ttfamily procomm} µÄÍ¨Ñ¶³ÌÊ½
\item {\ttfamily seyon} - ÒÔ X Îª»ù´¡»·¾³µÄÍ¨Ñ¶³ÌÊ½
\item {\ttfamily xc} - xcomm Í¨Ñ¶Ì×¼þ
\item ÆäËüÓÐÓÃµÄ³ÌÊ½ÊÇ {\ttfamily term} ¼° {\ttfamily SLiRP}£®ËüÃÇÌá¹©Ê¹ÓÃ shell ÕÊºÅµÄ TCP/IP ¹¦ÄÜ£®
\item {\ttfamily screen} ÊÇÁíÒ»¸ö¶àÇø¶Î×÷Òµ(multi-session)µÄ³ÌÊ½£®Õâ¸ö³ÌÊ½¾ÍÏñµÄ¶¯×÷¾ÍÏñÐéÄâ¿ØÖÆÌ¨£®
\item {\ttfamily callback} ÕâÖ§³ÌÊ½»áÊ¹ÄãµÄÊý¾Ý»ú»Ø²¦¸øÄã£®
\item {\ttfamily mgetty+fax} ´¦Àí´«ÕæÊÂÎñ£¬²¢ÇÒÌá¹©Ò»¸ö²»Í¬µÄ {\ttfamily getty}£®
\item {\ttfamily ZyXEL} ÊÇ ZyXEL U-1496 Êý¾Ý»úµÄ¿ØÖÆ³ÌÊ½£®Ëü´¦Àí½ÓÊÜ²¦½Ó£¬²¦ºÅ£¬»Ø²¦±£ÃÜ£¬´«Õæ£¬ÒÔ¼°ÓïÒôÐÅÏä¹¦ÄÜ£®
\item SLIP ¼° PPP µÄÈíÌå¿ÉÔÚ {\ttfamily \onlynameurl{ftp://sunsite.unc.edu/pub/Linux/system/network/serial}} ÕÒµ½£®
\item ÆäËü¶«Î÷¿ÉÒÔÔÚ {\ttfamily \onlynameurl{ftp://sunsite.unc.edu/pub/Linux/system/serial}} ÒÔ¼° {\ttfamily \onlynameurl{ftp://sunsite.unc.edu/pub/Linux/apps/serialcomm}} »òÐí¶àµÄÓ³Éä½ÚµãÖ®Ò»ÕÒµ½£®ÕâÐ©ÊÇ±£ÁôËùÓÐ´®ÁÐ³ÌÊ½µÄÄ¿Â¼£®
\end{itemize}





\section{´®ÁÐÊ¹ÓÃÃØ¾÷}

 
ÕâÀïÓÐÒ»Ð©Äã¿ÉÄÜ·¢ÏÖºÜÓÐÓÃµÄ´®ÁÐ¡õ¾÷...




\subsection{{\ttfamily kermit} ÒÔ¼° zmodem}

ÒªÔÚ {\ttfamily kermit} ÏÂÊ¹ÓÃ zmodem µÄ»°£¬½«ÏÂÁÐÄÚÈÝ¼Óµ½ÄãµÄ {\ttfamily .kermrc} ÀïÈ¥:
\begin{tscreen}
\begin{verbatim}
define rz !rz < /dev/ttyS3 > /dev/ttyS3
define sz !sz \%0 > /dev/ttyS3 < /dev/ttyS3
\end{verbatim}
\end{tscreen}

ÒªÈ·¶¨ÕýÈ·µØ·ÅÈëÄãÊý¾ÝËùÔÚµÄ´®ÁÐ²º£®È»áá£¬ÒªÊ¹ÓÃµÄ»°£¬Ö»ÒªÔÚ kermit µÄÌáÊ¾·ûºÅÏÂ¼üÈë {\ttfamily rz} »ò {\ttfamily sz $<$µµÃû$>$} ¼´¿É£®




\subsection{×Ô¶¯Éè¶¨ÖÕ¶Ë»úÐÍÊ½}

ÒªÔÚµ±ÄãÇ©ÈëµÄÊ±ºò×Ô¶¯Éè¶¨ÄãµÄÖÕ¶Ë»úÐÎÊ½µÄ»°£¬°ÑÖÕ¶Ë»úµÄÐÎÊ½¼Óµ½ {\ttfamily /etc/inittab} µÄÏîÄ¿ÀïÈ¥£®
Èç¹ûÎÒÓÐÒ»Ì¨ vt100 ÖÕ¶Ë»úÔÚ {\ttfamily ttyS1} ÉÏ £¬ÎÒÒª¶Ô {\ttfamily getty} Ö¸Áî¼ÓÉÏ ``vt100'':
\begin{tscreen}
\begin{verbatim}
S1:456:respawn:/sbin/getty ttyS1 DT9600 vt100
\end{verbatim}
\end{tscreen}


ÄãÒ²¿ÉÒÔÊ¹ÓÃ {\ttfamily tset}£¬¿ÉÒÔÔÚÄãÇ©ÈëµÄÊ±ºò½¨Á¢ÖÕ¶Ë»úµÄÌØÐÔ£¬¶øÇÒ²»ÐèÒªÒÀÀµÈÎºÎµÄÔ¤ÉèÖµ£®




\subsection{ÔÚ´®ÁÐÁ¬ÏßÏÂµÄ²ÊÉ« {\ttfamily ls}}

        
Èç¹û {\ttfamily ls} ÒòÎª²ÊÉ«ÌØÐÔ¶øÈÅÂÒÁËÄãµÄÖÕ¶Ë»úÄ£Äâ£¬°ÑËü¹Øµô£®
{\ttfamily ls --color} ÒÔ¼° {\ttfamily ls --colour} ¶¼Ê¹ÓÃ²ÊÉ«ÌØÐÔ£®ÓÐÐ©°²×°·½Ê½Ê¹µÃ {\ttfamily ls} Ô¤ÉèÎªÊ¹ÓÃ²ÊÉ«£®
¼ì²é {\ttfamily /etc/profile} ÒÔ¼° {\ttfamily /etc/csh.cshrc} ÀïµÄ {\ttfamily ls} ±ðÃû£®
Èç¹ûÄã²»ÏëÐÞ¸ÄÏµÍ³Ô¤ÉèÖµµÄ»°£¬ÄãÒ²¿ÉÒÔÉè¸ø {\ttfamily ls} ±ðÃû {\ttfamily ls --no-color}£®




\subsection{´ÓÖÕ¶Ë»úËùÁ¬½ÓµÄÓ¡±í»ú½øÐÐÁÐÓ¡}

        
ÓÐÒ»¸ö½Ð×ö {\ttfamily vtprint} µÄ³ÌÊ½¿ÉÒÔ×öµÃµ½£¬ÔÚ {\ttfamily \onlynameurl{ftp://ftp.sdsu.edu/pub/vtprint}} ¼°
{\ttfamily \onlynameurl{http://www.sdsu.edu/\~{}garrett}} ¿ÉÈ¡µÃ£®

ÁíÍâÒ»Ö§½Ð {\ttfamily xprt} µÄ³ÌÊ½Ò²ÄÜ×öµ½£®Ëü¿ÉÔÚ {\ttfamily \onlynameurl{ftp://sunsite.unc.edu/pub/Linux/system/printing}} ÕÒµ½£®




\subsection{Linux ÄÜ²»ÄÜ¹»×Ô¶¯µØÅäÖÃ´®ÁÐÉè±¸?}

¿ÉÒÔ£®ÒªÈÃ Linux ÔÚÆô¶¯µÄÊ±ºò×Ô¶¯µØÕì²â²¢ÇÒÉè¶¨´®ÁÐÉè±¸µÄ»°£¬°ÑÕâÒ»ÐÐ:
\begin{tscreen}
\begin{verbatim}
/sbin/setserial /dev/ttyS3 auto_irq skip_test autoconfig
\end{verbatim}
\end{tscreen}

¼Óµ½ÄãµÄ {\ttfamily /etc/rc.d/rc.local} »òÊÇ {\ttfamily /etc/rc.d/rc.serial} µµ°¸ÀïÃæ£®
¶ÔÃ¿Ò»¸öÄãÏ£Íû×Ô¶¯ÅäÖÃµÄ´®ÁÐ²º¶¼Òª×ö£®ÒªÈ·¶¨Ëù¸øµÄÊÇÒ»¸öÕæÕý´æÔÚì¶ÄãµçÄÔÉÏµÄÉè±¸Ãû³Æ£®




\subsubsection{¶à²º¿¨µÄ×¢ÒâÊÂÏî}

¶Ôì¶¿¨µÄÎ»Ö·£¬ÒÔ¼° IRQs ²éÔÄ {\ttfamily setserial} ³ÌÊ½Ëæ¸½µÄ {\ttfamily rc.serial}£®
ËüÓÐºÜ¶à¹Øì¶¶à²º¿¨µÄÏ¸½Ú£¬°üÀ¨Êä³öÈëÎ»Ö·ÒÔ¼°Éè±¸Ãû³Æ£®




\subsection{Ê¹ÓÃ´®ÁÐ¿ØÖÆÌ¨}

ÔÚµÚÈýÊ®ÁùÆÚµÄ {\itshape Linux Journal\/} ÔÚ {\ttfamily \onlynameurl{http://www.ssc.com/lj/issue36/index.html}} ÓÐÆªÎÄÕÂ½âÊÍÈçºÎÊ¹ÓÃ´®ÁÐ¿ØÖÆÌ¨(serial console)£®
²»ÐÒµÄÊÇ£¬¼Äµç×ÓÓÊ¼þ¸ø×÷Õß¶¼±»ÍË»Ø£®ÎÒÏ£ÍûÕâÆªÎÄÕÂ»áºÜ¿ìµØÉÏÊö URL µÄ {\itshape Linux Journal\/} ÍøÕ¾ÖÐ£®




\subsection{¸ü¸ßµÄ´®ÁÐÁ÷Á¿}

Èç¹ûÔÚÒ»²¿Ê¹ÓÃ (E)IDE ´Åµú»úµÄÏµÍ³ÉÏÄã·¢ÏÖÁ÷Á¿ºÜÂý¶øÇÒ´®ÁÐ²º³£ÒçÂú£¬Äã¿ÉÒÔÈ¡µÃ {\ttfamily hdparm}£®
ÕâÊÇÒ»¸ö¿ÉÒÔÐÞ¸Ä (E)IDE ²ÎÊý£¬°üº¬ÈÃÒ»´Åµú IRQ ¶¯×÷ÆÚ¼äÆäËü IRQs ÈÔ¿É¹¤×÷£®
Õâ»á¸ÄÉÆ·´Ó¦ËÙ¶È²¢°ïÖúÏû³ýÒçÂú£®È·¶¨Ð¡ÐÄµØ¶Á¹ýÁËÏßÉÏÊÖ²á£¬ÒòÎªÄ³Ð©´Åµú/¿ØÖÆ¿¨×éºÏ²»Ï²»¶Ëü²¢ÇÒ¿ÉÄÜËð»Ùµµ°¸ÏµÍ³£®

Ò²¿ÉÒÔ¿´Ò»ÏÂÒ»¸ö½Ð {\ttfamily irqtune} µÄ¹¤¾ß£¬¿ÉÒÔ¸Ä±äÒ»¸ö×°ÖÃ IRQ µÄÓÅÏÈË³Ðò£¬ÀýÈçÄãÊý¾Ý»úËùÔÚµÄ´®ÁÐ²º£®ÕâÒ²¿ÉÄÜ¸ÄÉÆÄãÏµÍ³µÄ´®ÁÐÁ÷Á¿£®
{\ttfamily irqtune} µÄ³£¼ûÎÊÌâ½â´ð(FAQ)¿ÉÔÚ {\ttfamily \onlynameurl{http://www.best.com/\~{}cae/irqtune}} ÕÒµ½£®




\section{¸ü½øÒ»²½...}

ÕâÒ»½Ú²¢²»ÐèÒªÔÄ¶Á£¬µ«ÊÇ¿ÉÄÜ´ø¸øÄãÒ»Ð©¶Ôì¶ Unix ÒÔ¼°µç×ÓÍ¨Ñ¶ÊÀ½ç¸ü½øÒ»²½µÄÁË½â£®




\subsection{Ê²÷áÊÇËø¶¨µµ°¸(lock files)?}

Lock files Ö»ÊÇµ¥´¿µÄÒ»¸öµµ°¸ÓÃÀ´±íÊ¾Ä³¸öÌØ¶¨µÄÉè±¸ÕýÔÚÊ¹ÓÃÖÐ£®
ËüÃÇ±£´æÔÚ {\ttfamily /usr/spool/uucp} »òÊÇ {\ttfamily /var/lock} ÀïÃæ£®
Linux µÄ lock files Ãû×Ö¶¼ÊÇ {\ttfamily LCK..}{\itshape name\/}£¬ÆäÖÐµÄ {\itshape name\/} ²»ÊÇÉè±¸Ãû³Æ¾ÍÊÇÒ»¸ö UUCP ½ÚµãÃû³Æ£®
ÓÐÐ©³ÌÐò½¨Á¢ÕâÐ© locks ÒÔ±ãÈÃËüÃÇ×Ô¼º¿ÉÒÔ¶ÀÕ¼¸ÃÉè±¸µÄ´æÈ¡È¨£®
ÀýÈçÈç¹ûÄã´ÓÄãµÄÊý¾Ý»ú²¦ºÅ³öÈ¥£¬½«»á³öÏÖÒ»¸ö lock ¸æËßÆäËü³ÌÐòÏÖÔÚÒÑ¾­ÓÐÈËÕýÔÚÊ¹ÓÃÊý¾Ý»ú£®
Lock files ÀïÃæÖ÷ÒªÊÇ°üº¬Ëø×¡¸ÃÉè±¸µÄ³ÌÐòµÄÐÐ³ÌºÅÂë(PID)£®
´ó²¿·ÝµÄ³ÌÊ½»á²éÔÄ lock£¬È»áá¼ì²éÐÐ³Ì±í(process table)ÖÐËø¶¨¸ÃÉè±¸µÄÐÐ³ÌÀ´ÊÔÖø¾ö¶¨Õâ¸ö lock ÊÇ·ñÈÔÈ»ÓÐÐ§£®
Èç¹û·¢ÏÖÕâ¸ö lock ÊÇÓÐÐ§µÄ»°£¬Õâ¸ö³ÌÊ½(Ó¦¸Ã)Òª½áÊø£®
Èç¹û²»ÊÇ£¬Ä³Ð©³ÌÊ½»áÉ¾³ý¹ýÊ±µÄ lock£¬È»ááÊ¹ÓÃ¸ÃÉè±¸£¬²¢ÔÚÐÐ³ÌÖ´ÐÐÊ±½¨Á¢ËûÃÇ×Ô¼ºµÄ lock£®
ÆäËüµÄ³ÌÊ½¾ÍÖ»ºÃ½áÊø²¢¸æËßÄã¸ÃÉè±¸ÕýÔÚÊ¹ÓÃÖÐ£®




\subsection{``baud'' ¶Ô ``bps''}

``baud'' ¸ú ``bps'' ¿ÉÄÜÊÇµçÄÔ/µç×ÓÍ¨Ñ¶Õâ¸öÁìÓòÀï×î³£±»´íÓÃµÄÊõÓïÖ®Ò»£®
µ±ËüÃÇÊÂÊµÉÏ²¢²»ÏàÍ¬µÄÊ±ºò£¬ºÜ¶àÈËÈÔ½»ÌæÊ¹ÓÃÕâÐ©ÊõÓï£®
\begin{description}
\item[±«ÂÊ(baud)] \mbox{}

±«ÂÊÊÇÃ¿ÃëÖÓÊý¾Ý»ú(µ÷±ä½âµ÷Æ÷£¬{\bfseries mo}dulator-{\bfseries dem}odulator)ËÍ³ö¶àÉÙ´ÎÑ¶ºÅ¸Ä±äµÄ¶ÈÁ¿£®
ÀýÈç£¬±«ÂÊÎª 1200 µÄº¬ÒâÊÇÐÅºÅÃ¿¸ô 833 Î¢Ãë(microsecond)¼´¸Ä±äÒ»´Î£®
ÆÕ±éµÄ±«ÂÊÓÐ 50, 75, 110, 300, 600, 1200 ÒÔ¼° 2400£®´ó²¿·ÝµÄ¸ßËÙÊý¾Ý»úËùÊ¹ÓÃµÄ±«ÂÊÎª 2400£®
ÒòÎªÓïÒô¼¶(voice-grade)µç»°ÏßÂ·µÄÆµ¿íÏÞÖÆ£¬³¬¹ý 2400 µÄ±«ÂÊºÜÄÑ´ïµÄµ½£¬¶øÖ»ÄÜÔÚ·Ç³£´¿¾»µÄµç»°ÏßÆ·ÖÊÏÂ²ÅÄÜÔË×÷£®
``baud''Ò»´ÊÔÚ Emile Baudot Ö®áá²ÅÓÐ£¬ËûÊÇ·ÇÍ¬²½µç±¨Ó¡±í»ú(asynchronous telegraph printer)µÄ·¢Ã÷Õß£®



\item[Ã¿Ãë´«ÊäÎ»Ôª(bps)] \mbox{}

Ã¿ÃëÎ»Ôª´«ÊäÂÊÊÇÃ¿ÃëÖÓ´«Êä¶àÉÙÎ»ÔªµÄ¶ÈÁ¿£®ÆÕ±éÃ¿ÃëÎ»Ôª´«ÊäÂÊÓÐ 50, 75, 110, 300, 1200, 2400, 4800, 9600, ... 115200£®
ÔÚÊ¹ÓÃ V.42bis  Ñ¹Ëõ(Ñ¹Ëõ×î´óÂÊ 4:1)µÄÊý¾Ý»úÏÂ£¬{\itshape ÀíÂÛÉÏ\/}Ã¿ÃëÎ»Ôª´«ÊäÂÊ¿ÉÒÔ¸ß´ï 115200£®
ÕâÊÇÐí¶àÈËÔÚ´íÓÃ ``baud'' Õâ¸ö×ÖÊ±ËùÖ¸µÄÒâË¼£®        

\end{description}
        

ËùÒÔ£¬Èç¹û¸ßËÙÊý¾Ý»úÒÔ 2400 baud ÔË×÷£¬ËüÃÇÈçºÎÄÜ¹»´«ËÍ 14400 bps?
Êý¾Ý»ú¶ÔÃ¿¸ö baud ±àÂëÀ´±íÊ¾Ä³Ò»ÊýÁ¿µÄÎ»Ôª¶øÊ¹µÃ bps ÄÜ´óì¶ baud£®
ÕâÑùÒ»À´£¬µ±¶þ¸ö»ò¸ü¶àÎ»Ôª±àÂë³ÉÒ»¸ö baud µÄÊ±ºò£¬bps ¾Í»á³¬Ô½ baud£®
Èç¹ûÄãµÄÊý¾Ý»úÊÇÒÔ 14400 bps Á¬ÏßµÄ»°£¬Ëü½«»áÒÔ 2400 baud µÄËÙ¶ÈÃ¿¸ö baud ´«ËÍÁù¸öÎ»Ôª£®

        
Õâ¸ö»ìÏýÊÇÔõ÷áÑù¿ªÊ¼µÄ? àÅ£¬»Øµ½½ñÌìµÄµÍËÙÊý¾Ý»ú»¹ÊÇ×òÌìµÄ¸ßËÙÊý¾Ý»úÄÇ¸öÊ±´ú£¬Ã¿ÃëÎ»Ôª´«ÊäÂÊ¸úÐÅºÅ¸Ä±äÂÊÊµ¼ÊÉÏÊÇÍêÈ«ÏàµÈµÄ£®
Ã¿¸ö bit ±àÂë³ÉÒ»¸ö baud£®ÈËÃÇ½»ÌæÊ¹ÓÃ bps ÒÔ¼° baud ÊÇÒòÎªËüÃÇµÄÊý×ÖÏàÍ¬£®
ÀýÈçÒ»Ì¨ 300 bps µÄÊý¾Ý»úÆäÐÅºÅ¸Ä±äÂÊÒ²ÊÇ 300£®
µ±¸ßËÙÊý¾Ý»úÆÕ¼°ááÒ»ÇÐ¶¼¸Ä±äÁË£¬¶øÇÒÃ¿ÃëÎ»Ôª´«ÊäÂÊ³¬¹ýÁËÐÅºÅ¸Ä±äÂÊ£®




\subsection{Ê²÷áÊÇ UARTs? ËüÃÇÈçºÎÓ°ÏìÐ§ÄÜ?\label{uart}}

UARTs (Í¨ÓÃ·ÇÍ¬²½½ÓÊÕ×ª»»Æ÷£¬{\bfseries U}niversal {\bfseries A}syncronous {\bfseries R}eceiver {\bfseries T}ransmitter)ÊÇÄã PC ´®ÁÐ¿¨ÉÏµÄ¾§Æ¬£®
ËüÃÇµÄ¹¦ÓÃÊÇ°Ñ×ÊÁÏ×ª³ÉÎ»Ôª£¬½«ÕâÐ©Î»ÔªËÍÉÏ´®ÁÐÏßÂ·£¬È»ááÔÚÁíÒ»¶ËÖØÐÂ½¨Á¢×ÊÁÏ£®
UARTs ÊÇÒÔÎ»Ôª×éÎªµ¥Î»´¦Àí×ÊÁÏ£¬ºÜ·½±ãµØÒ²ÊÇÃÀ¹ú±ê×¼½»»»Âë(ASCII)µÄ×ÖÔª´óÐ¡£®

¼Ù¶¨ÊÇÄãÓÐÒ»Ì¨Á¬½Óµ½Äã PC µÄÖÕ¶Ë»ú£®µ±Äã¼üÈëÒ»¸ö×ÖÔªÊ±£¬ÖÕ¶Ë»ú°ÑËü½»¸øËüµÄ×ª»»Æ÷(Ò²ÊÇ UART µÄÒ»ÖÖ)£®
¸Ã×ª»»Æ÷ÒÔÖ¸¶¨µÄËÙÂÊ°ÑÕâ¸öÎ»Ôª×éËÍµ½´®ÁÐÏßÂ·ÉÏ£¬Ã¿´ÎÒ»¸öÎ»Ôª£®
ÔÚ PC ÕâÒ»¶Ë£¬½ÓÊÕÎ»ÔªµÄ UART ÄÃ×ßËùÓÐµÄÎ»Ôª£¬È»ááÖØÐÂ×é³ÉÎ»Ôª×é²¢ÇÒ·Åµ½»º³åÇøÀïÈ¥£®

ÓÐÁ½ÖÖ²»Í¬µÄ UARTs ÀàÐÍ£®Äã¿ÉÄÜÓÐÌý¹ýÓÞ´ÀµÄ(dumb)UARTs - 8250 »¹ÓÐ 16450£¬ÒÔ¼°ÏÈ½øÏÈ³öÊ½ UARTs - 16550A£®
ÒªÁË½âËüÃÇµÄ²»Í¬£¬Ê×ÏÈÈÃÎÒÃÇÀ´¼ìÑéµ± UART ËÍ³ö»ò½ÓÊÕÒ»¸öÎ»Ôª×éÊ±Ëù·¢ÉúµÄÊÂ£®

Õâ UART ±¾Éí²¢²»ÄÜ¶Ô×ÊÁÏ×öÊ²÷á´¦Àí£¬ËüÖ»ÊÇËÍ³öÒÔ¼°½ÓÊÕËü£®
Ã¿´ÎËÍ³ö»ò½ÓÊÕÒ»¸öÎ»Ôª×éÊ±£¬CPU ¶¼»á´Ó´®ÁÐÉè±¸½Óµ½Ò»¸öÖÐ¶Ï£®
È»áá CPU ¾Í°Ñ½ÓÊÕµ½µÄÎ»Ôª×é´Ó UARTs µÄ»º³åÇø°áµ½¼ÇÒäÌåµÄÄ³´¦£¬»òÊÇÌá¹©ÁíÒ»¸öÎ»Ôª×é¸ø UART ´«ËÍ£®
8250 ÒÔ¼° 16450 UARTs Ö»ÓÐÒ»¸öÎ»Ôª×éµÄ»º³åÇø£®Õâ¸öÒâË¼ÊÇ£¬Ã¿ËÍ³ö»ò½ÓÊÕÒ»¸öÎ»Ôª×é¾Í»áÖÐ¶Ï CPU Ò»´Î£®
ÔÚµÍËÙµÄÇé¿öÏÂÕâÑùÃ»ÓÐÎÊÌâ£®µ«ÊÇÔÚ¸ßËÙµÄ´«ÊäÂÊÏÂ£¬CPU »áÃ¦ì¶´¦Àí UART ¶øÃ»ÓÐÊ±¼äÕÕÁÏÆäËü¹¤×÷£®
ÔÚÄ³Ð©Çé¿öÏÂ£¬CPU Ã»ÓÐ×ã¹»µÄâÅÔ£¼°Ê±´¦ÀíÖÐ¶Ï·þÎñ£¬¸ÃÎ»Ôª×é½«Òò×ÊÁÏÈç´Ë¿ìËÙµØ´«Èë¶ø±»¸²Ð´£®

Õâ¾ÍÊÇ 16550A UARTs ÓÐÓÃµÄµØ·½£®ÕâÐ©¾§Æ¬¾ßÓÐ 16 ¸öÎ»Ôª×éµÄÏÈ½øÏÈ³öØùÁÐ£®
Õâ¸öÒâË¼ÊÇËüÔÚ±ØÐëÖÐ¶Ï CPU Ö®Ç°¿ÉÒÔ½ÓÊÕ»ò×ª»»´ï 16 ¸öÎ»Ôª×é£®
Ëü²»½öÊÇÄÜµÈ£¬¶øÇÒ CPU ÏÖÔÚÒ²¿ÉÒÔÍ¬Ê±´«ËÍÈ«²¿ 16 ¸öÎ»Ôª×éµÄ×ÊÁÏ£®
ËäÈ»ÖÐ¶Ï½çÏÞ(threshold)ºÜÉÙÓÐÉèµ½ 16 µÄ£¬Õâ¶Ôì¶ÆäËüÖ»ÓÐÒ»¸öÎ»Ôª×é»º³åÇøµÄ UARTs ¶øÑÔÈÔÈ»ÊÇÒ»¸öÖØÒªµÄÓÅµã£®
CPU ÊÕµ½½ÏÉÙµÄÖÐ¶Ï£¬Òò´Ë¿ÉÒÔ×ÔÓÉµØ×öÆäËüÊÂÇé£®×ÊÁÏ²»»áÂ©Ê§£¬Ã¿¸öÈË¶¼ºÜ¸ßÐË£®
(Ò²ÓÐ 16550 Õâ¸ö UART£¬µ«ÊÇËü¸ú 16450 Ò»ÑùÒòÎªËüÓÐÎÊÌâ£®)

Ò»°ãÀ´Ëµ£¬ 8250 ÒÔ¼° 16450 UARTs Ó¦¸ÃÄÜ¹»Ê¤ÈÎ¸ß´ï 38400 bps µÄ¹¤×÷ËÙÂÊ£®
ÔÚ¸ßì¶ 38400 bps  µÄËÙÂÊÏÂ£¬Äã¿ÉÄÜ¿ªÊ¼¼ûµ½×ÊÁÏÂ©Ê§£®
ÆäËüµÄ PC ×÷ÒµÏµÍ³(ÕâÀïµÄ¶¨ÒåºÜ¿íËÉ)£¬Ïñ DOS ²¢·ÇÊÇ¶à¹¤µÄ£¬ËùÒÔËüÃÇÓÐ¿ÉÄÜ¿ÉÒÔÓÃ 8250 »ò 16450s È´Ó¦¸¶µÄ¸üºÃ£®
Õâ¾ÍÊÇÎªÊ²÷áÓÐÐ©ÈË²¢Ã»ÓÐ¿´µ½×ÊÁÏÂ©Ê§£¬Ö±µ½ËûÃÇ¸ÄÓÃ Linux  ²Å·¢Éú£®

ÎÞ-UART(Non-UART)ÒÔ¼°ÖÇ»ÛÐÍ¶à²º¿¨Ê¹ÓÃÊýÎ»´¦Àí»ú(DSP)¾§Æ¬À´´¦Àí¶îÍâµÄ»º³åÒÔ¼°¿ØÖÆ£¬Èç´Ë¸üÄÜ¼õÇá CPU µÄ¸ºµ££®
ÀýÈç£¬Cyclades Cyclom ¼° Stallion EasyIO ÕâÐ©¿¨Ê¹ÓÃ Cirrus Logic CD-1400 RISC ¾§Æ¬£¬»¹ÓÐÐí¶à¿¨Ê¹ÓÃ 80186 CPU »ò¸üÌØ±ðµÄ RISC CPU À´´¦Àí´®ÁÐÊä³öÈë£®

ÐÄÀïÒª¼ÇµÃ£¬ÕâÐ©ÓÞ´ÀÐÍµÄ UART ²¢·ÇÊÇ»µµÄ£¬Ö»ÊÇËüÃÇ²»ÊÊºÏ×ö¸ßËÙ´«Êä£®
µ±Äã½«ÖÕ¶Ë»ú»ò»¬ÊóÁ¬½Óµ½ÕâÐ© UARTs Ê±Ó¦¸Ã²»»áÔâÓöÀ§ÄÑ£®
µ«ÊÇ¶Ô¸ßËÙÊý¾Ý»ú¶øÑÔ£¬16550A ¿ÉÒÔËµÊÇ±ØÐëµÄ£®

Äã¿ÉÒÔ»¨¶àÒ»µãµãµÄÇ®¹ºÂòÓÐ 16550A UARTs µÄ´®ÁÐ¿¨£¬Ö»ÒªÑ¯ÎÊµçÄÔÉÌ¸Ã¿¨ËùÊ¹ÓÃµÄÊÇÊ²÷áÐÍºÅµÄ UARTs ¼´¿É£®
»òÕßÄãÏëÉý¼¶ÄãÏÖÔÚµÄ¿¨£¬Äã¿ÉÒÔÖ»Òª¼òµ¥µØ¹ºÂò 16550A ¾§Æ¬²¢ÇÒÖÃ»»ÄãÏÖÔÚµÄ 16450 UARTs ¾§Æ¬£®
ËüÃÇµÄ½ÅÎ»ÏàÈÝ(pin-to-pin compatible)£®ÓÐÐ©¿¨ÓÐ UARTs ²å²ÛÀ´×÷Õâ¸öÓÃÍ¾Ê¹ÓÃ£®
Èç¹û²»ÊÇµÄ»°Äã¿ÉÒÔº¸½Ó£®×¢Òâ£¬Èç¹ûÄãÓÐÇ®£¬ÂòÒ»ÕÅÐÂ¿¨½«¿ÉÄÜ»áÊ¡µôÄãÐí¶àÂé·³£¬ËüÃÇÔÚ \$50 ÔªÃÀ½ðÒÔÏÂ£®




\section{¹ÊÕÏÅÅ³ý}


\subsection{ÎÒ²»¶ÏµØÊÕµ½ ``line {\itshape NNN\/} of inittab invalid''}

ÒªÈ·¶¨Äã¶ÔÄãµÄ {\ttfamily init} °æ±¾Ê¹ÓÃÕýÈ·µÄÎÄ·¨£®ÕâÀïËùÃ»ÓÐµÄÒ»Ð© {\ttfamily init} »áÔÚ {\ttfamily /etc/inittab} µµ°¸ÀïÊ¹ÓÃ²»Í¬µÄÎÄ·¨£®
ÒªÈ·¶¨Äã¶ÔÄãµÄ {\ttfamily getty} °æ±¾Ê¹ÓÃÕýÈ·µÄÎÄ·¨£®




\subsection{µ±ÎÒÊÔÖø²¦ºÅÊ±£¬ËüËµ ``/dev/cua{\itshape N\/}: Device or resource busy''}

Õâ¸öÎÊÌâ¿ÉÄÜ·¢ÉúÔÚ DCD »ò DTR Ã»ÓÐÉè¶¨ÕýÈ·µÄÊ±ºò£®
DCD Ó¦¸ÃÖ»ÔÚÕæµÄÓÐÁ¬ÏßÊ±(ÏñÊÇÓÐÈË²¦½Ó½øÀ´)²Å±»Éè¶¨£¬¶ø²»ÊÇÔÚ {\ttfamily getty} ³ÖÐø¼à¿´¸Ã²ºµÄÊ±ºò£®
¼ì²é²¢È·¶¨ÄãµÄÊý¾Ý»úÕýÈ·µØÅäÖÃ³ÉÖ»ÔÚÕæÕýÁ¬ÏßÊ±²ÅÉè¶¨ DCD£®
DTR Ó¦¸ÃÔÚÈÎºÎ¶«Î÷Ê¹ÓÃ»ò¼à¿´ÏßÂ·Ê±Éè¶¨£¬ÏñÊÇ {\ttfamily getty}, {\ttfamily kermit}, »òÆäËüÍ¨Ñ¶³ÌÊ½£®

ÁíÒ»¸öÒýÆð ``device busy''  ´íÎóµÄÆÕ±éÔ­ÒòÊÇÄãÉè¶¨ÄãµÄ´®ÁÐ²ºÊ¹ÓÃÒ»¸öÒÑ¾­±»Ä³ÖÖÆäËü¶«Î÷Ê¹ÓÃµÄÖÐ¶Ï£®
ÔÚÃ¿Ò»¸öÉè±¸³õÊ¼»¯µÄÊ±áá£¬Ëü»áÒªÇó Linux ÔÊÐíËüÊ¹ÓÃËüµÄÓ²ÌåÖÐ¶Ï£®
Linux ³ÖÐø×·×ÙÄÇ¸öÖÐ¶Ï±»Ö¸¶¨¸øË­£¬¶øÈç¹ûÄãµÄÖÐ¶ÏÒÑ¾­±»Õ¼ÓÃ£¬ÄãµÄÉè±¸½«²»ÄÜÊÊµ±µØ³õÊ¼»¯£®
¸ÃÉè±¸ÕæµÄ²¢Ã»ÓÐÊ²÷á°ì·¨¸æËßÄã·¢ÉúµÄÕâ¼þÊÂ£¬³ýÁËµ±Äã³¢ÊÔÈ¥Ê¹ÓÃËüµÄÊ±ºò£¬Ëü»á»ØÓ¦ ``device-busy'' ´íÎóÑ¶Ï¢£®
¼ì²éÄãËùÓÐµÄ¿¨(´®ÁÐ£¬ÒÒÌ«ÍøÂ·£¬SCSI ½çÃæµÈµÈ)£®ÕÒÑ°Ó²ÌåÖÐ¶Ï³åÍ»µÄµØ·½£®




\subsection{ÎÒ³ÖÐø½Óµ½ ``Id S{\itshape N\/} respawning too fast: disabled for 5 minutes''}

È·¶¨ÄãµÄÊý¾Ý»úÓÐÕýÈ·µÄÅäÖÃ£®²é¿´ÔÝ´æÆ÷ {\ttfamily E} ºÍ {\ttfamily Q}£®
Õâ¿ÉÄÜ·¢ÉúÔÚÄãµÄÊý¾Ý»ú¸ú {\ttfamily getty} ¹µÍ¨µÄÊ±ºò£®

È·¶¨ÄãÕýÈ·µØ´Ó {\ttfamily /etc/inittab} ºô½Ð {\ttfamily getty}£®
Ê¹ÓÃ´íÎóµÄÎÄ·¨»òÉè±¸Ãû³Æ½«»áÒýÆðÑÏÖØµÄÎÊÌâ£®

ÒÔÏÂ·¨¼ì²éÄãµÄ {\ttfamily /etc/gettydefs} ÎÄ·¨ÊÇ·ñÕýÈ·:
\begin{tscreen}
\begin{verbatim}
linux# getty -c /etc/gettydefs
\end{verbatim}
\end{tscreen}




ÕâÒ²¿ÉÄÜ·¢ÉúÔÚ {\ttfamily uugetty} ³õÊ¹»¯Ê§°ÜÊ±£®²ÎÔÄ \ref{nowork} {(getty »ò uugetty ÈÔÈ»ÎÞ·¨ÔË×÷)} Ò»½Ú£®




\subsection{´®ÁÐÉè±¸ºÜÂý»òÊÇ´®ÁÐÉè±¸Ö»ÄÜµ¥Ïò´«ËÍ}

        
ÄãµÄÓ²ÌåÖÐ¶Ï¿ÉÄÜÓÐ³åÍ»£®È·¶¨Ã»ÓÐÓ²ÌåÖÐ¶ÏÊÇ±»·ÖÏíµÄ£®
¼ì²éÄãËùÓÐµÄ¿¨(´®ÁÐ¿¨, ÒÒÌ«ÍøÂ·¿¨, SCSI µÈµÈ)È·¶¨Äã´®ÁÐÉè±¸ÅäµÄÌø½ÓÉè¶¨ÒÔ¼° {\ttfamily setserial} ²ÎÊýÊÇÕýÈ·µÄ£®
Í¬Ê±¼ì²é {\ttfamily /proc/ioports} ¼° {\ttfamily /proc/interrups} ÒÔÈ·¶¨ÊÇ·ñÓÐ³åÍ»·¢Éú£®




\subsection{ÎÒµÄÊý¾Ý»úÔÚÄ³ÈË¶ÏÏßááÌ±»¾»òÊÇ {\ttfamily uugetty} ²¢Ã»ÓÐÖØÐÂÖ´ÐÐ}

        
ÕâÔÚ DTR Ñ¶ºÅµôÏÂ¶øÄãµÄÊý¾Ý»úÃ»ÓÐÖØÖÃÊ±»á·¢Éú£®
Õâ¸öÎÊÌâÔÚÎÒÉíÉÏ·¢ÉúµÄÊ±ºòÎÒ¿´µ½ÎÒµÄ RD ¸ú SD LEDs ·è¿ñµØÉÁË¸£®ÄãÐèÒªÈÃÄãµÄÊý¾Ý»úÖØÖÃ£®
´ó²¿·ÝµÄ Hayes ÏàÈÝÊý¾Ý»úÊ¹ÓÃ {\ttfamily \&D3} À´×öÕâ¼þÊÂ£¬µ«ÊÇÔÚÎÒµÄ USR Courier ÉÏ£¬ÎÒµÃÒªÉè {\ttfamily \&D2} ÒÔ¼° {\ttfamily S13=1}£®²éÔÄÄãµÄÊý¾Ý»úÊÖ²á£®




\subsection{ÎÒ½«ÎÒµÄÖÕ¶Ë»úÁ¬µ½ÎÒµÄ PC  ÉÏ£¬µ«ÊÇÔÚÎÒÊäÈëÇ©ÈëÃû³ÆÖ®áá£¬Ëü¾ÍËø×¡²»¶¯}

\begin{itemize}
\item Èç¹ûÄãÊ¹ÓÃ {\ttfamily getty}:
ÔÚÄãµÄ {\ttfamily /etc/gettydefs} ÏîÄ¿Àï¿ÉÄÜÃ»ÓÐÉè {\ttfamily CLOCAL} ¸øÖÕ¶Ë»ú£¬¶øÇÒ¿ÉÄÜÄãÓÃµÄ²¢²»ÊÇÍêÕûµÄ null modem Á¬½ÓÏß£®
ÄãÐèÒª {\ttfamily CLOCAL} À´¸æËß Linux ºöÂÔÊý¾Ý»ú¿ØÖÆÐÅºÅ£®Ëü¿´ÆðÀ´ÏñÕâÀïÕâÑù:
\begin{tscreen}
\begin{verbatim}
# 38400 bps Dumb Terminal entry
DT38400# B38400 CS8 CLOCAL # B38400 SANE -ISTRIP CLOCAL #@S @L login: #DT38400

# 19200 bps Dumb Terminal entry
DT19200# B19200 CS8 CLOCAL # B19200 SANE -ISTRIP CLOCAL #@S @L login: #DT19200

# 9600 bps Dumb Terminal entry
DT9600# B9600 CS8 CLOCAL # B9600 SANE -ISTRIP CLOCAL #@S @L login: #DT9600
\end{verbatim}
\end{tscreen}

½ÓÏÂÀ´£¬ÓÃ {\ttfamily kill} ¿³µô¸Ã {\ttfamily getty} ÐÐ³ÌÕâÑùÐÂÐÐ³Ì»áÒÔÐÂµÄÏîÄ¿²úÉú£®
\item Èç¹ûÄãÊ¹ÓÃ {\ttfamily agetty}:
¼ÓÉÏ {\ttfamily -L} Æì±êµ½ÄãµÄ {\ttfamily /etc/initab} ÖÐµÄ {\ttfamily agetty} ÄÇÐÐ£®
Õâ»áÊ¹µÃËüºöÂÔÊý¾Ý»ú¿ØÖÆÐÅºÅ£®È»áá¼üÈë {\ttfamily init q} ÒÔÖØÐÂÖ´ÐÐ {\ttfamily init}£®
Õâ¸öÏîÄ¿¿´ÆðÀ´ÏñÕâÑù:
\begin{tscreen}
\begin{verbatim}
s1:345:respawn:/sbin/agetty -L 9600 ttyS1 vt100
\end{verbatim}
\end{tscreen}
\end{itemize}





\subsection{ÔÚ¸ßËÙÏÂ£¬ÎÒµÄÊý¾Ý»úÂ©Ê§×ÊÁÏ}

Èç¹ûÄã³¢ÊÔÔÚ´óì¶ 38400 bps µÄËÙÂÊÏÂÊ¹ÓÃÄãµÄÊý¾Ý»ú£¬¶øÄã²¢Ã»ÓÐ 16550A UARTs µÄ»°£¬ÄãÓ¦¸ÃÒª½«ËüÃÇÉý¼¶£®
ÓÐ¹Ø UARTs µÄËµÃ÷²ÎÔÄ \ref{uart} {(Ê²÷áÊÇ UARTs?)} Ò»½Ú£®




\subsection{ÔÚÏµÍ³Æô¶¯Ê±£¬Linux Ã»ÓÐÒÀÕÕÎÒµÄÅäÖÃ»Ø±¨´®ÁÐÉè±¸£®}

ÕâÊÇÊÂÊµ£®Linux ÔÚÏµÍ³Æô¶¯Ê±²¢Ã»ÓÐ×öÈÎºÎµÄ IRQ Õì²â£¬ËüÖ»×ö´®ÁÐÉè±¸Õì²â£®
ËùÒÔ£¬²»ÒªÀí»áËüËùÏÔÊ¾ÓÐ¹ØÓ²ÌåÖÐ¶ÏµÄ²¿·Ý£¬ÒòÎªËüÖ»ÊÇ¼Ù¶¨Ê¹ÓÃ±ê×¼µÄÓ²ÌåÖÐ¶Ï£®
ÕâÊÇÒòÎªÓ²ÌåÖÐ¶ÏÕì²â²»¿É¿¿£¬¶øÇÒ¿ÉÄÜ±»Â÷Æ­¶øÕâÑù×öµÄ£®

ËùÒÔ¼´Ê¹ÎÒµÄ {\ttfamily ttyS2} ÉèÔÚ IRQ5£¬ÎÒÈÔÈ»¿´µ½
\begin{tscreen}
\begin{verbatim}
Jan 23 22:25:28 misfits vmunix: tty02 at 0x03e8 (irq = 4) is a 16550A
\end{verbatim}
\end{tscreen}

ÔÚ Linux Æô¶¯Ê±£¬Äã±ØÐëÊ¹ÓÃ {\ttfamily setserial} À´¸æËß Linux ÄãËùÊ¹ÓÃµÄÓ²ÌåÖÐ¶Ï£®
Linux Æô¶¯áá£¬Äã¿ÉÒÔ²é¿´ {\ttfamily /proc/interrupts} µµÒÔÁË½âÕæÕý±»ÅäÖÃµÄ IRQ ÊÇÊ²÷á£® 




\subsection{µ±ÎÒÊ¹ÓÃÎÒµÄÊý¾Ý»ú½ÐÓÃ Linux »úÆ÷Ê± {\ttfamily rz} ÒÔ¼°/»òÊÇ {\ttfamily sz} ²»¶¯}

Èç¹û Linux ÔÚÄã³¢ÊÔ´«ËÍµµ°¸Ê±»áÑ°ÕÒ {\ttfamily /dev/modem} µÄ»°£¬²é¿´ {\ttfamily /etc/profile} ÒÔ¼° {\ttfamily /etc/csh.cshrc}£®
Ä³Ð©·¢ÐÐÌ×¼þ»áÔÚÕâÐ©µØ·½¶¨ÒåÒ»Ð©±ðÃû£¬×îÖøÃûµÄÊÇ Slackware£®
ÕâÐ©±ðÃûÈÅÂÒÁË zmodem ³ÌÊ½£®°ÑËüÃÇÄÃµô»òÊÇ¸üÕýËüÃÇ£®




\subsection{ÎÒµÄÓ©Ä»Ó¡³ö¿´ÆðÀ´ºÜºÃÍæµÄ×ÖÔª}

ÕâÔÚµ±Äã°Ñ¶þ½øÎ»×ÊÁÏËÍÍùÓ©Ä»µÄÊ±ºò»á·¢ÉúÔÚÐéÄâ¿ØÖÆÌ¨ÉÏ£¬»òÕßÓÐÊ±ºò»á·¢ÉúÔÚ´®ÁÐÁ¬ÏßÉÏ£®
ÐÞ¸´Õâ¸öÎÊÌâµÄ·½·¨ÊÇÊäÈë {\ttfamily echo \^{}v\^{}[c}£®ÒòÎª¿ØÖÆ×ÖÔªÖ®¹Ê£¬ËüÊÇ:
\begin{tscreen}
\begin{verbatim}
linux% echo <ctrl>v<esc>c
\end{verbatim}
\end{tscreen}





\subsection{{\ttfamily getty} »ò {\ttfamily uugetty} ÈÔÈ»ÎÞ·¨ÔË×÷\label{nowork}}

{\ttfamily getty\_ps} ÉÏÓÐ¸ö {\ttfamily DEBUG} Ñ¡Ïî£®±à¼­ÄãµÄ {\ttfamily /etc/conf.$\{$uu$\}$getty.ttyS}{\itshape N\/} ÅäÖÃµµ²¢¼ÓÉÏ {\ttfamily DEBUG=}{\itshape NNN\/}£®
ÆäÖÐ {\itshape NNN\/} ÊÇÏÂÁÐµÄÊý×Ö×éºÏÖ®Ò»£¬¸ù¾ÝÄãÏëÒªÕì²âÊ²÷á´íÎó¶ø¶¨:
\begin{tscreen}
\begin{verbatim}
D_OPT   001            option settings
D_DEF   002            defaults file processing
D_UTMP  004            utmp/wtmp processing
D_INIT  010            line initialization (INIT)
D_GTAB  020            gettytab file processing
D_RUN   040            other runtime diagnostics
D_RB    100            ringback debugging
D_LOCK  200            uugetty lockfile processing
D_SCH   400            schedule processing
D_ALL   777            everything 
\end{verbatim}
\end{tscreen}

Éè¶¨ {\ttfamily DEBUG=010} ÊÇ¸ö¿ªÊ¼µÄºÃµØ·½£®

Èç¹ûÄãÕýÔÚÖ´ÐÐ {\ttfamily syslogd} µÄ»°£¬Õì´í×ÊÑ¶½«»á³öÏÖÔÚÄãµÄ¼ÇÂ¼µµÀï£®
Èç¹ûÄãÃ»ÓÐÖ´ÐÐ {\ttfamily syslogd} ÄÇ÷á {\ttfamily getty} µÄ×ÊÑ¶½«»á³öÏÖÔÚ {\ttfamily /tmp/getty:ttyS}{\itshape N\/} Àï¶ø {\ttfamily uugetty} µÄ×ÊÑ¶Ôò»á³öÏÖÔÚ {\ttfamily /tmp/uugetty:ttyS}{\itshape N\/} Àï£¬¶øÇÒËüÃÇÒ²»á±»·Åµ½ {\ttfamily /var/adm/getty.log} ÀïÈ¥£®
²é¿´Õì´í×ÊÑ¶¿´¿´·¢ÉúÁËÊ²÷á£®×î¿ÉÄÜµÄÊÇ£¬Äã½«µÃÒªµ÷ÕûÒ»Ð©ÄãÅäÖÃµµÀïµÄ²ÎÊý£¬²¢ÇÒÖØÐÂÅäÖÃÄãµÄÊý¾Ý»ú£®

ÄãÓ¦¸ÃÒ²È¥ÊÔÊÔ {\ttfamily mgetty}£®ÓÐÐ©ÈËÔÚÊ¹ÓÃËüÊ±¸üÎªÐÒÔË£®




\section{ÆäËüµÄ×ÊÑ¶À´Ô´}

\begin{itemize}
\item ÏÂÁÐÖ¸ÁîµÄÏßÉÏÊÖ²á(man pages): {\ttfamily agetty(8)}, {\ttfamily getty(1m)}, {\ttfamily gettydefs(5)}, 
{\ttfamily init(1)}, {\ttfamily login(1)}, {\ttfamily mgetty(8)}, {\ttfamily setserial(8)}
\item ÄãµÄÊý¾Ý»úÊÖ²á
\item NET-3 HOWTO: ËùÓÐ¹Øì¶ÍøÂ·µÄ¶«Î÷£¬°üÀ¨ÁË SLIP, CSLIP, ÒÔ¼° PPP
\item \onlynameurl{PPP HOWTO}: ÓÐÖúì¶Ê¹ÓÃ PPP
\item Printing HOWTO: ÈçºÎÉè¶¨´®ÁÐÓ¡±í»ú
\item Term HOWTO: ËùÓÐÄãÏëÖªµÀ¹Øì¶ {\ttfamily term} ³ÌÊ½µÄÊÂÇé
\item UPS HOWTO: Éè¶¨Á¬ÉÏÄãµÄ´®ÁÐ²ºµÄ UPS
\item UUCP HOWTO: ½¨Á¢ UUCP µÄ×ÊÑ¶
\item Usenet ÐÂÎÅÈº×é: 
\begin{tscreen}
\begin{verbatim}
comp.os.linux.answers
        ¹Øì¶ Linux µÄ FAQs, How-To's, READMEs µÈµÈ£®
comp.os.linux.hardware    
    Linux ×÷ÒµÏµÍ³µÄÓ²ÌåÏàÈÝÐÔ£®
comp.os.linux.networking  
        Linux µÄÍøÂ·¼°Í¨Ñ¶£®
comp.os.linux.setup       
        Linux µÄ°²×°¼°ÏµÍ³¹ÜÀí£®
\end{verbatim}
\end{tscreen}

\item Linux ´®ÁÐµç×ÓÓÊ¼þÁÐ±í(mailing list)£®Òª¼ÓÈëµÄ»°£¬¼Äµç×ÓÓÊ¼þµ½ {\ttfamily \onlynameurl{majordomo@vger.rutgers.edu}}£¬ÎÄÕÂÄÚÈÝÐ´ ``{\ttfamily subscribe linux-serial}''£®
Èç¹ûÄãÔÚÄÚÈÝÉÏÐ´ ``{\ttfamily help}''£¬Äã»áµÃµ½Ò»·Ý¸¨ÖúËµÃ÷£®
Õâ¸öËÅ·þÆ÷»¹Ìá¹©Ðí¶àÆäËüµÄ Linux ÁÐ±í£®ËÍ³ö ``{\ttfamily lists}'' Ö¸Áî¿ÉÒÔµÃµ½ËùÓÐµç×ÓÓÊ¼þÁÐ±íµÄÁÐ±í£®
\item ÌÖÂÛ´®ÁÐÍ¨Ñ¶¼°¶à²º´®ÁÐ¿¨µÄ°×Æ¤Êé¿É×Ô Cyclades µÄ {\ttfamily \onlynameurl{http://www.cyclades.com}} È¡µÃ£®
\item Modem FAQs:\\ 
\nameurl{http://web.aimnet.com/jnavas/modem/faq.html}{Navas 28800 Modem FAQ}\\ 
\nameurl{http://www.teleport.com/curt/modems.html}{Curt's High Speed Modem Page}
\item ´®ÁÐ³ÌÊ½Ð´×÷:
\nameurl{http://heg-school.aw.com/cseng/authors/stevens/advanced/advanced.nclk}{Advanced Programming in the UNIX Environment}, by W. Richard Stevens 
(ISBN 0-201-56317-7; Addison-Wesley)\\ 
\nameurl{http://www.ora.com/catalog/posix/}{POSIX Programmer's Guide}, by Donald Lewine (ISBN 0-937175-73-0; O'Reilly)
\end{itemize}





\section{ÃúÐ»}

        
¶ÀÁ¢×«Ð´Õâ·Ý HOWTO ÊÇ²»¿ÉÄÜµÄÊÂ£®
ËäÈ»Õâ·Ý HOWTO µÄÄÚÈÝ´ó²¿·Ý¶¼ÊÇÎÒÐ´µÄ£¬ÎÒ¾­³£ÖØÐ´ÕâÐ©¸ÐÐ»À´Î¬³ÖÐí¶àÔÚÐ´×÷·½Ê½ÒÔ¼°ÄÚÈÝÉÏÓÐ¹±Ï×µÄÈË£®
¸ÐÐ»Ã¿¸öÔø¾­¹±Ï×¾­Ñé»ò½¨ÒéµÄÈË£¬ÕâÐ©ÈËµÄÁÐ±íÒÑ¾­³¤µÃÎÞ·¨ÁÐ³ö(³¬¹ýÒ»°ÙÈË)£®
ÌØ±ð¸ÐÐ» Ted T'so ¶Ôì¶ÓÐ¹Ø´®ÁÐÇý¶¯³ÌÊ½ÎÊÌâµÄ»Ø´ð£¬»¹ÓÐ¸ºÔðÎ¬»¤ {\ttfamily getty\_ps} µÄ Kris Gleason£¬ÒÔ¼°¸ºÔðÎ¬»¤ {\ttfamily mgetty} µÄ Gert D\"oring£®

SERIAL HOWTO ½áÊø

\end{document}
