The Linux Serial HOWTO 
revised by David S.Lawyer  bf347@lafn.org original by Greg Hankins

v1.12, July 1998

--------------------------------------------------
Translated by Ilgiz Kalmetev (2:5011/36.6@fidonet)
--------------------------------------------------

     ,   
Text-Terminal-HOWTO  Serial-Programming-HOWTO.     
getty,     .

______________________________________________________________________



1. 

  1.1  
  1.2  HOWTO's (:  )
  1.3   
  1.4    
  1.5  
  1.6 

2.    

  2.1    PC
  2.2 Plug And Play (PnP) 
  2.3 Dumb    (  
      8250/16450/16550A)
  2.4    
  2.5    
    2.5.1 Winmodem  
    2.5.2  Rockwell (RPI)  

3.    ?

  3.1 : modem, mouse
  3.2  cua
  3.3       /dev
    3.3.1  ttyS   /dev
  3.4   dumb  
  3.5     

4.  ,      

  4.1   getty
    4.1.1  getty_ps
    4.1.2  mgetty
    4.1.3  agetty
  4.2   setserial

5.       ?

  5.1  
    5.1.1  
    5.1.2  
  5.2    
  5.3      
  5.4    

6.          

  6.1       
  6.2  getty_ps

7. uugetty

  7.1  uugetty
    7.1.1  
    7.1.2   
    7.1.3     
  7.2  uugetty

8.       PC?

  8.1  
  8.2 
  8.3    PC   

9.       ?

  9.1    
  9.2    

10.         ? 
           ?

11.    

12.      

  12.1 kermit  zmodem
  12.2    
  12.3  ls   
  12.4   ,   
  12.5   Linux    ?
    12.5.1    
  12.6   
  12.7.    

13.    ...

  13.1   lock  ( )?
  13.2 ``"  ``\"
  13.3   UART?     ?

14.  

  14.1    ``line NNN of inittab invalid''
  14.2      ,   
       ``/dev/cua N : Device or resource busy''
  14.3    
       ``getty respawning too fast: disabled for 5 min- utes''
  14.4    ,   
               
  14.5     ,  - ,  uugetty  
        
  14.6  ,    PC,   ,      
          ,    
  14.7   ,    
  14.8   Linux     ,
         
  14.9 rz / sz  ,         Linux
  14.10     
  14.11 getty  uugetty    

15.   

16. 

______________________________________________________________________

1. 

 - Linux Serial HOWTO.       , 
     HOWTO'S.  -     
 Linux,          
.

  HOWTO   (. `` HOWTO'S "). 
HOWTO   Linux   Intel x86,      
  .


1.1.  

  (c) 1993 - 1997  Greg Hankins,   1998 - David 
Lawyer.      ,   
 LDP  http://sunsite.unc.edu/LDP/COPYRIGHT.html.    
       .


1.2.  HOWTO'S   (:  )

 Serial-Programming-HOWTO      C (  ),
      .     
  "stty...",       .

 Text-Terminal-HOWTO -     (dumb ).


1.3.   

, David Lawyer,    (Greg Hankins   
 ).   ,      ,  ,
   .      .  
,    .  ,      
Howto: 1.     Text-Terminal-HOWTO. 2.   
   Howto: ModemHOWTO. 3.    , 
   Howto.         
 1998.


1.4.    

  Serial HOWTO    
ftp://sunsite.unc.edu:/pub/Linux/docs/HOWTO/Serial-HOWTO  .  
 ,  Postscript  DVI   other-formats. 
Serial HOWTO    
http://sunsite.unc.edu/LDP/HOWTO/Serial-HOWTO.html     
comp.os.linux.answers .


1.5.  

    , ,   
 .    ,     
HOWTO.      !   ,    
,       .      
bf347@lafn.org (David Lawyer).


1.6. 

 mileage  .          
  .


2.    

Linux,  ,      
.


2.1.    PC 

    PC (COM1 - COM4),     
      (,  
    . ...).   PC      (    
   ,    ),      
   .

    PC (COM1 - COM4)

 Quickpath Systems Port-Folio 550e ( IRQ - 3, 4, 5, 9, 10, 11, 12  
  15). : -  ,     
  COM4   IBM8514 .  -    IBM8514.


2.2.  Plug And Play (PnP) 

   - PnP,      (  
)   Linux.     - ,   
  PnP.

  ,        
COM  IRQ, PnP .      PnP  BIOS
 .      PnP,    :

  Win95/98,    ,   
  ,    Linux.  , :

  Win95/98,        
  Linux ,   .      
  loadlin.

    PnP  
  http://www.redhat.com/linux-info/pnp


2.3 Dumb    (  
    8250/16450/16550A)

   " ".

* = > "setserial"   

  AST FourPort   (4 ) *
  Accent Async-4 (4 ) *
  Arnet Multiport-8 (8 )
  Bell Technologies HUB6 (6 )
  Boca BB-1004 (4 ), BB-1008 (8 ), BB-2016 (16 ) *
  Boca IOAT66 (6 )
  Boca 2by4 (4  , 2  )
  Byterunner (claims low prices)
  Computone ValuePort V4-ISA (  AST FourPort) *
  Digi PC/8 (8 )
  GTEK BBS-550 (8 ) . mini-howto  .
  HUB-6 . Bell Technologies.
  Longshine LCS-8880, Longshine LCS-8880+ (  AST FourPort)
  Moxa C104, Moxa C104+ (  AST FourPort)
  PC-COMM (4 )
  Sealevel Systems <http://www.sealevel.com> COMM-2 (2 ), COMM-4 (4 
   )  COMM-8 (8 )
  SIIG I/O Expander 2S IO1812 (4 )
  STB-4COM (4 )
  Twincom ACI/550
  Usenet Serial Board II (4 ) *

 -, Linux     ,  
 8250, 16450, 16550, 16550A, 16650 ( ) UART,  
 ,      UART.

 : BB-1004  BB-1008    DCD  RI,   
       , 
 .      .


