home *** CD-ROM | disk | FTP | other *** search
/ Il CD di internet / CD.iso / HOWTO / SERIAL-H < prev    next >
Encoding:
Text File  |  1995-04-20  |  52.0 KB  |  1,646 lines

  1.   The Linux Serial HOWTO
  2.   by Greg Hankins, gregh@cc.gatech.edu
  3.   v1.7,    29 October 1994
  4.  
  5.   This document    describes how to set up    serial communications devices
  6.   on a Linux box.
  7.  
  8.   1.  Introduction
  9.  
  10.   This is the Linux Serial HOWTO.  All about how to set    up modems and
  11.   terminals under Linux, some serial tips, and troubleshooting.
  12.  
  13.  
  14.   1.1.    Copyright
  15.  
  16.   The Linux Serial HOWTO is copyright (C) 1994 by Greg Hankins.     Linux
  17.   HOWTO    documents may be reproduced and    distributed in whole or    in part,
  18.   in any medium    physical or electronic,    as long    as this    copyright notice
  19.   is retained on all copies. Commercial    redistribution is allowed and
  20.   encouraged; however, the author would    like to    be notified of any such
  21.   distributions.
  22.  
  23.   All translations, derivative works, or aggregate works incorporating
  24.   any Linux HOWTO documents must be covered under this copyright notice.
  25.   That is, you may not produce a derivative work from a    HOWTO and impose
  26.   additional restrictions on its distribution. Exceptions to these rules
  27.   may be granted under certain conditions; please contact the Linux
  28.   HOWTO    coordinator at the address given below.
  29.  
  30.   In short, we wish to promote dissemination of    this information through
  31.   as many channels as possible.    However, we do wish to retain copyright
  32.   on the HOWTO documents, and would like to be notified    of any plans to
  33.   redistribute the HOWTOs.
  34.  
  35.   If you have questions, please    contact    Matt Welsh, the    Linux HOWTO
  36.   coordinator, at
  37.   mdw@sunsite.unc.edu.    You may    finger this address for    phone number and
  38.   additional contact information.
  39.  
  40.  
  41.  
  42.   1.2.    Other sources of information
  43.  
  44.  
  45.  
  46.   o  man pages for: getty(1m), gettydefs(4), init(1), login(1),
  47.      setserial(8)
  48.  
  49.  
  50.   o  Your modem    manual
  51.  
  52.  
  53.   o  UUCP HOWTO: for information on setting up UUCP
  54.  
  55.   o  Printing HOWTO: deals with    setting    up a serial printer
  56.  
  57.   o  NET-2 HOWTO: all about networking,    including SLIP and  PPP
  58.  
  59.   o  Term HOWTO: everything you    wanted to know about the term program
  60.  
  61.   o  USENET newsgroups:
  62.  
  63.  
  64.  
  65.  
  66.  
  67.   comp.os.linux.admin          Installing and administering Linux systems.
  68.   comp.os.linux.announce      Announcements    important to the Linux community.
  69.                   (Moderated)
  70.   comp.os.linux.development      Ongoing work on the Linux operating system.
  71.   comp.os.linux.help          Questions and    advice about Linux.
  72.   comp.os.linux.misc          Linux    topics not covered by other groups.
  73.  
  74.  
  75.  
  76.  
  77.  
  78.   o  the Linux SERIAL channel mailing list.  To    join, send email to
  79.  
  80.      linux-activists-request@niksula.hut.fi with ``X-Mn-Admin: join
  81.      SERIAL'' in the message body or header.  If you send ``X-Mn-Admin:
  82.      help'' you    get a help message.
  83.  
  84.  
  85.  
  86.   1.3.    New versions of    this document
  87.  
  88.   New versions will be placed on
  89.   sunsite.unc.edu:/pub/Linux/docs/HOWTO/Serial-HOWTO,
  90.  
  91.   and the mirror sites.     The Serial HOWTO
  92.   (http://sunsite.unc.edu/mdw/HOWTO/Serial-HOWTO.html) is also available
  93.   for WWW clients such as mosaic.
  94.  
  95.  
  96.   If you don't have FTP    access,    you can    get Linux help files via email.
  97.   Bill Riemers runs a mail handler on his account.  Send mail to
  98.   bcr@physics.purdue.edu with a    subject    of ``help'' for    more infomation,
  99.   and to get an    index file.
  100.  
  101.  
  102.   1.4.    Feedback
  103.  
  104.   Please send me any questions,    comments, suggestions, or additional
  105.   material.  I'm always    eager to hear about what you think about the
  106.   HOWTO.  I'm also always on the lookout for improvements!  Tell me
  107.   exactly what you don't understand, or    what could be clearer.    You can
  108.   reach    me at gregh@cc.gatech.edu via email.  I    can also be reached at:
  109.  
  110.   Greg Hankins
  111.   College of Computing
  112.   801 Atlantic Drive
  113.   Atlanta, GA 30332-0280
  114.  
  115.  
  116.   via snail mail, and at my home page
  117.   (http://www.cc.gatech.edu/staff/h/Greg.Hankins/) via the WWW.
  118.  
  119.   Please include the version number of the Serial HOWTO    when writing,
  120.   this is version 1.7.
  121.  
  122.  
  123.  
  124.   1.5.    Disclaimer
  125.  
  126.   Your milage may vary.     The answers given may not work    for all    systems
  127.   and all setup    combinations.
  128.  
  129.  
  130.  
  131.  
  132.  
  133.   2.  Supported    serial hardware
  134.  
  135.   Linux    supports the following serial hardware,    (ie is known to    work
  136.   with).
  137.  
  138.  
  139.   o  standard PC serial    boards (COM1 - COM4)
  140.  
  141.   o  standard PC internal modems (COM1 - COM4)
  142.  
  143.  
  144.   2.1.    Multiport serial boards
  145.  
  146.  
  147.   o  Usenet Serial Board II
  148.  
  149.   o  Boca 4-port (BB-1004)
  150.  
  151.   o  Boca 8-port (BB-1008)
  152.  
  153.   o  Boca 16-port (BB-2016)
  154.  
  155.   o  Boca 6-port (IO/AT66)
  156.  
  157.   o  AST FourPort boards and clones
  158.  
  159.   o  Accent Async boards
  160.  
  161.   o  Bell Technologies HUB6
  162.  
  163.   o  STB-4COM
  164.  
  165.  
  166.   In general, Linux will support any serial board which    uses a 8250,
  167.   16450, 16550,    16550A (or compatible) UART, or    an internal modem which
  168.   emulates one of the above UARTs.
  169.  
  170.  
  171.   Special note on the BB-1004 and BB-1008, they    do not support DCD and
  172.   RI lines, and    thus are not usable for    dialin modems.    They will work
  173.   fine for all other purposes.
  174.  
  175.  
  176.   2.2.    Intelligent multiport serial boards
  177.  
  178.  
  179.   o  Cyclades Cyclom 8-port (Cyclom 8Y)
  180.  
  181.   o  Cyclades Cyclom 16-port (Cyclom 16Y)
  182.  
  183.   o  DigiBoard PC/Xe (2, 4, or 8 port) (expected November 1994)
  184.  
  185.   o  Digiboard COM/Xi (4 or 8 port)
  186.      (pre-ALPHA    driver contact Simon Park <si@wimpol.demon.co.uk> for
  187.      information)
  188.  
  189.   o  Specialix SI0 (modular, 4 - 32 ports)
  190.  
  191.      (ALPHA driver: contact Simon Allen    <simonallen@cix.compulink.co.uk>
  192.      for information)
  193.  
  194.  
  195.  
  196.  
  197.  
  198.  
  199.   2.3.    Network    serial boards
  200.  
  201.  
  202.   o  SDL N2 (RS-232 and    V.35) HDLC (driver under developement)
  203.  
  204.   o  Sangoma Technologies frame-relay board (driver under developement)
  205.  
  206.  
  207.  
  208.   3.  What are the names of the    serial ports?
  209.  
  210.   There    are the    4 serial devices corresponding to COM1 - COM4:
  211.  
  212.  
  213.  
  214.        /dev/cua0, /dev/ttyS0 (COM1) address 0x3f8 IRQ 4
  215.        /dev/cua1, /dev/ttyS1 (COM2) address 0x2f8 IRQ 3
  216.        /dev/cua2, /dev/ttyS2 (COM3) address 0x3e8 IRQ 4
  217.        /dev/cua3, /dev/ttyS3 (COM4) address 0x2e8 IRQ 3
  218.  
  219.  
  220.  
  221.  
  222.   The /dev/ttySN devices are for incoming connections and /dev/cuaN
  223.   devices for outgoing connections.  N is the serial port number.  In
  224.   this document, I refer to COM1 as ttyS0, COM2    as ttyS1, COM3 as ttyS2,
  225.   and COM4 as ttyS3.  If I am refering to a specific device in /dev, I
  226.   will always prepend /dev to avoid confusing you.
  227.  
  228.  
  229.   On some installations, two extra devices will    be created, /dev/modem
  230.   for your modem and /dev/mouse    for your mouse.     Both of these are
  231.   symbolic links to the    appropriate /dev/cuaN device which you specified
  232.   during the installation (unless you have a bus mouse,    then /dev/mouse
  233.   will point to    the bus    mouse device).
  234.  
  235.  
  236.   There    has been some discussion on the    merits of /dev/mouse and
  237.   /dev/modem.  I strongly discourage the use of    these links.  In
  238.   particular, if you are planning on using your    modem for dialin you
  239.   will run into    problems because the lock files    will not work correctly
  240.   if you use /dev/modem.  Also,    Taylor UUCP does not support symlinks
  241.   either.  Use them if you like, but be    sure they point    to the right
  242.   device.
  243.  
  244.  
  245.  
  246.   3.1.    Major and minor    device numbers of serial devices in /dev
  247.  
  248.  
  249.  
  250.        /dev/ttyS0 major    4, minor 64    /dev/cua0 major 5, minor    64
  251.        /dev/ttyS1 major    4, minor 65    /dev/cua1 major 5, minor    65
  252.        /dev/ttyS2 major    4, minor 66    /dev/cua2 major 5, minor    66
  253.        /dev/ttyS3 major    4, minor 67    /dev/cua3 major 5, minor    67
  254.  
  255.  
  256.  
  257.  
  258.  
  259.   Note that all    distributions come with    these devices already made
  260.   correctly.
  261.  
  262.  
  263.  
  264.  
  265.   3.1.1.  Creating devices in /dev
  266.  
  267.   If you don't have a device, you will have to create it with the mknod
  268.   command.
  269.  
  270.   Example, suppose you needed to create    devices    for ttyS0:
  271.  
  272.  
  273.  
  274.        linux# mknod -m 666 /dev/cua0 c 5 64
  275.        linux# mknod -m 666 /dev/ttyS0 c    4 64
  276.  
  277.  
  278.  
  279.  
  280.   You can also get the MAKEDEV script, available on the    usual FTP sites.
  281.   This simplifies the making of    devices.  For example, if you needed to
  282.   make the devices for ttyS0 you would type:
  283.  
  284.  
  285.  
  286.        linux# cd /dev
  287.        linux# MAKEDEV ttyS0
  288.  
  289.  
  290.  
  291.  
  292.   This handles the devices creation for    the incoming and outgoing
  293.   devices.
  294.  
  295.  
  296.   3.1.2.  Notes    for multiport boards
  297.  
  298.   The devices your multiport board uses    depends    on what    kind of    board
  299.   you have.  These are listed in detail    in the rc.serial which comes
  300.   with the setserial program.  You will    probably need to create    these
  301.   devices.  Either use the mknod command, or get the MAKEDEV script.
  302.   Devices for mulitport    boards are made    by adding 64 + the port    number.
  303.   So, if you wanted to create devices for ttyS17, you would type:
  304.  
  305.  
  306.  
  307.        linux# mknod -m 666 /dev/cua17 c    5 81
  308.        linux# mknod -m 666 /dev/ttyS17 c 4 81
  309.  
  310.  
  311.  
  312.  
  313.  
  314.   Note that ``64 + 17 =    81''.  Using the MAKEDEV script, you would type:
  315.  
  316.  
  317.  
  318.        linux# cd /dev
  319.        linux# /dev/MAKEDEV ttyS17
  320.  
  321.  
  322.  
  323.  
  324.  
  325.  
  326.   4.  What is getty_ps?
  327.  
  328.   This is just another version of getty, which is a program that handles
  329.   some of the login process when you log in to a UNIX box.  It was
  330.   written by Paul Sutcliffe, Jr. <paul@devon.lns.pa.us>.  Kris Gleason
  331.   <gleasokr@boulder.colorado.edu> currently maintains it.  2.0.7e is the
  332.   latest version, and supercedes any older versions.  Most Linux
  333.   distributions    come with getty_ps installed as    the default getty.
  334.   Thus,    I will mainly focus on using the getty_ps package in this
  335.   document, but    you are    free to    use any    getty you like.     You should
  336.   check    to make    sure you do indeed have    getty_ps as the    default    getty.
  337.   At your Linux    prompt,    type:
  338.  
  339.  
  340.  
  341.        linux# strings /sbin/getty | grep RINGBACK
  342.  
  343.  
  344.  
  345.  
  346.  
  347.  
  348.   If grep returns ``RINGBACK'' then you    have the right getty.  If you do
  349.   not have this    version    of getty, I highly recommend that you get it.
  350.   It can be found on the standard Linux    FTP sites.  (Kris has promised
  351.   me to    implement a version feature in the next    release, to avoid doing
  352.   this grep sillyness.)
  353.  
  354.  
  355.   4.1.    Installing getty_ps
  356.  
  357.   Get the latest version from a    Linux FTP site.
  358.  
  359.   By default, getty_ps will be configured to be    Linux FSSTND (FileSystem
  360.   STaNDard) compliant, which means that    it will    put the    binaries in
  361.   /sbin, and config files in /etc/conf.{uu}getty.ttySN.     It will also
  362.   expect lock files to go in /var/lock.     Make sure you have the
  363.   /var/lock directory.
  364.  
  365.  
  366.   If you don't want FSSTND compliance, binaries    will go    in /etc, config
  367.   files    will go    in /etc/default/{uu}getty.ttySN, and lock file will go
  368.   in /usr/spool/uucp.  I recommend doing things    this way if you    are
  369.   using    UUCP, because Taylor UUCP will have problems if    you move the
  370.   lock files to    where it isn't looking for them.  You could always link
  371.   /usr/spool/uucp to /var/lock though, I guess.
  372.  
  373.  
  374.  
  375.   getty_ps also    uses syslogd to    log messages.  See the man pages for
  376.   syslogd(1) and syslog.conf(5)    for setting up syslogd,    if you don't
  377.   have it running already.  Messages are logged    with priority LOG_AUTH,
  378.   errors use LOG_ERR, and debugging uses LOG_DEBUG.  If    you don't want
  379.   to use syslogd you can edit tune.h in    the getty_ps source files to use
  380.   a log    file for messages instead, namely /var/adm/getty.log by    default.
  381.  
  382.  
  383.   When you have    decided    if you want FSSTND, and    syslog,    edit tune.h and
  384.   the Makefile in the getty_ps source directory    to reflect you
  385.   decisions.  Now, install according to    the instructions.
  386.  
  387.  
  388.   Once you have    installed getty_ps, and    are certain it is working, you
  389.   can remove any other versions    of getty you have.  Be sure to check in
  390.   /bin,    /etc, /usr/bin,    /usr/etc, /usr/man/man1, and /usr/man/cat1 for
  391.   any thing called getty - there are old versions lurking everywhere.
  392.   Also,    you can    safely remove the old config file /etc/gettytab    - you
  393.   only need /etc/gettydefs.  From this point on, all references    to getty
  394.   will refer to    getty_ps.  References to uugetty will refer to the
  395.   uugetty that comes with the getty_ps package.
  396.  
  397.   5.  What is setserial?
  398.  
  399.   setserial is a program which allows you to look at and change    various
  400.   attributes of    a serial device, including its port, its IRQ, and other
  401.   serial port options.    It was initially written Rick Sladkey, and was
  402.   heavily modified by Ted T'so <tytso@athena,mit.edu>, who also
  403.   maintains it.     The newest version is 2.10, and can be    found on the
  404.   Linux    FTP sites.  You    can find out what version you have by running
  405.   setserial with no arguments.
  406.  
  407.  
  408.   On boot, only    the ttyS{0-3} ports are    configured, using the default
  409.   IRQs of 4 and    3.  So,    if you have any    other serial ports provided by
  410.   other    boards (such as    an AST Fourport), or if    ttyS{0-3} have a non-
  411.   standard IRQ,    you must use this program in order to configure    those
  412.   serial ports.     For the full listing of options, consult the man page.
  413.  
  414.  
  415.  
  416.   6.  How do I dial out    with my    modem?
  417.  
  418.   6.1.    Hardware requirements
  419.  
  420.   First, make sure you have the    right cable.  Your modem requires a
  421.   straight through cable, with no pins crossed.     Any computer store
  422.   should have these.  Make sure    you get    the correct gender.  Your DB25
  423.   serial port on your PC is always male.  Do not confuse it with the
  424.   parallel port, which is the female DB25.  Hook up your modem to one of
  425.   your serial ports.  Consult your modem manual    on how to do this if you
  426.   need help.
  427.  
  428.  
  429.   6.1.1.  Notes    on internal modems
  430.  
  431.   For an internal modem, you will not need a cable.  An    internal modem
  432.   does not need    a serial port, it has one built    in.  All you need to do
  433.   is configure it to use an interrupt that is not being    used, and
  434.   configure the    I/O address.  Consult your modem manual    if you get
  435.   stuck.  Also,    see section ``Can I use    more than   2 serial devices?''
  436.   if you need help on choosing interrupts or addresses.
  437.  
  438.   Due to a bit of stupidity on IBM's part, you may encounter problems if
  439.   you want your    internal modem to be on    ttyS3.    If Linux does not detect
  440.   your internal    modem on ttyS3,    you can    use setserial and the modem will
  441.   work fine.  Internal modems on ttyS{0-2} should not have any problems
  442.   being    detected.
  443.  
  444.  
  445.   6.2.    Talking    to your    modem
  446.  
  447.   Make sure that nothing is using the serial port you hooked your modem
  448.   to.  Check your /etc/inittab for getty processes using the serial
  449.   port.     Comment the line out (with a ``#'') and restart init:
  450.  
  451.  
  452.  
  453.        linux# init q
  454.  
  455.  
  456.  
  457.  
  458.   Do not comment any lines that    contain    a ttyN device, only ones
  459.   containing ttySN devices. ttyN devices are your virtual consoles.
  460.  
  461.   Use kermit to    test the setup.     For example, say your modem was on
  462.   ttyS3, and it    could handle 2400 bps.    You would do the following:
  463.        linux# kermit
  464.        C-Kermit    5A(188), 23 Nov    92, POSIX
  465.        Type ? or HELP for help
  466.        C-Kermit>set line /dev/cua3
  467.        C-Kermit>set speed 2400
  468.        /dev/cua3, 2400 bps
  469.        C-Kermit>c
  470.        Connecting to /dev/cua3,    speed 2400.
  471.        The escape character is Ctrl-\ (ASCII 28, FS)
  472.        Type the    escape character followed by C to get back,
  473.        or followed by ?    to see other options.
  474.        AT
  475.        OK
  476.        <ctrl>-\-C
  477.        (Back at    linux)
  478.        C-Kermit>quit
  479.        linux#
  480.  
  481.  
  482.  
  483.  
  484.  
  485.   If your modem    responds to AT commands, you can assume    your modem is
  486.   working correctly on the Linux side.    Try calling another modem.  If
  487.   you don't like kermit, try one of the    more advanced comm programs.
  488.   Check    out section ``Noteworthy communications    programs'' about comm
  489.   programs if you need some pointers.
  490.  
  491.  
  492.   6.3.    Dial out modem configuration
  493.  
  494.   For dial out use only, you can configure your    modem however you want.
  495.  
  496.  
  497.   I like to see    result codes, so I set Q0 - result codes are reported.
  498.   To set this on my modem, I would have    to preceed the register    name
  499.   with an AT command.  Using kermit or some comm program, connect to
  500.   your modem and do the    following:
  501.  
  502.  
  503.        ATQ0
  504.  
  505.  
  506.  
  507.  
  508.  
  509.   If your modem    says OK    back to    you, then the register is set.    Do this
  510.   for each register you    want to    set.
  511.  
  512.  
  513.   I also like to see what I'm typing, so I set E1 - command echo on.  If
  514.   your modem has data compression capabilities,    you probably want to
  515.   enable them.    If you can lock    the serial port    speed, and let the modem
  516.   handle modem-modem bps rate transitions, do this.  Consult your modem
  517.   manual for more help,    and a full listing of options.    If your    modem
  518.   supports a stored profile, be    sure to    write the configuration    to the
  519.   modem    (often done with AT&W) if not you will have to set the registers
  520.   everytime you    turn on    your, or reset your modem.
  521.  
  522.  
  523.   When you dial    out with your modem, set the speed to the highest bps
  524.   rate that your modem supports.  Since    there is no speed named    57600 or
  525.   115200 bps, you must use the setserial program to set    your serial port
  526.   to a higher speed.  See section ``How    do I set up my serial ports for
  527.   higher speeds?'' for doing this.  Then, set the speed    to 38400 bps in
  528.   your comm program.
  529.   6.4.    Hardware flow control
  530.  
  531.   If your modem    supports hardware flow control (RTS/CTS), I highly
  532.   recommend you    use it.     This will allow you to    lock your serial port -
  533.   modem    speed (DTE - DCE) at a high bps    rate, independant from the modem
  534.   - modem speed.  This is particularly important for modems that support
  535.   data compression.  First, you    have to    enable RTS/CTS flow control on
  536.   the serial port itself.  This    is best    done on    startup, like in
  537.   /etc/rc.local    or /etc/rc.serial:
  538.  
  539.  
  540.        stty crtscts < /dev/cua3
  541.  
  542.  
  543.  
  544.  
  545.  
  546.   Be sure to put in the    correct    serial port you    wish to    enable.
  547.  
  548.  
  549.   You must also    enable RTS/CTS flow control on your modem.  Consult your
  550.   modem    manual on how to do this, as it    varies between modem
  551.   manufacturers.  Be sure to save your modem configuration if your modem
  552.   supports stored profiles.
  553.  
  554.  
  555.   7.  How do I dial in and out with my modem?
  556.  
  557.   Get your modem to dial out correctly.     If you    haven't    read section
  558.   ``How    do I dial out with my modem'' go read it now.
  559.  
  560.  
  561.  
  562.   7.1.    Dial in    and out    modem configuration
  563.  
  564.   For dialin and dialout use, you have to set up your modem a certain
  565.   way (again, using the    AT command on your modem):
  566.  
  567.  
  568.        E1    command    echo ON
  569.        Q0    result codes are reported
  570.        V1    verbose    ON
  571.        S0=0    never answer (uugetty handles this with    the WAITFOR option)
  572.  
  573.  
  574.  
  575.  
  576.   If you don't set these correctly, your INIT string in    your config file
  577.   may fail, hosing the whole process.  But, more on config files
  578.   below...
  579.  
  580.  
  581.  
  582.        &C1     DCD is on after connect only
  583.        &S0     DSR is always on
  584.            DTR on/off resets modem (depends    on manufacturer    - RTFM)
  585.  
  586.  
  587.  
  588.  
  589.   These    affect what your modem does when calls start and end.
  590.  
  591.  
  592.   If your modem    does not support a stored profile, you can set these
  593.   through the INIT string in your config file.    See below.  Some modems
  594.   come with DIP    switches that affect register settings.     Be sure these
  595.   are set correctly, too.
  596.  
  597.  
  598.   I have started a collection of modem setups for different types of
  599.   modems.  So far, I only have a few of    them, if you would like    to send
  600.   me your working configuration, please    do so!    If you would like me to
  601.   send you one of the configurations, just mail    me and ask.  I'm not
  602.   listing them here due    to space concerns.  I have setups for Telebit
  603.   T1600, USR Courier, and Zoom 14.4/28.8 modems.
  604.  
  605.  
  606.   7.2.    Setting    up uugetty
  607.  
  608.   For dialing into, and    out from your modem, we    want to    use uugetty.
  609.   uugetty does important lock file checking.  Replace the stock    getty
  610.   with getty_ps    as described in    section    ``What is <tt>getty_ps</tt>''.
  611.   Update /etc/gettydefs    to include entries for modems (note that the
  612.   entries point    to each    other, these are not for fixed speed):
  613.  
  614.  
  615.        # Modem entries
  616.        38400# B38400 CS8 # B38400 SANE -ISTRIP HUPCL #@S @L @B login: #19200
  617.  
  618.        19200# B19200 CS8 # B19200 SANE -ISTRIP HUPCL #@S @L @B login: #9600
  619.  
  620.        9600# B9600 CS8 # B9600 SANE -ISTRIP HUPCL #@S @L @B login: #2400
  621.  
  622.        2400# B2400 CS8 # B2400 SANE -ISTRIP HUPCL #@S @L @B login: #1200
  623.  
  624.        1200# B1200 CS8 # B1200 SANE -ISTRIP HUPCL #@S @L @B login: #300
  625.  
  626.        300# B300 CS8 # B300 SANE -ISTRIP HUPCL #@S @L @B login:    #38400
  627.  
  628.  
  629.  
  630.  
  631.  
  632.   If you have a    9600 bps or faster modem, you can lock your serial port
  633.   speed    and let    the modem handle the transition    to other bps rates.
  634.   Then,    instead    of the step down series    of lines listed    above,
  635.   /etc/gettydefs only needs to contain one line    for the    modem:
  636.  
  637.  
  638.  
  639.        # 38400 fixed speed
  640.        F38400# B38400 CS8 # B38400 SANE    -ISTRIP    HUPCL #@S @L @B    login: #F38400
  641.        # 19200 fixed speed
  642.        F19200# B19200 CS8 # B19200 SANE    -ISTRIP    HUPCL #@S @L @B    login: #F19200
  643.        # 9600 fixed speed
  644.        F9600# B9600 CS8    # B9600    SANE -ISTRIP HUPCL #@S @L @B login: #F9600
  645.  
  646.  
  647.  
  648.  
  649.  
  650.  
  651.   If you have your modem set up    to do RTS/CTS hardware flow control, you
  652.   can add CRTSCTS to the entries:
  653.  
  654.  
  655.  
  656.  
  657.  
  658.  
  659.  
  660.  
  661.   # 38400 fixed    speed with hardware flow control
  662.   F38400# B38400 CS8 CRTSCTS # B38400 SANE -ISTRIP HUPCL CRTSCTS #@S @L    @B login: #F38400
  663.   # 19200 fixed    speed with hardware flow control
  664.   F19200# B19200 CS8 CRTSCTS # B19200 SANE -ISTRIP HUPCL CRTSCTS #@S @L    @B login: #F19200
  665.   # 9600 fixed speed with hardware flow    control
  666.   F9600# B9600 CS8 CRTSCTS # B9600 SANE    -ISTRIP    HUPCL CRTSCTS #@S @L @B    login: #F9600
  667.  
  668.  
  669.  
  670.  
  671.  
  672.   If you want, you can make uugetty print interesting things in    the
  673.   login    banner.     In my examples, I have    the system name, the serial
  674.   line,    and the    current    bps rate.  You can add other things:
  675.  
  676.  
  677.  
  678.           @B    The    current    (evaluated at the time the @B is seen) bps rate.
  679.           @D    The    current    date, in MM/DD/YY.
  680.           @L    The    serial line to which getty is attached.
  681.           @S    The    system name.
  682.           @T    The    current    time, in HH:MM:SS (24-hour).
  683.           @U    The    number of currently signed-on users.  This is  a
  684.             count of the number    of entries in the /etc/utmp file
  685.             that have a    non-null ut_name field.
  686.           @V    The    value of VERSION, as given in the defaults file.
  687.           To display a single '@' character, use either '\@' or '@@'.
  688.  
  689.  
  690.  
  691.  
  692.  
  693.   Next,    make sure that you have    an outgoing and    incoming device    for the
  694.   serial port your modem is on.     If you    have your modem    on ttyS3 you
  695.   will need the    /dev/cua3, and /dev/ttyS3 devices.  If you don't have
  696.   the correct devices, see section ``Creating devices in <tt>/dev</tt>''
  697.   on how to create devices, and    create the devices.
  698.  
  699.  
  700.   7.3.    Customizing uugetty
  701.  
  702.   There    are lots of parameters you can tweak for each port you have.
  703.   These    are implemented    in seperate config files for each port.     The
  704.   file /etc/conf.uugetty will be used by all instances of uugetty, and
  705.   /etc/conf.uugetty.ttySN will only be used by that one    port.  Sample
  706.   default config files can be found with the getty_ps source files,
  707.   which    come with most Linux distributions.  Due to space concerns, they
  708.   are not listed here.    Note that if you are using older versions of
  709.   getty    (older than 2.0.7e), or    aren't using FSSTND, then the default
  710.   files    will be    in /etc/default/uugetty.ttySN.    My
  711.   /etc/conf.uugetty.ttyS3 looks    like this:
  712.  
  713.  
  714.  
  715.  
  716.  
  717.  
  718.  
  719.  
  720.  
  721.  
  722.  
  723.  
  724.  
  725.  
  726.  
  727.   # sample uugetty configuration file for a Hayes compatible modem to allow
  728.   # incoming modem connections
  729.  
  730.   # alternate lock file    to check... if this lock file exists, then uugetty is
  731.   # restarted so that the modem    is re-initialized
  732.   ALTLOCK=cua3
  733.   ALTLINE=cua3
  734.  
  735.   # line to initialize
  736.   INITLINE=cua3
  737.  
  738.   # timeout to disconnect if idle...
  739.   TIMEOUT=60
  740.  
  741.   # modem initialization string...
  742.   #
  743.   # format: <expect> <send> ...    (chat sequence)
  744.   INIT="" \d+++\dAT\r OK\r\n ATH0\r OK\r\n AT\r    OK\r\n
  745.  
  746.   WAITFOR=RING
  747.   CONNECT="" ATA\r CONNECT\s\A
  748.  
  749.   # this line sets the time to delay before sending the    login banner
  750.   DELAY=1
  751.  
  752.   #DEBUG=010
  753.  
  754.  
  755.  
  756.  
  757.  
  758.   Add the following line to your /etc/inittab, so that uugetty is run on
  759.   your serial port (substituting in the    correct    information for    your
  760.   environment -    port, speed, and terminal type):
  761.  
  762.  
  763.        S3:456:respawn:/sbin/uugetty ttyS3 F38400 vt100
  764.  
  765.  
  766.  
  767.  
  768.  
  769.   Restart init:
  770.  
  771.  
  772.        linux# init q
  773.  
  774.  
  775.  
  776.  
  777.  
  778.   For the speed    parameter in your inittab, you will want to use    the
  779.   highest bps rate that    your modem supports.  Since there is no    speed
  780.   named    57600 or 115200, you must use the setserial program to set your
  781.   serial port to a higher speed.  See section ``How do I set up    my
  782.   serial ports for higher speeds?'' for    doing this.  Then, use 38400 bps
  783.   in your inittab.
  784.  
  785.  
  786.   Now Linux will be watching your serial port for connections.    Dial in
  787.   from another site and    login to you Linux system.  Rejoice.
  788.  
  789.  
  790.   getty    and uugetty have a lot more options, see the man page for
  791.   getty(1m) for    a full description.  Among other things    there is a
  792.   scheduling feature, and a ringback feature.  RTFM :-).
  793.   8.  How do I set up a    terminal connected to my PC?
  794.  
  795.   8.1.    Hardware requirements
  796.  
  797.   Make sure you    have the right kind of cable.  A null modem cable bought
  798.   at a computer    store will do it.  But it must be a null modem cable!
  799.   Make sure you    are using your serial port, and    not your parallel port.
  800.  
  801.  
  802.  
  803.   At a minimum,    you should have    (for a DB25 connector):
  804.  
  805.       RxD    Receive    Data          2    - 3      TxD    Transmit Data
  806.       TxD    Transmit Data          3    - 2      RxD    Receive    Data
  807.       GND    Signal Ground          7    - 7      GND    Signal Ground
  808.  
  809.  
  810.  
  811.   If you want to have flow control and hardware    handshaking, you must
  812.   have a full null modem cable:
  813.  
  814.         Frame Ground          1    - 1        Frame Ground
  815.       RxD    Receive    Data          2    - 3      TxD    Transmit Data
  816.       TxD    Transmit Data          3    - 2      RxD    Receive    Data
  817.       RTS    Request    To Send          4    - 5      CTS    Clear To Send
  818.       CTS    Clear To Send          5    - 4      RTS    Request    To Send
  819.       DSR    Data Set Ready          6    - 20      DTR    Data Terminal Ready
  820.       GND    Signal Ground          7    - 7      GND    Signal Ground
  821.       DCD    Carrier    Detect          8    - 20      DTR    Data Terminal Ready
  822.       DTR    Data Terminal Ready  20    - 6      DSR    Data Set Ready
  823.       DTR    Data Terminal Ready  20    - 8      DCD    Carrier    Detect
  824.  
  825.  
  826.  
  827.   If you have a    DB9 connector on your port, try    the following:
  828.  
  829.                     DB9      DB25
  830.       RxD    Receive    Data          2    - 2      TxD    Transmit Data
  831.       TxD    Transmit Data          3    - 3      RxD    Receive    Data
  832.       GND    Signal Ground          5    - 7      GND    Signal Ground
  833.  
  834.  
  835.  
  836.   Alternatively, a DB9-DB25 null modem cable:
  837.  
  838.                     DB9      DB25
  839.       DCD    Carrier    Detect          1    - 20      DTR    Data Terminal Ready
  840.       RxD    Receive    Data          2    - 2      TxD    Transmit Data
  841.       TxD    Transmit Data          3    - 3      RxD    Receive    Data
  842.       DTR    Data Terminal Ready   4    - 6      DSR    Data Set Ready
  843.       DTR    Data Terminal Ready   4    - 8      DCD    Carrier    Detect
  844.       GND    Signal Ground          5    - 7      GND    Signal Ground
  845.       DSR    Data Set Ready          6    - 20      DTR    Data Terminal Ready
  846.       RTS    Request    To Send          7    - 5      CTS    Clear To Send
  847.       CTS    Clear To Send          8    - 4      RTS    Request    To Send
  848.       (RI Ring Indicator          9    not needed)
  849.  
  850.  
  851.  
  852.   If you are not using a full null modem cable,    you might have to do the
  853.   following trick: on your computer side of the    connector, connect RTS
  854.   and CTS together, and    also connect DSR, DCD and DTR together.     This
  855.   way, when the    computer wants a certain handshaking signal, it    will get
  856.   it (from itself).
  857.  
  858.  
  859.   Now that you have the    right kind of cable, connect your terminal to
  860.   your computer.  If you can, tell you terminal    to ignore modem    control
  861.   signals.  Try    using 9600 bps,    8 data bits, 1 stop bit, no parity bits
  862.   for the terminal's setup.
  863.  
  864.  
  865.   8.2.    Setting    up getty
  866.  
  867.   Replace the stock getty with getty_ps    as described in    section    ``What
  868.   is <tt>getty_ps</tt>?''.  Add    an entry for getty to use for your
  869.   terminal in /etc/gettydefs:
  870.  
  871.  
  872.  
  873.        # 38400 bps Dumb    Terminal entry
  874.        DT38400#    B38400 CS8 CLOCAL # B38400 SANE    -ISTRIP    CLOCAL #S @L login: #DT38400
  875.        # 19200 bps Dumb    Terminal entry
  876.        DT19200#    B19200 CS8 CLOCAL # B19200 SANE    -ISTRIP    CLOCAL #S @L login: #DT19200
  877.        # 9600 bps Dumb Terminal    entry
  878.        DT9600# B9600 CS8 CLOCAL    # B9600    SANE -ISTRIP CLOCAL #S @L login: #DT9600
  879.  
  880.  
  881.  
  882.  
  883.  
  884.   You can add HUPCL so the login is killed whenever you    switch of the
  885.   terminal (provided you use a proper null modem cable).
  886.  
  887.  
  888.   If you want, you can make getty print    interesting things in the login
  889.   banner.  In my examples, I have the system name and the serial line
  890.   printed.  You    can add    other things:
  891.  
  892.  
  893.  
  894.        @B    The current (evaluated at the time    the @B is seen)    bps rate.
  895.        @D    The current date, in MM/DD/YY.
  896.        @L    The serial    line to    which getty is attached.
  897.        @S    The system    name.
  898.        @T    The current time, in HH:MM:SS (24-hour).
  899.        @U    The number    of currently signed-on users.  This is    a
  900.          count of the number of entries in the /etc/utmp file
  901.          that have a non-null ut_name field.
  902.        @V    The value of VERSION, as given in the defaults file.
  903.        To display a single '@' character, use either '\@' or '@@'.
  904.  
  905.  
  906.  
  907.  
  908.  
  909.   Edit your /etc/inittab file to run getty on the serial port
  910.   (substituting    in the correct information for your environment    - port,
  911.   speed, and terminal type):
  912.  
  913.  
  914.        S1:456:respawn:/sbin/getty ttyS1    DT9600 vt100
  915.  
  916.  
  917.  
  918.  
  919.  
  920.   Restart init:
  921.  
  922.  
  923.        linux# init q
  924.  
  925.   At this point, you should see    a login    prompt on your terminal.  You
  926.   may have to hit return a couple of times to get the terminal's
  927.   attention.  Rejoice.    Party.    Log in on your terminal    and PC.     talk to
  928.   yourself from    accross    the room.
  929.  
  930.  
  931.   9.  Can I use    more than 2 serial devices?
  932.  
  933.   You don't need to read this section, unless you want to use 3    or more
  934.   serial devices... (assuming you don't    have a multiport board).
  935.  
  936.  
  937.   Providing you    have another spare serial port,    yes, you can.
  938.  
  939.  
  940.   The number of    serial ports you can use is limited by the number of
  941.   interrupts (IRQ) and port I/O    addresses we have to use.  Each    serial
  942.   devices must be assigned it's    own interrupt and address.  A serial
  943.   device can be    a serial port, an internal modem, or a multiport serial
  944.   board.
  945.  
  946.  
  947.   Multiport serial boards are specially    designed to have multiple serial
  948.   ports    that share the same IRQ    for all    serial ports on    the board.
  949.   Linux    gets data from them by using a different I/O address for each
  950.   port on the card.
  951.  
  952.  
  953.   9.1.    Choosing serial    device interrupts
  954.  
  955.   Your PC will normally    come with ttyS0    and ttyS2 at IRQ 4, and    ttyS1
  956.   and ttyS3 at IRQ 3.  To use more than    2 serial devices, you will have
  957.   to give up an    interrupt to use.  A good choice is to reassign    an
  958.   interrupt from your parallel port.  Your PC normally comes with IRQ 5
  959.   and IRQ 7 set    up as interrupts for your parallel ports, but few people
  960.   use 2    parallel ports.     You can reassign one of the interrupts    to a
  961.   serial device, and still happily use a parallel port.     You will need
  962.   the setserial    program    to do this.  In    addition, you have to play with
  963.   the jumpers on your boards, check the    docs for your board.  Set the
  964.   jumpers to the IRQ you want for each port.
  965.  
  966.  
  967.   You will need    to set things up so that there is one, and only    one
  968.   interrupt for    each serial device.  Here is how I set mine up in
  969.   /etc/rc.local    - you should do    it upon    startup    somewhere:
  970.  
  971.  
  972.  
  973.            /etc/setserial /dev/cua0    irq 3           # my mouse
  974.            /etc/setserial /dev/cua1    irq 4           # my dumb terminal
  975.            /etc/setserial /dev/cua2    irq 5           # my 2400 bps modem
  976.            /etc/setserial /dev/cua3    irq 9           # my telebit modem
  977.  
  978.  
  979.  
  980.  
  981.  
  982.   Standard IRQ assignments:
  983.  
  984.  
  985.  
  986.  
  987.  
  988.  
  989.  
  990.  
  991.         IRQ  0      Timer    channel    0
  992.         IRQ  1      Keyboard
  993.         IRQ  2      Cascade for controller 2
  994.         IRQ  3      Serial port 2
  995.         IRQ  4      Serial port 1
  996.         IRQ  5      Parallel port    2
  997.         IRQ  6      Floppy diskette
  998.         IRQ  7      Parallel port    1
  999.         IRQ  8      Real-time clock
  1000.         IRQ  9      Redirected to    IRQ2
  1001.         IRQ 10      not assigned
  1002.         IRQ 11      not assigned
  1003.         IRQ 12      not assigned
  1004.         IRQ 13      Math coprocessor
  1005.         IRQ 14      Hard disk controller
  1006.         IRQ 15      not assigned
  1007.  
  1008.  
  1009.  
  1010.  
  1011.  
  1012.   There    is really no Right Thing to do when choosing interrupts.  Just
  1013.   make sure it isn't being used.  2, 3,    4, 5, or 7  is a good choice.
  1014.   ``not    assigned'' means that currently    nothing    standard uses these
  1015.   IRQs.     Also note that    IRQ 2 is the same as IRQ 9.  You can call it
  1016.   either 2 or 9, the serial driver is very understanding.
  1017.  
  1018.  
  1019.   If you have a    serial card with a 16-bit bus connector, you can also
  1020.   use IRQ 10, 11, 12 or    15.
  1021.  
  1022.  
  1023.   Just make sure you don't use IRQ 0, 1, 6, 8, 13 or 14!  These    are used
  1024.   by your mother board.     You will make her very    unhappy    by taking her
  1025.   IRQs.
  1026.  
  1027.  
  1028.   9.2.    Setting    serial device addresses
  1029.  
  1030.   Next,    you must set the port address.    Check the manual on your board
  1031.   for the jumper settings.  Like interrupts, there can only be one
  1032.   serial device    at each    address.  Yours    port will usually come
  1033.   configured as    follows:
  1034.  
  1035.  
  1036.            /dev/cua0, /dev/ttyS0 address 0x3f8 ttyS0
  1037.            /dev/cua1, /dev/ttyS1 address 0x2f8 ttyS1
  1038.            /dev/cua2, /dev/ttyS2 address 0x3e8 ttyS2
  1039.            /dev/cua3, /dev/ttyS3 address 0x3e8 ttyS3
  1040.  
  1041.  
  1042.  
  1043.  
  1044.   Choose which address you want    each serial device to have and set the
  1045.   jumpers accordingly.    I have my modem    on ttyS3, and my mouse on ttyS0.
  1046.  
  1047.   When you reboot, Linux should    see your serial    ports at the address you
  1048.   set them.  The IRQ Linux sees    may not    correspond to the IRQ you set
  1049.   with the jumpers.  Don't worry about this.  Linux does not do    any IRQ
  1050.   detection when it boots, because IRQ detection is dicy and can be
  1051.   fooled.  Use setserial to tell Linux what IRQ    the port is using.
  1052.  
  1053.  
  1054.  
  1055.  
  1056.  
  1057.   10.  Can Linux configure the serial devices automagically?
  1058.  
  1059.   Yes.    To get Linux to    detect and set up the serial devices
  1060.   automatically    on startup, add    the line:
  1061.  
  1062.  
  1063.        /etc/setserial /dev/cua0    auto_irq skip_test autoconfig
  1064.  
  1065.  
  1066.  
  1067.  
  1068.   to your /etc/rc.local    or /etc/rc.serial file.     Do this for every
  1069.   serial port you want to auto configure.  Be sure to give the correct
  1070.   location of where your setserial program lives, and give a device name
  1071.   that really does exist on your machine.
  1072.  
  1073.  
  1074.   10.1.     Notes for multiport boards
  1075.  
  1076.   For board addresses, and IRQs, look at the rc.serial that comes with
  1077.   the setserial    program.  It has a lot of detail on multiport boards,
  1078.   including I/O    addresses and device names.
  1079.  
  1080.  
  1081.   11.  How do I    set up my serial    ports for higher speeds?
  1082.  
  1083.   Use setserial, with the spd_hi flag to configure your    serial port to
  1084.   use 57600 bps.  Use spd_vhi to use 115200 bps.  Then,    set your speed
  1085.   to 38400 bps.     This is now the new speed you have set.  There    is no
  1086.   speed    named 57600 or 115200.    Make sure you have 16550A UARTs    :-).
  1087.  
  1088.  
  1089.   In my    /etc/rc.local I    set ttyS3 to 115200 bps    by doing:
  1090.  
  1091.  
  1092.        /bin/setserial /dev/cua3    irq 9 spd_vhi
  1093.  
  1094.  
  1095.  
  1096.  
  1097.  
  1098.   12.  Noteworthy communications programs     and utilities
  1099.  
  1100.   Once you get everything working, you may want    to check out these more
  1101.   advanced programs, all are available on the usual FTP    sites, if they
  1102.   didn't come with your    distribution.
  1103.  
  1104.  
  1105.   o  seyon - X based comm program
  1106.  
  1107.   o  minicom - telix-like comm program
  1108.  
  1109.   o  procomm - procommish comm program with zmodem
  1110.  
  1111.  
  1112.   These    programs offer more features that just kermit alone, including
  1113.   telephone directories, auto-dialing and so on.
  1114.  
  1115.  
  1116.   o  Another useful program is term.  term multiplexes many connections
  1117.      over one serial line.  It is somewhat similar to SLIP, and    offers
  1118.      some SLIP functionality.  These include rlogin, telnet, ftp, ncftp,
  1119.      finger, rdate, xmosaic and    tredir.     tredir    is a special program
  1120.      which lets    you redirect remote TCP/IP ports to your local machine.
  1121.      This allows for remote NNTP, and SMTP access.  The    good thing about
  1122.      term is that is runs entirely in user space, meaning it requires no
  1123.      kernel support, or    sysadmin support (like SLIP does).
  1124.  
  1125.   o  screen is another multi-session program.  This one    behaves    like the
  1126.      virtual consoles.
  1127.  
  1128.   o  callback is a program that    will have your modem call you back
  1129.      immediately from where you    just called.
  1130.  
  1131.   o  mgetty+fax    handles    FAX stuff, and provides    an alternate getty
  1132.  
  1133.  
  1134.   o  Other things can be found on
  1135.      sunsite.unc.edu:/pub/Linux/system/Serial
  1136.      and sunsite.unc.edu:/pub/Linux/apps/comm or one of    the many
  1137.      mirrors.  These are the directories where all the serial type
  1138.      things are    kept.
  1139.  
  1140.  
  1141.  
  1142.   13.  Serial Tips
  1143.  
  1144.  
  1145.   Here are some    serial tips you    might find helpful...
  1146.  
  1147.  
  1148.   13.1.     kermit    and zmodem
  1149.  
  1150.   To use zmodem    with kermit, add the following to your .kermrc:
  1151.  
  1152.  
  1153.        define rz !rz < /dev/cua3 > /dev/cua3
  1154.        define sz !sz \%0 > /dev/cua3 < /dev/cua3
  1155.  
  1156.  
  1157.  
  1158.  
  1159.  
  1160.   Be sure to put in the    correct    port your modem    is on.    Then, to use it,
  1161.   just type rz or sz <filename>    at the kermit prompt.
  1162.  
  1163.  
  1164.   13.2.     Setting terminal types    automagically
  1165.  
  1166.   To set your terminal type automagically when you log in, add the
  1167.   terminal type    to the entry in    /etc/inittab.  If I have a vt100
  1168.   terminal on ttyS1, I would add ``vt100'' to the getty    command:
  1169.  
  1170.  
  1171.  
  1172.        S1:456:respawn:/sbin/getty ttyS1    DT9600 vt100
  1173.  
  1174.  
  1175.  
  1176.  
  1177.  
  1178.   You can also get tset    from sunsite.unc.edu:/pub/Linux/system/Terminal-
  1179.   management or    a mirror site.    See the    docs that come with tset to
  1180.   learn    how to use it.    tset can establish terminal characteristics when
  1181.   you log in, and doesn't depend on any    defaults.
  1182.  
  1183.  
  1184.   13.3.     Color ls on serial connections
  1185.  
  1186.   If ls    is screwing up your terminal emulation with the    color feature,
  1187.   turn it off.    ls --color, and    ls --colour all    use the    color feature.
  1188.   Some installations have ls set to use    color by default.  Check
  1189.   /etc/profile and /etc/csh.cshrc for ls aliases.  You can also    alias ls
  1190.   to ls    -o or ls --no-color, if    you don't want to change the system
  1191.   defaults.
  1192.  
  1193.  
  1194.   13.4.     Printing to a printer connected to a terminal
  1195.  
  1196.   There    is a program called vtprint that will do this, written by
  1197.   Garrett D'Amore <garrett@sciences.sdsu.edu>.    It is available    from
  1198.   ftp.sdsu.edu:/pub/vtprint.  The following is from the    README file that
  1199.   comes    with the program:
  1200.  
  1201.  
  1202.        vtprint is a program that allows    users to print from a
  1203.        remote UNIX host    to a printer attached to their local termi-
  1204.        nal or emulator,    which makes it great for printing files    at
  1205.        home, etc. (It only does    text files, though.)
  1206.  
  1207.  
  1208.  
  1209.   14.  Linux FTP sites
  1210.  
  1211.  
  1212.  
  1213.        sunsite.unc.edu [152.2.22.81]:/pub/Linux           (NC, USA)
  1214.        tsx-11.mit.edu [18.172.1.2]:/pub/linux           (MA, USA)
  1215.        nic.funet.fi [128.214.6.100)]/pub/OS/Linux      (Finland, Europe)
  1216.  
  1217.  
  1218.  
  1219.  
  1220.   sunsite.unc.edu is the official Linux    FTP site, and has many mirrors.
  1221.   Please use a mirror site if at all possible to save sunsite some
  1222.   traffic.
  1223.  
  1224.  
  1225.   sunsite mirrors:
  1226.  
  1227.  
  1228.  
  1229.  
  1230.  
  1231.  
  1232.  
  1233.  
  1234.  
  1235.  
  1236.  
  1237.  
  1238.  
  1239.  
  1240.  
  1241.  
  1242.  
  1243.  
  1244.  
  1245.  
  1246.  
  1247.  
  1248.  
  1249.  
  1250.  
  1251.  
  1252.  
  1253.  
  1254.  
  1255.   site                  path
  1256.   ------------------------------------------------------------------------------
  1257.   mrcnext.cso.uiuc.edu          /pub/linux/
  1258.   ftp.linux.org              /pub/mirrors/sunsite.unc.edu/
  1259.   ftp.uni-paderborn.de          /pub/Mirrors/sunsite.unc.edu/
  1260.   ftp.cs.cuhk.hk          /pub/Linux/
  1261.   ftp.dungeon.com          /pub/lunux/sunsite-mirror/
  1262.   ftp.dfv.rwth-aachen.de      /pub/linux/sunsite/
  1263.   ftp.maths.warwick.ac.uk      /mirrors/linux/sunsite.unc-mirror/
  1264.   ftp.rus.uni-stuttgart.de      /pub/unix/systems/linux/MIRROR.sunsite/
  1265.   ftp.uni-erlangen.de          /pub/Linux/MIRROR.sunsite/
  1266.   ftp.uni-paderborn.de          /pub/linux/sunsite/
  1267.   ftp.gwdg.de              /pub/linux/mirrors/sunsite/
  1268.   ftp.tu-graz.ac.at          /pub/Linux/
  1269.   pub.vse.cz              /pub/386-unix/linux/
  1270.   dcs.muni.cz              /pub/UNIX/linux/
  1271.   ftp.univ-angers.fr          /pub/linux/
  1272.   hypergly.watson.ibm.com      /pub/linux-sunsite (IBM internal network only)
  1273.   brandy.jf.intel.com          /something (Intel internal network only)
  1274.   ftp.tu-dresden.de          /pub/Linux/sunsite/
  1275.   ftp.germany.eu.net          /pub/os/Linux/Mirror.SunSITE/
  1276.   ftp.nus.sg              /pub/unix/Linux/
  1277.   ftp.uni-tuebingen.de          /pup/linux/Mirror.sunsite/
  1278.   ftp.cnr.it              /pub/Linux/
  1279.   ftp.kfki.hu              /pub/linux/
  1280.   cnuce-arch.cnr.it          /pub/Linux/
  1281.   ftp.orst.edu              /pub/mirrors/sunsite.unc.edu/linux/
  1282.   ftp.nectec.or.th          /pub/mirrors/linux/
  1283.   ftp.switch.ch              /mirrors/linux/
  1284.   ftp.iquest.com          /pub/linux/sunsite/
  1285.   src.doc.ic.ac.uk          /packages/linux/sunsite.unc-mirror/
  1286.   smug.student.adelaide.edu.au      /pub/sunsite.linux/
  1287.   ftp.ba-mannheim.de          /pub/linux/mirror.sunsite
  1288.   ftp.loria.fr              /pub/linux/sunsite
  1289.   ftp.rz.uni-ulm.de          /pub/mirrors/linux/sunsite
  1290.   ftp.cc.gatech.edu          /pub/linux
  1291.  
  1292.  
  1293.  
  1294.  
  1295.  
  1296.   These    FTP sites support annonymous FTP, which    means login as ftp, and
  1297.   password as your email address, ie logname@yourhost.yourdomain.
  1298.  
  1299.  
  1300.  
  1301.   15.  One step    further...
  1302.  
  1303.  
  1304.  
  1305.   15.1.     What are lock files?
  1306.  
  1307.   Lock file are    simply a file saying that a particular device is in use.
  1308.   They are kept    in /usr/spool/uucp, or /var/lock.  Lock    files are named
  1309.   LCK..<name>, where <name> is either a    device name, or    a UUCP site
  1310.   name.     Certain processes create these    locks so that they can have
  1311.   exclusive access to devices, for instance if you dial    out on your
  1312.   modem, a lock    will appear telling other processes that someone is
  1313.   using    the modem already.  Locks mainly contain the PID of the    process
  1314.   that has locked the device.  Most programs look at the lock, and try
  1315.   to determine if that lock is still valid by checking the process table
  1316.   for the process that has locked the device.  If the lock is found to
  1317.   be valid, the    program    (should) exit.    If not,    some programs remove the
  1318.   stale    lock, and use the device, creating their own lock in the
  1319.   process.  Other programs just    exit and tell you that the device is in
  1320.   use.
  1321.   15.2.     ``baud'' vs. ``bps''
  1322.  
  1323.   ``baud'' and ``bps'' are prehaps one of the most misused terms in the
  1324.   computing/telecom field.  Many people    use these terms    interchangeably,
  1325.   when in fact they are    not!
  1326.  
  1327.  
  1328.      baud
  1329.     The baud rate is a measure of how many times per second    the
  1330.     signal sent by a modem (modulator-demodulator) changes.     For
  1331.     example, a baud    rate of    1200 implies one signal    change every 833
  1332.     microseconds.  Common baud rates are 300, 600, 1200, and 2400.
  1333.     Most high speed    modems run at 2400 baud.  Because of the
  1334.     bandwidth limitations on voice-grade phone lines, baud rates
  1335.     greater    than 2400 are harder to    achieve, and only work under
  1336.     very pristine phone line quality.  ``baud'' is named after Emile
  1337.     Baudot,    the inventor of    the asynchronous telegraph printer.
  1338.  
  1339.  
  1340.      bps
  1341.     The bps    rate is    a measure of how many bits per second are
  1342.     transmitted.  Common modem bps rates are 300, 1200, 2400, 4800,
  1343.     ... 28800.  With V.42bis compression (4:1 compression),
  1344.     theoretical bps    rates are possible up to 115200.  This is what
  1345.     most people mean when they misuse the word ``baud''.
  1346.  
  1347.  
  1348.   So, if high speed modems are running at 2400 baud, how can they send
  1349.   14400    bps?  The modems achive    a bps >    baud rate by encoding a    number
  1350.   of bits per baud.  Thus, when    2 or more bits are encoded per baud, the
  1351.   bps rate exceeds the baud rate.  If your modem connects at 14400 bps,
  1352.   it's going to    be sending 6 bits per baud.
  1353.  
  1354.   How did this confusion start?     Well, back when low speed modems were
  1355.   high speed modems, the bps rate actually did equal the baud rate.  One
  1356.   bit would be encoded per baud.  People would use bps and baud
  1357.   interchangeably, because they    were the same number.  For example, a
  1358.   300 bps modem    also had a baud    rate of    300.  This all changed when
  1359.   faster bps modems came around, and the bit rate exceeded the baud
  1360.   rate.
  1361.  
  1362.  
  1363.  
  1364.   15.3.     What are UARTs?  How do they affect performance?
  1365.  
  1366.   UARTs    (Universal Asyncronous Receiver    Transmitter) are chips on your
  1367.   PC serial card.  Their purpose is to convert data to bits, send the
  1368.   bits down the    serial line, and then rebuild the data again on    the
  1369.   other    end.  UARTs deal with data in byte sized pieces, which is
  1370.   conveniently also the    size of    ASCII characters.
  1371.  
  1372.  
  1373.   Say you have a terminal hooked up to your PC.     When you type a
  1374.   character, the terminal presents it to it's transmitter (also    a UART,
  1375.   although probably different that the PC UART).  The transmitter sends
  1376.   that byte out    onto the serial    line, one bit at a time, at a specific
  1377.   rate.     On the    PC end,    the receiving UART takes all the bits and
  1378.   rebuilds the byte and    puts it    in a buffer.
  1379.  
  1380.  
  1381.   There    are two    different types    of UARTs.  You have probably heard of
  1382.   dumb UARTs - the 8250    and 16450, and smart or    FIFO UARTs - the 16550A.
  1383.   To understand    their differences, first let's examine what happens when
  1384.   a UART has sent or received a    byte.
  1385.  
  1386.  
  1387.   The UART itself can't    do anything with the data, it just sends and
  1388.   receives it.    The CPU    gets an    interrupt every    time a byte has    been
  1389.   sent or received.  The CPU then moves    the received byte out of the
  1390.   UART's buffer    and into memory    somewhere, or gives the    UART another
  1391.   byte to send.    The 8250 and 16450 UARTs only have a 1 byte buffer.
  1392.   That means, that every time 1    byte is    sent or    received, it interrupts
  1393.   the CPU.  At low rates, this is OK.  But, at high transfer rates, the
  1394.   CPU get so busy dealing with the UART, that is doesn't have time to
  1395.   tend to other    tasks.    In some    cases, the CPU does not    get around to
  1396.   servicing the    interrupt in time, and the byte    is overwritten,    because
  1397.   they are coming in so    fast.
  1398.  
  1399.  
  1400.   That's where the 16550A UARTs    come in.  These    chips come with    16 byte
  1401.   FIFOs.  This means that it can receive or transmit up    to 16 bytes
  1402.   before it has    to interrupt the CPU.  Not only    can it wait, but the CPU
  1403.   then can transfer all    16 bytes at a time.  Although the interrupt
  1404.   threshold is seldom set at 16, this is still a significant advantage
  1405.   over the other UARTs,    which only have    the 1 byte buffer.  The    CPU
  1406.   receives less    interrupts, and    is free    to do other things.   Data is
  1407.   not lost, and    everyone is happy.
  1408.  
  1409.  
  1410.   In general, the 8250 and 16450 UARTs should be fine for speeds up to
  1411.   19200    bps.  At speeds    greater    than 19200 bps,    you might start    seeing
  1412.   data loss, and a reduction in    interactive response time.  Other PC
  1413.   operating systems (definition    used loosely here), like DOS aren't
  1414.   multitasking,    so they    might be able to cope better with 8250 or
  1415.   16450s.  That's why some people don't    see data loss, until they switch
  1416.   to Linux.
  1417.  
  1418.  
  1419.   Keep in mind that these dumb UART types are not bad, they just aren't
  1420.   good for high    speeds.     You should have no problem connecting a
  1421.   terminal, or a mouse to these    UARTs.    But, for a high    speed modem, the
  1422.   16550A is definately a must.
  1423.  
  1424.  
  1425.   You can buy serial cards with    the 16550A UARTs for a little more
  1426.   money, just ask your dealer what type    of UART    is on the card.     Or if
  1427.   you want to upgrade your existing card, you can simply purchase 16550A
  1428.   chips    and replace your existing 16450    UARTs.    They are pin-to-pin
  1429.   compatible.  Some cards come with socketed UARTs for this purpose, if
  1430.   not you can solder.  Note, that you'll probably save yourself    a lot of
  1431.   trouble by just getting a new    card, if you've    got the    money, they are
  1432.   under    US$ 50.
  1433.  
  1434.  
  1435.  
  1436.   16.  Troubleshooting
  1437.  
  1438.   16.1.     I keep    getting    ``line NNN of inittab invalid''.
  1439.  
  1440.   Make sure you    are using the correct syntax for your version of init.
  1441.   The different    init's that are    out there use different    syntax in the
  1442.   /etc/inittab file.  Make sure    you are    using the correct syntax for
  1443.   your version of getty.
  1444.  
  1445.  
  1446.   16.2.     When I    try to dial out, it says ``/dev/cuaN: Device or    resource
  1447.   busy''.
  1448.  
  1449.   This problem can arise when DCD or DTR are not set correctly.     DCD
  1450.   should only be set when there    is an actual connection    (ie someone is
  1451.   dialed in), not when getty is    watching the port.  Check to make sure
  1452.   that your modem is configured    to only    set DCD    when there is a
  1453.   connection.  DTR should be set whenever something is using, or
  1454.   watching the line, like getty, kermit, or some other comm program.
  1455.  
  1456.   Another common cause of ``device busy'' errors, is that you set up
  1457.   your serial port with    an interrupt already taken by something    else.
  1458.   As each device initializes, it asks Linux for    permission to use its
  1459.   hardware interrupt.  Linux keeps track of which interrupt is assigned
  1460.   to whom, and if your interrupt is already taken, your    device won't be
  1461.   able to initialize properly.    The device really doesn't have much of
  1462.   any way to tell you that this    happened, except that when you try to
  1463.   use it, it will return a ``device-busy'' error.  Check the interrupts
  1464.   on all of your cards (serial,    ethernet, SCSI,    etc.).    Look for IRQ
  1465.   conflicts.
  1466.  
  1467.  
  1468.   16.3.     I keep    getting    ``Id SN    respawning too fast: disabled for 5 min-
  1469.   utes''.
  1470.  
  1471.   Make sure your modem is configured correctly.     Look at registers ` E
  1472.   and Q.  This can occur when your modem is chatting with getty.
  1473.  
  1474.   Make sure you    are calling getty correctly from your /etc/inittab.
  1475.   Using    the wrong syntax or device names will cause serious problems.
  1476.  
  1477.  
  1478.   16.4.     Serial    devices    are slow or serial devices can only send in one
  1479.   direction.
  1480.  
  1481.   You probably have an IRQ conflict.  Make sure    there are no IRQs being
  1482.   shared.  Check all your cards    (serial, ethernet, SCSI, etc...).  Make
  1483.   sure the jumper settings, and    the setserial parameters are correct for
  1484.   all your serial devices.
  1485.  
  1486.  
  1487.   16.5.     My modem is hosed after someone hangs up.
  1488.  
  1489.   This can happen when your modem doesn't reset    when DTR is dropped.  I
  1490.   saw my RD and    SD LEDs    go nuts    when this happened to me.  You need to
  1491.   have your modem reset.  Most Hayes compatible    modems do this with &D3,
  1492.   but on my USR    Courier, I had to set &D2 and S13=1.  Check your modem
  1493.   manual.
  1494.  
  1495.  
  1496.   16.6.     I have    a serial device    connected, but root can't login    on it.
  1497.  
  1498.   This is done on purpose for security reasons.     Generally, you    should
  1499.   only have root logins    enabled    on the console.     It is considered
  1500.   dangerous to allow root logins on anything other than    the console.
  1501.  
  1502.   But, you asked...  Edit /etc/login.defs, and find the    line that says
  1503.   CONSOLE.  Add    the name of the    serial device to it.  Say I have my
  1504.   terminal on ttyS1.  I    would change the line:
  1505.  
  1506.  
  1507.        CONSOLE tty1:tty2:tty3:tty4:tty5:tty6:tty8
  1508.  
  1509.  
  1510.  
  1511.  
  1512.   to
  1513.  
  1514.  
  1515.        CONSOLE tty1:tty2:tty3:tty4:tty5:tty6:tty8:ttyS1
  1516.  
  1517.  
  1518.  
  1519.   16.7.     it just locks up.  I have my terminal connected to my PC, but
  1520.   after    I type in a login name,
  1521.  
  1522.   You probably don't have CLOCAL in your /etc/gettydefs    entry for the
  1523.   terminal, and    you're probably    not using a full null modem cable.  You
  1524.   need CLOCAL.    CLOCAL tells Linux to ignore modem control signals.
  1525.   Here is what it should look like:
  1526.  
  1527.  
  1528.        # 38400 bps Dumb    Terminal entry
  1529.        DT38400#    B38400 CS8 CLOCAL # B38400 SANE    -ISTRIP    CLOCAL #@S @L login: #D38400
  1530.        # 19200 bps Dumb    Terminal entry
  1531.        DT19200#    B19200 CS8 CLOCAL # B19200 SANE    -ISTRIP    CLOCAL #@S @L login: #DT19200
  1532.        # 9600 bps Dumb Terminal    entry
  1533.        DT9600# B9600 CS8 CLOCAL    # B9600    SANE -ISTRIP CLOCAL #@S    @L login: #DT9600
  1534.  
  1535.  
  1536.  
  1537.  
  1538.   Next,    kill the getty process so a new    one will be spawned with the new
  1539.   entry.
  1540.  
  1541.  
  1542.   16.8.     At high speeds, my modem looses data.
  1543.  
  1544.   If you are trying to run your    modem at > 19200 bps, and you don't have
  1545.   16550A UARTs,    you should upgrade them.  See section ``What are
  1546.   UARTs?'' about UARTs.
  1547.  
  1548.  
  1549.   16.9.     them configured.  On startup, Linux doesn't report the    serial
  1550.   devices the way I have
  1551.  
  1552.   This is true.     Linux does not    do any IRQ detection on    startup, it only
  1553.   does serial device detection.     Thus, disregard what it says about the
  1554.   IRQ, because it's just assuming the standard IRQs.  This is done,
  1555.   because IRQ detection    is unreliable, and can be fooled.
  1556.  
  1557.  
  1558.   So, even though I have my ttyS2 set at IRQ 5,    I still    see
  1559.  
  1560.  
  1561.        Jan 23 22:25:28 misfits vmunix: tty02 at    0x03e8 (irq = 4) is a 16550A
  1562.  
  1563.  
  1564.  
  1565.  
  1566.  
  1567.   You have to use setserial to tell Linux the IRQ you are using.
  1568.  
  1569.  
  1570.   16.10.  rz and/or sz don't work when I call my Linux box on my modem.
  1571.  
  1572.   If Linux looks for /dev/modem    when you try to    transfer files,    look at
  1573.   /etc/profile,    and /etc/csh.cshrc.  There are a bunch of aliases
  1574.   defined there    on some    distributions, most notably Slackware.    These
  1575.   aliases mess up the zmodem programs.    Take them out, or correct them.
  1576.  
  1577.  
  1578.   16.11.  My screen is printing    funny looking characters.
  1579.  
  1580.   This happens on virtual consoles when    you send binary    data to    your
  1581.   screen, or sometimes on serial connections.  The way to fix this is to
  1582.   type echo ^v^[c.  For    the control-character-impaired,    thats echo
  1583.   <ctrl>v<esc>c.
  1584.  
  1585.   16.12.  getty    or uugetty still doesn't work.
  1586.  
  1587.   There    is a DEBUG option that comes with getty_ps.  Edit your config
  1588.   file /etc/conf.{uu}getty.ttySN and add DEBUG=NNN.  Where NNN is one of
  1589.   the following    combination of numbers according to what you are trying
  1590.   to debug:
  1591.  
  1592.  
  1593.        D_OPT   001          option settings
  1594.        D_DEF   002          defaults file processing
  1595.        D_UTMP  004          utmp/wtmp    processing
  1596.        D_INIT  010          line initialization (INIT)
  1597.        D_GTAB  020          gettytab file processing
  1598.        D_RUN   040          other runtime diagnostics
  1599.        D_RB    100          ringback debugging
  1600.        D_LOCK  200          uugetty lockfile processing
  1601.        D_SCH   400          schedule processing
  1602.        D_ALL   777          everything
  1603.  
  1604.  
  1605.  
  1606.  
  1607.   Setting DEBUG=010 is a good place to start.
  1608.  
  1609.  
  1610.   If you are running syslogd, debugging    info will appear in your log
  1611.   files.  If you aren't    running    syslogd    info will appear in
  1612.   /tmp/getty:ttySN for debugging getty and /tmp/uugetty:ttySN for
  1613.   uugetty.  Look at the    debugging info and see what is going on.  Most
  1614.   likely, you will need    to tune    some of    the parameters in your config
  1615.   file,    and you    may have to configure your modem differently, too.
  1616.  
  1617.  
  1618.   16.12.1.  Alternate versions of getty
  1619.  
  1620.   You might like these better:
  1621.  
  1622.  
  1623.   mgetty, a different version of getty,    can also handle    faxes.    It can
  1624.   be found on the Linux    FTP sites.
  1625.  
  1626.  
  1627.   agetty, a simpler version of getty.  This version comes with most
  1628.   distributions.  If not, it should be on the Linux FTP    sites.
  1629.  
  1630.  
  1631.  
  1632.   17.  Contributions
  1633.  
  1634.  
  1635.   There    was no possible    way to write this HOWTO    alone.    Although a lot
  1636.   of the HOWTO is my writing, I    have often rewritten contributions to
  1637.   maintain continuity in the writing style and flow.  Thanks to    everyone
  1638.   who has contributed or commented, the    list of    people has gotten too
  1639.   long to list (somewhere over fifty).    Special    thanks to Matt Welch for
  1640.   coordinating the LPD project (I suspect that's much like herding
  1641.   cats), Ted T'so for answering    questions about    the serial drivers, and
  1642.   to Kris Gleason who maintains    getty_ps.
  1643.  
  1644.  
  1645.   END OF Serial-HOWTO
  1646.