home *** CD-ROM | disk | FTP | other *** search
/ DP Tool Club 15 / CD_ASCQ_15_070894.iso / vrac / how_to.zip / SERIAL.HOW < prev    next >
Text File  |  1994-04-29  |  30KB  |  763 lines

  1. Archive-name: linux/howto/serial
  2. Last-modified: 15 Apr 94
  3.  
  4. Linux Serial-HOWTO version 1.0 Thu Jan 6 1994 
  5. maintained by Greg Hankins <gregh@cc.gatech.edu>.
  6.  
  7. ** Note: This file supercedes the old Linux Serial-FAQ.
  8.  
  9. INDEX 
  10.  0.  Introduction
  11.  0.1 New versions of this document
  12.  0.2 Recommended reading
  13.  0.3 Feedback 
  14.  0.4  Disclaimer
  15.  1.  Supported serial hardware 
  16.  2.  How are serial devices named?
  17.  3.  What is 'getty_ps 2.0.7b'? 
  18.  3.1 Installation
  19.  3.2 Customizing 'getty'
  20.  4.  How do I dial out with my modem?
  21.  4.1 Hardware requirements
  22.  4.2 Connecting to your modem
  23.  5.  How do I dial in and out with my modem?
  24.  5.1 Note for UUCP users
  25.  6.  How do I set up a terminal connected to my PC?
  26.  6.1 Hardware requirements
  27.  6.2 Setting up 'getty'
  28.  7.  Can I use more than 2 serial ports?  
  29.  8.  Can Linux detect the serial devices automatically? 
  30.  9.  What numbers should my serial devices in /dev have? 
  31.  9.1 Creating devices with the 'mknod' command
  32.  10.  How should I configure my modem?
  33.  10.1 Dial out configuration
  34.  10.2 Dial in and out configuration
  35.  11.  How can I hook up a printer to my serial port?
  36.  12. What are locks, and what are they for?
  37.  13.  What are UARTs?  How do they affect performance?  
  38.  14.  'kermit': a quick start
  39.  15.  Troubleshooting
  40.  15.1 I keep getting "line XXX of inittab invalid"
  41.  15.2 When I try to dial out, it says "/dev/cuaX: Device or 
  42.   resource busy"
  43.  15.3 I keep getting "respawning too fast, disableing for 5 minutes"
  44.  15.4 I have a modem/terminal connected, but root can't login from 
  45.   the serial device.
  46.  15.5 I have my terminal connected to my PC, but after I type in a 
  47.   login name, it just locks up.
  48.  15.6 At high speeds, my modem looses characters, and my computer 
  49.   gets really slow!
  50.  16.  Contributions
  51.  
  52. ===============================================================================
  53.  
  54. 0. Introduction
  55.  
  56.  This is the Linux SERIAL-HOWTO.  This document is a rewrite of the 
  57.  serial-FAQ.  The serial-FAQ is out of date, and should no longer be 
  58.  distributed.
  59.  
  60.  This document describes the Linux serial drivers, and software
  61.  used for serial communications. 
  62.  
  63.  I will attempt to provide answers to a variety of serial questions
  64.  and common problems.
  65.  
  66.  
  67. 0.1 New versions of this document
  68.  
  69.  New versions of this document can be retrieved via anonymous ftp from 
  70.  sunsite.unc.edu:/pub/Linux/docs.  It will also be posted to several 
  71.  newsgroups, including comp.os.linux.announce.
  72.  
  73.  
  74. 0.2 Recommended reading
  75.  
  76.  - man pages for:
  77.   init(1), getty(1), login(1)
  78.   gettydefs(4)
  79.   setserial(8)
  80.  
  81.  - your modem manual
  82.  
  83.  - "Managing UUCP and Usenet" by Tom O'Reilly and Grace Todino, 
  84.    (highly recommended by nearly everyone)
  85.  
  86.  - Other HOWTOs: UUCP-HOWTO, Printing-HOWTO
  87.  
  88.  
  89. 0.3  Feedback
  90.  
  91.  Please send me any comments, suggestions, or additional material you 
  92.  have.  I'm always eager to hear about what you think about the HOWTO.  
  93.  I'm also always on the lookout for improvements!  But, please don't 
  94.  just tell me "it sucks".  Tell me what exactly you don't understand, 
  95.  or what could be clearer.
  96.  
  97.  If you find any wrong information, please contact me ASAP.
  98.  
  99.  
  100. 0.4 Disclaimer
  101.  
  102.  Your milage may vary.  The answers given may not work for all systems
  103.  and all setup combinations.  
  104.  
  105.  
  106. 1.  Supported serial hardware 
  107.  
  108.  Linux supports standard PC serial boards, internal modems, and a number
  109.  of multiport serial boards, including the Usenet Serial Board II, the 
  110.  Boca 4-port (BB-1004), 8-port (BB-1008), and 16-port (BB-2016) boards, 
  111.  and AST FourPort boards and clones.  In general, Linux will support any
  112.  serial board which uses a 8250, 16450, 16550, or 16550A (or compatible)
  113.  UART, and assignes the UART registers to a contiguous block of 8 I/O 
  114.  ports on the 386/486.
  115.  
  116.  Linux does not support any intelligent serial ports, nor is it likely
  117.  that it will in the future.
  118.  
  119.  The Usenet Serial Board II is available from:
  120.  South Coast Computing Services, Inc.
  121.  phone +1 713 661 3301
  122.  email info@sccsi.com
  123.  
  124.  
  125. 2.  How are serial devices named?
  126.  
  127.  There are 4 serial devices corresponding to COM1 - COM4, /dev/cua0 - 
  128.  /dev/cua3 and /dev/ttyS0 - /dev/ttyS3. The /dev/ttyS* devices are for 
  129.  dialin and /dev/cua* devices for dialout. 
  130.  
  131.  On some installations, two extra devices will be created, /dev/modem 
  132.  for your modem and /dev/mouse for your mouse.  Both of these are 
  133.  symbolic links to the appropriate /dev/cua* device which you specified 
  134.  during the installation (unless you have a bus mouse, then /dev/mouse 
  135.  will point to the bus mouse device).
  136.  
  137.  There has been some discussion on the merits of /dev/mouse and 
  138.  /dev/modem.  I prefer using the "real" device names, and not the 
  139.  symbolic links.  It just seems less confusing to me.  Use them if you 
  140.  like, but make sure they point to the right device.
  141.  
  142.  On the other hand, if you use the links, and they point to the correct 
  143.  devices, using /dev/modem may be simpler for some people.  It's really 
  144.  up to you what you use.
  145.  
  146.  
  147. 3.  What is 'getty_ps 2.0.7b'?  
  148.  
  149.  This is just another version of 'getty', which is a program that handles
  150.  some of the login process when you log in to a UNIX box.  This version 
  151.  is better than the stock 'getty' that comes with most recent Linux 
  152.  distributions.  It was written by Paul Sutcliffe, Jr.  
  153.  <paul@devon.lns.pa.us>.  2.0.7b is the latest version, and supercedes 
  154.  any older versions.  If you do not have this version of 'getty', I 
  155.  highly recommend that you get it.  It can be found on the standard 
  156.  Linux ftp sites.
  157.  
  158. 3.1  Installation
  159.  
  160.  Get the package from an ftp sites, and install according to the 
  161.  instructions.
  162.  
  163.  Users of SLS 1.0.1/1.0.2 should be very carefull because there might 
  164.  be two versions of 'getty_ps' lurking on your disks!  The default one 
  165.  is 2.0.4 and the non-default one is 2.0.7b.  Make sure you use the 
  166.  right one.
  167.  
  168.  Be sure that the new 'getty_ps' works correctly *before* you remove all 
  169.  the other stuff!  I recommend changing one of your virtual console 
  170.  lines from:
  171.  c2:23456:respawn:/etc/getty tty2
  172.  to:
  173.  c2:23456:respawn:/etc/getty_ps tty2 VC console
  174.  
  175.  Put this line in your /etc/gettydefs:
  176.  VC# B9600 SANE CLOCAL # B9600 SANE -ISTRIP CLOCAL #@S @L login: #VC
  177.  
  178.  and restart 'init':
  179.  yourbox# init q     (for poegil init, use "kill -HUP 1")
  180.  
  181.  If you can log in with 'getty_ps', it's working.  Move 'getty_ps' to 
  182.  'getty', or link it.  Be sure to update your /etc/inittab to correctly 
  183.  invoke the new 'getty'.  'getty_ps' can handle the stock 'getty's 
  184.  syntax.
  185.  
  186.  Once you have installed it, and are certain it is working, you can 
  187.  remove any other versions of 'getty' you have.  Be sure to check in 
  188.  /bin, /etc, /usr/bin, /usr/etc, /usr/man/man1, and /usr/man/cat1 for 
  189.  any thing called "getty" - there are old versions lurking everywhere...
  190.  Also, you can safely remove the old config file /etc/gettytab - you 
  191.  only need /etc/gettydefs.
  192.  
  193. 3.2 Customizing 'getty'
  194.  
  195.  There are lots of parameters you can tweak for each port you have.  
  196.  These are implemented in seperate config files for each port (if you 
  197.  want).  I'm not convinced you need them at all.  Mine works fine without
  198.  them.  In general you should only need them to implement setups for 
  199.  unusual situations.  You might consider using the ALTLOCK option, to 
  200.  be sure that all locks are checked properly.  Here are a couple of 
  201.  /etc/default sample files - note the /etc/default/getty will be used 
  202.  by *all* instances of 'getty', and that /etc/default/getty.tty* will 
  203.  only be used by that one port.
  204.  
  205.  /etc/default/getty:
  206.  SYSTEM=<systemname>
  207.  VERSION=/proc/version
  208.  LOGIN=/bin/login
  209.  ISSUE=/ etc/issue
  210.  CLEAR=NO
  211.  HANGUP=YES
  212.  
  213.  /etc/default/getty.ttySX:
  214.  SYSTEM=<systemname>
  215.  VERSION=/proc/version
  216.  LOGIN=/bin/login
  217.  ISSUE=/etc/issue
  218.  CLEAR=NO
  219.  HANGUP=YES
  220.  INIT="" ATZ\r OK
  221.  TIMEOUT=60
  222.  WAITFOR=RING
  223.  CONNECT="" ATA\r CONNECT \s\A
  224.  ALTLINE=cuaX
  225.  
  226.  /etc/default/uugetty.ttySX:
  227.  ALTLOCK=cuaX
  228.  TIMEOUT=60
  229.  INIT="" ATZ\r OK
  230.  DELAY=1
  231.  CLEAR=NO
  232.  
  233.  /etc/default/uugetty.ttySX:
  234.  SYSTEM=<systemname>
  235.  VERSION=/proc/version
  236.  LOGIN=/bin/login
  237.  ISSUE=/etc/issue
  238.  CLEAR=NO
  239.  HANGUP=YES
  240.  INIT="" ATZ1\r
  241.  ALTLINE=cuaX
  242.  ALTLOCK=cuaX
  243.  INITLINE=cuaX
  244.  TIMEOUT=60
  245.  
  246.  
  247. 4.  How do I dial out with my modem?
  248.  
  249. 4.1 Hardware requirements
  250.  
  251.  First, make sure you have the right hardware.  You probably want to 
  252.  hook the modem to the DB25 pin port on your PC.  This requires a 
  253.  straight through cable, with no pins crossed.  (The 9 pin port works 
  254.  nicely for a mouse, since most serial mice already have a DB9 
  255.  connector.)  
  256.  
  257.  For an internal modem, you will not need a modem cable.  Be sure to
  258.  set the interrupt to something that is not being used.
  259.  
  260. 4.2 Connecting to your modem
  261.  
  262.  For now, make sure that nothing is using that port.  Check to see if 
  263.  there is a 'getty' watching it, or it is not locked by anything else.  
  264.  If there is a 'getty' process, check your /etc/inittab file for entries
  265.  using your serial port.  Comment the line out (with "#"), and restart 
  266.  'init'.  Do not comment any lines that contain a tty* device, only 
  267.  ones containing ttyS* or cua*.  tty* are your virtual consoles.
  268.  
  269.  Use 'kermit' to test the setup.  You should set your line to 
  270.  /dev/cua*, and the speed to the highest speed your modem can handle.  
  271.  Try dialing out, or talking to the modem.  If you are properly connected
  272.  your modem should respond to "AT" commands.  If you say "AT" to your 
  273.  modem, it should respond with "OK".  Once you are sure that the modem 
  274.  is functional, you can use more complex programs, like 'Seyon', or 
  275.  'xconn'.
  276.  
  277.  
  278. 5. How do I dial in and out with my modem?
  279.  
  280.  Get your modem to dial out correctly.  
  281.  
  282.  Replace the stock 'getty' with 'getty_ps' as described in HOWTO section
  283.  2.  Update /etc/gettydefs to include entries for modems:
  284.  (note that the entries point to each other, these are not for fixed 
  285.  speed)
  286.  
  287.  # Modem entries
  288.  38400# B38400 CS8 # B38400 SANE -ISTRIP HUPCL #@S @L @B login: #19200
  289.  
  290.  19200# B19200 CS8 # B19200 SANE -ISTRIP HUPCL #@S @L @B login: #9600
  291.  
  292.  9600# B9600 CS8 # B9600 SANE -ISTRIP HUPCL #@S @L @B login: #2400
  293.  
  294.  2400# B2400 CS8 # B2400 SANE -ISTRIP HUPCL #@S @L @B login: #1200
  295.  
  296.  1200# B1200 CS8 # B1200 SANE -ISTRIP HUPCL #@S @L @B login: #300
  297.  
  298.  300# B300 CS8 # B300 SANE -ISTRIP HUPCL #@S @L @B login: #38400
  299.  
  300.  If you have a 9600 bps or faster modem with flow control, you can lock
  301.  your serial port speed and let the modem handle the translation to 
  302.  other bps rates. Then, instead of the step down series of lines listed 
  303.  below, /etc/gettydefs only needs to contain one line for the modem: 
  304.  
  305.  38400# B38400 CS8 # B38400 SANE -ISTRIP HUPCL #@S login: #38400
  306.   or
  307.  19200# B19200 CS8 # B19200 SANE -ISTRIP HUPCL #@S login: #19200
  308.  
  309.  If you have your modem set up to do RTS/CTS hardware flow control, you
  310.  can add CRTSCTS to the entries.
  311.  
  312.  Next, make sure that you have a dialin and dialout device for the port
  313.  and your modem is on.  If you have your modem on /dev/cua1, you will 
  314.  need a device called /dev/ttyS1.  If you don't have the correct devices,
  315.  see the question on how to create devices, and create the devices.
  316.  
  317.  Edit your /etc/inittab, so that 'getty' is run on your serial port:
  318.  
  319.  Add the following line:
  320.  S1:456:respawn:/etc/getty ttyS1 38400
  321.  (    ^-- put your highest modem speed here)
  322.  
  323.  
  324.  Restart 'init':
  325.  yourbox# init q     (for poegil init, use "kill -HUP 1")
  326.  
  327.  Now Linux will be watching your serial port for connections.
  328.  
  329.  Dial in from another site and log in to you Linux system.  Rejoice.
  330.  
  331. 5.1 Note for UUCP users
  332.  
  333.  For sites with UUCP feeds, you probably want to use 'uu_getty', instead
  334.  of plain 'getty'.  It's designed for use with UUCP.  Look at the README
  335.  for it for exact differences.  Most importantly, it checks the lock 
  336.  files that UUCP creates.
  337.  
  338.  
  339. 6.  How do I set up a terminal connected to my PC.
  340.  
  341. 6.1 Hardware requirements
  342.  
  343.  Make sure you have the right kind of cable!  A null modem cable bought 
  344.  at a computer store should do it.  At a minimum, you should have:
  345.  
  346.                 2 - 3     
  347.                 3 - 2      
  348.          7 - 7       
  349.          20 - 20    
  350.  
  351.  If that doesn't work, try the following (a full null modem cable):
  352.  
  353.    2 - 3        Pin names:
  354.    3 - 2       1 Frame Ground 
  355.    4 - 5        2 TxD
  356.    5 - 4       3 RxD 
  357.    6 - 20      4 RTS 
  358.    7 - 7       5 CTS 
  359.    8 - 20      6 DSR 
  360.          20 - 6    7 Signal Ground
  361.                        20 - 8    8 DCD
  362.              20 DTR
  363.  
  364.  You will need pins 4 and 5 if you want to do any kind of hardware flow
  365.  control.
  366.  
  367.  Connect your terminal to your computer.  If you can, tell you terminal
  368.  to ignore modem control signals.  Try using 9600 bps, 8 data bits, 1 
  369.  stop bit, no parity bits.
  370.  
  371. 6.2 Setting up 'getty'
  372.  
  373.  Replace the stock 'getty' with 'getty_ps' as described in section 2.
  374.  Add an entry for 'getty' to use for your terminal in /etc/gettydefs.  
  375.  Mine looks like this:
  376.  
  377.  # 9600 baud Dumb Terminal entry
  378.  DT9600# B9600 CS8 CLOCAL # B9600 SANE -ISTRIP CLOCAL #@S @L login: 
  379.  #DT9600
  380.  
  381.  (the above should all be on one line) 
  382.  
  383.  You might add HUPCL so the login is killed whenever you switch of
  384.  the terminal (provided you use a proper null-modem cable).
  385.  
  386.  Edit your /etc/inittab file to run getty on the serial port.  Mine 
  387.  looks like this:
  388.  
  389.  S1:456:respawn:/etc/getty ttyS1 DT9600 vt100
  390.  
  391.  restart 'init'
  392.  yourbox# init q     (for poegil init, use "kill -HUP 1")
  393.  
  394.  At this point, you should see a login prompt on your terminal.  Rejoice.
  395.  Party.  Log in on your terminal and PC.  'talk' to yourself from 
  396.  accross the room.
  397.  
  398.  
  399. 7.  Can I use more than 2 serial ports?  Can I use a modem, a terminal, 
  400.  and my mouse?
  401.  
  402.  That depends.  The number of serial ports you can use is limited by the
  403.  number of interrupts (IRQ) we have to use.  Each serial devices must 
  404.  be assigned it's own interrupt.  On a PC, each serial port counts as a 
  405.  device.  However, there are specially designed multiport serial cards 
  406.  which have multiple serial ports on one device.  (For those of you who 
  407.  are hardware minded, all it means that is that there is a OR gate 
  408.  combining all of the IRQ outputs from each serial port.)
  409.  
  410.  Your PC will normally come with COM1 and COM3 at IRQ 4, and COM2 and 
  411.  COM4 at IRQ 3.  To use more than 2 serial devices, you will have to 
  412.  give up an interrupt to use.  A good choice is to reassign an interrupt
  413.  from your parallel port.  Your PC normally comes with IRQ 5 and IRQ 7 
  414.  set up as interrupts for your parallel ports, but few people use 2 
  415.  parallel ports.  You can reassign one of the interrupts to a serial 
  416.  device, and still happily use your parallel port.  You will need the 
  417.  'setserial' program to do this.  In addition, you have to play with the
  418.  jumpers on your boards.  
  419.  
  420.  You will need to set things up so that there is one, and only one 
  421.  interrupt for each serial device.  Here is how I set mine up (in 
  422.  /etc/rc.local - you should do it upon startup somewhere):
  423.  
  424.  /etc/setserial /dev/cua0 irq 3  # mouse
  425.  /etc/setserial /dev/cua1 irq 4  # terminal
  426.  /etc/setserial /dev/cua2 irq 5  # modem 
  427.  /etc/setserial /dev/cua3 irq 9  # modem
  428.  # my printer is hooked up on my parallel port IRQ 7 - no change 
  429.  
  430.  The problem is that all of the bus lines on the ISA bus are 
  431.  electrically connected together, in parallel, and all of the bus lines 
  432.  are driven by TTL gates.  If there are two devices simultaneously 
  433.  trying to drive an IRQ line, they end up "fighting" over that line.  
  434.  You get undefined behavior when one of the TTL gates is trying to drive
  435.  the IRQ line low, and the other TTL gate is trying to drive the IRQ 
  436.  line high.  Usually one of the gates will consistently win, with the 
  437.  net result that the computer will only see interrupts from one of the 
  438.  serial devices --- but this is not guaranteed; there may be very 
  439.  erratic behavior as a result.
  440.  
  441.  Standard IRQ assignments:
  442.               IRQ  0    Timer channel 0
  443.        IRQ  1    Keyboard
  444.               IRQ  2    Cascade for controller 2
  445.               IRQ  3    Serial port 2
  446.               IRQ  4    Serial port 1
  447.               IRQ  5    Parallel port 2 (Reserved in PS/2)
  448.               IRQ  6    Floppy diskette
  449.               IRQ  7    Parallel port 1
  450.               IRQ  8    Real-time clock
  451.               IRQ  9    Redirected to IRQ2
  452.               IRQ 10    Reserved
  453.               IRQ 11    Reserved
  454.               IRQ 12    Reserved (Auxillary device in PS/2)
  455.               IRQ 13    Math coprocessor
  456.               IRQ 14    Hard disk controller
  457.               IRQ 15    Reserved
  458.  
  459.  There is really no Right Thing to do when choosing interrupts.  Just 
  460.  make sure it isn't being used.  5 is a good choice.  If 5 is also
  461.  taken, I suggest 2 (which is the same as 9).
  462.  
  463. 8.  Can Linux detect the serial devices automatically?
  464.  
  465.  Yes.  To get Linux to detect and set up the serial devices automatically
  466.  on startup, add the line:
  467.  #define CONFIG_AUTO_IRQ
  468.  to /usr/src/linux/chr_drv/serial.c (look for where the other #defines 
  469.  are).
  470.  You'll have to recompile your kernel.
  471.  
  472.  
  473. 9.  What numbers should my serial devices in /dev have?
  474.  
  475.  The recommended convention is:
  476.  
  477.  /dev/ttyS0 major 4, minor 64 /dev/cua0 major 5, minor 64
  478.  /dev/ttyS1 major 4, minor 65 /dev/cua1 major 5, minor 65
  479.  /dev/ttyS2 major 4, minor 66 /dev/cua2 major 5, minor 66
  480.  /dev/ttyS3 major 4, minor 67 /dev/cua3 major 5, minor 67
  481.  
  482. 9.1  Creating devices with the 'mknod' command
  483.  
  484.  If you don't have a device, you will have to create it with the 'mknod' 
  485.  command.
  486.  
  487.  Example, suppose you needed to create devices for cua0 (COM1):
  488.  
  489.  yourbox# mknod /dev/cua0 c 5 64
  490.  yourbox# mknod /dev/ttyS0 c 4 64
  491.  
  492.  Note that all distributions should come with the correct devices
  493.  already made.
  494.  
  495.  
  496. 10.  How should I configure my modem?
  497.  
  498.  Modems have several registers you can change to your liking.
  499.  You'll have to get your modem connected before you try to set registers.
  500.  Consult your modem manual for more detail on registers.
  501.  
  502. 10.1 Dial out configuration
  503.  
  504.  For dial out use only, configure it however you want.
  505.  
  506.  I like to see result codes, so I set Q0.  I also like to see what I'm 
  507.  typing, so I set E1.
  508.  
  509. 10.2 Dial in and out configuration
  510.  
  511.  For dial in and dial out use, you have to set it up a certain way.
  512.  
  513.  Here is what you have to set: (preceed each register with the AT 
  514.            command - ie ATE0, etc...)
  515.  
  516.  E0 Command echo OFF 
  517.  Q1 NO result codes are reported  
  518.  
  519.  If you don't shut up the modem completely, it will talk to 'getty'.
  520.  'getty' will think someone is trying to log in, and will spawn 'login'.
  521.  This will cause all sorts of confusion.  Not setting these correctly 
  522.  will probably cause the dreaded "respawning to fast" message.
  523.  
  524.  &C1 DCD is on after connect *only*
  525.  
  526.  If DCD is always on, there will always be a connection, and 'getty' 
  527.  will try to log people in.  Not setting this can cause "device busy" 
  528.  errors.
  529.  
  530.  Other things you should set:
  531.  
  532.  &S0 DSR is always on
  533.  &D3 DTR on/off resets modem 
  534.  enable your data compression (setting depend on modem manufacturer, 
  535.  consult your modem manual)
  536.  autobaud       (same applies here)
  537.  
  538.  
  539. 11.  How can I hook up a printer to my serial port?
  540.  
  541.  The answer to this question can be found in the Printing-HOWTO.  It is 
  542.  available on both tsx-11.mit.edu, and sunsite.unc.edu.  There
  543.  may be more than one of these around.  Look for the one maintained by
  544.  Brian McCauley <b.a.mccauley@bhan.ac.uk>.
  545.  
  546.  
  547. 12.  What are locks, and what are they for?
  548.  
  549.  Locks are simply a file saying that a particular device is in use.  
  550.  They are kept in /usr/spool/uucp.  Locks are named LCK..<name>, where 
  551.  <name> is either a device name, or a UUCP site name.  Certain processes
  552.  create these locks so that they can have exclusive access to devices, 
  553.  for instance if you dial out on your modem, a lock will appear telling 
  554.  other processes that someone is using the modem already.  Locks mainly 
  555.  contain the PID of the process that has locked the device.  Most 
  556.  programs look at the lock, and try to determine if that lock is still 
  557.  valid by checking the process table for the process that has locked
  558.  the device.  If the lock is found to be valid, the program should exit.  
  559.  If not, some programs remove the stale lock, and use the device, 
  560.  creating their own lock in the process.
  561.  
  562.  
  563. 13.   What are UARTs?  How do they affect performance?
  564.  
  565.  UARTs (Universal Asyncronous Receiver Transmitter) are chips inside
  566.  your communication devices (terminal, PC).  There is one on each end.  
  567.  Their purpose is to convert characters to bits, send it down the line, 
  568.  and then rebuild characters again on the other end.  The UARTs are 
  569.  asyncronous devices, bacause the time interval between transmission of 
  570.  characters is not fixed.
  571.  
  572.  Say you have a terminal hooked up to your PC.  When you type a 
  573.  character, the terminal presents it to it's UART.  The UART shifts 
  574.  that character (a byte) out onto the serial line one bit at at time, 
  575.  at a specific rate.  Hence, we have the rates 110, 300, 1200, 2400, 
  576.  ... bits/sec (bps).  This is simple a measure of how fast the UART is 
  577.  sending bits.  On the other end, the receiving UART takes all the bits 
  578.  and rebuilds the character (byte).
  579.  
  580.  There are several different types of UARTs.  You have probably heard of
  581.  dumb UARTs - the 8250 and 16450, and smart or FIFO UARTs - the 16550A.    
  582.  To understand their differences, first let's examine what happens when
  583.  a UART has received a character.
  584.  
  585.  The UART itself can't do anything with the character, it just sends and 
  586.  receives them.  The CPU gets an interrupt ever time a character is done
  587.  (receiving or sending).  The CPU then moves that character out of the 
  588.  UART and into memory somewhere.  The 8250 and 16450 UARTs only have a 
  589.  1 character buffer.  That means, that every time a character is done, 
  590.  it interrupts the CPU.  At low rates, this is OK.  But, at high transfer
  591.  rates, the CPU get so busy dealing with the UART, that is doesn't have 
  592.  time to tend to other tasks.  In some cases, the CPU does not get 
  593.  around to servicing the interrupt in time, and the character is 
  594.  overwritten.  
  595.  
  596.  That's where the 16550A UARTs come in.  These chips come with 16 
  597.  character FIFOs.  This means that it can receive or transmit up to 16 
  598.  characters before it has to interrupt the CPU.  Not only can it wait, 
  599.  but the CPU then can transfer all 16 characters at a time.  This is a 
  600.  significant advantage over the other UARTs, which only have the 1 
  601.  character buffer.  The CPU receives significantly less interrupts, and 
  602.  is free to do other things.
  603.  
  604.  In general, the 8250 and 16450 UARTs should be fine for speeds up to 
  605.  19200 bps.  After 19200, you might start seeing character losses, and a 
  606.  reduction in computing speed.
  607.  
  608.  Keep in mind that these dumb UART types are not bad, or harmful, they 
  609.  just aren't good for high speeds.  You should have no problem connecting
  610.  a terminal, or a mouse to these UARTs.  But, for a high speed modem,
  611.  the 16550A is definately a must.
  612.  
  613.  You can buy serial cards with the FIFO UARTs for a little more money,
  614.  just ask your dealer what type of UART is on the card.  Or if you want 
  615.  to upgrade your existing card, you can simply purchase 16550A chips and 
  616.  replace your existing 16450 UARTs.  They are pin-to-pin compatible.
  617.  Some cards come with socketed UARTs for this purpose, if not you can 
  618.  solder.  Note, that you'll probably save yourself a lot of trouble by
  619.  just getting a new card :-).
  620.  
  621.  
  622. 14.  'kermit': a quick start.
  623.  
  624.  'kermit' is one of the many communications programs available to you.  
  625.  It has been ported to nearly ever platform imaginable.
  626.  If you are a beginning user, 'kermit' is a simple way to start using 
  627.  your modem.
  628.   
  629.  Fire up 'kermit' by typing "kermit".  You'll need to set a few basic 
  630.  things up before you can use your modem.  You can keep these commands 
  631.  in $HOME/.kermrc so you don't have to type them every time.  Here is my
  632.  .kermrc as an example.  You'll have to adjust things to fit your setup.
  633.  
  634.  set line /dev/cua3   # serial device you want to use
  635.  set modem v42-telebit # which type of modem you are using
  636.  set speed 38400  # speed 
  637.  
  638.  At this point, you can just type "c" to connect to your modem, and dial
  639.  manually with "at" commands.  Or, from the kermit> prompt, you can use 
  640.  the "dial" command.
  641.  
  642.  If you want to use the zmodem file transfer protocol, you can include:
  643.  define rz !rz </dev/cua3 >/dev/cua3
  644.  define sz !sz \%0 >/dev/cua3 </dev/cua3
  645.  
  646.  in your .kermrc (be sure to put in your correct devices).
  647.  
  648.  This has been a really quick intro, for more info on 'kermit', RTFM. 
  649.  
  650.  
  651. 15.  Troubleshooting:
  652.  
  653. 15.1  I keep getting "line XXX of inittab invalid"
  654.  
  655.  Make sure you are using the correct syntax for your version of 'init'.
  656.  The different 'init's that are out there use different syntax in the 
  657.  /etc/inittab file.  Make sure you are using the correct syntax for your
  658.  version of 'getty'. 
  659.  
  660. 15.2  When I try to dial out, it says "/dev/cuaX: Device or resource busy"
  661.  
  662.  This is one of the most frequent errors people get.  It can happen for 
  663.  a variety of reasons.  If you followed the instructions carefully, this
  664.  should not happen, so double check to make sure you did everything 
  665.  right.  
  666.  
  667.  This problem usually arrises when DCD is not set correctly.  DCD should
  668.  only be set when there is an actual connection (ie someone is dialed 
  669.  in), not when 'getty' is watching the port.  When 'getty' sees DCD get 
  670.  set, it will lock the port and probably spawn 'login'.  Check to make 
  671.  sure that your modem is configured to only set DCD when there is a 
  672.  connection.  DTR and RTS should be set whenever something is using, or 
  673.  watching the line, like 'getty', 'kermit', or some other comm program.
  674.  
  675.  Another common cause of "device busy" errors, is that you set up your 
  676.  serial port with an interrupt already taken by something else.  As each
  677.  device initializes, it asks Linux for permission to use its hardware 
  678.  interrupt.  
  679.  
  680.  Linux keeps track of which interrupt is assigned to whom, and if your 
  681.  interrupt is already taken, your device won't be able to initialize 
  682.  properly.  The device really doesn't have much of any way to tell you 
  683.  that this happened, except that when you try to use it, it will return 
  684.  a device-busy error.
  685.  
  686.  A fix for this may be to remake the kernel, after doing "make config", 
  687.  and answering "no" to all the devices that you don't actually have.  
  688.  If they're compiled in, the software for these devices may be grabbing 
  689.  your interrupt, even though the physical device does not exist.  Also, 
  690.  you can search through the source and include files.  For example, 
  691.  "grep IRQ /usr/src/linux/include/linux/*" yields a 
  692.  "#define MOUSE_IRQ 5" line in busmouse.h.  Another good place to look 
  693.  is in /usr/src/linux/net/tcp/Space.c.  
  694.  
  695.  You might experience problems when you use the WAITFOR or WAITCHAR 
  696.  options in your /etc/defaults/getty.whatever file.  Try taking them out.
  697.  
  698. 15.3  I keep getting "respawning too fast, disableing for 5 minutes".
  699.  
  700.  Make sure your modem is configured correctly.  Look at registers E and 
  701.  Q.  This usually occurs when your modem is chatting with 'getty'.
  702.  
  703. 15.4  I have a modem/terminal connected, but root can't login from the serial
  704.     device.
  705.  
  706.  This is done on purpose for security reasons.  Generally, you should 
  707.  only have root logins enabled on the console.  It is considered 
  708.  dangerous to allow root logins on anything other than the console.  
  709.  
  710.  But, you asked...  Edit /etc/login.defs, and find the line that says 
  711.  CONSOLE.  Add the name of the serial device to it.  Say I have my 
  712.  terminal on /dev/ttyS1.  I would change the line:
  713.  CONSOLE tty1:tty2:tty3:tty4:tty5:tty6:tty8
  714.  to
  715.  CONSOLE tty1:tty2:tty3:tty4:tty5:tty6:tty8:ttyS1
  716.  
  717.  
  718. 15.5  I have my terminal connected to my PC, but after I type in a login name,
  719.  it just locks up.
  720.  
  721.  You probably don't have CLOCAL in your /etc/gettydefs entry for the 
  722.  terminal.  You need CLOCAL.  Here is what it should look like:
  723.  
  724.  # 9600 baud Dumb Terminal entry
  725.  DT9600# B9600 CS8 CLOCAL # B9600 SANE -ISTRIP CLOCAL #@S @L login: 
  726.  #DT9600
  727.  
  728.  Next, "kill -HUP" the 'getty' process to make it read the entry again.
  729.  
  730. 15.6  At high speeds, my modem looses characters, and my computer gets really 
  731.  slow!
  732.  
  733.  If you are trying to run your modem at > 19200 bps, and you don't have 
  734.  16550A UARTs, you should upgrade them.  See the section about UARTs.
  735.  
  736. 16.  Contributions 
  737.  
  738.  There was no possible way to write this HOWTO alone.  Much of the 
  739.  material is repeated verbatim from the original sources.
  740.  
  741.  Contributions, ideas, suggestions, and material:
  742.  (in alphabetical order)
  743.  
  744.  Brandon S. Allbery <bsa@kf8nh.wariat.org>
  745.  Karl Buck <kxb@cis.ksu.edu>
  746.  Bryan Curnutt <bryan%uhura1@uunet.uu.net>
  747.  Arthur Donkers <arthur%ptt-iat@nluug.nl>
  748.  Karlheinz Hagen <kalle@dg8lav.toppoint.de>
  749.  Michael Hamilton <hamilton@golem.wcc.govt.nz>
  750.  Wayne Hayes <wayne@csri.toronto.edu>
  751.  John Henders <jhenders@jonh.wimsey.bc.ca>
  752.  Ed Carp <erc@apple.com>
  753.  Cheng Chang Huang <huangch@cps.msu.edu>
  754.  Camillus Jayewardena <jayeward@abs.ascom.ch>
  755.  Jerry Kaidor <jkaidor@synoptics.com>
  756.  Juha Laiho <jlaiho@ichaos.nullnet.fi>
  757.  Bambang N. Prastowo <prastowo@qucis.queensu.ca>
  758.  Mark Schwabacher <schwabac@yoko.rutgers.edu>
  759.  Andrew Tefft <teffta@engr.dnet.ge.com>
  760.  Theodore Ts'o <tytso@Athena.MIT.EDU>
  761.  
  762. END OF SERIAL-HOWTO
  763.