2.4.    

,    Linux  .    
.

 Comtrol RocketPort (36MHz ASIC; 4, 8, 16  32 ) 
   : info@comtrol.com  http://www.comtrol.com 
   :  Comtrol
   : 
    ftp://tsx-11.mit.edu/pub/linux/packages/comtrol

 Computone IntelliPort II (16MHz 80186; 4, 8  16 ), 
  IntelliPort II EXpandable (20MHz 80186; 16 - 64 ) 
   : Michael H. Warfield, mhw@wittsend.atl.ga.us 
   : "pre-ALPHA"

 Cyclades Cyclom-Y (Cirrus Logic CD1400 UARTS; 8 - 32 ), 
  Cyclom-Z (25MHz MIPS R3000; 8 - 128 ) 
   : sales@cyclades.com  http://www.cyclades.com 
   :  Cyclades 
   : 
    ftp://ftp.cyclades.com/pub/cyclades     Linux,   
     1.1.75

 Decision PCCOM8 (8 ) 
   : pccom8@signum.se 
   : ftp://ftp.signum.se/pub/pccom8

 Digi PC/XI (12. 5MHz 80186; 4, 8,  16 ),
       PC/XE (12. 5/16MHz 80186; 2, 4,  8 ),
       PC/XR (16MHz IDT3041; 4  8 ),
       PC/XEM (20MHz IDT3051; 8 - 64 ) 
   : sales@dgii.com  http://www.dgii.com
   :  Digi
   : ftp://ftp.dgii.com/drivers/linux
      Linux,    2.0

 Digi COM/XI (10MHz 80188; 4  8 ) 
   : Simon Park, si@wimpol.demon.co.uk 
   : ALPHA 
  :  -      email   
  -  . Mark Hatle, fray@krypton.mankato.msus.edu - , 
      ,    . Mark  
      .

 Equinox SuperSerial Technology (30MHz ASIC; 2 - 128 ) 
   : sales@equinox.com  http://www.equinox.com 
   :  Equinox
   : 
    ftp://ftp.equinox.com/library/sst

 GTEK Cyclone (16C654 UARTS; 6, 16  32 ), 
  SmartCard (24MHz Dallas DS80C320; 8 ),
  BlackBoard-8A (16C654 UARTS; 8 ),
  PCSS (15/24MHz 8032; 8 ) 
   : spot@gtek.com  http://www.gtek.com
   :  GTEK
   : ftp://ftp.gtek.com/pub

 Hayes ESP (COM-BIC; 1 - 8 ) 
   : Andrew J. Robinson, arobinso@nyx.net  
    http://www.nyx.net/~arobinso
  c :   
   : http://www.nyx.net /~arobinso     Linux,
        2.1.15

 Maxpeed SS (Toshiba; 4, 8  16 ) 
   : info@maxpeed.com  http://www.maxpeed.com
   :  Maxpeed 
   : ftp://maxpeed.com/pub/ss

 Moxa C218 (12MHz 80286; 8 ), 
  Moxa C320 (40MHz TMS320; 8 - 32 ) 
   : info@moxa.com.tw  http://www.moxa.com.tw
   :  Moxa
   : ftp://ftp.moxa.com.tw/drivers/c218-320/linux

 SDL RISCOM/8 (Cirrus Logic CD180; 8 ) 
   : sales@sdlcomm.com  http://www.sdlcomm.com
   :  SDL
   : ftp://ftp.sdlcomm.com/pub/drivers
 
 Specialix SIO (20MHz Zilog Z280; 4 - 32 ),
  XIO (25MHz Zilog Z280; 4 - 32 ) 
   :  , simonallen@cix.compulink.co.uk
   : 
   : ftp://sunsite.unc.edu/pub/Linux/kernel/patches/serial

  Stallion EasyIO-4 (4 ports), EasyIO-8 (8 ports), and EasyConnection (8 - 32 
ports) - each with Cirrus Logic CD1400

 Stallion EasyIO-4 (4 ), 
           EasyIO-8 (8 ), 
           EasyConnection (8 - 32 ) -   Cirrus Logic CD1400 UARTs,
  Stallion (8MHz 80186 CPU; 8  16 ), 
  Brumby (10/12 MHZ 80186 CPU; 4, 8  16 ),
  ONBOARD (16MHz 80186 CPU; 4, 8, 12, 16  32 ), 
  EasyConnection 8/64 (25MHz 80186 CPU; 8 - 64 ) 
   : sales@stallion.com  http://www.stallion.com
   :  Stallion
   : ftp://ftp.stallion.com/drivers/ata5/linux  
       linux,   1.3.27

  Comtrol, Cyclades, Digi,  Stallion     
