home *** CD-ROM | disk | FTP | other *** search
/ Freelog Special Edition 1: Linux / CD1.iso / doc / HOWTO / Serial-HOWTO < prev    next >
Text File  |  1998-10-14  |  73KB  |  2,113 lines

  1.   The Linux Serial HOWTO
  2.   revised by David S.Lawyer   bf347@lafn.org original by Greg
  3.   Hankins
  4.   v1.12, July 1998
  5.  
  6.   This document describes serial port features not covered by Text-Ter¡
  7.   minal-HOWTO or Serial-Programming-HOWTO.  It covers mostly getty, mul¡
  8.   tiport serial cards and modems.
  9.   ______________________________________________________________________
  10.  
  11.   Table of Contents
  12.  
  13.  
  14.  
  15.  
  16.  
  17.  
  18.  
  19.  
  20.  
  21.  
  22.  
  23.  
  24.  
  25.  
  26.  
  27.  
  28.  
  29.  
  30.  
  31.  
  32.  
  33.  
  34.  
  35.  
  36.  
  37.  
  38.  
  39.  
  40.  
  41.  
  42.  
  43.  
  44.  
  45.  
  46.  
  47.  
  48.  
  49.  
  50.  
  51.  
  52.  
  53.  
  54.  
  55.  
  56.  
  57.  
  58.  
  59.  
  60.  
  61.  
  62.  
  63.  
  64.  
  65.  
  66.  
  67.   1. Introduction
  68.  
  69.      1.1 Copyright
  70.      1.2 Related HOWTO's re: the Serial Port
  71.      1.3 Release Notes
  72.      1.4 New Versions Of This Document
  73.      1.5 Feedback
  74.      1.6 Disclaimer
  75.  
  76.   2. Supported Serial Hardware
  77.  
  78.      2.1 Standard PC Serial Boards
  79.      2.2 Plug And Play (PnP) Modems
  80.      2.3 Dumb Multiport Serial Boards (with 8250/16450/16550A UART's)
  81.      2.4 Intelligent Multiport Serial Boards
  82.      2.5 Unsupported Serial Hardware
  83.         2.5.1 Winmodems Don't Work
  84.         2.5.2 Rockwell (RPI) Drivers May Work
  85.  
  86.   3. What Are The Names Of The Serial Ports?
  87.  
  88.      3.1 Devices: modem, mouse
  89.      3.2 The cua Device
  90.      3.3 Serial Port Devices and Numbers In
  91.         3.3.1 Creating Devices In
  92.      3.4 Notes For Dumb Multiport Boards
  93.      3.5 Notes For Intelligent Multiport Boards
  94.  
  95.   4. Interesting Programs You Should Know About
  96.  
  97.      4.1 What is
  98.         4.1.1 About
  99.         4.1.2 About
  100.         4.1.3 About
  101.      4.2 What is
  102.  
  103.   5. How Do I Dial Out With My Modem?
  104.  
  105.      5.1 Hardware Requirements
  106.         5.1.1 External Modems
  107.         5.1.2 Internal Modems
  108.      5.2 Talking To Your Modem
  109.      5.3 Dial Out Modem Configuration
  110.      5.4 Hardware Flow Control
  111.  
  112.   6. How Do I Dial In And Out With My Modem Using
  113.  
  114.      6.1 Dial In And Out Modem Configuration
  115.      6.2 Installing
  116.  
  117.   7. uugetty
  118.  
  119.      7.1 Setting up
  120.         7.1.1 Modern Modems
  121.         7.1.2 Old slow modems
  122.         7.1.3 Login Banner
  123.      7.2 Customizing
  124.  
  125.   8. How Do I Set Up A Terminal Connected To My PC?
  126.  
  127.      8.1 Hardware Requirements
  128.      8.2 Setting up
  129.      8.3 Notes On Setting Up A PC As A Terminal
  130.  
  131.   9. Can I Use More Than Two Serial Devices?
  132.  
  133.      9.1 Choosing Serial Device Interrupts
  134.      9.2 Setting Serial Device Addresses
  135.  
  136.   10. How Do I Set Up My Serial Ports For Higher Speeds?  What Speed Should I Use With My Modem?
  137.  
  138.   11. Communications Programs And Utilities
  139.  
  140.   12. Serial Tips And Miscellany
  141.  
  142.      12.1 kermit and zmodem
  143.      12.2 Setting Terminal Types Automagically
  144.      12.3 Color
  145.      12.4 Printing To A Printer Connected To A Terminal
  146.      12.5 Can Linux Configure The Serial Devices Automagically?
  147.         12.5.1 Notes For Multiport Boards
  148.      12.6 Using A Serial Console
  149.      12.7 Higher Serial Throughput
  150.  
  151.   13. One Step Further...
  152.  
  153.      13.1 What Are Lock Files?
  154.      13.2 ``baud'' Vs. ``bps''
  155.      13.3 What Are UARTs?  How Do They Affect Performance?
  156.  
  157.   14. Troubleshooting
  158.  
  159.      14.1 I Keep Getting ``line
  160.      14.2 When I Try To Dial Out, It Says ``/dev/cua
  161.      14.3 I Keep Getting ``Getty respawning too fast: disabled for 5 minutes''
  162.      14.4 Serial Devices Are Slow, Or Serial Devices Can Only Send In One Direction
  163.      14.5 My Modem Is Hosed After Someone Hangs Up, Or
  164.      14.6 I Have My Terminal Connected To My PC, But After I Type In A Login Name, It Just Locks Up
  165.      14.7 At High Speeds, My Modem Looses Data
  166.      14.8 On Startup, Linux Doesn't Report The Serial Devices The Way I Have Them Configured
  167.      14.9 (TT
  168.      14.10 My Screen Is Displaying Funny Looking Characters
  169.      14.11 (TT
  170.  
  171.   15. Other Sources Of Information
  172.  
  173.   16. Contributions
  174.  
  175.  
  176.  
  177.   ______________________________________________________________________
  178.  
  179.   1.  Introduction
  180.  
  181.   This is the Linux Serial HOWTO.  This covers info on the Serial Port
  182.   that is not available in other HOWTO's.  It includes how to set up
  183.   modems under Linux, some serial tips, and troubleshooting advice.
  184.   Another HOWTO exists for terminals (see ``Related HOWTO's'').  This
  185.   HOWTO addresses Linux running on Intel x86 hardware, although it might
  186.   work for other architectures.
  187.  
  188.  
  189.   1.1.  Copyright
  190.  
  191.   Copyright (c) 1993 - 1997 by Greg Hankins, 1998 by David Lawyer.  This
  192.   document may be distributed under the terms set forth in the LDP
  193.   license at http://sunsite.unc.edu/LDP/COPYRIGHT.html.  This document
  194.   may not be distributed in modified form without consent of the author.
  195.  
  196.  
  197.  
  198.  
  199.   1.2.  Related HOWTO's re: the Serial Port
  200.  
  201.  
  202.   ╖  Serial-Programming-HOWTO helps you write C programs (or parts of
  203.      them) that handle the serial port.  You may do the equivalent of
  204.      "stty ...", open ports in various modes, and more.
  205.  
  206.   ╖  Text-Terminal-HOWTO is all about character-cell terminals (dumb
  207.      terminals ?).
  208.  
  209.  
  210.   1.3.  Release Notes
  211.  
  212.   I, David Lawyer, am the new maintainer (Greg Hankins was the original
  213.   author and maintainer).  This is a minor revision and I haven't
  214.   checked out much of the info to see if it's up-to-date.  There is much
  215.   work to do on this.  Let me know what's wrong or missing.  In the
  216.   future, I may do a 3-way split on this Howto:  1. Info on terminals
  217.   into Text-Terminal-HOWTO.   2. Info on modems into a new Howto: Modem-
  218.   HOWTO.  3. More info on the Serial Port added to this Howto.  Thus
  219.   look for major new versions in Aug. or Sept. 1998.
  220.  
  221.  
  222.   1.4.  New Versions Of This Document
  223.  
  224.   New versions of the Serial HOWTO will be available at
  225.   ftp://sunsite.unc.edu:/pub/Linux/docs/HOWTO/Serial-HOWTO and mirror
  226.   sites.  There are other formats, such as Postscript and DVI versions
  227.   in the other-formats directory.  The Serial HOWTO is also available at
  228.   http://sunsite.unc.edu/LDP/HOWTO/Serial-HOWTO.html and will be posted
  229.   to comp.os.linux.answers monthly.
  230.  
  231.  
  232.   1.5.  Feedback
  233.  
  234.   Please send me any questions, comments, suggestions, or additional
  235.   material.  I'm always eager to hear about what you think about this
  236.   HOWTO.  I'm also always on the lookout for improvements!  Tell me
  237.   exactly what you don't understand, or what could be clearer.  You can
  238.   reach me at bf347@lafn.org (David Lawyer) via email.
  239.  
  240.  
  241.   1.6.  Disclaimer
  242.  
  243.   Your mileage may vary.  The answers given may not work for all systems
  244.   and all setup combinations.
  245.  
  246.  
  247.   2.  Supported Serial Hardware
  248.  
  249.   Linux is known to work with the following serial hardware.
  250.  
  251.  
  252.   2.1.  Standard PC Serial Boards
  253.  
  254.  
  255.   ╖  standard PC serial boards (COM1 - COM4), to which external serial
  256.      devices (modems, serial mice, etc...) can be connected.  Since PC's
  257.      no longer come with them (but have the chips for this purpose
  258.      mounted on the motherboard), they are hard to find in retail
  259.      stores.
  260.  
  261.   ╖  standard PC internal modems (COM1 - COM4)
  262.  
  263.   ╖  Quickpath Systems Port-Folio 550e (allows IRQs of 3, 4, 5, 9, 10,
  264.      11, 12, and 15)
  265.   Note: due to address conflicts, you cannot use COM4 and IBM8514 video
  266.   board simultaneously.  This is due to a bug in the IBM8514 board.
  267.  
  268.  
  269.   2.2.  Plug And Play (PnP) Modems
  270.  
  271.   Most modems today are PnP and most will (with some effort) work with
  272.   Linux.  It's best to get one that has jumpers (shunts) to disable PnP.
  273.   In many cases, if you simply set the jumpers for a certain COM number
  274.   and IRQ number, this will disable PnP.  You may also want (need ??) to
  275.   disable PnP in your computer's BIOS.  If you can't disable PnP then
  276.   you may try:
  277.  
  278.  
  279.   ╖  Boot Win95/98, configure the modem, and see if the settings are
  280.      preserved when you boot Linux.  If not, then:
  281.  
  282.   ╖  Boot Win95/98, configure the modem, and then warm boot Linux so
  283.      that the settings are preserved.  You can do this with the loadlin
  284.      boot loader.
  285.  
  286.   ╖  Get the PnP tools from http://www.redhat.com/linux-info/pnp.
  287.  
  288.  
  289.   2.3.  Dumb Multiport Serial Boards (with 8250/16450/16550A UART's)
  290.  
  291.   They are also called "serial adapters".
  292.   * =>  "setserial" shows details of configuring
  293.  
  294.   ╖  AST FourPort and clones (4 ports) *
  295.  
  296.   ╖  Accent Async-4 (4 ports) *
  297.  
  298.   ╖  Arnet Multiport-8 (8 ports)
  299.  
  300.   ╖  Bell Technologies HUB6 (6 ports)
  301.  
  302.   ╖  Boca BB-1004 (4 ports), BB-1008 (8 ports), BB-2016 (16 ports) *
  303.  
  304.   ╖  Boca IOAT66 (6 ports)
  305.  
  306.   ╖  Boca 2by4 (4 serial ports, 2 parallel ports)
  307.  
  308.   ╖  Byterunner (claims low prices)
  309.  
  310.   ╖  Computone ValuePort V4-ISA (AST FourPort compatible) *
  311.  
  312.   ╖  Digi PC/8 (8 ports)
  313.  
  314.   ╖  GTEK BBS-550 (8 ports) See the mini-howto for this.
  315.  
  316.   ╖  HUB-6 See Bell Technologies.
  317.  
  318.   ╖  Longshine LCS-8880, Longshine LCS-8880+ (AST FourPort compatible)
  319.  
  320.   ╖  Moxa C104, Moxa C104+ (AST FourPort compatible)
  321.  
  322.   ╖  PC-COMM (4 ports)
  323.  
  324.   ╖  Sealevel Systems <http://www.sealevel.com> COMM-2 (2 ports), COMM-4
  325.      (4 ports) and COMM-8 (8 ports)
  326.  
  327.   ╖  SIIG I/O Expander 2S IO1812 (4 ports)
  328.  
  329.   ╖  STB-4COM (4 ports)
  330.  
  331.   ╖  Twincom ACI/550
  332.  
  333.   ╖  Usenet Serial Board II (4 ports) *
  334.  
  335.   In general, Linux will support any serial board which uses a 8250,
  336.   16450, 16550, 16550A, 16650 (or compatible) UART, or an internal modem
  337.   which emulates one of the above UARTs.
  338.  
  339.   Note: the BB-1004 and BB-1008 do not support DCD and RI lines, and
  340.   thus are not usable for dialin modems.  They will work fine for all
  341.   other purposes.
  342.  
  343.  
  344.   2.4.  Intelligent Multiport Serial Boards
  345.  
  346.   Make sure that a Linux computable driver is available.  This list is a
  347.   little out of date.
  348.  
  349.   ╖  Comtrol RocketPort (36MHz ASIC; 4, 8, 16 or 32 ports)
  350.      contact: info@comtrol.com or http://www.comtrol.com
  351.      driver status: supported by Comtrol
  352.      driver location: ftp://tsx-11.mit.edu/pub/linux/packages/comtrol
  353.  
  354.   ╖  Computone IntelliPort II (16MHz 80186; 4, 8, or 16 ports),
  355.      IntelliPort II EXpandable (20MHz 80186; 16 - 64 ports)
  356.      contact: Michael H. Warfield, mhw@wittsend.atl.ga.us
  357.      driver status: pre-ALPHA
  358.  
  359.   ╖  Cyclades Cyclom-Y (Cirrus Logic CD1400 UARTs; 8 - 32 ports),
  360.      Cyclom-Z (25MHz MIPS R3000; 8 - 128 ports)
  361.      contact: sales@cyclades.com or http://www.cyclades.com
  362.      driver status: supported by Cyclades
  363.      driver location: ftp://ftp.cyclades.com/pub/cyclades and included
  364.      in Linux kernel since version 1.1.75
  365.  
  366.   ╖  Decision PCCOM8 (8 ports)
  367.      contact: pccom8@signum.se
  368.      driver location: ftp://ftp.signum.se/pub/pccom8
  369.  
  370.  
  371.   ╖  Digi PC/Xi (12.5MHz 80186; 4, 8, or 16 ports),
  372.      PC/Xe (12.5/16MHz 80186; 2, 4, or 8 ports),
  373.      PC/Xr (16MHz IDT3041; 4 or 8 ports),
  374.      PC/Xem (20MHz IDT3051; 8 - 64 ports)
  375.      contact: sales@dgii.com or http://www.dgii.com
  376.      driver status: supported by Digi
  377.      driver location: ftp://ftp.dgii.com/drivers/linux and included in
  378.      Linux kernel since version 2.0
  379.  
  380.   ╖  Digi COM/Xi (10MHz 80188; 4 or 8 ports)
  381.      contact: Simon Park, si@wimpol.demon.co.uk
  382.      driver status: ALPHA
  383.      note: Simon is often away from email for months at a time due to
  384.      his job.  Mark Hatle, fray@krypton.mankato.msus.edu has graciously
  385.      volunteered to make the driver available if you need it.  Mark is
  386.      not maintaining or supporting the driver.
  387.  
  388.  
  389.   ╖  Equinox SuperSerial Technology (30MHz ASIC; 2 - 128 ports)
  390.      contact: sales@equinox.com or http://www.equinox.com
  391.      driver status: supported by Equinox
  392.      driver location: ftp://ftp.equinox.com/library/sst
  393.  
  394.  
  395.   ╖  GTEK Cyclone (16C654 UARTs; 6, 16 and 32 ports),
  396.      SmartCard (24MHz Dallas DS80C320; 8 ports),
  397.      BlackBoard-8A (16C654 UARTs; 8 ports),
  398.      PCSS (15/24MHz 8032; 8 ports)
  399.      contact: spot@gtek.com or http://www.gtek.com
  400.      driver status: supported by GTEK
  401.      driver location: ftp://ftp.gtek.com/pub
  402.  
  403.  
  404.   ╖  Hayes ESP (COM-bic; 1 - 8 ports)
  405.      contact: Andrew J. Robinson, arobinso@nyx.net or
  406.      http://www.nyx.net/~arobinso
  407.      driver status: supported by author
  408.      driver location: http://www.nyx.net/~arobinso and included in Linux
  409.      kernel since version 2.1.15
  410.  
  411.  
  412.   ╖  Maxpeed SS (Toshiba; 4, 8 and 16 ports)
  413.      contact: info@maxpeed.com or http://www.maxpeed.com
  414.      driver status: supported by Maxpeed
  415.      driver location: ftp://maxpeed.com/pub/ss
  416.  
  417.  
  418.   ╖  Moxa C218 (12MHz 80286; 8 ports),
  419.      Moxa C320 (40MHz TMS320; 8 - 32 ports)
  420.      contact: info@moxa.com.tw or http://www.moxa.com.tw
  421.      driver status: supported by Moxa
  422.      driver location: ftp://ftp.moxa.com.tw/drivers/c218-320/linux
  423.  
  424.  
  425.   ╖  SDL RISCom/8 (Cirrus Logic CD180; 8 ports)
  426.      contact: sales@sdlcomm.com or http://www.sdlcomm.com
  427.      driver status: supported by SDL
  428.      driver location: ftp://ftp.sdlcomm.com/pub/drivers
  429.  
  430.  
  431.   ╖  Specialix SIO (20MHz Zilog Z280; 4 - 32 ports),
  432.      XIO (25MHz Zilog Z280; 4 - 32 ports)
  433.      contact: Simon Allen, simonallen@cix.compulink.co.uk
  434.      driver status: BETA
  435.      driver location:
  436.      ftp://sunsite.unc.edu/pub/Linux/kernel/patches/serial
  437.  
  438.  
  439.   ╖  Stallion EasyIO-4 (4 ports), EasyIO-8 (8 ports), and
  440.      EasyConnection (8 - 32 ports) - each with Cirrus Logic CD1400
  441.      UARTs,
  442.      Stallion (8MHz 80186 CPU; 8 or 16 ports),
  443.      Brumby (10/12 MHz 80186 CPU; 4, 8 or 16 ports),
  444.      ONboard (16MHz 80186 CPU; 4, 8, 12, 16 or 32 ports),
  445.      EasyConnection 8/64 (25MHz 80186 CPU; 8 - 64 ports)
  446.      contact: sales@stallion.com or http://www.stallion.com
  447.      driver status: supported by Stallion
  448.      driver location: ftp://ftp.stallion.com/drivers/ata5/Linux and
  449.      included in linux kernel since 1.3.27
  450.  
  451.  
  452.   A review of Comtrol, Cyclades, Digi, and Stallion products was printed
  453.   in the June 1995 issue of the Linux Journal.  The article is available
  454.   at http://www.ssc.com/lj/issue14.
  455.  
  456.  
  457.   2.5.  Unsupported Serial Hardware
  458.  
  459.   2.5.1.  Winmodems Don't Work
  460.  
  461.   Modems that claim to be ``Winmodems'', for example the USR Sportster
  462.   Winmodem and IBM Aptiva MWAVE, are not supported under Linux.  These
  463.   modems use proprietary designs that require special Windows drivers.
  464.   Avoid these types of modems.
  465.  
  466.  
  467.   2.5.2.  Rockwell (RPI) Drivers May Work
  468.  
  469.   Modems that require Rockwell RPI drivers are not fully usable since
  470.   the driver software doesn't work on Linux.  The RPI does compression
  471.   and error correction using MS software on your computer's CPU.  If you
  472.   are willing to operate the modem without using the RPI (and thus have
  473.   no compression nor error correction) then you may easily disable RPI
  474.   by sending the modem (via the initialization string) a RPI disable
  475.   command: +H0
  476.  
  477.  
  478.   3.  What Are The Names Of The Serial Ports?
  479.  
  480.   An I/O port is a way to get data into and out of a computer.  There
  481.   are many types of I/O ports such as serial ports, parallel ports, disk
  482.   drive controllers, ethernet boards, etc.  We will be dealing with
  483.   serial ports since modems and terminals are serial devices.  Each
  484.   serial port must have an I/O address, and an interrupt (IRQ).  There
  485.   are the four serial ports corresponding to COM1 - COM4:
  486.  
  487.  
  488.        ttyS0 (COM1) address 0x3f8 IRQ 4
  489.        ttyS1 (COM2) address 0x2f8 IRQ 3
  490.        ttyS2 (COM3) address 0x3e8 IRQ 4
  491.        ttyS3 (COM4) address 0x2e8 IRQ 3
  492.  
  493.  
  494.  
  495.  
  496.   If Linux does not detect any serial ports when it boots, then make
  497.   sure that serial support is enabled and compiled into the kernel. In
  498.   this document, I refer to COM1 as ttyS0, COM2 as ttyS1, COM3 as ttyS2,
  499.   and COM4 as ttyS3.  Notice that by default these devices have overlap¡
  500.   ping IRQs.  You cannot use all of the ports in this default configura¡
  501.   tion, and you must reassign different IRQs.  See section ``Can I Use
  502.   More Than Two Serial Devices?'' on setting IRQs.
  503.  
  504.  
  505.   3.1.  Devices: modem, mouse
  506.  
  507.   On some installations, two extra devices will be created, /dev/modem
  508.   for your modem and /dev/mouse for your mouse.  Both of these are
  509.   symbolic links to the appropriate device in /dev which you specified
  510.   during the installation (unless you have a bus mouse, then /dev/mouse
  511.   will point to the bus mouse device).
  512.  
  513.  
  514.   There has been some discussion on the merits of /dev/mouse and
  515.   /dev/modem.  I strongly discourage the use of these links.  In
  516.   particular, if you are planning on using your modem for dialin you may
  517.   run into problems because the lock files may not work correctly if you
  518.   use /dev/modem. Use them if you like, but be sure they point to the
  519.   right device.  However, if you change or remove this link, some
  520.   applications (minicom for example) might need reconfiguration.
  521.  
  522.  
  523.   3.2.  The cua Device
  524.  
  525.   Each ttyS device has a corresponding cua device.  There has been some
  526.   talk about abolishing cua so perhaps it's best to use ttyS.  The main
  527.   difference between cua and ttyS is that for an ordinary "open" command
  528.   (without certain flags) in an application program, cua will open the
  529.   port even if the modem control signals (such as DCD) say not to.
  530.   (stty must have been set to check modem control signals.)  A ttyS port
  531.   would refuse to open in such a case, but it can be forced to open by
  532.   giving a certain flag to the "open" command.
  533.  
  534.   Thus a ttyS port can do everything a cua port can.  Except that a
  535.   "forced" open results in read statements in the program behaving in a
  536.   certain way but the programmer may prevent this by adding some other
  537.   statements to the program.  Eliminating cua would brings Linux more
  538.   into compliance with the Posix standard and avoids certain problems
  539.   with lock files.
  540.  
  541.  
  542.   3.3.  Serial Port Devices and Numbers In /dev
  543.  
  544.  
  545.  
  546.        /dev/ttyS0 major 4, minor 64    /dev/cua0 major 5, minor 64
  547.        /dev/ttyS1 major 4, minor 65    /dev/cua1 major 5, minor 65
  548.        /dev/ttyS2 major 4, minor 66    /dev/cua2 major 5, minor 66
  549.        /dev/ttyS3 major 4, minor 67    /dev/cua3 major 5, minor 67
  550.  
  551.  
  552.  
  553.  
  554.   Note that all distributions should come with these devices already
  555.   made correctly (unless cua is abolished).  You can verify this by typ¡
  556.   ing:
  557.  
  558.  
  559.        linux% ls -l /dev/cua*
  560.        linux% ls -l /dev/ttyS*
  561.  
  562.  
  563.  
  564.  
  565.  
  566.   3.3.1.  Creating Devices In /dev
  567.  
  568.   If you don't have a device, you will have to create it with the mknod
  569.   command.  Example, suppose you needed to create devices for ttyS0:
  570.  
  571.  
  572.        linux# mknod -m 666 /dev/cua0 c 5 64
  573.        linux# mknod -m 666 /dev/ttyS0 c 4 64
  574.  
  575.  
  576.  
  577.  
  578.   You can use the MAKEDEV script, which lives in /dev.  This simplifies
  579.   the making of devices.  For example, if you needed to make the devices
  580.   for ttyS0 you would type:
  581.  
  582.  
  583.        linux# cd /dev
  584.        linux# ./MAKEDEV ttyS0
  585.  
  586.  
  587.  
  588.  
  589.   This handles the devices creation for the incoming and outgoing
  590.   devices, and should set the correct permissions.
  591.  
  592.  
  593.  
  594.  
  595.   3.4.  Notes For Dumb Multiport Boards
  596.  
  597.   The devices your multiport board uses depends on what kind of board
  598.   you have.  Some of these are listed in detail in rc.serial or in
  599.   0setserial which comes with the setserial package.  I highly recommend
  600.   getting the latest version of setserial if you are trying to use
  601.   multiport boards.  You will probably need to create these devices.
  602.   Either use the mknod command, or the MAKEDEV script.  Devices for
  603.   multiport boards are made by adding ``64 + port number''.  So, if you
  604.   wanted to create devices for ttyS17, you would type:
  605.  
  606.  
  607.  
  608.        linux# mknod -m 666 /dev/cua17 c 5 81
  609.        linux# mknod -m 666 /dev/ttyS17 c 4 81
  610.  
  611.  
  612.  
  613.  
  614.   Note that ``64 + 17 = 81''.  Using the MAKEDEV script, you would type:
  615.  
  616.  
  617.        linux# cd /dev
  618.        linux# ./MAKEDEV ttyS17
  619.  
  620.  
  621.  
  622.  
  623.   Note: the SIIG manual for the IO1812 listing for COM5-COM8 is wrong.
  624.   They should be COM5=0x250, COM6=0x258, COM7=0x260, and COM8=0x268.
  625.  
  626.   Note: the Digi PC/8 Interrupt Status Register is at 0x140.
  627.  
  628.   Note: for an AST Fourport, you might need to specify skip_test in
  629.   rc.serial.
  630.  
  631.  
  632.   3.5.  Notes For Intelligent Multiport Boards
  633.  
  634.   Read the information that comes with the driver.  These boards use
  635.   special devices, and not the standard ones.  This information varies
  636.   depending on your hardware.
  637.  
  638.  
  639.   4.  Interesting Programs You Should Know About
  640.  
  641.   4.1.  What is getty ?
  642.  
  643.   getty is a program that handles the login process when you log onto a
  644.   Unix box.  You will need to use getty if you want to be able to dial
  645.   in to your Linux machine with a modem.  You do not need to use getty
  646.   if you only want to dial out with your modem.  There are three
  647.   versions that are commonly used with Linux: getty_ps, mgetty and
  648.   agetty.  The syntax for these programs differs, so be sure to check
  649.   and make sure that you are using the correct syntax         for
  650.   whatever getty you use.
  651.  
  652.  
  653.   4.1.1.  About getty_ps
  654.  
  655.  
  656.   Most distributions come with the getty_ps package installed.  (Debian
  657.   used agetty but now uses mgetty.)  It contains two programs: getty is
  658.   used for console and terminal devices, and uugetty for modems.  I use
  659.   this version of getty, so that is what I will focus on.
  660.  
  661.   4.1.2.  About mgetty
  662.  
  663.   mgetty is a version of getty mainly for use with modems.  It may be
  664.   used for hard-wired terminals but the documentation is about 99%
  665.   related to modems.  In addition to allowing dialup logins, mgetty also
  666.   provides FAX support and auto PPP detection. The mgetty documentation
  667.   (supplied in texinfo format) is good, and does not need supplementing.
  668.   Please refer to it for installation instructions.  You can find the
  669.   latest information on mgetty at http://www.leo.org/~doering/mgetty/.
  670.  
  671.  
  672.   4.1.3.  About agetty
  673.  
  674.   agetty is the third variation of getty. It's a simple, completely
  675.   functional implementation of getty which is best suited for virtual
  676.   consoles or terminals rather than modems.
  677.  
  678.  
  679.   4.2.  What is setserial ?
  680.  
  681.   setserial is a program which allows you to look at and change various
  682.   attributes of a serial device, including its port address, its
  683.   interrupt, and other serial port options.  You can find out what
  684.   version you have by running setserial with no arguments.  If the
  685.   argument is /dev/ttyS1, etc., then you'll see some info about that
  686.   port.
  687.  
  688.  
  689.   When your Linux system boots, only ttyS{0-3} are configured, using the
  690.   default IRQs of 4 and 3.  So, if you have any other serial ports
  691.   provided by other boards or if ttyS{0-3} have a non-standard IRQ, you
  692.   must use setserial in order to configure those serial ports.  For the
  693.   full listing of options, consult the man page.
  694.  
  695.  
  696.   5.  How Do I Dial Out With My Modem?
  697.  
  698.   5.1.  Hardware Requirements
  699.  
  700.   You may use either an external or internal modem.  The internal costs
  701.   less and takes up no space on the desk or table.  But the external are
  702.   easier to "install" and have lights to give you a clue as to what is
  703.   happening.  But externals need to be switched off when not in use and
  704.   are likely to consume a little electricity even when turned off.
  705.  
  706.  
  707.   5.1.1.  External Modems
  708.  
  709.   First, make sure you have the right cable.  Your modem requires a
  710.   straight through cable, with no pins crossed.  Any computer store
  711.   should have these.  Make sure you get the correct gender.  If you are
  712.   using the DB25 serial port, it will always be the male DB25.  Do not
  713.   confuse it with the parallel port, which is the female DB25.  Hook up
  714.   your modem to one of your serial ports.  Consult your modem manual on
  715.   how to do this if you need help.
  716.  
  717.  
  718.   5.1.2.  Internal Modems
  719.  
  720.   For an internal modem, you will not need a cable.  An internal modem
  721.   does not need a serial port, it has one built in.  All you need to do
  722.   is configure it to use an interrupt that is not being used, and
  723.   configure the port I/O address.  Consult your modem manual if you get
  724.   stuck.  Also, see section ``Can I Use More Than  Two Serial Devices?''
  725.   if you need help on choosing interrupts or addresses.
  726.  
  727.   On some motherboards you will have to disable the serial port that the
  728.   modem is replacing in order to avoid conflicts.  This may be done with
  729.   jumpers or in the BIOS settings, depending on your motherboard.
  730.   Consult your motherboard manual.
  731.  
  732.   If you have an IBM8514 video board, then there is a bug you should
  733.   know about.  You may encounter problems if you want your internal
  734.   modem to be on ttyS3.  If Linux does not detect your internal modem on
  735.   ttyS3, you can use setserial and the modem will work fine.  Internal
  736.   modems on ttyS{0-2} should not have any problems being detected.
  737.   Linux does not do any autoconfiguration on ttyS3 due to this video
  738.   board bug.
  739.  
  740.  
  741.   5.2.  Talking To Your Modem
  742.  
  743.   Use kermit, minicom or some other communications program to test the
  744.   setup, before you go jumping into complex things SLIP or PPP.  You can
  745.   find the latest version of kermit at http://www.columbia.edu/kermit/.
  746.   For example, say your modem was on ttyS3, and it's speed was 115200
  747.   bps.  You would do the following:
  748.  
  749.  
  750.        linux# kermit
  751.        C-Kermit 6.0.192, 6 Sep 96, for Linux
  752.         Copyright (C) 1985, 1996,
  753.          Trustees of Columbia University in the City of New York.
  754.        Default file-transfer mode is BINARY
  755.        Type ? or HELP for help.
  756.        C-Kermit>set line /dev/ttyS3
  757.        C-Kermit>set carrier-watch off
  758.        C-Kermit>set speed 115200
  759.        /dev/ttyS3, 115200 bps
  760.        C-Kermit>c
  761.        Connecting to /dev/ttyS3, speed 115200.
  762.        The escape character is Ctrl-\ (ASCII 28, FS)
  763.        Type the escape character followed by C to get back,
  764.        or followed by ? to see other options.
  765.        ATE1Q0V1                           ; you type this and then the Enter key
  766.        OK                                 ; modem should respond with this
  767.  
  768.  
  769.  
  770.  
  771.   If your modem responds to AT commands, you can assume your modem is
  772.   working correctly on the Linux side.  Now try calling another modem by
  773.   typing:
  774.  
  775.  
  776.        ATDT7654321
  777.  
  778.  
  779.  
  780.  
  781.   where 7654321 is a phone number.  Use ATDP instead of ATDT if you have
  782.   a pulse line.  If the call goes through, your modem is working.
  783.  
  784.   To get back to the kermit prompt, hold down the Ctrl key, press the
  785.   backslash key, then let go of the Ctrl key, then press the C key:
  786.  
  787.  
  788.        Ctrl-\-C
  789.        (Back at linux)
  790.        C-Kermit>quit
  791.        linux#
  792.  
  793.   This was just a test using the primitive "by-hand" dialing method.
  794.   The normal method is to let kermit do the dialing for you with its
  795.   built-in modem database and automatic dialing features, for example
  796.   using a US Robotics (USR) modem:
  797.  
  798.  
  799.        linux# kermit
  800.        C-Kermit 6.0.192, 6 Sep 1997, for Linux
  801.         Copyright (C) 1985, 1996,
  802.          Trustees of Columbia University in the City of New York.
  803.        Default file-transfer mode is BINARY
  804.        Type ? or HELP for help
  805.        C-Kermit>set modem type usr        ; Select modem type
  806.        C-Kermit>set line /dev/ttyS3       ; Select communication device
  807.        C-Kermit>set speed 115200          ; Set the dialing speed
  808.        C-Kermit>dial 7654321              ; Dial
  809.         Number: 7654321
  810.         Device=/dev/ttyS3, modem=usr, speed=115200
  811.         Call completed.<BEEP>
  812.        Connecting to /dev/ttyS3, speed 115200
  813.        The escape character is Ctrl-\ (ASCII 28, FS).
  814.        Type the escape character followed by C to get back,
  815.        or followed by ? to see other options.
  816.  
  817.        Welcome to ...
  818.  
  819.        login:
  820.  
  821.  
  822.  
  823.  
  824.   See section ``Communications Programs'' about communications programs
  825.   if you need some pointers.
  826.  
  827.   When you dial out with your modem, set the speed to the highest serial
  828.   port speed that your modem supports (provided it's not over 115200
  829.   bps).  This is not the same as the "advertised" speed of the modem
  830.   such as 56K.  Versions of Linux with a libc version greater then 5.x
  831.   have support for speeds up to 115200 bps.  Even higher speeds than
  832.   this are in the works for Linux.
  833.  
  834.  
  835.   5.3.  Dial Out Modem Configuration
  836.  
  837.   For dial out use only, you can configure your modem however you want.
  838.   If you intend to use your modem for dialin, you must configure your
  839.   modem at the same speed that you intend to run getty at.  However,
  840.   most modems today set their speed automatically to the same speed that
  841.   modem commands use.  Thus having getty run at 115,200 will
  842.   automatically set the modem at this speed when getty sends an init
  843.   string to the serial port where the modem is.  In general, factory
  844.   defaults that enable error correction and hardware flow control are
  845.   the best setting for dial out modems, consult your modem manual for
  846.   these settings.
  847.  
  848.  
  849.   5.4.  Hardware Flow Control
  850.  
  851.   If your modem supports hardware flow control (RTS/CTS), I highly
  852.   recommend you use it. This is particularly important for modems that
  853.   support data compression.  First, you have to enable RTS/CTS flow
  854.   control on the serial port itself.  This is best done on startup, like
  855.   in /etc/rc.d/rc.local or /etc/rc.d/rc.serial.  Make sure that these
  856.   files are being run from the main rc.sysinit file!  You need to do the
  857.   following for each serial port you want to enable hardware flow
  858.   control on:
  859.        stty crtscts < /dev/ttyS3
  860.  
  861.  
  862.  
  863.  
  864.   If its not enabled by default, you must also enable RTS/CTS flow con¡
  865.   trol on your modem.  Your communication program may enable it.  Con¡
  866.   sult your modem manual if needed and then save your modem configura¡
  867.   tion if your modem supports stored profiles.
  868.  
  869.  
  870.   6.  How Do I Dial In And Out With My Modem Using getty_ps
  871.  
  872.   Get your modem to dial out correctly.  If you haven't read section
  873.   ``How Do I Dial Out With My Modem'' go read it now!  It contains very
  874.   important setup information.  You do not need to read this section if
  875.   you only want to dial out with your modem.
  876.  
  877.  
  878.   6.1.  Dial In And Out Modem Configuration
  879.  
  880.   For dialin and dialout use, you have to set up your modem a certain
  881.   way (again, using AT commands on your modem):
  882.  
  883.  
  884.        E1       command echo ON
  885.        Q0       result codes are reported
  886.        V1       verbose ON
  887.        S0=0     never answer (uugetty handles this with the WAITFOR option)
  888.  
  889.  
  890.  
  891.  
  892.   If you don't set these correctly, your INIT string in your config file
  893.   may fail, hosing the whole process.  But, more on config files
  894.   below...
  895.  
  896.  
  897.        &C1     DCD is on after connect only
  898.        &S0     DSR is always on
  899.        DTR on/off resets modem (depends on manufacturer - RTFM)
  900.  
  901.  
  902.  
  903.  
  904.   These affect what your modem does when calls start and end.
  905.  
  906.   If your modem does not support a stored profile, you can set these
  907.   through the INIT string in your config file.  See below.  Some modems
  908.   come with DIP switches that affect register settings.  Be sure these
  909.   are set correctly, too.
  910.  
  911.  
  912.   I have started a collection of modem setups for different types of
  913.   modems.  So far, I only have a few of them, if you would like to send
  914.   me your working configuration, please do so!  You can get them at
  915.   ftp://ftp.cc.gatech.edu/pub/people/gregh/modem-configs.
  916.  
  917.  
  918.   Note: to get my USR Courier V.34 modem to reset correctly when DTR
  919.   drops, I had to set &D2 and S13=1 (this sets bit 0 of register S13).
  920.   This has been confirmed to work on USR Sportster V.34 modems as well.
  921.  
  922.  
  923.   Note: some Supra modems treat DCD differently than other modems.  If
  924.   you are using a Supra, try setting &C0 and not &C1.  You must also set
  925.   &D2 to handle DTR correctly.
  926.  
  927.  
  928.   6.2.  Installing getty_ps
  929.  
  930.   Get the latest version from sunsite.unc.edu:/pub/Linux/system/serial.
  931.   In particular, if you want to use high speeds (57600 and 115200 bps),
  932.   you must get version 2.0.7j or later.  You must also have libc 5.x or
  933.   greater.
  934.  
  935.   By default, getty_ps will be configured to be Linux FSSTND (File
  936.   System Standard) compliant, which means that the binaries will be in
  937.   /sbin, and the config files will be named /etc/conf.{uu}getty.ttySN.
  938.   This is not apparent from the documentation!  It will also expect lock
  939.   files to go in /var/lock.  Make sure you have the /var/lock directory.
  940.  
  941.   If you don't want FSSTND compliance, binaries will go in /etc, config
  942.   files will go in /etc/default/{uu}getty.ttySN, and lock files will go
  943.   in /usr/spool/uucp.  I recommend doing things this way if you are
  944.   using UUCP, because UUCP will have problems if you move the lock files
  945.   to where it isn't looking for them.
  946.  
  947.  
  948.   getty_ps can also use syslogd to log messages.  See the man pages for
  949.   syslogd(1) and syslog.conf(5) for setting up syslogd, if you don't
  950.   have it running already.  Messages are logged with priority LOG_AUTH,
  951.   errors use LOG_ERR, and debugging uses LOG_DEBUG.  If you don't want
  952.   to use syslogd you can edit tune.h in the getty_ps source files to use
  953.   a log file for messages instead, namely /var/adm/getty.log by default.
  954.  
  955.  
  956.   Decide on if you want FSSTND compliance and syslog capability.  You
  957.   can also choose a combination of the two.  Edit the Makefile, tune.h
  958.   and config.h to reflect your decisions.  Then compile and install
  959.   according to the instructions included with the package.
  960.  
  961.   >From this point on, all references to getty will refer to getty_ps.
  962.   References to uugetty will refer to the uugetty that comes with the
  963.   getty_ps package.  These instructions will not work for mgetty or
  964.   agetty.
  965.  
  966.  
  967.   7.  uugetty
  968.  
  969.   7.1.  Setting up uugetty
  970.  
  971.   Make sure that you have an outgoing and incoming device for the serial
  972.   port your modem is on.  If you have your modem on ttyS3 you
  973.   will need the /dev/cua3, and /dev/ttyS3 devices.  If you don't have
  974.   the correct devices, see section ``Creating Devices In <tt>/dev</tt>''
  975.   on how to create devices, and create the devices.  If you want to be
  976.   able to dial out with your modem while uugetty is watching the port
  977.   for logins, use the /dev/cuaN device instead of the /dev/ttySN device
  978.   [One wouldn't need cua if the software was written to avoid it.]
  979.  
  980.  
  981.   uugetty does important lock file checking.  Update /etc/gettydefs to
  982.   include an entry for your modem.  When you are done editing
  983.   /etc/gettydefs, you can verify that the syntax is correct by doing:
  984.  
  985.  
  986.        linux# getty -c /etc/gettydefs
  987.  
  988.  
  989.  
  990.  
  991.   7.1.1.  Modern Modems
  992.  
  993.   If you have a 9600 bps or faster modem with data compression, you can
  994.   lock your serial port to one speed.  For example:
  995.  
  996.  
  997.        # 115200 fixed speed
  998.        F115200# B115200 CS8 # B115200 SANE -ISTRIP HUPCL #@S @L @B login: #F115200
  999.  
  1000.  
  1001.  
  1002.  
  1003.  
  1004.   If you have your modem set up to do RTS/CTS hardware flow control, you
  1005.   can add CRTSCTS to the entries:
  1006.  
  1007.  
  1008.        # 115200 fixed speed with hardware flow control
  1009.        F115200# B115200 CS8 CRTSCTS # B115200 SANE -ISTRIP HUPCL CRTSCTS #@S @L @B login: #F115200
  1010.  
  1011.  
  1012.  
  1013.  
  1014.  
  1015.   7.1.2.  Old slow modems
  1016.  
  1017.   If you have a slow modem (under 9600 bps) Then, instead of one line
  1018.   for a single speed, your need several lines to try a number of speeds.
  1019.   Note the these lines are linked to each other by the last "word" in
  1020.   the line such as #38400.  Blank lines are needed between each entry.
  1021.  
  1022.  
  1023.  
  1024.        # Modem entries
  1025.        115200# B115200 CS8 # B115200 SANE -ISTRIP HUPCL #@S @L @B login: #57600
  1026.  
  1027.        57600# B57600 CS8 # B57600 SANE -ISTRIP HUPCL #@S @L @B login: #38400
  1028.  
  1029.        38400# B38400 CS8 # B38400 SANE -ISTRIP HUPCL #@S @L @B login: #19200
  1030.  
  1031.        19200# B19200 CS8 # B19200 SANE -ISTRIP HUPCL #@S @L @B login: #9600
  1032.  
  1033.        9600# B9600 CS8 # B9600 SANE -ISTRIP HUPCL #@S @L @B login: #2400
  1034.  
  1035.        2400# B2400 CS8 # B2400 SANE -ISTRIP HUPCL #@S @L @B login: #115200
  1036.  
  1037.  
  1038.  
  1039.  
  1040.  
  1041.   7.1.3.  Login Banner
  1042.  
  1043.   If you want, you can make uugetty print interesting things in the
  1044.   login banner.  In my examples, I have the system name, the serial
  1045.   line, and the current bps rate.  You can add other things:
  1046.  
  1047.  
  1048.  
  1049.  
  1050.  
  1051.  
  1052.  
  1053.  
  1054.  
  1055.  
  1056.  
  1057.          @B    The current (evaluated at the time the @B is seen) bps rate.
  1058.          @D    The current date, in MM/DD/YY.
  1059.          @L    The serial line to which getty is attached.
  1060.          @S    The system name.
  1061.          @T    The current time, in HH:MM:SS (24-hour).
  1062.          @U    The number of currently signed-on users.  This is  a
  1063.                count of the number of entries in the /etc/utmp file
  1064.                that have a non-null ut_name field.
  1065.          @V    The value of VERSION, as given in the defaults file.
  1066.          To display a single '@' character, use either '\@' or '@@'.
  1067.  
  1068.  
  1069.  
  1070.  
  1071.  
  1072.   7.2.  Customizing uugetty
  1073.  
  1074.   There are lots of parameters you can tweak for each port you have.
  1075.   These are implemented in separate config files for each port.  The
  1076.   file /etc/conf.uugetty will be used by all instances of uugetty, and
  1077.   /etc/conf.uugetty.ttySN will only be used by that one port.  Sample
  1078.   default config files can be found with the getty_ps source files,
  1079.   which come with most Linux distributions.  Due to space concerns, they
  1080.   are not listed here.  Note that if you are using older versions of
  1081.   getty (older than 2.0.7e), or aren't using FSSTND, then the default
  1082.   file will be /etc/default/uugetty.ttySN.  Greg's
  1083.   /etc/conf.uugetty.ttyS3 looked like this:
  1084.  
  1085.  
  1086.        # sample uugetty configuration file for a Hayes compatible modem to allow
  1087.        # incoming modem connections
  1088.        #
  1089.        # alternate lock file to check... if this lock file exists, then uugetty is
  1090.        # restarted so that the modem is re-initialized
  1091.        ALTLOCK=cua3
  1092.        ALTLINE=cua3
  1093.        # line to initialize
  1094.        INITLINE=cua3
  1095.        # timeout to disconnect if idle...
  1096.        TIMEOUT=60
  1097.        # modem initialization string...
  1098.        # format: <expect> <send> ... (chat sequence)
  1099.        INIT="" AT\r OK\r\n
  1100.        WAITFOR=RING
  1101.        CONNECT="" ATA\r CONNECT\s\A
  1102.        # this line sets the time to delay before sending the login banner
  1103.        DELAY=1
  1104.        #DEBUG=010
  1105.  
  1106.  
  1107.  
  1108.  
  1109.   Add the following line to your /etc/inittab, so that uugetty is run on
  1110.   your serial port (substituting in the correct information for your
  1111.   environment - config file location, port, speed, and default terminal
  1112.   type):
  1113.  
  1114.  
  1115.        S3:456:respawn:/sbin/uugetty -d /etc/default/uugetty.ttyS3 ttyS3 F115200 vt100
  1116.  
  1117.  
  1118.  
  1119.  
  1120.   Restart init:
  1121.  
  1122.  
  1123.   linux# init q
  1124.  
  1125.  
  1126.  
  1127.  
  1128.   For the speed parameter in your /etc/inittab, you want to use the
  1129.   highest bps rate that your modem supports.
  1130.  
  1131.   Now Linux will be watching your serial port for connections.  Dial in
  1132.   from another machine and login to you Linux system.
  1133.  
  1134.   uugetty has a lot more options, see the man page for getty(1m) for a
  1135.   full description.  Among other things there is a scheduling feature,
  1136.   and a ringback feature.
  1137.  
  1138.  
  1139.   8.  How Do I Set Up A Terminal Connected To My PC?
  1140.  
  1141.   See Text-Terminal-HOWTO for a more detailed (but still incomplete)
  1142.   discussion of terminals.  The instructions in this section will work
  1143.   for connecting terminals, as well as other computers to the serial
  1144.   port on your Linux box.
  1145.  
  1146.  
  1147.   8.1.  Hardware Requirements
  1148.  
  1149.   Make sure you have the right kind of cable.  A null modem cable bought
  1150.   at a computer store may do it, but it probably will not work for
  1151.   hardware flow control.  But it must be a null modem cable!  Many
  1152.   computer stores advertise this kind of cable as a serial printer
  1153.   cable.  Make sure you are using your serial port, the male DB25 or the
  1154.   DB9, and not your parallel port (female DB25 or centronics).
  1155.  
  1156.  
  1157.   For a DB25 connector, you need a minimum of:
  1158.  
  1159.  
  1160.   PC male DB25                            Terminal DB25
  1161.           TxD   Transmit Data         2 --> 3     RxD   Receive Data
  1162.           RxD   Receive Data          3 <-- 2     TxD   Transmit Data
  1163.           SG    Signal Ground         7 --- 7     SG    Signal Ground
  1164.  
  1165.  
  1166.  
  1167.   This null modem cable works OK between two computers that use RTS/CTS
  1168.   hardware handshaking signals, but many terminals use DTR handshaking
  1169.   which can't be set in linux with "stty".   A workaround is to stty
  1170.   crtscts and connect terminal pin 20 (DTR) with the PC pin 5 (CTS).
  1171.  
  1172.  
  1173.   PC male DB25                            Terminal DB25
  1174.   TxD   Transmit Data         2 --> 3     RxD   Receive Data
  1175.   RxD   Receive Data          3 <-- 2     TxD   Transmit Data
  1176.   RTS   Request To Send       4 --> 5     CTS   Clear To Send
  1177.   CTS   Clear To Send         5 <-- 4     RTS   Request To Send
  1178.   DSR   Data Set Ready        6
  1179.                               |
  1180.   DCD   Carrier Detect        8 <-- 20    DTR   Data Terminal Ready
  1181.   SG    Signal Ground         7 --- 7     SG    Signal Ground
  1182.                                     6     DSR   Data Set Ready
  1183.                                     |
  1184.   DTR   Data Terminal Ready  20 --> 8     DCD   Carrier Detect
  1185.  
  1186.  
  1187.  
  1188.  
  1189.   If you have a DB9 connector on your serial port, try the following:
  1190.  
  1191.   PC DB9                                  Terminal DB25
  1192.           RxD   Receive Data          2 <-- 2     TxD   Transmit Data
  1193.           TxD   Transmit Data         3 --> 3     RxD   Receive Data
  1194.           SG    Signal Ground         5 --- 7     SG    Signal Ground
  1195.  
  1196.  
  1197.  
  1198.   Alternatively, a full DB9-DB25 null modem cable (Not likely to work
  1199.   with terminal hardware handshaking; see above):
  1200.  
  1201.   PC DB9                                  Terminal DB25
  1202.   RxD   Receive Data          2 <-- 2     TxD   Transmit Data
  1203.   TxD   Transmit Data         3 --> 3     RxD   Receive Data
  1204.                                     6     DSR   Data Set Ready
  1205.                                     |
  1206.   DTR   Data Terminal Ready   4 --> 8     DCD   Carrier Detect
  1207.   GND   Signal Ground         5 --- 7     GND   Signal Ground
  1208.   DCD   Carrier Detect        1
  1209.                               |
  1210.   DSR   Data Set Ready        6 <-- 20    DTR   Data Terminal Ready
  1211.   RTS   Request To Send       7 --> 5     CTS   Clear To Send
  1212.   CTS   Clear To Send         8 <-- 4     RTS   Request To Send
  1213.   (RI   Ring Indicator        9 not needed)
  1214.  
  1215.  
  1216.   (Yes, the pins 2 and 3 really do have the opposite meanings in DB9
  1217.   connectors than in DB25 connectors!)
  1218.  
  1219.   If you are not using a full null modem cable, you might have to do the
  1220.   following trick: on your computer side of the connector, connect RTS
  1221.   and CTS together, and also connect DSR, DCD and DTR together.  This
  1222.   way, when the computer wants a certain handshaking signal, it will get
  1223.   it (from itself).
  1224.  
  1225.   Now that you have the right kind of cable?, connect your terminal to
  1226.   your computer.  If you can, tell the terminal to ignore modem control
  1227.   signals.  Try using 9600 bps, 8 data bits, 1 stop bit, no parity bits
  1228.   for the terminal's setup (or enable parity if you want to be more
  1229.   sophisticated).
  1230.  
  1231.  
  1232.   8.2.  Setting up getty  (part of getty_ps )
  1233.  
  1234.   Consult your getty manual for other getty programs such as agetty.
  1235.   Add entries for getty to use for your terminal in /etc/gettydefs if
  1236.   there they aren't already there:
  1237.  
  1238.  
  1239.        # 38400 bps Dumb Terminal entry
  1240.        DT38400# B38400 CS8 CLOCAL # B38400 SANE -ISTRIP CLOCAL #@S @L login: #DT38400
  1241.  
  1242.        # 19200 bps Dumb Terminal entry
  1243.        DT19200# B19200 CS8 CLOCAL # B19200 SANE -ISTRIP CLOCAL #@S @L login: #DT19200
  1244.  
  1245.        # 9600 bps Dumb Terminal entry
  1246.        DT9600# B9600 CS8 CLOCAL # B9600 SANE -ISTRIP CLOCAL #@S @L login: #DT9600
  1247.  
  1248.  
  1249.  
  1250.  
  1251.   If you want, you can make getty print interesting things in the login
  1252.   banner.  In my examples, I have the system name and the serial line
  1253.   printed.  You can add other things:
  1254.  
  1255.   @B    The current (evaluated at the time the @B is seen) bps rate.
  1256.   @D    The current date, in MM/DD/YY.
  1257.   @L    The serial line to which getty is attached.
  1258.   @S    The system name.
  1259.   @T    The current time, in HH:MM:SS (24-hour).
  1260.   @U    The number of currently signed-on users.  This is  a
  1261.         count of the number of entries in the /etc/utmp file
  1262.         that have a non-null ut_name field.
  1263.   @V    The value of VERSION, as given in the defaults file.
  1264.   To display a single '@' character, use either '\@' or '@@'.
  1265.  
  1266.  
  1267.  
  1268.  
  1269.   When you are done editing /etc/gettydefs, you can verify that the
  1270.   syntax is correct by doing:
  1271.  
  1272.  
  1273.        linux# getty -c /etc/gettydefs
  1274.  
  1275.  
  1276.  
  1277.  
  1278.  
  1279.   Make sure there is no getty or uugetty config file for the serial port
  1280.   that your terminal is attached to (/etc/default/{uu}getty.ttySN or
  1281.   /etc/conf.{uu}getty.ttySN), as this will probably interfere with
  1282.   running getty on a terminal.  Remove the file if it exits.
  1283.  
  1284.   Edit your /etc/inittab file to run getty on the serial port
  1285.   (substituting in the correct information for your environment - port,
  1286.   speed, and default terminal type):
  1287.  
  1288.  
  1289.        S1:456:respawn:/sbin/getty ttyS1 DT9600 vt100
  1290.  
  1291.  
  1292.  
  1293.  
  1294.   Restart init:
  1295.  
  1296.  
  1297.        linux# init q
  1298.  
  1299.  
  1300.  
  1301.  
  1302.   At this point, you should see a login prompt on your terminal.  You
  1303.   may have to hit return to get the terminal's attention.
  1304.  
  1305.  
  1306.   8.3.  Notes On Setting Up A PC As A Terminal
  1307.  
  1308.  
  1309.   Many people set up other PCs as terminals connected to Linux boxes.
  1310.   For example, old 8088 or 80286 PCs are perfect for this purpose.  All
  1311.   you need is a DOS boot disk containing a version of DOS suitable for
  1312.   your terminal-PC, and a communications program for your terminal-PC to
  1313.   run.  kermit works very well for this purpose.  You can find pre-
  1314.   compiled versions of kermit for every OS in existence at
  1315.   http://www.columbia.edu/kermit/.  Other popular DOS comm programs such
  1316.   as telix and procomm will work equally well.  Be sure to input correct
  1317.   serial port information into your terminal-PC's communications setup.
  1318.  
  1319.  
  1320.  
  1321.   9.  Can I Use More Than Two Serial Devices?
  1322.  
  1323.   You don't need to read this section, unless you want to use three or
  1324.   more serial devices... (assuming you don't have a multiport board).
  1325.  
  1326.   Providing you have another spare serial port, yes you can.  The number
  1327.   of serial ports you can use is limited by the number of interrupts
  1328.   (IRQs) and port I/O addresses we have to use.  This is not a Linux
  1329.   limitation, but a limitation of the PC bus.  Each serial devices must
  1330.   be assigned it's address and should be assigned it's own interrupt.
  1331.   If two devices share the same interrupt, it may work OK provided the
  1332.   two devices are not operating at the same time.  (In most cases, the
  1333.   two programs must not even be running at the same time.)  A serial
  1334.   device can be a serial port, an internal modem, or a multiport serial
  1335.   board.
  1336.  
  1337.  
  1338.   Multiport serial boards are specially designed to have multiple serial
  1339.   ports that share the same IRQ for all serial ports on the board.
  1340.   Linux gets data from them by using a different I/O address for each
  1341.   port on the board.
  1342.  
  1343.  
  1344.   9.1.  Choosing Serial Device Interrupts
  1345.  
  1346.   Your PC will normally come with ttyS0 and ttyS2 at IRQ 4, and ttyS1
  1347.   and ttyS3 at IRQ 3.  You can see what IRQs are in use by typing:
  1348.   setserial /dev/ttyS2, etc.  Looking at /proc/interrupts will show some
  1349.   of them.  To use more than two serial devices, you will have to
  1350.   reassign an interrupt.  A good choice is to reassign an interrupt from
  1351.   your parallel port.  Your PC normally comes with IRQ 5 and IRQ 7 set
  1352.   up as interrupts for your parallel ports, but few people use two
  1353.   parallel ports.  You can reassign one of the interrupts to a serial
  1354.   device, and still happily use a parallel port.  You will need the
  1355.   setserial program to do this.  In addition, you have to play with the
  1356.   jumpers on your boards, check the docs for your board.  Set the
  1357.   jumpers to the IRQ you want for each port.
  1358.  
  1359.  
  1360.   You should set things up so that there is one, and only one interrupt
  1361.   for each serial device.  Here is how Greg set his up in
  1362.   /etc/rc.d/rc.local - you should do it in a file which runs upon
  1363.   startup:
  1364.  
  1365.  
  1366.        /sbin/setserial /dev/ttyS0 irq 3        # my serial mouse
  1367.        /sbin/setserial /dev/ttyS1 irq 4        # my Wyse dumb terminal
  1368.        /sbin/setserial /dev/ttyS2 irq 5        # my Zoom modem
  1369.        /sbin/setserial /dev/ttyS3 irq 9        # my USR modem
  1370.  
  1371.  
  1372.  
  1373.  
  1374.   Standard IRQ assignments:
  1375.  
  1376.  
  1377.  
  1378.  
  1379.  
  1380.  
  1381.  
  1382.  
  1383.  
  1384.  
  1385.  
  1386.  
  1387.                 IRQ  0    Timer channel 0
  1388.         IRQ  1    Keyboard
  1389.                 IRQ  2    Cascade for controller 2
  1390.                 IRQ  3    Serial port 2
  1391.                 IRQ  4    Serial port 1
  1392.                 IRQ  5    Parallel port 2
  1393.                 IRQ  6    Floppy diskette
  1394.                 IRQ  7    Parallel port 1
  1395.                 IRQ  8    Real-time clock
  1396.                 IRQ  9    Redirected to IRQ2
  1397.                 IRQ 10    not assigned
  1398.                 IRQ 11    not assigned
  1399.                 IRQ 12    not assigned
  1400.                 IRQ 13    Math coprocessor
  1401.                 IRQ 14    Hard disk controller 1
  1402.                 IRQ 15    Hard disk controller 2
  1403.  
  1404.  
  1405.  
  1406.   There is really no Right Thing to do when choosing interrupts.  Just
  1407.   make sure it isn't being used by the motherboard, or any other boards.
  1408.   2, 3, 4, 5, or 7  is a good choice.  ``not assigned'' means that
  1409.   currently nothing standard uses these IRQs.  Also note that IRQ 2 is
  1410.   the same as IRQ 9.  You can call it either 2 or 9, the serial driver
  1411.   is very understanding.  If you have a serial board with a 16-bit bus
  1412.   connector , you can also use IRQ 10, 11, 12 or 15.
  1413.  
  1414.  
  1415.   Just make sure you don't use IRQ 0, 1, 6, 8, 13 or 14!  These are used
  1416.   by your mother board.  You will make her very unhappy by taking her
  1417.   IRQs.  When you are done, double-check /proc/interrupts and make sure
  1418.   there are no conflicts.
  1419.  
  1420.  
  1421.   9.2.  Setting Serial Device Addresses
  1422.  
  1423.   Next, you must set the port address.  Check the manual on your board
  1424.   for the jumper settings.  Like interrupts, there can only be one
  1425.   serial device at each address.  Your ports will usually come
  1426.   configured as follows:
  1427.  
  1428.  
  1429.        ttyS0 address 0x3f8
  1430.        ttyS1 address 0x2f8
  1431.        ttyS2 address 0x3e8
  1432.        ttyS3 address 0x2e8
  1433.  
  1434.  
  1435.  
  1436.  
  1437.   Choose which address you want each serial device to have and set the
  1438.   jumpers accordingly.  I have my modem on ttyS3, my mouse on ttyS0, and
  1439.   my terminal on ttyS2.
  1440.  
  1441.   When you reboot, Linux should see your serial ports at the address you
  1442.   set them.  The IRQ Linux sees may not correspond to the IRQ you set
  1443.   with the jumpers.  Don't worry about this.  Linux does not do any IRQ
  1444.   detection when it boots, because IRQ detection is dicey and can be
  1445.   fooled.  Use setserial to tell Linux what IRQ the port is using.  You
  1446.   can check /proc/ioports to see what I/O port addresses are in use
  1447.   after Linux boots.
  1448.  
  1449.  
  1450.  
  1451.  
  1452.  
  1453.   10.  How Do I Set Up My Serial Ports For Higher Speeds?  What Speed
  1454.   Should I Use With My Modem?
  1455.  
  1456.   This section should help you figure out what speed to use when using
  1457.   your modem with a communications program, or with a getty program.
  1458.   Normally you just set the speed by a parameter given to getty or by a
  1459.   menu in your communications program (or in a configuration file).  If
  1460.   for some reason that doesn't work for high speeds, there is a
  1461.   workaround by giving special options to setserial:   With the spd_hi
  1462.   or spd_vhi options given to setserial, setting 38400 will actually set
  1463.   the speed to 57600 (spd_hi) or 115200 (spd_vhi).
  1464.  
  1465.   Make sure you have at least 16550A UARTs for higher speeds.  Here are
  1466.   some suggested speeds:
  1467.  
  1468.   ╖  If you have a 28.8K (V.34), 33.6K (V.34), or 56K (V.90) modem use
  1469.      115200 bps.
  1470.  
  1471.   ╖  If you have a 14400 bps (V.32bis) modem, with V.42bis data
  1472.      compression, use 57600 bps.
  1473.  
  1474.   ╖  If you have a 9600 bps (V.32) modem, with V.42bis data compression,
  1475.      use 38400 bps.
  1476.  
  1477.   ╖  If you have something slower than a 9600 bps (V.32) modem, set your
  1478.      speed to the highest speed your modem supports.  For example 300
  1479.      bps (V.21/Bell 103), 1200 bps (V.22/Bell 212A), or 2400 bps
  1480.      (V.22bis).
  1481.  
  1482.   If you use setserial test them on the command line first, and then
  1483.   when you have them working, put them into /etc/rc.d/rc.serial or
  1484.   /etc/rc.d/rc.local or /etc/rc.boot/0setserial so that they are run at
  1485.   startup.  Make sure that you are using a valid path for setserial, and
  1486.   a valid device name.  You can check the settings of a serial port by
  1487.   running:
  1488.  
  1489.  
  1490.        setserial -a /dev/ttyS3
  1491.  
  1492.  
  1493.  
  1494.  
  1495.  
  1496.   11.  Communications Programs And Utilities
  1497.  
  1498.   Here is a list of some communication software you can choose from,
  1499.   available via FTP, if they didn't come with your distribution.
  1500.  
  1501.  
  1502.   ╖  ecu - a communications program
  1503.  
  1504.   ╖  C-Kermit <http://www.columbia.edu/kermit/> - portable, scriptable,
  1505.      serial and TCP/IP communications including file transfer and
  1506.      character-set translation
  1507.  
  1508.   ╖  minicom - telix-like communications program
  1509.  
  1510.   ╖  procomm - procomm-like communications program with zmodem
  1511.  
  1512.   ╖  seyon - X based communication program
  1513.  
  1514.   ╖  xc - xcomm communication package
  1515.  
  1516.   ╖  Other useful programs are term and SLiRP.  They offer TCP/IP
  1517.      functionality using a shell account.
  1518.  
  1519.   ╖  screen is another multi-session program.  This one behaves like the
  1520.      virtual consoles.
  1521.  
  1522.   ╖  callback is a program that will have your modem call you back.
  1523.  
  1524.   ╖  mgetty+fax handles FAX stuff, and provides an alternate ps_getty.
  1525.  
  1526.   ╖  ZyXEL is a control program for ZyXEL U-1496 modems.  It handles
  1527.      dialin, dialout, dial back security, FAXing, and voice mailbox
  1528.      functions.
  1529.  
  1530.   ╖  SLIP and PPP software can be found at
  1531.      ftp://sunsite.unc.edu/pub/Linux/system/network/serial.
  1532.  
  1533.   ╖  Other things can be found on
  1534.      ftp://sunsite.unc.edu/pub/Linux/system/serial and
  1535.      ftp://sunsite.unc.edu/pub/Linux/apps/serialcomm or one of the many
  1536.      mirrors.  These are the directories where serial programs are kept.
  1537.  
  1538.  
  1539.   12.  Serial Tips And Miscellany
  1540.  
  1541.   Here are some serial tips you might find helpful...
  1542.  
  1543.  
  1544.   12.1.  kermit and zmodem
  1545.  
  1546.   To use zmodem with kermit, add the following to your .kermrc:
  1547.  
  1548.  
  1549.        define rz !rz < /dev/ttyS3 > /dev/ttyS3
  1550.        define sz !sz \%0 > /dev/ttyS3 < /dev/ttyS3
  1551.  
  1552.  
  1553.  
  1554.  
  1555.   Be sure to put in the correct port your modem is on.  Then, to use it,
  1556.   just type rz or sz <filename> at the kermit prompt.
  1557.  
  1558.  
  1559.   12.2.  Setting Terminal Types Automagically
  1560.  
  1561.   To set your terminal type automagically when you log in, add the
  1562.   terminal type to the entry in /etc/inittab.  If I have a vt100
  1563.   terminal on ttyS1, I would add ``vt100'' to the getty command:
  1564.  
  1565.  
  1566.        S1:456:respawn:/sbin/getty ttyS1 DT9600 vt100
  1567.  
  1568.  
  1569.  
  1570.  
  1571.   Other gettys have similar options.  You can also use tset, which can
  1572.   establish terminal characteristics when you log in, and doesn't depend
  1573.   on any defaults.
  1574.  
  1575.  
  1576.   12.3.  Color ls  On Serial Connections
  1577.  
  1578.  
  1579.   If ls is screwing up your terminal emulation with the color feature,
  1580.   turn it off.  ls --color, and ls --colour all use the color feature.
  1581.   Some installations have ls set to use color by default.  Check
  1582.   /etc/profile and /etc/csh.cshrc for ls aliases.  You can also alias ls
  1583.   to ls --no-color, if you don't want to change the system defaults.
  1584.  
  1585.   12.4.  Printing To A Printer Connected To A Terminal
  1586.  
  1587.  
  1588.   There is a program called vtprint, available from
  1589.   ftp://ftp.sdsu.edu/pub/vtprint, and from http://www.sdsu.edu/~garrett.
  1590.  
  1591.   Another program that will do this is called xprt.  It can be found at
  1592.   ftp://sunsite.unc.edu/pub/Linux/system/printing.
  1593.  
  1594.  
  1595.   12.5.  Can Linux Configure The Serial Devices Automagically?
  1596.  
  1597.   Yes.  If it's not already set up like this (or close to it) you may
  1598.   set Linux up to detect and set up the serial devices automatically on
  1599.   startup.  If needed add the line:
  1600.  
  1601.  
  1602.  
  1603.        /sbin/setserial /dev/ttyS3 auto_irq skip_test autoconfig
  1604.  
  1605.  
  1606.  
  1607.  
  1608.   to your /etc/rc.d/rc.local or /etc/rc.d/rc.serial or
  1609.   /etc/rc.boot/0setserial file.  Do this for every serial port you want
  1610.   to auto configure.  Be sure to give a device name that really does
  1611.   exist on your machine.
  1612.  
  1613.  
  1614.   12.5.1.  Notes For Multiport Boards
  1615.  
  1616.   For board addresses, and IRQs, look at the rc.serial or
  1617.   /etc/rc.boot/0setserial that comes with the setserial program.  It has
  1618.   a lot of detail on multiport boards, including I/O addresses and
  1619.   device names.
  1620.  
  1621.  
  1622.   12.6.  Using A Serial Console
  1623.  
  1624.   There is an article in issue 36 of the Linux Journal,
  1625.   http://www.ssc.com/lj/issue36/index.html that explains how to use a
  1626.   serial console.  See Text-Terminal-HOWTO.
  1627.  
  1628.  
  1629.   12.7.  Higher Serial Throughput
  1630.  
  1631.   If you are seeing slow throughput and serial port overruns on a system
  1632.   with (E)IDE disk drives, you can get hdparm.  This is a utility that
  1633.   can modify (E)IDE parameters, including unmasking other IRQs during a
  1634.   disk IRQ.  This will improve responsiveness and will help eliminate
  1635.   overruns.  Be sure to read the man page very carefully, since some
  1636.   drive/controller combinations don't like this and may corrupt the
  1637.   filesystem.
  1638.  
  1639.   Also have a look at a utility called irqtune that will change the IRQ
  1640.   priority of a device, for example the serial port that your modem is
  1641.   on.  This may improve the serial throughput on your system.  The
  1642.   irqtune FAQ is at http://www.best.com/~cae/irqtune.
  1643.  
  1644.  
  1645.   13.  One Step Further...
  1646.  
  1647.   This section is not required reading, but may give you some further
  1648.   insight into Unix, and the world of telecommunications.
  1649.  
  1650.  
  1651.   13.1.  What Are Lock Files?
  1652.  
  1653.   Lock file are simply a file saying that a particular device is in use.
  1654.   They are kept in /usr/spool/uucp, or /var/lock.  Linux lock files are
  1655.   named LCK..name, where name is either a device name, or a UUCP site
  1656.   name.  Certain processes create these locks so that they can have
  1657.   exclusive access to devices.  For instance if you dial out on your
  1658.   modem, a lock will appear telling other processes that someone is
  1659.   using the modem already.  Locks mainly contain the PID of the process
  1660.   that has locked the device.  Most programs look at the lock, and try
  1661.   to determine if that lock is still valid by checking the process table
  1662.   for the process that has locked the device.  If the lock is found to
  1663.   be valid, the program (should) exit.  If not, some programs remove the
  1664.   stale lock, and use the device, creating their own lock in the
  1665.   process.  Other programs just exit and tell you that the device is in
  1666.   use.
  1667.  
  1668.  
  1669.   13.2.  ``baud'' Vs. ``bps''
  1670.  
  1671.   ``baud'' and ``bps'' are perhaps one of the most misused terms in the
  1672.   computing and telecommunications field.  Many people use these terms
  1673.   interchangeably, when in fact they are not!
  1674.  
  1675.      baud
  1676.         The baud rate is a measure of how many times per second a
  1677.         signal, for instance one sent by a modem (modulator-demodulator)
  1678.         changes. For example, a baud rate of 1200 implies one signal
  1679.         change every 833 microseconds. Common modem baud rates are 50,
  1680.         75, 110, 300, 600, 1200, and 2400. Most high speed modems run at
  1681.         2400 baud. Because of the bandwidth limitations on voice-grade
  1682.         phone lines, baud rates greater than 2400 are harder to achieve,
  1683.         and only work under very pristine phone line quality.  Multiple
  1684.         bits can be encoded per baud, to get bit rates that exceed the
  1685.         baud rate. ``baud'' is named after Emile Baudot, the inventor of
  1686.         the asynchronous telegraph printer.
  1687.  
  1688.  
  1689.      bps
  1690.         The bps rate is a measure of how many bits per second are
  1691.         transmitted.  Common modem bps rates were formerly  50, 75, 110,
  1692.         300, 1200, 2400, 9600.  Today they are 14.4K, 28.8K, 33.6K, and
  1693.         56K (these do not correspond to the rates over the serial-port-
  1694.         to-modem cable which are in addition to the old modem bps rates
  1695.         (50-9600): 19.2K, 38.4K, 57.6K and 115.2K).  Using modems with
  1696.         V.42bis compression (max 4:1 compression), rates up to 115.2K
  1697.         bps are possible.  This is what most people mean when they
  1698.         misuse the word ``baud''.
  1699.  
  1700.  
  1701.   So, if high speed modems are running at 2400 baud, how can they send
  1702.   14400 bps (or higher)?  The modems achieve a bps rate greater than
  1703.   baud rate by encoding many bits in each signal change, or phase
  1704.   change. Thus, when 2 or more bits are encoded per baud, the bps rate
  1705.   exceeds the baud rate. If your modem connects at 14400 bps, it's going
  1706.   to be sending 6 bits per phase change, at 2400 baud.
  1707.  
  1708.   How did this confusion start? Well, back when antique low speed modems
  1709.   were high speed modems, the bps rate actually did equal the baud rate.
  1710.   One bit would be encoded per phase change. People would use bps and
  1711.   baud interchangeably, because they were the same number. For example,
  1712.   a 300 bps modem also had a baud rate of 300. This all changed when
  1713.   faster modems came around, and the bit rate exceeded the baud rate.
  1714.  
  1715.  
  1716.  
  1717.   13.3.  What Are UARTs?  How Do They Affect Performance?
  1718.  
  1719.   UARTs (Universal Asynchronous Receiver Transmitter) are chips on your
  1720.   PC serial board (if you have one) or on the motherboard.  The UART
  1721.   function may also be done on a chip that does other things as well.
  1722.   The UART's purpose is to convert data to bits, send the bits down the
  1723.   serial line, and then rebuild the data again on the other end.  UARTs
  1724.   deal with data in byte sized pieces, which is conveniently also the
  1725.   size of ASCII characters.
  1726.  
  1727.   Say you have a terminal hooked up to your PC.  When you type a
  1728.   character, the terminal gives that character to it's transmitter (also
  1729.   a UART).  The transmitter sends that byte out onto the serial line,
  1730.   one bit at a time, at a specific rate.  On the PC end, the receiving
  1731.   UART takes all the bits and rebuilds the byte and puts it in a buffer.
  1732.  
  1733.   There are two different types of UARTs.  You have probably heard of
  1734.   dumb UARTs - the 8250 and 16450, and FIFO UARTs - the 16550A.  To
  1735.   understand their differences, first let's examine what happens when a
  1736.   UART has sent or received a byte.
  1737.  
  1738.   The UART itself can't do anything with the data, it just sends and
  1739.   receives it.  For the original UARTS, the CPU gets an interrupt from
  1740.   the serial device every time a byte has been sent or received.  The
  1741.   CPU then moves the received byte out of the UART's buffer and into
  1742.   memory somewhere, or gives the UART another byte to send. The 8250 and
  1743.   16450 UARTs only have a 1 byte buffer.  That means, that every time 1
  1744.   byte is sent or received, the CPU is interrupted.  At low rates, this
  1745.   is OK.  But, at high transfer rates, the CPU gets so busy dealing with
  1746.   the UART, that is doesn't have time to tend to other tasks.  In some
  1747.   cases, the CPU does not get around to servicing the interrupt in time,
  1748.   and the byte is overwritten, because they are coming in so fast.
  1749.  
  1750.   That's where the 16550A UARTs are useful.  These chips come with 16
  1751.   byte FIFOs.  This means that it can receive or transmit up to 14 bytes
  1752.   before it has to interrupt the CPU.  Not only can it wait, but the CPU
  1753.   then can transfer all 14 bytes at a time.  Although the interrupt
  1754.   threshold is not always set at 14, this is still a significant
  1755.   advantage over the other UARTs, which only have the 1 byte buffer.
  1756.   The CPU receives less interrupts, and is free to do other things.
  1757.   Data is not lost, and everyone is happy.  (There is also a 16550 UART,
  1758.   but it is treated as a 16450 since it is broken.)
  1759.  
  1760.   In general, the 8250 and 16450 UARTs should be fine for speeds up to
  1761.   38400 bps.  At speeds greater than 38400 bps, you might start seeing
  1762.   data loss.  Other PC operating systems (definition used loosely here),
  1763.   like DOS aren't multitasking, so they might be able to cope better
  1764.   with 8250 or 16450s.  That's why some people don't see data loss,
  1765.   until they switch to Linux.
  1766.  
  1767.   Non-UART, and intelligent multiport boards use DSP chips to do
  1768.   additional buffering and control, thus relieving the CPU even more.
  1769.   For example, the Cyclades Cyclom, and Stallion EasyIO boards use a
  1770.   Cirrus Logic CD1400 RISC UART, and many boards use 80186 CPUs or even
  1771.   special RISC CPUs, to handle the serial I/O.
  1772.  
  1773.   Keep in mind that these dumb UART types are not bad, they just aren't
  1774.   good for high speeds.  You should have no problem connecting a
  1775.   terminal, or a mouse to these UARTs.  But, for a high speed modem, the
  1776.   16550A is definitely a must.
  1777.  
  1778.   Most newer PC's (486's, Pentiums, or better) come with 16550A's.  If
  1779.   you have something really old you may be able to upgrade it by buying
  1780.   16550A chips and replacing your existing 16450 UARTs.  If the
  1781.   functionality has been put on another type of chip, you are out of
  1782.   luck.  If the UART is socketed, then upgrading is easy (if you can
  1783.   find a replacement).  The new and old are pin-to-pin compatible.  It
  1784.   may be more feasible to just buy a serial board from the Internet (few
  1785.   retail stores stock them today).
  1786.  
  1787.  
  1788.   14.  Troubleshooting
  1789.  
  1790.   14.1.  I Keep Getting ``line NNN  of inittab invalid''
  1791.  
  1792.   Make sure you are using the correct syntax for your version of init.
  1793.   The different init's that are out there use different syntax in the
  1794.   /etc/inittab file.  Make sure you are using the correct syntax for
  1795.   your version of getty.
  1796.  
  1797.  
  1798.   14.2.  When I Try To Dial Out, It Says ``/dev/cua N : Device or
  1799.   resource busy''
  1800.  
  1801.   This problem can arise when DCD or DTR are not set correctly.  DCD
  1802.   should only be set when there is an actual connection (ie someone is
  1803.   dialed in), not when getty is watching the port.  Check to make sure
  1804.   that your modem is configured to only set DCD when there is a
  1805.   connection.  DTR should be set whenever something is using, or
  1806.   watching the line, like getty, kermit, or some other comm program.
  1807.  
  1808.   Another common cause of ``device busy'' errors, is that you set up
  1809.   your serial port with an interrupt already taken by something else.
  1810.   As each device initializes, it asks Linux for permission to use its
  1811.   hardware interrupt.  Linux keeps track of which interrupt is assigned
  1812.   to whom, and if your interrupt is already taken, your device won't be
  1813.   able to initialize properly.  The device really doesn't have much of
  1814.   any way to tell you that this happened, except that when you try to
  1815.   use it, it will return a ``device-busy'' error.  Check the interrupts
  1816.   on all of your boards (serial, ethernet, SCSI, etc.).  Look for IRQ
  1817.   conflicts.
  1818.  
  1819.  
  1820.   14.3.  I Keep Getting ``Getty respawning too fast: disabled for 5 min¡
  1821.   utes''
  1822.  
  1823.   Make sure your modem is configured correctly.  Look at registers E and
  1824.   Q.  This can occur when your modem is chatting with getty.
  1825.  
  1826.   Make sure you are calling getty correctly from your /etc/inittab.
  1827.   Using the wrong syntax or device names will cause serious problems.
  1828.  
  1829.   Verify that your /etc/gettydefs syntax is correct by doing the
  1830.   following:
  1831.  
  1832.  
  1833.        linux# getty -c /etc/gettydefs
  1834.  
  1835.  
  1836.  
  1837.  
  1838.  
  1839.   This can also happen when the uugetty initialization is failing.  See
  1840.   section ``getty Or uugetty Still Doesn't Work''.
  1841.  
  1842.  
  1843.   14.4.  Serial Devices Are Slow, Or Serial Devices Can Only Send In One
  1844.   Direction
  1845.  
  1846.  
  1847.   You probably have an IRQ conflict.  Make sure there are no IRQs being
  1848.   shared.  Check all your boards (serial, ethernet, SCSI, etc...).  Make
  1849.   sure the jumper settings, and the setserial parameters are correct for
  1850.   all your serial devices.  Also check /proc/ioports and
  1851.   /proc/interrupts for conflicts.
  1852.  
  1853.  
  1854.   14.5.  My Modem Is Hosed After Someone Hangs Up, Or uugetty  doesn't
  1855.   respawn
  1856.  
  1857.  
  1858.   This can happen when your modem doesn't reset when DTR is dropped.  I
  1859.   saw my RD and SD LEDs go crazy when this happened to me.  You need to
  1860.   have your modem reset.  Most Hayes compatible modems do this with &D3,
  1861.   but on my USR Courier, I had to set &D2 and S13=1.  Check your modem
  1862.   manual.
  1863.  
  1864.  
  1865.   14.6.  I Have My Terminal Connected To My PC, But After I Type In A
  1866.   Login Name, It Just Locks Up
  1867.  
  1868.  
  1869.   ╖  If you are using getty: You probably don't have CLOCAL in your
  1870.      /etc/gettydefs entry for the terminal, and you're probably not
  1871.      using a full null modem cable.  You need CLOCAL, which tells Linux
  1872.      to ignore modem control signals.  Here is what it should look like:
  1873.  
  1874.  
  1875.         # 38400 bps Dumb Terminal entry
  1876.         DT38400# B38400 CS8 CLOCAL # B38400 SANE -ISTRIP CLOCAL #@S @L login: #DT38400
  1877.  
  1878.         # 19200 bps Dumb Terminal entry
  1879.         DT19200# B19200 CS8 CLOCAL # B19200 SANE -ISTRIP CLOCAL #@S @L login: #DT19200
  1880.  
  1881.         # 9600 bps Dumb Terminal entry
  1882.         DT9600# B9600 CS8 CLOCAL # B9600 SANE -ISTRIP CLOCAL #@S @L login: #DT9600
  1883.  
  1884.  
  1885.  
  1886.  
  1887.  
  1888.   Next, kill the getty process so a new one will be spawned with the new
  1889.   entry.
  1890.  
  1891.   ╖  If you are using agetty: Add the -L flag to the agetty line in your
  1892.      /etc/inittab.  This will make it ignore modem control signals.
  1893.      Then restart init by typing init q.  The entry should look like
  1894.      this:
  1895.  
  1896.  
  1897.         s1:345:respawn:/sbin/agetty -L 9600 ttyS1 vt100
  1898.  
  1899.  
  1900.  
  1901.  
  1902.  
  1903.  
  1904.   14.7.  At High Speeds, My Modem Looses Data
  1905.  
  1906.   If you are trying to run your modem faster than 38400 bps, and you
  1907.   don't have 16550A UARTs, you should upgrade them.  See section ``What
  1908.   Are UARTs?'' about UARTs.
  1909.  
  1910.  
  1911.   14.8.  On Startup, Linux Doesn't Report The Serial Devices The Way I
  1912.   Have Them Configured
  1913.  
  1914.  
  1915.   This is only partly true.  Linux does not do any IRQ detection on
  1916.   startup, it only does serial device detection.  Thus, disregard what
  1917.   it says about the IRQ, because it's just assuming the standard IRQs.
  1918.   This is done, because IRQ detection is unreliable, and can be fooled.
  1919.   But when setserial changes the IRQ's, you should see this on the
  1920.   startup screen.
  1921.  
  1922.   So, even though I have my ttyS2 set at IRQ 5, I still see
  1923.  
  1924.  
  1925.        Jan 23 22:25:28 misfits vmunix: tty02 at 0x03e8 (irq = 4) is a 16550A
  1926.  
  1927.  
  1928.  
  1929.  
  1930.   at first when Linux boots.  You have to use setserial to tell Linux
  1931.   the IRQ you are using.
  1932.  
  1933.  
  1934.   14.9.  rz  And/Or sz  Don't Work When I Call My Linux Box On A Modem
  1935.  
  1936.   If Linux looks for /dev/modem when you try to transfer files, look at
  1937.   /etc/profile or /etc/csh.cshrc.  There may be a bunch of aliases
  1938.   defined there on some distributions, most notably Slackware.  These
  1939.   aliases mess up the zmodem programs.  Take them out, or correct them.
  1940.  
  1941.  
  1942.   14.10.  My Screen Is Displaying Funny Looking Characters
  1943.  
  1944.   This happens on virtual consoles when you send binary data to your
  1945.   screen, or sometimes on serial connections.  The way to fix this is to
  1946.   type echo ^v^[c.  For the control-character-impaired, thats:
  1947.  
  1948.  
  1949.        linux% echo <ctrl>v<esc>c
  1950.  
  1951.  
  1952.  
  1953.  
  1954.  
  1955.   14.11.  getty  Or uugetty  Still Doesn't Work
  1956.  
  1957.   There is a DEBUG option that comes with getty_ps.  Edit your config
  1958.   file /etc/conf.{uu}getty.ttySN and add DEBUG=NNN.  Where NNN is one of
  1959.   the following combination of numbers according to what you are trying
  1960.   to debug:
  1961.  
  1962.  
  1963.        D_OPT   001            option settings
  1964.        D_DEF   002            defaults file processing
  1965.        D_UTMP  004            utmp/wtmp processing
  1966.        D_INIT  010            line initialization (INIT)
  1967.        D_GTAB  020            gettytab file processing
  1968.        D_RUN   040            other runtime diagnostics
  1969.        D_RB    100            ringback debugging
  1970.        D_LOCK  200            uugetty lockfile processing
  1971.        D_SCH   400            schedule processing
  1972.        D_ALL   777            everything
  1973.  
  1974.  
  1975.  
  1976.  
  1977.   Setting DEBUG=010 is a good place to start.
  1978.  
  1979.   If you are running syslogd, debugging info will appear in your log
  1980.   files.  If you aren't running syslogd info will appear in
  1981.   /tmp/getty:ttySN for debugging getty and /tmp/uugetty:ttySN for
  1982.   uugetty, and in /var/adm/getty.log.  Look at the debugging info and
  1983.   see what is going on.  Most likely, you will need to tune some of the
  1984.   parameters in your config file, and reconfigure your modem.
  1985.  
  1986.   You could also try mgetty.  Some people have better luck with it.
  1987.  
  1988.  
  1989.   15.  Other Sources Of Information
  1990.  
  1991.  
  1992.   ╖  man pages for: agetty(8), getty(1m), gettydefs(5), init(1),
  1993.      login(1), mgetty(8), setserial(8)
  1994.  
  1995.   ╖  Your modem or terminal manual
  1996.  
  1997.   ╖  NET-3 HOWTO: all about networking, including SLIP, CSLIP, and PPP
  1998.  
  1999.   ╖  PPP HOWTO: help with PPP
  2000.  
  2001.   ╖  Printing HOWTO: for setting up a serial printer
  2002.  
  2003.   ╖  Serial-Programming-HOWTO: for some aspects of serial-port
  2004.      programming
  2005.  
  2006.   ╖  Term HOWTO: everything you wanted to know about the term program
  2007.  
  2008.   ╖  Text-Terminal-HOWTO: how they work and how to install and configure
  2009.  
  2010.   ╖  UPS HOWTO: setting up UPS sensors connected to your serial port
  2011.  
  2012.   ╖  UUCP HOWTO: for information on setting up UUCP
  2013.  
  2014.   ╖  Usenet newsgroups:
  2015.  
  2016.  
  2017.         comp.os.linux.answers
  2018.         FAQs, How-To's, READMEs, etc. about Linux.
  2019.         comp.os.linux.hardware
  2020.         Hardware compatibility with the Linux operating system.
  2021.         comp.os.linux.networking
  2022.         Networking and communications under Linux.
  2023.         comp.os.linux.setup
  2024.         Linux installation and system administration.
  2025.         comp.terminals
  2026.  
  2027.  
  2028.  
  2029.  
  2030.  
  2031.  
  2032.  
  2033.   ╖  The Linux serial mailing list.  To join, send email to
  2034.      majordomo@vger.rutgers.edu, with ``subscribe linux-serial'' in the
  2035.      message body.  If you send ``help'' in the message body, you get a
  2036.      help message.  The server also serves many other Linux lists.  Send
  2037.      the ``lists'' command for a list of mailing lists.
  2038.  
  2039.  
  2040.   ╖  A white paper discussing serial communications and multiport serial
  2041.      boards is available from Cyclades at http://www.cyclades.com.
  2042.  
  2043.   ╖  Modem FAQs:
  2044.      Navas 28800 Modem FAQ
  2045.      <http://web.aimnet.com/~jnavas/modem/faq.html>
  2046.      Curt's High Speed Modem Page
  2047.      <http://www.teleport.com/~curt/modems.html>
  2048.  
  2049.   ╖  Serial programming: Serial-Programming-HOWTO
  2050.      Advanced Programming in the UNIX Environment <http://heg-
  2051.      school.aw.com/cseng/authors/stevens/advanced/advanced.nclk>, by W.
  2052.      Richard Stevens (ISBN 0-201-56317-7; Addison-Wesley)
  2053.      <http://www.ora.com/catalog/posix/> name="POSIX Programmer's
  2054.      Guide">, by Donald Levine (ISBN 0-937175-73-0; O'Reilly)
  2055.  
  2056.  
  2057.   16.  Contributions
  2058.  
  2059.  
  2060.   Most of the original HOWTO was written by  Greg Hankins.
  2061.   greg.hankins@cc.gatech.edu He also rewrote many contributions by
  2062.   others in order to maintain continuity in the writing style and flow.
  2063.   He wrote: "Thanks to everyone who has contributed or commented, the
  2064.   list of people has gotten too long to list (somewhere over one
  2065.   hundred).  Special thanks to Ted T'so for answering questions about
  2066.   the serial drivers, Kris Gleason who used to maintain getty_ps, and
  2067.   Gert D÷ring who maintains mgetty."
  2068.  
  2069.  
  2070.   END OF SERIAL HOWTO
  2071.  
  2072.  
  2073.  
  2074.  
  2075.  
  2076.  
  2077.  
  2078.  
  2079.  
  2080.  
  2081.  
  2082.  
  2083.  
  2084.  
  2085.  
  2086.  
  2087.  
  2088.  
  2089.  
  2090.  
  2091.  
  2092.  
  2093.  
  2094.  
  2095.  
  2096.  
  2097.  
  2098.  
  2099.  
  2100.  
  2101.  
  2102.  
  2103.  
  2104.  
  2105.  
  2106.  
  2107.  
  2108.  
  2109.  
  2110.  
  2111.  
  2112.  
  2113.