1995  Linux Journal.    http://www.ssc.com/lj/issue14.


2.5.    

2.5.1. Winmodem  

,  ``Winmodems",  USR Sportster Winmodem  IBM 
Aptiva MWAVE,    Linux.     
,     Windows.

   .


2.5.2.  Rockwell (RPI)  

,    Rockwell RPI,   
 ,         Linux. 
RPI     ,    MS  
CPU  .        
RPI (        ),    
  RPI,    (   )  
 RPI: +H0


3.     ?

 - -     / .  
   -   ,  
,  ,    ethernet  ..   
    ,      - 
 .       
-   (IRQ).    , 
 COM1 - COM4:

        ttyS0 (COM1) address 0x3f8 IRQ 4
        ttyS1 (COM2) address 0x2f8 IRQ 3
        ttyS2 (COM3) address 0x3e8 IRQ 4
        ttyS3 (COM4) address 0x2e8 IRQ 3

 Linux      ,  
,       
  .   ,    COM1  ttyS0, COM2 
 ttyS1, COM3  ttyS2,  COM4  ttyS3.  ,   
     IRQ.     
      ,      
IRQ. .  ``   ,    
?"   IRQ.


3.1. : , 

  ,     , 
/dev/modem     /dev/mouse   .    - 
      /dev,   
   (   bus mouse,  /dev/mouse   
 bus mouse).

  /dev/mouse  /dev/modem  .    
  .  ,      
    ,      , 
       ,    
/dev/modem.   ,    ,  , 
     . ,     
  ,    (minicom, )  
.


3.2.  cua

  ttyS    cua.   
   cua,      -   ttyS.
   cua  ttyS - ,     "open" ( 
- )   , cua  ,   
   ( DCD)    .

(        stty.) 
 ttyS      ,    
,      "open".

   ttyS   ,    cua.   
,   ""  in read statements in the 
program  -,     ,  
 .  cua   Linux     Posix 
        .


3.3.       /dev

     /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

 ,        ,
   ( cua  ).    , 
:

     linux% ls -l /dev/cua* linux% ls -l /dev/ttyS*


3.3.1.  ttyS   /dev

    ,        mknod. 
, ,      ttyS0:

     linux# mknod -m 666 /dev/cua0 c 5 64
     linux# mknod -m 666 /dev/ttyS0 c 4 64

    MAKEDEV,    /dev.   
 . ,      ttyS0,  
 :

     linux# cd /dev
     linux# ./MAKEDEV ttyS0

         
     .


3.4.   dumb  

           . 
      rc.serial   0setserial,  
   setserial.       
setserial,      . ,  
    .

   mknod,   MAKEDEV.    
   ``64 + _". ,     
 ttyS17,  :

linux# mknod -m 666 /dev/cua17 c 5 81
linux# mknod -m 666 /dev/ttyS17 c 4 81

 ,  ``64 + 17 = 81".    MAKEDEV,  
 :

linux# cd /dev
linux# ./MAKEDEV ttyS17

 :  SIIG  IO1812   COM5-COM8 
 .

   COM5 = 0x250, COM6 = 0x258, COM7 = 0x260  COM8 = 0x268.

 : Digi PC/8 Interrupt Status Register -  0x140.

 :  AST Fourport,     
skip_test  rc.serial.


3.5.     

 ,    .    
   .     
    .


4.  ,     

4.1.   getty?

getty - ,      ,   
  Unix .     getty,   
     Linux .     getty, 
       .   , 
   Linux: getty_ps, mgetty  agetty.    
 ,   ,     , 
       getty,  .


4.1.1.  getty_ps

      getty_ps. (Debian 
 agetty,    mgetty).    : 
getty -      ,  uugetty  .
    getty,        .


4.1.2.  mgetty

mgetty -  getty,      .   
   ,     99%, 
  .         , mgetty 
       PPP. 
  mgetty (   texinfo)  ,  
   .

,       .    
   mgetty   http://www.leo.org/~doering/mgetty/.


4.1.3.  agetty

Agetty -   getty.    
getty,        ,  
 .


4.2.   setserial?

setserial - ,        
  ,   ,   
   .      
 ,  setserial  .   - /dev/ttyS1, 
 ..,        .

  Linux  ,   ttyS{0-3}, 
   IRQS 4  3.  ,       
 ,      ttyS{0-3}  
 IRQ,     setserial,    
 .      man. 


5.       ?

5.1.  

       .   
         .   
     ,      ,  
.     ,    , 
 ,       .


5.1.1.  

, ,     .    
 ,   .     
 . ,    ,  .    DB25 
 ,      "" DB25 ( ).
     ,   "" DB25 
().         
.        ,  
 ,    .


5.1.2.  

      .      
 ,    . ,     - 
        -. 
     ,   . 
, .  ``       
?",         .

         
,   ,   .    
     BIOS,     
.

      .

    IBM8514,      ,     .
    ,  ,     
  ttyS3.  Linux       ttyS3,  
  setserial,     .  
  ttyS{0-2}    - .

Linux      ttyS3 -   
.


5.2    

 kermit, minicom    ,   
, ,         SLIP  PPP. 
     kermit  http://www.columbia.edu/kermit/.

,  ,      ttyS3,     
115200 \.      :

     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                           ; you type this and then the Enter key 
     OK                                 ; modem should respond with this

      AT,    ,    
 Linux   .      
, :

     ATDT7654321

 7654321 -  .  ATDP  ATDT,    
 .   ,    .

    kermit,   Ctrl,   
  ,    Ctrl,    C:

     Ctrl-\-C
     (Back at linux)
     C-Kermit>quit
     linux#

        "".

    ,   kermit    
       , 
,   USRobotics (USR):

       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        ; Select modem type
       C-Kermit>set line /dev/ttyS3       ; Select communication device
       C-Kermit>set speed 115200          ; Set the dialing speed
       C-Kermit>dial 7654321              ; Dial
        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:


.  `` c"   ,    -
.

      ,    
   ,     
(    115200 \). This is not the same as the "advertised" 
speed of the modem such as 56K.  Linux  libc   5.x  
    115200 \.  Linux     
,  .


5.3      

      ,   
  .

        ,   
       ,    
  getty. ,      
    ,   
.  , getty,    115200,  
    ,  getty  init   
 ,    . ,   
 ,        
   -       
,         .


5.4.    

        (RTS/CTS),  
    .     ,  
  . ,    RTS/CTS  
     .    
  , ,  /etc/rc.d/rc.local  /etc/rc.d/rc.serial. 
,        rc.sysinit!  
      ,    
     : 

     stty crtscts < /dev/ttyS3

    ,    RTS/CTS   . 
       .   
   ,  ,     
 ,      .


6.          

      .      
``      ?",    !
      .      
,        .


6.1       

     ,      
  (,  AT    ):

E1        
Q0         
V1       verbose ON
S0=0        (uugetty     WAITFOR)

      ,  INIT     
   ,   .    
     ...

&C1      DCD   
&S0     DSR  
DTR on/off   (   - RTFM)

   ,    ,     
.

      ,      
 INIT     . . .   
  DIP ,     . 
,     .

        . , 
     ,        
, ,  !      
ftp://ftp.cc.gatech.edu/pub/people/gregh/modem-configs

 :     USR Courier V.34 
,   DTR,     &D2   S13=1 ( 
 0  S13).

  USR Sportster V.34   .

 :   Supra  DCD ,   
.    Supra,   &C0,   &C1.  
   &D2,    DTR.


6.2.  getty_ps

     sunsite.unc.edu:/pub/Linux/system/serial.

 ,       (57600  115200 
\),     2.0.7j  .     
libc 5.x  .

 , getty_ps      Linux FSSTND 
(  ),  ,     /sbin,  
    /etc/conf.{uu}getty.ttySN.

    !  ,      
/var/lock. ,      /var/lock.

      FSSTND,    /  ., 
    /etc/default/{uu}getty.ttySN,  
  /usr/spool/uucp.    ,    
UUCP,    UUCP  ,     
 ,     .

getty_ps    syslogd,   . . 
man  syslogd(1)  syslog.conf(5)   syslogd,     
 .     LOG_AUTH,   
LOG_ERR    LOG_DEBUG.      
syslogd,    tune.h    getty_ps,  
         
,  /var/adm/getty.

,    - FSSTND    syslog.   
    .  Makefile, tune.h  config.h, 
   .      
,   .

>   ,    getty    getty_ps.

  uugetty   uugetty,     getty_ps. 
     mgetty  agetty.


7.  uugetty

7.1.  uugetty

,         
 -   .       ttyS3,   
 /dev/cua3  /dev/ttyS3.     , . 
 `` ttyS   /dev"  ,   ,  
 .          
,  uugetty      ,   
 /dev/cuaN   /dev/ttySN

[      cua,      .]

uugetty     .  
/etc/gettydefs,        .   
  /etc/gettydefs,     
, :

     linux# getty -c /etc/gettydefs


7.1.1.  

         9600 \   , 
        . :

     # 115200 fixed speed
     F115200# B115200 CS8 # B115200 SANE -ISTRIP HUPCL #@S @L @B login: #F115200

           RTS/CTS, 
     CRTSCTS:

     # 115200 fixed speed with hardware flow control
     F115200# B115200 CS8 CRTSCTS # B115200 SANE -ISTRIP HUPCL CRTSCTS #@S @L @B login: #F115200


7.1.2.   

     ( 9600 \),      
 ,    ,    
.

 ,        ""  
,  #38400.       .


       # 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



7.1.3     

 ,    uugetty       
.   ,    ,     
\.      :


         @B      (    @B ) 
                /.
         @D        MM/DD/YY.
         @L     ,    getty.
         @S     .
         @T        HH:MM:SS (24-).
         @U         .  
                      /etc/utmp,
                   ut_name.
         @V     VERSION,     defaults.
            '@',   '\@',  '@@'.



7.2.  uugetty

   ,       
   .

         .  
/etc/conf.uugetty     uugetty,  
/etc/conf.uugetty.ttySN      . 
    ,      
getty_ps,     Linux-. -  
   .  , ,    
  getty (,  2.0.7e),    FSSTND,  
     /etc/default/uugetty.ttySN.  
/etc/conf.uugetty.ttyS3   :


       #    uugetty  Hayes- 
       #    
       #
       #   lock ...   lock  ,  uugetty 
       #  ,     
       ALTLOCK=cua3
       ALTLINE=cua3
       #   
       INITLINE=cua3
       #  ,     ...
       TIMEOUT=60
       #   ...
       # : <> <> ... (-)
       INIT="" AT\r OK\r\n
       WAITFOR=RING
       CONNECT="" ATA\r CONNECT\s\A
       #           
       # 
       DELAY=1
       #DEBUG=010


     /etc/inittab, ,  uugetty 
    (      
 -   , ,     
  ):

     S3:456:respawn:/sbin/uugetty -d /etc/default/uugetty.ttyS3 ttyS3 F115200 vt100

 init:

     linux# init q

   /etc/inittab   ,   
 .

 Linux          
 .          .

uugetty    , .    man  getty(1m). 
        .


8.       PC?

    Text-Terminal-HOWTO (    ). 
         , 
   ,      
Linux .


8.1.  

,     . - , 
   ,  ,  ,     
     .     -
 !        
  . ,     
  (-"" (   ) DB25  DB9), 
     (-""() DB25  centronics).

  DB25,   :

    PC "" DB25                            Terminal DB25 
    TxD           2 --> 3     RxD    
    RxD              3 <-- 2     TxD    
    SG           7 --- 7     SG     

 -      ,  
   RTS/CTS,     
  DTR,       linux  
 "stty".   stty crtscts     20 (DTR) 
 PC 5 (CTS).

    PC "" DB25                                  Terminal DB25 
    TxD                   2 --> 3     RxD    
    RxD                      3 <-- 2     TxD    
    RTS                   4 --> 5     CTS     
    CTS                   5 <-- 4     RTS    
    DSR   Data Set Ready                6
                                        |
    DCD               8 <-- 20    DTR     
    SG                   7 --- 7     SG     
                                              6     DSR   Data Set Ready
                                              |
    DTR       20 --> 8     DCD    


       DB9,   
:

    PC DB9                                  Terminal DB25 
    TxD           2 --> 2     RxD    
    RxD              3 <-- 3     TxD    
    SG           5 --- 7     SG     


  ,   DB9-DB25 -  (  
     ; . ):


  PC DB9                                         Terminal DB25
  TxD                  2 --> 2     RxD    
  RxD                     3 <-- 3     TxD    
                                           6     DSR   Data Set Ready
                                           |
  DTR       4 --> 8     DCD    
  GND                 5 --- 7     GND    
  DCD              1
                                     |
  DSR   Data Set Ready               6 <-- 20    DTR     
  RTS                  7 --> 5     CTS     
  CTS                  8 <-- 4     RTS    
  (RI   Ring Indicator               9  )

(,  2  3   DB9    
   DB25!)

     - ,     
  :     ,  RTS 
 CTS ,     DSR, DCD  DTR.  ,  
    ,    (  ).

,     ?,      
.  ,      
.       9600 \, 
8  , 1  ,      
(    ,     ).


8.2.  getty ( getty_ps)

     getty    getty,
, agetty.

   getty   /etc/gettydefs,    
,       :

       # 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


 ,    uugetty       
.   ,       .   
   :


         @B      (    @B ) 
                /.
         @D        MM/DD/YY.
         @L     ,    getty.
         @S     .
         @T        HH:MM:SS (24-).
         @U         .  
                      /etc/utmp,
                   ut_name.
         @V     VERSION,     defaults.
            '@',   '\@',  '@@'.


     /etc/gettydefs,    
 , :


         linux# getty -c /etc/gettydefs


,       getty  uugetty  
 ,      
(/etc/default{/uu}getty.ttySN  /etc/conf.{uu}getty.ttySN),  
    getty,    .  
,   .

   /etc/inittab,   getty  
 (     ,    
   ):


S1:456:respawn:/sbin/getty ttyS1 DT9600 vt100


 init:


linux# init q


  ,          . 
, ,   Enter,    .


8.3    PC   

    PC  ,   Linux .

,  8088  80286 PC     . ,   
    -    DOS,   DOS, 
  PC-,      PC-.
Kermit      .    
 kermit   OS  http://www.columbia.edu/kermit/.  
      DOS  telix  procomm.
,    PC-    
 .


9.    ,    ?

     ,       
  ... (,      ).

       ,  ,  .  
 ,    ,   
 (IRQs)    -.  -    
Linux,    PC.      
    .

        ,    
 ,  ,        
. (  ,       
.)      , 
     .

      
  ,       
IRQ      .

Linux    ,    -  
   .


9.1    

 PC  ttyS0  ttyS2  IRQ 4,  ttyS1  ttyS3  IRQ 3.   
,  IRQs , : setserial /dev/ttyS2,  .. 
 /proc/interrupts    .   , 
   ,     .
        .  
PC        IRQ 5  IRQ 7,
      .      
   ,    
 .   ,     setserial. 
 ,        ,  
   .    IRQ,    
  .

    ,        
   .       
/etc/rc.d/rc.local -      ,    
:

       /sbin/setserial /dev/ttyS0 irq 3        #   
       /sbin/setserial /dev/ttyS1 irq 4        #  Wyse dumb 
       /sbin/setserial /dev/ttyS2 irq 5        #   Zoom
       /sbin/setserial /dev/ttyS3 irq 9        #   USR


  IRQ:


                IRQ  0    ,  0
                IRQ  1    
                IRQ  2    Cascade for controller 2
                IRQ  3      2
                IRQ  4      1
                IRQ  5      2
                IRQ  6       
                IRQ  7      1
                IRQ  8      
                IRQ  9      IRQ2
                IRQ 10     
                IRQ 11     
                IRQ 12     
                IRQ 13     
                IRQ 14        1
                IRQ 15        2


    " "  . 
 ,         
 .

  2, 3, 4, 5  7 -   . `` " ,
         IRQS.   
,  IRQ 2 -  ,   IRQ 9.       2 
  9,    .    
   16-  ,     
 IRQ 10, 11, 12  15.

 ,     IRQ 0, 1, 6, 8, 13  14!  
   .     
,   IRQ   .   , 
 /proc/interrupts  ,   .


9.2.    

,     .       
 .  ,    
    .       
:


       ttyS0  0x3f8
       ttyS1  0x2f8
       ttyS2  0x3e8
       ttyS3  0x2e8


 ,        
    .     
ttyS3,   ttyS0,     ttyS2.

  , Linux       
 ,     . IRQ,   Linux,   
 IRQ,    .   
. Linux     IRQ  ,   
 IRQ     .  setserial, 
  Linux,  IRQ  .    
/proc/ioports,  ,    - 
  Linux.


10.         ? 
           ?

     ,      
   getty,     .

     ,   getty   
   (   ).   
 ,      ,   
     setserial:    spd_hi  
spd_vhi,   setserial,  38400    
57600 (spd_hi)  115200 (spd_vhi).

,            
16550A UARTS.    :

     28.8 (V.34), 33.6 (V.34)  56 (V.90) , 
   115200 \.

     14400 \ (V.32bis)     V.42bis, 
    57600 \.

     9600 \ (V.32)     V.42bis, 
    38400 \.

      ,   9600 \ (V.32),  
      ,     . ,
   300 \ (V.21/Bell 103), 1200 \ (V.22/Bell 212A)  2400 \
   (V.22bis).

   setserial,        
,  ,  ,   ,    
/etc/rc.d/rc.serial  /etc/rc. d/rc.local  /etc/rc.boot/0setserial , 
     . ,    
   setserial    .    
   :

        setserial -a /dev/ttyS3


11.    

    ,    
 FTP,      .

 ecu -  

 C-Kermit <http://www.columbia.edu/kermit/> -  scriptable, 
    TCP/IP ,      
   

 minicom - telix-  

 procomm - procomm-     zmodem

 seyon -     X

 xc -   xcomm

     term  SLiRP.   
    TCP/IP,    shell.

 screen -   .      
  .

 callback - ,       .

 mgetty+fax       ps_getty.

 ZyXEL -     ZyXEL U-1496.  
   ,    ,    
   .

   SLIP  PPP    
  ftp://sunsite.unc.edu/pub/Linux/system/network/serial.

      ftp://sunsite.unc.edu/pub/Linux/system/serial  
  ftp://sunsite.unc.edu/pub/Linux/apps/serialcomm     .  
  ,        .


12.      

      ...

12.1. kermit  zmodem

  zmodem  kermit,     .kermrc:

define rz !rz < /dev/ttyS3 > /dev/ttyS3 define sz !sz \%0 > /dev/ttyS3 < /dev/ttyS3

,    ,     . , 
  ,    rz  sz < >  
  kermit.

12.2    

     ,   
  ,     /etc/inittab.    
   ttyS1    vt100,     ``vt100"  
 getty:

      S1:456:respawn:/sbin/getty ttyS1 DT9600 vt100

 getty   .     tset,  
   ,     
,     -   .


12.3  ls   

 ls        ,  
,  .     ls --color  
ls --colour .

   ls     .    
/etc/profile  /etc/csh.cshrc  ls.    
 ls   ls --no-color,      
  .


12.4.   ,   

 ,  vtprint,   
ftp://ftp.sdsu.edu/pub/vtprint   http://www.sdsu.edu/~garrett.

 ,    ,  xprt.    
ftp://sunsite.unc.edu/pub/Linux/system/printing.


12.5   Linux    ?

.      (  ),     
Linux        
.    :

        /sbin/setserial /dev/ttyS3 auto_irq skip_test autoconfig

   /etc/rc.d/rc.local  /etc/rc.d/rc.serial   
/etc/rc.boot/0setserial .      
,     . ,   
      .


12.5.1.    

  IRQS     rc.serial  /etc/rc.boot/0setserial, 
    setserial.      
   ,   -   
.


12.6.   

    36 Linux Journal, 
http://www.ssc.com/lj/issue36/index.html,  ,   
 . . Text-Terminal-HOWTO.


12.7.    

        
     (E)IDE ,      hdparm. 
 ,     (E)IDE ,  
unmasking  IRQs    IRQ.     
     . , 
     man ,     
/   ,     
.

     irqtune,    IRQ 
,   ,     .
        
. Irqtune FAQ    http://www.best.com/~cae/irqtune.


13.    ...

     ,       
 Unix   .


13.1   lock  ( )?

  -   , ,    
    ().

   /usr/spool/uucp  /var/lock.  Linux   
 LCK..name,  name -    ,   UUCP .
       ,   
   . ,      
 ,   ,   ,  - 
  .      PID , 
  .      
,   ,       
,      ,   
.  ,    ,   
()  .  ,     
  ,   ,   
.        ,  
  .


13.2. ``"  ``\"

``"  ``\"        
      .   
   ,     !

 (baud)

   -     ,   
  ( -    "-") . 
,   1200  ,      
833 .      - 50, 75, 110, 300, 600, 
1200  2400.       
2400 . -        
,    2400  ,      
pristine .       ,   
 ,        . ``" 
     (Emile Baudot),   
 .

\ (bps)

 \ -      .   
   \  50, 75, 110, 300, 1200, 2400, 9600. 
  - 14.4, 28.8, 33.6,  56 (     
 " -",     
 \ (50-9600): 19.2, 38.4, 57.6  115.2).  
     V.42bis (  4:1),  
   115.2/.       , 
     ``".

,      2400 ,    
 14400 \ ( )?    \ ,
   ,         
 .  ,      2   ,
 \    .       
 14400 \,    6     
,   2400 .

   ? ,    ,  \ 
    .      
.  \    ,     
. ,  300 \    300 .  
,     ,    
      .


13.3   UART?     ?

UART (Universal Asynchronous Receiver Transmitter --   
) -        .
 UART     ,    
  .

 UART   ,     ,  
          .
UART    ,  ,     
 ASCII.

,    ,   PC.    , 
      ( UART).  
          
. UART  PC         
      .

    UART.     dumb UART - 8250  
16450,  FIFO UART - 16550A.    ,   
,    UART    .

UART     -  ,    
  .   UART,       
   ,      .

       UART    
  UART    .  UART 8250  16450  
.  ,        
 1 .     .     
,      UART,     
.   ,      ,  
   ,       UART 
 .

    UART 16550A.     16- FIFO.  
,         14  
,         .  
     14    .    
    14,      
  UART,     .

    ,      
  .

  ,   . (  16550 UART,   
  16450,    .)

 , UART 8250  16450      
38400 \.    38400 \,     
 .     PC (definition used loosely 
here),  DOS,  ,         8250 
 16450s.        ,   
   Linux.

 -UART      DSP , 
      ,    
  .

,  Cyclades Cyclom  Stallion EasyIO  Cirrus Logic
CD1400 RISC UART,      80186   
 RISC ,    -.

  ,  dumb UART  ,       
 .          
    UART. ,    16550A -   
.

   PC (486's, Pentiums  )  16550A.  
   ,       
   16550A    16450 UART.  
   ,    .  UART   
"",    (    ).   
     . ,   
     (    
).


14.  

14.1    ``line NNN  of inittab invalid''

,        init .

 init      /etc/inittab. 
,         getty.


14.2.      ,   
      ``/dev/cua N : Device or resource busy''

   ,  DCD  DTR  . DCD 
        (  
- ),    getty    . , 
    ,  DCD    
 . DTR     ,  - 
    ,  getty, kermit    
 .

    ``device busy", -     
    -  .

   ,   Linux   
  . Linux ,    
,      ,     
.         
 ,    "device busy",  
   .     
  (, ethernet SCSI  ..).   IRQ.


14.3.    ``getty respawning too fast: disabled for 5 minutes''

,     .  
  Q.   ,      getty.

,    /etc/inittab getty  .

        .

    /etc/gettydefs,  :


        linux# getty -c /etc/gettydefs


       uugetty . . 
 ``getty  uugetty    ".


14.4    ,   
             

    IRQ. ,    .   
  (, ethernet, SCSI  . ...).   
   setserial     . 
     /proc/ioports  /proc/interrupts .


14.5     ,  - ,  uugetty  
      

  ,        DTR. 
    RD  SD   ,   .   
  .   Hayes-    
 &D3,    USR Courier,     &D2  S13=1. 
    .


14.6  ,    PC,   ,      
        ,    

    getty:      CLOCAL   
  /etc/gettydefs  ,       
  - .   CLOCAL,   Linux  
    .       :

        # 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

  ,   getty,        .

    agetty:   -L   agetty  
  /etc/inittab.       .

    init,  init q.     
  :


        s1:345:respawn:/sbin/agetty -L 9600 ttyS1 vt100


14.7       

       ,   38400 \, 
    UART 16550A,      .  UART  
 ``  UART?".


14.8.   Linux     ,
        

   . Linux    IRQ  ,   
   .   ,   
  IRQ,       IRQS.

    setserial  IRQ,      .

, ,  ,    ttyS2  IRQ 5,  


       Jan 23 22:25:28 misfits vmunix: tty02 at 0x03e8 (irq = 4) is a 16550A


  Linux.    setserial,   
Linux IRQ,   .


14.9. rz / sz  ,        Linux 

 Linux  /dev/modem,     ,  
 /etc/profile  /etc/csh.cshrc. ,      
 ,      ,  
Slackware.     zmodem.    .


14.10.     

    ,       
 ,     .    
  ,   echo ^v^[c.   :


        linux% echo <ctrl>v<esc>c


14.11.  getty  uugetty    

  DEBUG,    getty_ps.   
 /etc/conf.{uu}getty.ttySN   DEBUG=NNN.  NNN -   
      ,    :


       D_OPT   001             
       D_DEF   002               
       D_UTMP  004             utmp/wtmp
       D_INIT  010              (INIT)
       D_GTAB  020              gettytab
       D_RUN   040               
       D_RB    100             ringback
       D_LOCK  200               uugetty
       D_SCH   400             schedule
       D_ALL   777             


     DEBUG=010.

    syslogd,      log-.
 syslogd  ,     /tmp/getty:ttySN  
 getty  /tmp/uugetty:ttySN  uugetty,   log- 
/var/adm/getty.log .    ,  . 
 ,          
 ,    .

     mgetty.    .


15.   

  man  agetty(8), getty(1m), gettydefs(5), init(1),
   login(1), mgetty(8), setserial(8)

      

  NET-3 HOWTO:   ,  SLIP, CSLIP  PPP

  PPP HOWTO:    PPP

  Printing HOWTO:    

  Serial-Programming-HOWTO:    
    

  Term HOWTO: ,       term

  Text-Terminal-HOWTO:   ,     

  UPS HOWTO:  UPS-,     
   

  UUCP HOWTO:    UUCP

    Usenet:

   comp.os.linux.answers       FAQs, How-Tos, READMEs   Linux.
   comp.os.linux.hardware          Linux 
   comp.os.linux.networking          Linux.
   comp.os.linux.setup          Linux   .
   comp.terminals

         Linux. 
     ,     majordomo@vger.rutgers.edu, 
        ``subscribe linux-serial".   
       "help",      . 
           Linux. 
           ``lists''.

   ,        
    ,   Cyclades:  http://www.cyclades.com.

      : 
   
   Navas 28800 Modem FAQ  <http://web.aimnet.com/~jnavas/modem/faq.html>
   Curt's High Speed Modem Page <http://www.teleport.com/~curt/modems.html>

    : 
   Serial-Programming-HOWTO 
   Advanced Programming in the UNIX Environment 
     <http://hegschool.aw.com/cseng/authors/stevens/advanced/advanced.nclk>
      W. Richard Stevens (ISBN 0-201-56317-7; Addison-Wesley) 
   POSIX Programmer's Guide
     <http://www.ora.com/catalog/posix/>
      Donald Levine (ISBN 0-937175-73-0; O'Reilly)


16. 

   HOWTO   Greg Hankins 
(greg.hankins@cc.gatech.edu).        
,       .

 : " ,     
,     ,   ( )
  Ted T'so       
, Kris Gleason,   getty_ps,  Gert Dring,  
 mgetty."



                          SERIAL HOWTO

