home *** CD-ROM | disk | FTP | other *** search
/ IT.SOFT 22 / ITSOFTCD_22.iso / mac / linux22 / slackware3.6 / DOCS / TEXT-TERMINAL-HOWTO.;1 < prev    next >
Encoding:
Text File  |  1998-10-10  |  253.1 KB  |  5,809 lines  |  [TEXT/hscd]

  1.   Text-Terminal-HOWTO
  2.   David S. Lawyer,  <mailto:bf347@lafn.org>
  3.   v1.01, October 1998
  4.  
  5.   This document explains what text terminals are, how they work, how to
  6.   install and configure them, and provides some info on how to repair
  7.   them.  It may be of some use even if you don't have a terminal manual.
  8.   While it's written for real terminals on a Linux system, some of it is
  9.   also applicable to terminal emulation and may be helpful for non-Linux
  10.   systems.
  11.   ______________________________________________________________________
  12.  
  13.   Table of Contents
  14.  
  15.  
  16.  
  17.  
  18.  
  19.  
  20.  
  21.  
  22.  
  23.  
  24.  
  25.  
  26.  
  27.  
  28.  
  29.  
  30.  
  31.  
  32.  
  33.  
  34.  
  35.  
  36.  
  37.  
  38.  
  39.  
  40.  
  41.  
  42.  
  43.  
  44.  
  45.  
  46.  
  47.  
  48.  
  49.  
  50.  
  51.  
  52.  
  53.  
  54.  
  55.  
  56.  
  57.  
  58.  
  59.  
  60.  
  61.  
  62.  
  63.  
  64.  
  65.  
  66.  
  67.   1. Introduction
  68.  
  69.      1.1 Copyright, Trademarks, Disclaimer, & Credits
  70.         1.1.1 Copyright
  71.         1.1.2 Trademarks
  72.         1.1.3 Disclaimer
  73.         1.1.4 Credits
  74.      1.2 Future Plans: You Can Help
  75.      1.3 New Versions of this HOWTO
  76.      1.4 Related HOWTO's
  77.      1.5 Terminology Used in this Document
  78.      1.6 What is a Terminal ?
  79.  
  80.   2. Types of Terminals
  81.  
  82.      2.1 Dumb Terminals
  83.      2.2 Text Terminals
  84.      2.3 Graphics Terminals
  85.         2.3.1 Serial Line Graphics Terminals
  86.         2.3.2 Fast Graphics Terminals (often known by other names)
  87.      2.4 Quasi-Terminals (= Quasi-Computers)
  88.      2.5 Emulation on a PC
  89.  
  90.   3. Quick Install
  91.  
  92.   4. Why Use a Terminal ?
  93.  
  94.      4.1 Introduction
  95.      4.2 Lower Hardware Costs
  96.      4.3 Control of Software
  97.      4.4 Hardware Upgrades
  98.      4.5 Other Advantages of Terminals
  99.      4.6 Major Disadvantages of Terminals
  100.      4.7 Are Text Terminals Obsolete ?
  101.  
  102.   5. Overview of How Terminals Work (in Linux)
  103.  
  104.      5.1 Device Names
  105.      5.2 Login/Logout
  106.      5.3 Half/Full Duplex
  107.      5.4 Terminal Memory
  108.      5.5 Commands for the Terminal
  109.      5.6 Lack of Standardization Solved by Terminfo
  110.      5.7 The Interface
  111.      5.8 Emulation
  112.      5.9 The Console
  113.  
  114.   6. Terminal Special Files: /dev/tty... etc.
  115.  
  116.      6.1 Serial Port Terminals
  117.      6.2 Pseudo Terminals
  118.      6.3 The Controlling Terminal /dev/tty
  119.      6.4 /dev/ttyIN "Terminals"
  120.      6.5 The Console: /dev/ttyN
  121.      6.6 Creating a Device with
  122.  
  123.   7. Some Details on How Terminals Work
  124.  
  125.      7.1 Terminal Memory
  126.      7.2 Early Terminals
  127.      7.3 Escape Sequences and Control Codes (intro)
  128.         7.3.1 Control Codes
  129.         7.3.2 Escape Sequences
  130.      7.4 Display Attributes & Magic Cookies
  131.  
  132.   8. Special Features of Some Terminals
  133.      8.1 Color
  134.      8.2 Dual Sessions
  135.      8.3 Printer/Auxiliary Port
  136.      8.4 Pages
  137.      8.5 Character-Sets
  138.      8.6 Fonts
  139.      8.7 Keyboards & Special Keys
  140.  
  141.   9. Terminal Emulation; the Console
  142.  
  143.      9.1 Terminal Emulation
  144.         9.1.1 Communication (Dialing) programs
  145.         9.1.2 Emulation under X-Windows
  146.         9.1.3 Real Terminals Better
  147.      9.2 The Linux Console
  148.  
  149.   10. Flow Control (Handshaking)
  150.  
  151.      10.1 Why Is Flow Control Needed ?
  152.      10.2 Padding
  153.      10.3 Overrunning a Serial Port
  154.      10.4 Stop Sending
  155.      10.5 Keyboard Lock
  156.      10.6 Resume Sending
  157.      10.7 Hardware Flow Control (RTS/CTS etc.)
  158.         10.7.1 RTS/CTS and DTR Flow Control
  159.         10.7.2 Connecting Up DTR Flow Control
  160.         10.7.3 Old RTS/CTS Handshaking Is Different
  161.         10.7.4 Reverse Channel
  162.      10.8 Is Hardware Flow Control Done by Hardware ?
  163.      10.9 Obsolete ?? ETX/ACK or ENQ/ACK Flow Control
  164.  
  165.   11. Physical Connection
  166.  
  167.      11.1 Multiport I/O Cards (Adapters)
  168.      11.2 Direct Cable Connection.
  169.         11.2.1 Null Modem Cable Pin-out (3 or 4 conductor)
  170.         11.2.2 Null Modem Cable Pin-out (7 conductor)
  171.         11.2.3 Length Limitations
  172.         11.2.4 Hardware Flow Control Cables
  173.         11.2.5 Cable Tips
  174.         11.2.6 A Kludge using Twisted-Pair Cable
  175.         11.2.7 Cable Grounding
  176.      11.3 Modem Connection
  177.         11.3.1 Dialing Out From a Terminal
  178.         11.3.2 Terminal Gets Dialed Into
  179.      11.4 Terminal Server Connection
  180.      11.5 Connector and Adapter Types
  181.         11.5.1 Sex of Connector/Adapters
  182.         11.5.2 Types of Adapters
  183.         11.5.3 DB Connectors
  184.         11.5.4 RJ Modular Connectors
  185.      11.6 Making or Modifying a Cable
  186.         11.6.1 Buy or Make ?
  187.         11.6.2 Installing DB Connectors
  188.         11.6.3 Installing RJ Connectors
  189.  
  190.   12. Set-Up (Configure) in General
  191.  
  192.      12.1 Introduction
  193.      12.2 Terminal Set-Up (Configure) Overview
  194.      12.3 Computer Set-Up (Configure) Overview
  195.      12.4 Many Options
  196.      12.5 Communication Interface Options
  197.         12.5.1 Speed
  198.         12.5.2 Parity & Should You Use It ?
  199.         12.5.3 Bits/Character
  200.         12.5.4 Which Flow Control (Handshaking) ?
  201.         12.5.5 Port Select
  202.      12.6 Quick Attempt
  203.  
  204.   13. Terminal Set-Up (Configure) Details
  205.  
  206.      13.1 Send Escape Sequences to the Terminal
  207.      13.2 Older Terminals Set-Up
  208.      13.3 Getting Into Set-Up (Configuration) Mode
  209.      13.4 Communication Options
  210.      13.5 Saving the Set-up
  211.      13.6 Set-Up Options/Parameters
  212.      13.7 Emulation {Personality} {{Terminal Modes}}
  213.      13.8 Display Options
  214.         13.8.1 Character Cell Size {Char Cell}
  215.         13.8.2 Columns/Lines
  216.         13.8.3 Cursor
  217.         13.8.4 Display Attributes (Magic Cookies)
  218.         13.8.5 Display Control Characters {Monitor}
  219.         13.8.6 Double Width/Height
  220.         13.8.7 Reverse Video {Display} (Background Light/Dark)
  221.         13.8.8 Status Line
  222.         13.8.9 Upon 80/132 Change: Clear or Preserve?
  223.      13.9 Page Related Options
  224.         13.9.1 Page Size
  225.         13.9.2 Coupling (of cursor & display)
  226.      13.10 Reporting and Answerback
  227.         13.10.1 Answerback Message (String)
  228.         13.10.2 Auto Answerback
  229.         13.10.3 Answerback Concealed
  230.         13.10.4 Terminal ID {ANSI ID}
  231.      13.11 Keyboard Options
  232.         13.11.1 Keyclick
  233.         13.11.2 Caps Lock {Keylock}
  234.         13.11.3 Auto Repeat {Repeat}
  235.         13.11.4 Margin Bell
  236.         13.11.5 Remapping the Keys
  237.         13.11.6 Corner Key (for Wyse only)
  238.         13.11.7 Numeric Keypad or Arrow Keys Sends
  239.         13.11.8 What does shifted-del and shifted-bs send?
  240.         13.11.9 PC Scan Codes
  241.         13.11.10 Alternate Characters
  242.      13.12 Meaning of Received Control Codes
  243.         13.12.1 Auto New Line {Newline}
  244.         13.12.2 Auto Line Feed {Rcv CR}
  245.         13.12.3 Recognize Del (Wyse Only ??) or Null
  246.      13.13 Where New Text Goes
  247.         13.13.1 Line Wrap
  248.         13.13.2 Scrolling
  249.         13.13.3 New Page?
  250.      13.14 Function Keys
  251.      13.15 Block Mode Options
  252.         13.15.1 Forms Display
  253.         13.15.2 Send Entire Block ?
  254.         13.15.3 Region to Send
  255.         13.15.4 Block/Page terminator
  256.      13.16 Locks
  257.      13.17 Screen Saver {Scrn Saver}
  258.      13.18 Printer
  259.  
  260.   14. Computer Set-Up (Configure) Details
  261.  
  262.      14.1 Getty (in /etc/inittab)
  263.         14.1.1 Agetty (may be named getty)
  264.         14.1.2 getty (part of getty_ps)
  265.         14.1.3 Mgetty
  266.      14.2 Stty & Setserial
  267.         14.2.1 Setserial
  268.         14.2.2 Where to Run Setserial ?
  269.         14.2.3 Stty
  270.         14.2.4 Where to Put the Stty Command ?
  271.      14.3 Terminfo & Termcap (brief)
  272.      14.4 Setting TERM and TERMINFO
  273.      14.5 Rarely Needed /etc/ttytype File
  274.      14.6 Login Restrictions
  275.      14.7 Run Command Only If TERM=my_term_type
  276.  
  277.   15. Terminfo and Termcap (detailed)
  278.  
  279.      15.1 Introduction
  280.      15.2 Terminfo Database
  281.         15.2.1 Terminfo Compiler (tic)
  282.         15.2.2 Look at Your Terminfo
  283.         15.2.3 Deleting Data Not Needed
  284.      15.3 Modifying Terminfo Files
  285.      15.4 Init String
  286.      15.5 TERM Variable
  287.      15.6 Terminfo/Termcap Documents
  288.  
  289.   16. Using the Terminal
  290.  
  291.      16.1 Introduction
  292.      16.2 Starting Up the Terminal
  293.      16.3 Terminal Device Driver
  294.      16.4 Problems with Editors
  295.         16.4.1 emacs and ^Q
  296.         16.4.2 vi and Cursor-Keys
  297.      16.5 Display Freezes (hung terminal)
  298.      16.6 Corrupted Terminal Interface
  299.         16.6.1 Symptoms
  300.         16.6.2 Sent Terminal Binary Characters
  301.         16.6.3 Abnormally Exited a Program
  302.      16.7 Special (Control) Characters
  303.         16.7.1 Command-Line Editing
  304.         16.7.2 Interrupting (& Quit, Suspend, EOF, Flush)
  305.         16.7.3 Scrolling
  306.         16.7.4 Take Next Character Literally
  307.      16.8 Viewing Latin-1 Files on a 7-bit Terminal
  308.      16.9 Inspecting the Interface
  309.      16.10 Changing the Terminal Settings
  310.         16.10.1 setterm
  311.         16.10.2 tput
  312.         16.10.3 echo
  313.         16.10.4 Saving Changes
  314.      16.11 Make a Terminal the Console
  315.  
  316.   17. Trouble-Shooting (software)
  317.  
  318.      17.1 Terminal Was Working OK
  319.      17.2 Terminal Newly Installed
  320.      17.3 Is the Terminal OK ?
  321.      17.4 Missing Text
  322.      17.5 Getty Respawning Too Rapidly
  323.         17.5.1 No Modem Control Voltage
  324.         17.5.2 Key Shorted
  325.      17.6 Fails Just After Login
  326.      17.7 Can't Login
  327.      17.8 Garbled Login Prompt
  328.      17.9 No Sign of any Login Prompt
  329.         17.9.1 Diagnose Problem from the Console
  330.         17.9.2 Measure Voltages
  331.      17.10 Serial Monitoring/Diagnostics
  332.      17.11 Local Mode
  333.      17.12 Serial Electrical Test Equipment
  334.         17.12.1 Breakout Gadgets, etc.
  335.         17.12.2 Measuring Voltages
  336.         17.12.3 Taste Voltage
  337.  
  338.   18. Repair & Diagnose
  339.  
  340.      18.1 Repair Books & Websites
  341.         18.1.1 Books
  342.         18.1.2 Websites
  343.      18.2 Safety
  344.      18.3 Appearance of Display
  345.      18.4 Diagnose
  346.         18.4.1 Terminal Made a Noise
  347.         18.4.2 Terminal Made No Noise
  348.      18.5 Capacitors
  349.      18.6 Keyboards
  350.         18.6.1 Interchangeability
  351.         18.6.2 How They Work
  352.         18.6.3 One Press Types 2 Different Characters
  353.         18.6.4 Modern vs Old Keyboards
  354.         18.6.5 Keyboard Doesn't Work At All
  355.         18.6.6 Typing b Displays bb, etc. (doubled)
  356.         18.6.7 The Keyboard Types By Itself
  357.         18.6.8 Liquid Spilled on the Keyboard
  358.         18.6.9 Cleaning Keyboard Contacts
  359.            18.6.9.1 Keyboards with Membranes
  360.            18.6.9.2 Keyboards with Individual Switches
  361.  
  362.   19. Appendix A: General
  363.  
  364.      19.1 List of Linux Terminal Commands
  365.         19.1.1 Sending a Command to the Terminal
  366.         19.1.2 Configuring the Terminal Device Driver
  367.         19.1.3 Terminfo
  368.         19.1.4 Other
  369.      19.2 The Internet and Books
  370.         19.2.1 Terminal Info on the Internet
  371.         19.2.2 Books Related to Terminals
  372.         19.2.3 Entire Books on Terminals
  373.         19.2.4 Books with Chapters on Terminals
  374.      19.3 Non-Linux OS's
  375.  
  376.   20. Appendix B: Escape Sequence Commands Terminology
  377.  
  378.      20.1 Esc Sequence List
  379.      20.2 Printer Esc
  380.      20.3 Reports
  381.      20.4 Cursor Movements
  382.      20.5 Pages
  383.  
  384.   21. Appendix C: Serial Communications on EIA-232 (RS-232)
  385.  
  386.      21.1 Introduction
  387.      21.2 Voltages
  388.         21.2.1 Voltage for a Bit
  389.         21.2.2 Voltage Sequence for a Byte
  390.      21.3 Parity Explained
  391.      21.4 Forming a Byte (Framing)
  392.      21.5 Limitations of EIA-232
  393.         21.5.1 Low Speed & Short Distance
  394.         21.5.2 Successors to EIA-232
  395.         21.5.3 Line Drivers
  396.      21.6 Synchronization & Synchronous
  397.         21.6.1 How "Asynchronous" is Synchronized
  398.         21.6.2 Defining Asynchronous vs Synchronous
  399.         21.6.3 Synchronous Communication
  400.      21.7 Block Mode
  401.         21.7.1 Introduction
  402.         21.7.2 Types of Block Modes, Forms
  403.         21.7.3 Efficiency
  404.      21.8 EIA-232 (RS-232) Books
  405.      21.9 Serial Software
  406.  
  407.   22. Appendix D: Notes by Brand Name
  408.  
  409.      22.1 CIT
  410.      22.2 IBM
  411.         22.2.1 IBM 3153
  412.      22.3 Teletypes
  413.      22.4 VT (DEC)
  414.      22.5 Wyse
  415.         22.5.1 Wyse 99-GT
  416.         22.5.2 Wyse 150
  417.  
  418.  
  419.   ______________________________________________________________________
  420.  
  421.   1.  Introduction
  422.  
  423.   For a quick attempt to install a terminal see ``Quick Install''.
  424.  
  425.  
  426.   1.1.  Copyright, Trademarks, Disclaimer, & Credits
  427.  
  428.   1.1.1.  Copyright
  429.  
  430.   Copyright 1998 by David S. Lawyer.  Please freely copy and distribute
  431.   (sell or give away) this document.  Derivative works are permitted
  432.   provided you: 1. Make a good faith effort to insure that a copy
  433.   (including any master copy) gets on the Internet at an appropriate
  434.   site for free downloading.  2. License the work in the spirit of this
  435.   license, or use GPL (Free Software Foundation) 3. Make a good faith
  436.   effort to contact the maintainer (or principal copyright owners if
  437.   there is no maintainer) to let them know what you have done.  If the
  438.   changes are extensive, then you should also attempt to make more such
  439.   contacts before and possibly during your project.  4. Give full credit
  440.   to significant previous authors and contributors although the credits
  441.   section need not exceed 1% of the length of the document.
  442.  
  443.  
  444.   1.1.2.  Trademarks
  445.  
  446.   If certain words are trademarks, the context should make it clear to
  447.   whom they belong.  For example "MS Windows NT" implies that "Windows
  448.   NT" belongs to Microsoft (MS). Mac is by Apple Computer.  Trademarks
  449.   belong to their respective owners.
  450.  
  451.  
  452.   1.1.3.  Disclaimer
  453.  
  454.   Much of the info in this HOWTO was obtained from the Internet,
  455.   obsolete manuals, etc. and may be unreliable (although I've done some
  456.   double checking in some cases).  While I haven't intentionally tried
  457.   to mislead you, there are likely a number of errors in this document.
  458.   Please let me know about them.  Since this is free documentation, it
  459.   should be obvious that I cannot be held legally responsible for any
  460.   errors.
  461.  
  462.  
  463.   1.1.4.  Credits
  464.  
  465.   Most of chapter 8 from Serial-HOWTO v. 1.11 by Greg Hankins entitled:
  466.   "How Do I Set Up A Terminal Connected To My PC?"  was incorporated
  467.   into version 1.00 at various places.  The portions not incorporated
  468.   were on topics already covered in my previous version v0.05.
  469.  
  470.  
  471.   1.2.  Future Plans: You Can Help
  472.  
  473.   Please let me know of any errors in facts, opinions, logic, spelling,
  474.   grammar, clarity, links, etc.  But first, if the date is over a few
  475.   months old, check to see that you have the latest version.  Please
  476.   send me any info that you think belongs in this document.
  477.  
  478.   Starting with version 1.00, a first attempt was made to help people
  479.   set up terminals without recourse to a terminal manual.  Much more is
  480.   needed in this respect.  One way to solve this problem would be if
  481.   terminal manufacturers put their manuals on the Internet.  I suggest
  482.   that you encourage them to do so.  The task of providing information
  483.   on how to configure most terminals in this HOWTO is daunting.  There
  484.   are so many different terminals, but there are far fewer models than
  485.   there used to be in the 1980,s so the task is not totally infeasible.
  486.  
  487.   Please send me any surplus terminal manuals which you may have,
  488.   especially on terminals made within the past 10 years (but I'll accept
  489.   older ones also).  Also, you might want to write up something on a
  490.   certain terminal to put in the Appendix D: Notes by Brand Name.  My
  491.   email in 1998 is  <mailto:bf347@lafn.org>.
  492.  
  493.  
  494.   1.3.  New Versions of this HOWTO
  495.  
  496.   New versions of the Text-Terminal-HOWTO will be available to browse
  497.   and/or download at LDP mirror sites.  For a list of such sites see:
  498.   <http://sunsite.unc.edu/LDP/mirrors.html> When you get to a a nearby
  499.   mirror site, click on "Linux Documentation Project" (LDP) and then
  500.   search for the 2nd occurrence of "HOWTO".  Various formats are
  501.   available.  If you only want to quickly check the date of the latest
  502.   version (please don't spend a long time browsing there --you should
  503.   browse at your nearest mirror site) go to:
  504.   <http://sunsite.unc.edu/LDP/HOWTO/Text-Terminal-HOWTO.html>.
  505.  
  506.  
  507.   1.4.  Related HOWTO's
  508.  
  509.  
  510.   ∑  Serial-HOWTO has info on Multiport Serial Cards used for both
  511.      terminals and banks of modems.  Technical info on the serial port
  512.      will appear in the next revision of it (with less serial technical
  513.      info in this HOWTO).
  514.  
  515.   ∑  Modem-HOWTO (to be released in Oct. 1998)
  516.  
  517.   ∑  Serial-Programming-HOWTO
  518.  
  519.   ∑  Xterminal-HOWTO (unmaintained).  It's at
  520.      <http://sunsite.unc.edu/pub/Linux/docs/HOWTO/unmaintained/mini/Xterminal>
  521.  
  522.  
  523.   1.5.  Terminology Used in this Document
  524.  
  525.   Configuration means the same as set-up.  While Linux commands take
  526.   options (using - symbols), options in a broader sense include various
  527.   other types of choices.  Install in the broad sense includes setting
  528.   up (configuring) software and hardware.  A statement that I suspect is
  529.   true (but may not be) ends with 2 question marks: ??  If you know for
  530.   sure, let me know.
  531.  
  532.  
  533.   1.6.  What is a Terminal ?
  534.  
  535.   A terminal consists of a screen and keyboard that one uses to
  536.   communicate remotely with a (host) computer.  One uses it just like it
  537.   was a personal computer but the terminal is remote from the host
  538.   computer (on the other side of the room or even on the other side of
  539.   the world).  Programs execute on the host computer but the results
  540.   display on the terminal screen.  Its computational ability is
  541.   relatively low (otherwise it would be a computer and not a terminal).
  542.   This computational ability is generally limited to the ability to
  543.   display what is sent to it (possibly including full-screen graphics)
  544.   and the ability to send to the host what is typed at the keyboard.
  545.  
  546.   In the days of mainframes from the mid 1970's to the mid 1980's, most
  547.   people used terminals to communicate with computers.  They typed in
  548.   programs, ran programs, wrote documents, issued printing commands,
  549.   etc.  A cable connected the terminal to the computer (often
  550.   indirectly).  It was called a terminal since it was located at the
  551.   terminal end of this cable.
  552.  
  553.   If you've been using Linux (except for X-Window use) with a computer
  554.   monitor and keyboard you already know what a terminal is because you
  555.   have been using one (or more precisely a "virtual terminal").  The
  556.   monitor (along with the keyboard) is called the console, but it
  557.   emulates a terminal.  In X-Windows: xterm, rxvt, and zterm emulate
  558.   terminals.
  559.  
  560.   A real terminal is different from a monitor because it's a different
  561.   electronic setup.  A text terminal is often connected to a serial port
  562.   of the computer via a long cable.  Thus, in contrast to a monitor
  563.   which is usually located right next to the computer, a terminal may be
  564.   quite a distance away from its host computer.  The video card inside a
  565.   computer stores the video image seen on the monitor screen.  For a
  566.   terminal, the equivalent of this video card is built right into the
  567.   terminal but since text terminals are often monochrome without much
  568.   graphics, the capabilities of its "video card" are rather weak.  Also,
  569.   most text terminals do not have mice.
  570.  
  571.   In network client-server terminology, one might think that the
  572.   terminal is the client and that the host computer is the server.  The
  573.   terminal has been called a "thin client" by some.  This is not
  574.   actually true since the only "service" the host provides is to receive
  575.   every letter typed at the keyboard and react to this just like a
  576.   computer would.  The terminal is like a window into the computer just
  577.   like a monitor (and keyboard) are.  You may have already used virtual
  578.   terminals in Linux (by pressing Alt-F2, etc.).  A real terminal is
  579.   just like running such a virtual terminal on its own screen and
  580.   keyboard.  In contrast to using a virtual terminal at the console
  581.   (monitor), this allows another person to sit at the real terminal and
  582.   use the computer simultaneously with others.
  583.  
  584.  
  585.   2.  Types of Terminals
  586.  
  587.   2.1.  Dumb Terminals
  588.  
  589.   There are various conflicting definitions of "dumb terminal" but as
  590.   time goes by, more and more terminals are called dumb.  This document
  591.   mainly covers text terminals which display only text on the screen.
  592.   It might be titled "Dumb-Terminal-HOWTO" but in some magazines
  593.   articles any terminal, no matter how smart, including ones which
  594.   present a full graphical user interface (GUI), are called dumb.  If
  595.   all terminals are "dumb" then there is no point of prefixing the word
  596.   "dumb" to terminal (except as a sales pitch to sell computers or the
  597.   like in place of "smart" terminals).  Due to the ambiguous meaning of
  598.   "dumb terminal" it is not classified here as a type of terminal.
  599.  
  600.  
  601.   2.2.  Text Terminals
  602.  
  603.   For a text terminal, a 2-way flow of information between the computer
  604.   and the terminal takes place over the cable that connects them
  605.   together.  This flow is in ASCII bytes where each byte usually
  606.   represents a character.  Bytes typed at the keyboard go to the
  607.   computer and most bytes from the computer are displayed on the
  608.   terminal screen.  Special bytes (or sequences of bytes) from the
  609.   computer tell the terminal where to move the cursor to, what to erase,
  610.   where to begin and end underlining and/or blinking and/or bold, etc.
  611.   There are often hundreds of such special commands and many terminals
  612.   can even change fonts.
  613.  
  614.   The communication uses characters (letters) encoded using a code chart
  615.   for the character set being used.  Usually, the first 128 bytes out of
  616.   256 possible bytes use ASCII codes.  Terminals for Unix-like systems,
  617.   normally connect to computers via a cable running between the
  618.   asynchronous serial ports (RS-232-C = EIA-232-D) of the host computer
  619.   and terminal.  Sometimes the connection is via modem or terminal
  620.   server, etc.
  621.  
  622.   Other names for text terminals are "serial terminal", "character-cell
  623.   terminal", "ASCII/ANSI terminal", "asynchronous terminal", "data
  624.   terminal", "video terminal" and "video display terminal" (VDT).  In
  625.   olden days "video display unit" (VDU) was used for terminals but
  626.   strictly speaking, it excludes the keyboard.
  627.  
  628.   "Block mode" was used exclusively by old IBM mainframe terminals but
  629.   many modern terminals also have this capability (which is not used
  630.   much).  The characters you type are temporarily retained in the
  631.   terminal memory (and may possibly be edited by a built-in editor at
  632.   the terminal).  Then when the send key (or the like) is pressed, a
  633.   block of characters (sometimes just a line of characters) is sent to
  634.   the computer all at once.  Block mode (as of late 1998) is not
  635.   supported by Linux.  Block mode makes the terminal a block device (and
  636.   not a character device).  See section ``Block Mode''.
  637.  
  638.  
  639.   2.3.  Graphics Terminals
  640.  
  641.   To a limited degree some ASCII symbols can provide graphics on text
  642.   terminals.  One may form  arrows <--- and draw boxes with _ and |.
  643.   With special graphic character sets, even more is possible.  None of
  644.   these are really graphics terminals.  However, the term "graphics
  645.   terminal" is sometimes applied to all text-only terminals since text
  646.   is a limited form of graphics.
  647.  
  648.   There are two basic types of graphics displays: raster and vector
  649.   (rarely used).  Raster graphics (bit-mapped) puts dots on the screen
  650.   by horizontal scan lines drawn by an electron beam (or by activating
  651.   pixels or dots on a flat screen).  Vector graphic displays use smart
  652.   electronics to draw lines and curves with an electron beam that can
  653.   move in any direction.  Vector graphics draws high quality lines
  654.   without zig-zags but is both rare and expensive.  Raster graphics is
  655.   almost universally used today.  For PC's, images encoded in vector
  656.   graphic format are sometimes used but they are translated to raster
  657.   graphics format for display (with a drop in image quality).
  658.  
  659.  
  660.  
  661.   2.3.1.  Serial Line Graphics Terminals
  662.  
  663.   Most of this document also applies to these.  Most of these can also
  664.   function as text terminals.  The protocols for such graphics include:
  665.   Tektronix Vector Graphics, ReGIS (DEC), Sixel (DEC), and NAPLPS (North
  666.   American Presentation Level Protocol Syntax).
  667.  
  668.  
  669.   2.3.2.  Fast Graphics Terminals (often known by other names)
  670.  
  671.   None of these covered in this document.  A terminal that deserves to
  672.   be called smart is a graphics terminal which can rapidly display full-
  673.   screen graphics just like a PC monitor.  It will also have a mouse.
  674.   Bytes sent to it often represent bit-maps for pictures (and other
  675.   graphics).  It will often use a high-speed connection to the computer
  676.   using twisted pair or coax cable.  X-Window terminals are such
  677.   devices.  See the link to Xterminal-HOWTO at ``Related HOWTO's''
  678.  
  679.   For displaying a MS-Windows GUI there are at various types of
  680.   interfaces and terminals: Winterm using WinFrame software from Citrix
  681.   is one.  Another (based in part on Citrix's code) is Hydra (code name)
  682.   by Microsoft, also known as "Windows Terminal Server" which works with
  683.   versions 4 or higher of MS Windows NT.  Citrix uses its ICA protocol
  684.   and has created an add-on to Hydra known as pICAsso so that WinFrame
  685.   (ICA) based terminals can use the Hydra system.  Hydra is also multi-
  686.   user.  There is also the "MultiConsole Personal Terminal" by Unbounded
  687.   Technologies and Tektronix had its own multi-user interface but will
  688.   now support Hydra.  A magazine article in 1997 called Winterm a "dumb
  689.   terminal" but it's really pretty smart.  Such terminals are often
  690.   called "thin clients", but some thin clients are more that just
  691.   terminals as they can execute Java code sent to them, etc.
  692.  
  693.  
  694.   2.4.  Quasi-Terminals (= Quasi-Computers)
  695.  
  696.   "Quasi" is my terminology (not standard).  These are neither true
  697.   computers nor terminals but are something in-between.  Network
  698.   Computers (NC's) are computers with a CPU but no hard Disk.  They are
  699.   full-graphics and connect to a server computer.  They are different
  700.   from terminals since the programs they run execute on their own CPU
  701.   chips.  Java code may be sent to them for execution.  They should work
  702.   on IP networks and might work under a server running Linux.  Wintel
  703.   established a "NetPC" which, unlike the NC, is almost a PC computer.
  704.   However, it has no removable disks so users can't install their own
  705.   software or obtain copies of anything.
  706.  
  707.  
  708.   2.5.  Emulation on a PC
  709.  
  710.   Since a PC has a screen and keyboard (as does a terminal) but also has
  711.   much more computing power, it's easy to use some of this computing
  712.   power to make the PC computer behave like a text terminal.  This is
  713.   "terminal emulation".  It's not strictly a type of terminal since
  714.   emulation could emulate any of the above types (but the most common is
  715.   the emulation of a text terminal).  See ``Terminal Emulation''
  716.  
  717.  
  718.   3.  Quick Install
  719.  
  720.   This is a quick procedure to install a terminal without going through
  721.   a ``Setup'' procedure for both the terminal and the host computer.  It
  722.   probably will not work right if the terminal happens to have been set
  723.   up incompatible with the computer.  If you don't understand some of it
  724.   you'll need to consult other parts of this document for more info.
  725.  
  726.  
  727.   To install a terminal, first look in /etc/termcap or terminfo.src to
  728.   find an entry for it (see ``Terminfo and Termcap (detailed)'').
  729.   Figure out what serial port you'll connect it to and what the tty
  730.   designation is for that port (e.g. ttyS1, see ``Device Names''.  As
  731.   the root user, edit /etc/inittab and add a getty command next to the
  732.   other getty commands.  The format of the getty command depends on
  733.   which getty program you use.  agetty (called just getty in the Debian
  734.   distribution) is the easiest (no configuration file).  See the "info"
  735.   or "man re getty.  For getty parameters use the terminfo (or termcap)
  736.   name (such as vt100) for your terminal.  Type in a baud-rate that the
  737.   terminal supports.  But if you set the baud too high you may need to
  738.   use (See``Flow Control'').
  739.  
  740.   Then physically connect the main serial port of the terminal to the
  741.   chosen serial port of the computer with a null-modem cable and turn on
  742.   the terminal.  Don't expect most ready-made cables to be wired
  743.   correctly for hardware flow control.  Make sure the baud-rate of the
  744.   terminal is set the same as you gave to getty and that its "data bits"
  745.   is 8.  Then at the computer console type "init q" to apply the changes
  746.   you made to the inittab file.  You should now see a login prompt at
  747.   the terminal.  If you don't, tap the terminal's return key.  If this
  748.   doesn't work read more of this document and/or see ``Trouble-
  749.   Shooting''.
  750.  
  751.  
  752.   4.  Why Use a Terminal ?
  753.  
  754.   4.1.  Introduction
  755.  
  756.   PC's are so powerful today that one such computer can often support
  757.   several persons using it at once, especially if they are doing low-
  758.   load tasks such as text editing, data entry, etc.  One way to do this
  759.   is to connect a number of terminals to a single computer (host
  760.   computer) by modems or direct cable connection.  To do this, one needs
  761.   a multi-user operating system such as Linux.  This has been called
  762.   "time sharing" but it's not good terminology today since "distributed"
  763.   computing over a network is also a type of time sharing.  It might be
  764.   better described as "centralized" computing.  But the central computer
  765.   may be connected to the rest of the world via a network so that
  766.   terminal users may send email, browse the Internet with the "lynx"
  767.   browser, etc.  So it's not exactly "centralized" either.
  768.  
  769.   Terminals have seldom been used with PC's because the popular
  770.   operating systems used for them (Windows, DOS, and Mac) were not
  771.   multiuser until 1998 (available for MS Windows NT) and previously
  772.   could not support terminals.  Now that Linux, a multiuser operating
  773.   system, is freely available for PC's, the use of terminals with PC's
  774.   becomes more feasible.  The drawback is that text terminals are not
  775.   smart enough to support the type of graphical user interface (GUI)
  776.   that many computer users today normally expect.
  777.  
  778.  
  779.   4.2.  Lower Hardware Costs
  780.  
  781.   If several people use the same computer as the same time, there is a
  782.   reduction in the amount of hardware needed for the same level of
  783.   service.  One type of savings is due to code sharing.  The application
  784.   files on hard disks are shared as well as shared libraries in memory
  785.   (even when people are running different programs provided they use
  786.   some of the same functions in their code).  Another type of savings is
  787.   due to reduction of peak load.  The hardware of a single PC may be
  788.   idle most of the time as people slowly type in information, think,
  789.   talk, or are away from their desks.  Having several people on the same
  790.   computer at once makes good use of much of this idle time which would
  791.   otherwise be wasted.
  792.  
  793.   These savings are substantial.  One may roughly estimate (using
  794.   statistical theory) that for 9 persons (8 terminals & 1 console) the
  795.   shared PC only needs only about 3 times as much capacity (in memory,
  796.   disk storage, CPU(s), etc.) as a single PC in order to provide the
  797.   same level of service per person.  Thus the computational hardware for
  798.   such a shared system should only cost about 1/3 as much per user.
  799.   However, the cost of the display hardware (CRT's, keyboards, video
  800.   electronics, etc.) is about the same for both cases.  The terminals
  801.   have the added cost of requiring additional serial ports at the host
  802.   computer.
  803.  
  804.   For a fair comparison with PC's, the terminals should have the same
  805.   capabilities as the PC monitors.  Unfortunately, color graphic
  806.   terminals for Linux (X-windows) with high speed communication is a
  807.   niche market with high prices so in this case there may not be much
  808.   (if any) savings in hardware costs.  But for text terminals the
  809.   savings will be substantial.
  810.  
  811.  
  812.   4.3.  Control of Software
  813.  
  814.   For centralized computing, software (and the updates to software) only
  815.   need be installed on one host computer instead of several.  The person
  816.   in charge of this computer may control the software which is installed
  817.   on it.  This is advantageous if the person controlling the host
  818.   computer does an excellent job and knows about the needs and
  819.   preferences of the other users.  Users can be prevented from playing
  820.   games or surfing the Internet by not installing the software (or by
  821.   otherwise restricting access to it).  Whether or not centralized
  822.   control is desirable depends on the situation.
  823.  
  824.  
  825.   4.4.  Hardware Upgrades
  826.  
  827.   With terminals, the computer hardware upgrades take place on only one
  828.   computer instead of many.  This saves installation labor effort.
  829.   While the cost of the hardware for the host computer upgrade will be
  830.   more than that for a single PC (since the host needs more computing
  831.   power than a PC), the cost will be significantly less than upgrading a
  832.   number of PC's being used instead of terminals.
  833.  
  834.  
  835.   4.5.  Other Advantages of Terminals
  836.  
  837.  
  838.  
  839.   ∑  The elimination of noise from fans and disk drives provided the
  840.      terminals are not close to the computer.
  841.  
  842.   ∑  The users of the terminals can share data and files and send e-mail
  843.      to each other.  It's similar to a local network.
  844.  
  845.  
  846.   4.6.  Major Disadvantages of Terminals
  847.  
  848.  
  849.  
  850.   ∑  Text terminals have no high-speed graphic display (or high
  851.      resolution graphics) although they can often use graphic character
  852.      sets to draw boxes, etc.  This lack limits the software that may be
  853.      used on it.
  854.  
  855.   ∑  If the host computer goes down, then no one can use the terminals
  856.      either (unless there is another computer to connect to).
  857.  
  858.  
  859.   4.7.  Are Text Terminals Obsolete ?
  860.  
  861.   Text terminals are technologically obsolete because for a slightly
  862.   higher cost of hardware, one could build a smart terminal (with the
  863.   same quality of display).  This wasn't always the the case since
  864.   around 1980 memory cost thousands of dollars per megabyte.  Today with
  865.   low costs for memory and processors, one could make a text terminal
  866.   smart for only about a 10% or 20% increase in hardware cost.
  867.  
  868.   The reasons that text terminals are not yet obsolete are:
  869.  
  870.   ∑  There is no satisfactory standard interface for smart graphics
  871.      terminals.  The MS Hydra system is for MS Windows NT, while X-
  872.      Windows is not as efficient as it should be (and X-Windows
  873.      terminals are too costly).
  874.  
  875.   ∑  Many people don't need full screen graphics.
  876.  
  877.   ∑  Used text terminals are often very low in cost, yet can give access
  878.      to a much newer (and powerful) computer.
  879.  
  880.  
  881.   5.  Overview of How Terminals Work (in Linux)
  882.  
  883.   See also section ``Some Details on How Terminals Work''
  884.  
  885.  
  886.   5.1.  Device Names
  887.  
  888.   Each terminal is connected to a serial port on the host computer
  889.   (often just a PC).  The ports have names: ttyS0, ttyS1, ttyS2 etc.
  890.   These are represented by special files found in the /dev (device)
  891.   directory.  /dev/ttyS0 corresponds to COM1 in DOS or Windows.  ttyS1
  892.   is COM2, etc.  See ``Terminal Special Files'' for details on these and
  893.   related "devices" such as cua.
  894.  
  895.  
  896.   5.2.  Login/Logout
  897.  
  898.   When the host computer starts up it runs the program getty (see
  899.   Serial-HOWTO 4.1 & 7.2) on each serial port which has a terminal on it
  900.   (as specified in the file etc/inittab).  The getty program runs the
  901.   "login" program to log people in.  A "login:" prompt appears on the
  902.   screen.  People at the terminals log in (after giving their passwords)
  903.   and then have access to the computer.  When it's time to shut the
  904.   terminal down, one normally logs out and turns the terminal off.  See
  905.   ``Login Restrictions'' regarding restricting logins (including
  906.   allowing the root user to log in at terminal).
  907.  
  908.  
  909.   5.3.  Half/Full Duplex
  910.  
  911.   If one watches someone typing at a terminal, the letters one types
  912.   simultaneously appear on the screen.  A naive person might think that
  913.   what one types is being sent directly from the keyboard to the screen
  914.   with a copy going to the computer (called half-duplex).  What is
  915.   usually going on is that what is typed at the keyboard is directly
  916.   sent only to the host computer (called full-duplex) which in turn
  917.   echos back to the terminal each character it receives.  In some cases
  918.   (such as passwords or terse editor commands) the typed letters are not
  919.   echoed back.
  920.  
  921.  
  922.  
  923.  
  924.  
  925.   5.4.  Terminal Memory
  926.  
  927.   The image on a CRT tube will fade away almost instantly unless it is
  928.   frequently redrawn on the screen by a beam of electrons shot onto the
  929.   face of the tube.  Since text sent to a terminal needs to stay on the
  930.   screen, the image on the screen must be stored in the memory chips of
  931.   the terminal and the electron beam must repeatedly scan the screen
  932.   (say 60 times per second) to maintain the image.  See ``Terminal
  933.   Memory'' for more details.
  934.  
  935.  
  936.   5.5.  Commands for the Terminal
  937.  
  938.   The terminal is under the control of the computer.  The computer not
  939.   only sends the terminal text to display on the screen but also sends
  940.   the terminal commands which are acted on.  These are ``Control Codes''
  941.   (bytes) and ``escape sequences''.  For example, the CR (carriage
  942.   return) control code moves the cursor the the left hand edge of the
  943.   screen.  A certain escape sequence (several bytes where the first byte
  944.   is the "escape" control code) can move the cursor to the location on
  945.   the screen specified by parameters placed inside the escape sequence.
  946.  
  947.   The ``first terminals'' had only a few such commands but modern
  948.   terminals have hundreds of them.  The appearance of the display may be
  949.   changed for certain regions: such as bright, dim, underline, blink,
  950.   and reverse video.   A speaker in a terminal can "click" when any key
  951.   is pressed or beep if a mistake has occurred.  Function keys may be
  952.   programmed for special meanings.  Various fonts may exist.  The
  953.   display may be scrolled up or down.  Specified parts of the screen may
  954.   be erased.  Various types of flow control may be used to stop the flow
  955.   of data when bytes are being sent to the terminal faster than the
  956.   terminal can handle them.  There are many more as you will see from
  957.   looking over an advanced terminal manual or from the Internet links
  958.   ``Esc Sequence List''
  959.  
  960.  
  961.   5.6.  Lack of Standardization Solved by Terminfo
  962.  
  963.   While terminals made for the US all used the same ASCII code for the
  964.   alphabet (except for IBM terminals which used EBCDIC), they
  965.   unfortunately did not all use the same escape sequences.  This
  966.   happened even after various ANSI (and ISO) standards were established
  967.   since these standards were never quite advanced enough.  Furthermore,
  968.   older terminals often lacked the capabilities of newer terminals.
  969.   This might cause problems.  For example, the computer might send a
  970.   terminal an escape sequence telling it to split the screen up into two
  971.   windows of specified size, not realizing that the terminal was
  972.   incapable of doing this.
  973.  
  974.   To overcome these problems a database called "termcap" (now
  975.   "terminfo") was established.  This database resides in certain files
  976.   on the computer and has a section of it (sometimes an entire file) for
  977.   each model of terminal.  For each model (such as VT100) a list of
  978.   capabilities is provided including a list of certain escape sequences
  979.   available and what they do.  See Section ``Termcap and Terminfo
  980.   (detailed)'' for more details.  Application programs may utilize this
  981.   database by calling certain C-Library programs.  One large set of such
  982.   programs (over 200) is named "ncurses" and are listed in the manual
  983.   page for ncurses.
  984.  
  985.  
  986.   5.7.  The Interface
  987.  
  988.   The environment variable TERM is the type of terminal Linux thinks you
  989.   are using.  Some application programs use this to look up the
  990.   capabilities in the terminfo database so TERM needs to be set
  991.   correctly.   But there is more to a correct interface than the
  992.   computer knowing about the capabilities of the terminal.
  993.  
  994.   For bytes to flow from the computer to the terminal the terminal must
  995.   be set to receive the bytes at the same baud rate (bits per second) as
  996.   they are sent out from the terminal.  If the terminal is set to
  997.   receive at 19,200 baud and the computer sends out characters at 9600
  998.   baud, only garbage (or perhaps nothing) will be seen on the screen.
  999.   One selects the baud rate for a terminal (as well as many other
  1000.   features) from the terminals "set-up" menus at the terminal.  Most
  1001.   terminals have a large number of options in their "set-up" menus  (see
  1002.   ``Terminal Set-Up (Configure) Details'').  The computer serial port
  1003.   has options also and these options must be set up in a compatible way
  1004.   (see ``Computer Set-Up (Configure) Details''.
  1005.  
  1006.  
  1007.   5.8.  Emulation
  1008.  
  1009.   Most terminals today have more than one emulation (personality or
  1010.   "terminal mode").  The terminal model numbers of terminals formerly
  1011.   made by DEC (Digital Equipment Corporation now Compaq) start with VT
  1012.   (e.g. VT100).  Many other terminals which are not VT100 may be set up
  1013.   to emulate a VT100.  Wyse is a major terminal manufacturer and most of
  1014.   their terminals can emulate various DEC terminals such at VT100 and
  1015.   VT220.  Thus if you want to, say, use a VT320 terminal you may either
  1016.   use a real VT320 in "native" personality or possibly use some other
  1017.   terminal capable of emulating a VT320.  The "native" personalities
  1018.   usually have more capabilities so, other things being equal, "native"
  1019.   is usually the best to use.
  1020.  
  1021.   The most common type of emulation is to use a PC like it was a vt100
  1022.   terminal (or the like).  Programs loaded into the PC's memory permits
  1023.   this.  In Linux (unless you're in X-windows) the PC monitor (called
  1024.   the console) emulates a terminal of type "Linux" (close to vt100).
  1025.   Even certain windows within X-windows emulate terminals.  See
  1026.   ``Terminal Emulation''.
  1027.  
  1028.  
  1029.   5.9.  The Console
  1030.  
  1031.   On a PC, the monitor is known as the console.  It emulates a terminal
  1032.   of type "Linux".  One logs on to it as a virtual terminal.  See ``The
  1033.   Console: /dev/tty?''.  It receives messages from the kernel regarding
  1034.   booting and shutdown progress.  One may have the messages that
  1035.   normally go to the console, go the a terminal by patching and
  1036.   recompiling Linux. (see ``Make a Terminal the Console'').
  1037.  
  1038.  
  1039.   6.  Terminal Special Files: /dev/tty... etc.
  1040.  
  1041.   "tty" is an abbreviation for "Teletype".  The first terminals were
  1042.   Teletypes (like remotely controlled typewriters).  See subsection
  1043.   ``Teletypes''.
  1044.  
  1045.  
  1046.   6.1.  Serial Port Terminals
  1047.  
  1048.   The computer considers the terminal on a serial port to be a "device".
  1049.   For each such terminal there is a special file in the /dev (device)
  1050.   directory.  /dev/ttyS0 is the special file for the serial port known
  1051.   as COM1 in the DOS/Windows world.  To send text to a terminal you may
  1052.   redirect standard output of some command-line command to the
  1053.   appropriate special file.  For example typing "echo test > /dev/ttyS1"
  1054.   at the command prompt should send the word "test" to the terminal on
  1055.   ttyS1 (COM2) provided you have write permission on /dev/ttyS1.
  1056.   Similarly, typing "cat my_file > /dev/ttyS0" will send the contents of
  1057.   the file my_file to COM1 (ttyS0).
  1058.  
  1059.   In addition to ttyS0 (/dev/ttyS0), ttyS1, ttyS2, etc. (the "S" stands
  1060.   for Serial port) there is also a "cua" series: cua0, cua1, cua2, etc.
  1061.   cua0 is the same port as ttyS0, etc.  The "cu" of cua stands for
  1062.   CalloUt.  The ttyS series are Posix compliant while using cua may
  1063.   permit the opening of a port that the modem control lines say is not
  1064.   ready.  It's claimed that the cua series is only included for
  1065.   backwards compatibility so you should normally use the ttyS series.
  1066.   There is talk about abolishing cua since ttyS can behave just like cua
  1067.   provided the programmer uses the appropriate flags in the "open"
  1068.   command in an application.
  1069.  
  1070.  
  1071.   6.2.  Pseudo Terminals
  1072.  
  1073.   Pseudo terminals have no unique physical connector on the computer.
  1074.   They are used to emulate a serial port.  For example, if someone
  1075.   connects via telnet to your computer over a network, they may wind up
  1076.   connected to the device /dev/ptyp2 (a pseudo terminal port).  In X-
  1077.   Windows, the terminal emulator program, xterm (or rxvt), uses pseudo
  1078.   terminals.  Ham radio programs under Linux also use them.  Using
  1079.   certain application software it is possible to have 2 or more pseudo
  1080.   terminals attached to the same physical serial port.
  1081.  
  1082.   Pseudo terminals come in pairs such as ttyp3 and ptyp3.  The pty... is
  1083.   the master or controlling terminal and the tty... is the slave.  ttyq5
  1084.   is also a pseudo terminal as is ttysc (c is a hexadecimal digit).
  1085.   More precisely, pseudo master terminals are /dev/pty[p-s]N and the
  1086.   corresponding slaves are /dev/tty[p-s]N where N is a hexadecimal
  1087.   digit.
  1088.  
  1089.  
  1090.   6.3.  The Controlling Terminal /dev/tty
  1091.  
  1092.   /dev/tty stands for the controlling terminal (if any) for the current
  1093.   process (the process that uses "/dev/tty" in a command).  To find out
  1094.   which tty's are attached to which processes use the "ps -a" command at
  1095.   the shell prompt (command line).  Look at the "tty" column.  For the
  1096.   shell process you're in, /dev/tty is the terminal you are now using.
  1097.   Type "tty" at the shell prompt to see what it is (see manual pg.
  1098.   tty(1)).  /dev/tty is something like a link to the actually terminal
  1099.   device name with some additional features for C-programmers: see the
  1100.   manual page tty(4).
  1101.  
  1102.  
  1103.   6.4.  /dev/ttyIN "Terminals"
  1104.  
  1105.   N stands for an integer.  One use of these in Linux is with the ISDN
  1106.   driver package: isdn4linux.  The ttyIN is something like ttySN.  There
  1107.   is also a cuiN  which is something like cuaN.  The ttyI and cui
  1108.   emulate modems and may be given modem commands.
  1109.  
  1110.  
  1111.   6.5.  The Console: /dev/ttyN
  1112.  
  1113.   In Linux the PC monitor is called the console and has several device
  1114.   special files associated with it: tty0, tty1, tty2, etc.  When you log
  1115.   in you are on tty1.  To go to tty2 press Alt-F2.  tty1, tty2, etc. are
  1116.   "virtual terminals" (sometimes called "virtual consoles").  You may
  1117.   log in to different virtual terminals and thus have a few different
  1118.   sessions with the computer going on at the same time.  You switch
  1119.   between them using the Alt-F?  key where "?" is the virtual-terminal
  1120.   number you want.  The console is also known as /dev/tty0 and system
  1121.   messages may go to that device and display on your console.  Only the
  1122.   system or the root user may write to /dev/tty0 to which /dev/console
  1123.   is sometimes linked.  System messages may also be written directly to
  1124.   the hardware address of the console thus bypassing /dev/tty0.  For
  1125.   more info on the console see ``The Linux Console''.
  1126.  
  1127.  
  1128.   6.6.  Creating a Device with mknod
  1129.  
  1130.   The /dev directory comes supplied with many device special files.  If
  1131.   you need something that's not there you may try to create it with the
  1132.   "mknod" command.  See the manual page ttys(4) for how to do this for
  1133.   serial ports.  To use mknod you must know the major and minor device
  1134.   numbers.  You might be able to infer the numbers you need by using the
  1135.   "ls -l" command in the /dev directory.  It will display the major and
  1136.   minor numbers of existing special files.
  1137.  
  1138.  
  1139.   7.  Some Details on How Terminals Work
  1140.  
  1141.   If you know almost nothing about terminals, it's suggested that you
  1142.   first read ``Introduction'' and also read ``Overview of How Terminals
  1143.   Work''.
  1144.  
  1145.  
  1146.   7.1.  Terminal Memory
  1147.  
  1148.   The terminal screen refreshes itself at perhaps 60 times per second
  1149.   from an image stored in the memory of the terminal.  For a PC the
  1150.   monitor's image is stored on the video card inside the computer but
  1151.   for a terminal, the equivalent of the video card is inside the
  1152.   terminal.  For a text terminal the storage of the image uses little
  1153.   memory.  Instead of putting every dot (pixel) on the screen into
  1154.   memory and requiring the storage of about a quarter-million dots, a
  1155.   much more efficient method of storage is used.
  1156.  
  1157.   A screen-full of text may be represented inside the terminal memory by
  1158.   ASCII bytes, one for each character on the screen.   An entire screen
  1159.   only takes about 2K ASCII bytes.  To display these characters, the
  1160.   terminal must also know the bit-map (the shape) of each of the almost
  1161.   100 printable ASCII characters.  With a bit-map of a character using
  1162.   say 15 bytes, only about 1.5K of memory is needed for the bit-maps of
  1163.   all the ASCII characters (the font).  This ASCII text and font memory
  1164.   is scanned so that the resulting image is put on the screen about 60
  1165.   times each second.  This is a form of shared memory where a single
  1166.   bit-map of a letter such as the letter e, is shared by all of the many
  1167.   letter e's which appear on a screen-full of text.  Low memory
  1168.   requirements meant low costs to produce monitors in the early 1980's
  1169.   when the cost of memory was several thousand times higher than it is
  1170.   today (costing then several dollars per kilobyte).
  1171.  
  1172.  
  1173.   7.2.  Early Terminals
  1174.  
  1175.   The first terminals were something like remotely controlled
  1176.   typewriters which could only "display" (print on paper) the character
  1177.   stream sent to them from the computer.  The earliest models were
  1178.   called ``Teletypes''.  The name "tty" is just an abbreviation for
  1179.   "Teletype".   Early terminals could do a line feed and a carriage
  1180.   return just like a typewriter and ring a bell when a bell character
  1181.   was received.  Due to the lack of significant capabilities this was
  1182.   the first type of terminal to be labeled "dumb".  This type of
  1183.   terminal interface (using a terminal type called "dumb") is sometimes
  1184.   used today when the computer can't figure out what kind of a terminal
  1185.   it is communicating with.
  1186.  
  1187.  
  1188.  
  1189.   7.3.  Escape Sequences and Control Codes (intro)
  1190.  
  1191.   Terminals have many capabilities some of which are always present and
  1192.   some of which require commands from the computer to change or
  1193.   activate.  To exercise all these capabilities under the control of the
  1194.   computer requires that special codes be established so that the
  1195.   computer can tell the terminal what to do.  There are two major type
  1196.   of such codes: escape sequences and control codes (control
  1197.   characters).  There are many times more escape sequences than control
  1198.   codes.
  1199.  
  1200.  
  1201.   7.3.1.  Control Codes
  1202.  
  1203.   The control codes (or control characters) consist of the first 32
  1204.   bytes of the ASCII alphabet.  They include the following: carriage-
  1205.   return (cursor to far left), line-feed (cursor down one line),
  1206.   backspace, escape-character, tab, and bell.  They do not normally show
  1207.   on the screen.  There is usually a command which you may give to your
  1208.   terminal which will result in them being displayed when they are
  1209.   received by the terminal.  It's called something like "Display
  1210.   Controls" or "Monitor".  If you do this then the display may look a
  1211.   mess since escape sequences, which all start with the ESC (escape)
  1212.   control character, are no longer executed.  Words which should appear
  1213.   at the top or bottom of the screen will show up in other locations.
  1214.   The escape sequences to reposition the cursor display on the screen
  1215.   but the cursor doesn't move to where the escape sequence says.
  1216.  
  1217.  
  1218.   7.3.2.  Escape Sequences
  1219.  
  1220.   Since there are not nearly enough control codes to do everything (and
  1221.   for some reason, not all of them are utilized) many escape sequences
  1222.   are used.  They consist of the "escape" (ESC) control character
  1223.   followed by a sequence of ordinary characters.  Upon receiving an
  1224.   escape character, the terminal examines the characters following it so
  1225.   that it may interpret the sequence and carry out the intended command
  1226.   from the computer.  Once it recognizes the end of a valid sequence,
  1227.   further characters received just display on the screen (unless they
  1228.   are control codes or more escape sequences).  Some escape sequences
  1229.   may take parameters (or arguments) such as the coordinates on the
  1230.   screen to move the cursor to.  The parameters become a part of the
  1231.   escape sequence.  An ``Esc Sequence List'' is on the web for some
  1232.   terminals, but it's terse.
  1233.  
  1234.   A list of the escape sequences for your terminal should be in the
  1235.   "programmers manual" for the terminal.  Except for very old terminals,
  1236.   there may be two or three hundred such sequences.  If you don't have a
  1237.   such manual it's not easy to find them.  Some of the sequences are
  1238.   available on the Internet.  One link is ``Esc Sequence List''.  By
  1239.   searching the Internet for one sequence (such as ESC[5m) you may come
  1240.   across a long list of them.
  1241.  
  1242.   Another way to determine some of them is to find the terminfo entry
  1243.   (termcap) for the terminal and mentally decode it.  See ``Terminfo and
  1244.   Termcap (detailed)'' in this document and/or the ``Termcap Manual'' on
  1245.   the Internet.  Unfortunately, the terminfo (termcap) for a terminal
  1246.   often does not list all of the escape sequences which the terminal has
  1247.   available for use, but fortunately, the most important ones are
  1248.   usually there.
  1249.  
  1250.  
  1251.   7.4.  Display Attributes & Magic Cookies
  1252.  
  1253.   Terminals have various methods of generating character attributes such
  1254.   as bold, reverse-video, underlining, etc.  There should be no need for
  1255.   the user to worry about how how this is done, except that it creates
  1256.   problems for some old terminals and there is sometimes an option for
  1257.   this in the set-up menu of newer terminals.
  1258.  
  1259.   The magic cookie method is obsolete.  It's the simplest (and worst)
  1260.   method of defining attributes: Use a certain byte for the start of an
  1261.   attribute and another to end that attribute.  For example, a "start
  1262.   underlining" magic cookie byte is placed just before the first word to
  1263.   be underlined.  These extra bytes are put into the memory of the
  1264.   screen page, just like character bytes that display as characters.
  1265.   But this might foul up the count of the number of characters per line
  1266.   since non-printable magic cookie characters are intermingled with
  1267.   other printable characters.  This sometimes causes problems.
  1268.  
  1269.   A better method which uses more memory is to assign an attribute byte
  1270.   (or half=byte, etc.) to each displayed character.  This method is used
  1271.   by PC video cards (for text) for the common PC monitor.
  1272.  
  1273.  
  1274.   8.  Special Features of Some Terminals
  1275.  
  1276.   8.1.  Color
  1277.  
  1278.   While the common monochrome terminal is not a color terminal it may
  1279.   have a fixed "color" display other than white such as green or amber.
  1280.   All terminals have black (electron beam turned off = zero brightness).
  1281.   A real color terminal can change the color of the text and background
  1282.   to many different colors while a monochrome terminal can only change
  1283.   the brightness of a fixed color.
  1284.  
  1285.   However, changing the brightness, etc. gives a lot of possibilities.
  1286.   For example, a black and white (monochrome) terminal can have white,
  1287.   grey, and black by varying the brightness.  Some words can be black on
  1288.   a light grey background while other are highlighted by black on white.
  1289.   In addition there is white on black, underlining, and blinking.
  1290.  
  1291.   Color works like the color on a computer monitor or TV screen.  The
  1292.   CRT has three colors of dots on it with each color controlled by its
  1293.   own electron beam (3 beams).  Monochrome has inherently better
  1294.   resolution since it doesn't depend on dots permanently fixed on the
  1295.   screen.  For text terminals the only use of color is to differentiate
  1296.   text and this advantage is not always worth the cost of worse
  1297.   resolution.  Thus monochrome may be better since it also costs less.
  1298.  
  1299.  
  1300.   8.2.  Dual Sessions
  1301.  
  1302.   For this the terminal has two serial ports of equal status.  Each port
  1303.   is connected to a serial port on a different computer.  Thus one may
  1304.   log in to two different computers with each session displaying in a
  1305.   split-screen window.   Alternatively, each session may run full-screen
  1306.   with a "hot" key (or the like) to switch between sessions.  One could
  1307.   also connect to two different serial ports on the same computer and
  1308.   log in twice (similar to "virtual terminals" at the console).
  1309.  
  1310.  
  1311.   8.3.  Printer/Auxiliary Port
  1312.  
  1313.   Many terminals have a connector on the rear for such a port.  It may
  1314.   be labeled as "Aux" or "Printer", etc.  Some printer ports are for
  1315.   parallel printers while others are for serial printers.  If a printer
  1316.   is connected to the printer or auxiliary port, then pressing certain
  1317.   keys will print the screen.  One may also have everything that
  1318.   displays on the screen go also to the printer.  If the port is an
  1319.   auxiliary port, one may connect this to another computer and almost
  1320.   have dual sessions as above.  However, the video memory inside the
  1321.   terminal may not retain both sessions so you may need to refresh the
  1322.   screen when switching to the other session.  There will likely not be
  1323.   a hot key either but possibly a programmable function key may be
  1324.   programmed to do this.  There exists various key combinations and
  1325.   escape sequences for controlling such a port.  See ``Printer Esc''.
  1326.  
  1327.   There is a program called vtprint which is designed to send a print
  1328.   job to your terminal to be printed on a printer attached to the
  1329.   terminal.  It's homepage is http://people.qualcomm.com/garrett/vtprint
  1330.   .  It's also a included (as of 1998) in the Debian distribution of
  1331.   Linux.  xprt (also in Debian) seems to do something similar, but only
  1332.   for X-Window terminals ??
  1333.  
  1334.  
  1335.   8.4.  Pages
  1336.  
  1337.   Many terminals permit the storage of more than one page in their video
  1338.   memory.  Sometimes the page size is the same as the screen, but
  1339.   sometimes it is larger so that scrolling will reveal unseen parts of a
  1340.   page.  So when one looks at a screen, there may be hidden text on the
  1341.   same page above or below the display.  In addition, if there is more
  1342.   than just one page, there may be hidden text on these other pages.
  1343.   One use for pages is on terminals that support dual sessions.  Each
  1344.   session may have its own page and one may switch back and forth
  1345.   between them.
  1346.  
  1347.   Even if you only have a one-page-terminal with the page sized equal to
  1348.   what is displayed on the screen, you will still see other pages of a
  1349.   file (etc.) as the host sends more data to the terminal.  One
  1350.   advantage to having additional pages stored in the terminal memory is
  1351.   so that you can jump to them instantly without waiting a second or so
  1352.   for them to be transmitted from the host.
  1353.  
  1354.   I know of no Linux application program that exploits the use of
  1355.   multiple pages.  Let me know if you know of any.
  1356.  
  1357.  
  1358.   8.5.  Character-Sets
  1359.  
  1360.   A character-set is normally represented by a list (or table or chart)
  1361.   of characters along with the byte code assigned to each character.
  1362.   The codes for a byte range from 0 to 255 (00 to FF in hexadecimal).
  1363.   In MS-DOS, character-set tables are called "code-pages".  You should
  1364.   examine such a table if you're not familiar with them.  They are
  1365.   sometimes included in printer and terminal manuals but may be
  1366.   difficult to find.
  1367.  
  1368.   ASCII is one of the most common character-sets used on text terminals.
  1369.   It is a 7-bit code but can be made into 8-bit if the first bit (high
  1370.   order bit) is always set to 0.  Other character-sets are usually
  1371.   available (except on very old terminals where the only choice is
  1372.   ASCII).  The first half of most character-sets are the conventional
  1373.   ASCII characters and the second half (the characters with the high-
  1374.   order bit set to 1) belong to a wide variety of character-sets.
  1375.   Character sets are often ISO standards.  To get specialized character
  1376.   sets on a terminal, you may need to download a soft-font for that
  1377.   character-set into the memory of the terminal.
  1378.  
  1379.   Besides ASCII, there are some other common character-sets, all 8-bit.
  1380.   CP stands for Code Page character sets invented by IBM: CP-437 (DOS
  1381.   ECS), CP-850 (Multilingual Latin 1 --not the same as ISO Latin-1),
  1382.   ISO-8859-1 (Latin-1), ANSI (derived from Latin-1).  MS Windows uses
  1383.   ANSI while the Internet often uses Latin-1.  There are several
  1384.   ISO-8859 character sets in addition to Latin-1.  These include Greek
  1385.   (-7), Arabic (-6), Eastern European (-2), and Russian (-5).  There are
  1386.   many others.  For example, KOI8-R is more commonly used for Russian
  1387.   than IS0-8859-5.  Unicode is a very large character-set where each
  1388.   character is represented by 2 bytes instead on just one byte.
  1389.  
  1390.   More info re character-sets are:
  1391.  
  1392.   ∑  Manual pages: ASCII and latin1
  1393.  
  1394.   ∑  HOWTO's for various languages (likely written in that language).
  1395.      See "Cyrillic" for Russian.
  1396.  
  1397.   ∑  <http://www.cc.columbia.edu/kermit/charsets.html> for a short
  1398.      listing of various character-set names.
  1399.  
  1400.   ∑  <http://www.pku.edu.cn/on_line/w3html/International/Overview.html>
  1401.      for info on character-sets and the Internet.
  1402.  
  1403.   ∑  Languages, Countries and Character Sets
  1404.      <http://www.w3.org/International/O-charset-lang.html>
  1405.  
  1406.   ∑  <http://vancouver-webpages.com/multilingual/> name="Using Multiple
  1407.      Languages in HTML">
  1408.  
  1409.      Once you've found the character set name (or number) you are
  1410.      interested in, you may search for more info about it on the
  1411.      Internet.
  1412.  
  1413.  
  1414.   8.6.  Fonts
  1415.  
  1416.   Most terminals made after the mid 1980's can accept downloaded soft-
  1417.   font.  This means that they can display almost any character set
  1418.   provided that you can find the soft-font for it.  If you can't find
  1419.   the needed soft-font, you can always create your own.  A free font
  1420.   editor for this is called BitFontEdit (written by the author of this
  1421.   document) and (in 1998) was at
  1422.   Europe:  <http://www.funet.fi/pub/culture/russian/comp/cyril-term/>
  1423.   N. America:
  1424.   <ftp://cs.utk.edu/pub/shuford/terminal/BitFontEdit.tar.gz>
  1425.  
  1426.  
  1427.   8.7.  Keyboards & Special Keys
  1428.  
  1429.   Terminal keyboards often have a number of keys that one doesn't find
  1430.   on a PC keyboard.  Few (if any) actual terminals will have all of
  1431.   these keys and most will have additional keys not listed here.  Some
  1432.   have a large number of special purpose keys such as terminals made for
  1433.   use with cash registers.  There are often many more key meanings than
  1434.   shown here since these keys often have extended meanings when used in
  1435.   conjunction with other keys (such as shift and control).
  1436.  
  1437.  
  1438.   ∑  BREAK sends a very long 0 bit (space = +12 V) of duration 300 to
  1439.      700 milliseconds to the host.  The host may interpret this as an
  1440.      interrupt if stty has set brkint or ignore it if ignbrk is set.
  1441.  
  1442.   ∑  NO SCROLL stops the screen from scrolling like ^S does.  Depressing
  1443.      it again resumes scrolling.  Uses flow control signals to do this.
  1444.  
  1445.   ∑  REPEAT if held down with an other key, forces repeated output of
  1446.      that other key even if the auto-repeat option is set to off.
  1447.  
  1448.   ∑  LINE FEED sends the line feed character ^J to the host.  Seldom
  1449.      used.
  1450.  
  1451.   ∑  SET-UP allows the manual configuration of the terminal via menus.
  1452.      Sometimes purposely disabled by putting a block under it so it
  1453.      can't be pressed down.  Sometimes another key such as shift or
  1454.      control must be pressed at the same time. See ``Getting Into Set-Up
  1455.      (Configuration) Mode''.
  1456.  
  1457.   ∑  LOCAL disconnects the terminal from the host.  In local, what one
  1458.      types goes directly to the screen.  Useful for testing.
  1459.  
  1460.   ∑  RETURN is the same as the "enter" key on a PC.  It usually sends a
  1461.      carriage return to the host which normally get translated to a new-
  1462.      line character by the host's device driver.  On some terminals it
  1463.      may be set up to send something else.
  1464.  
  1465.   ∑  F1, F2, ... or PF1, PF2, ... are function keys which usually may be
  1466.      programmed to send out a sequence of bytes (characters).  See
  1467.      ``Function Keys''
  1468.  
  1469.  
  1470.   9.  Terminal Emulation; the Console
  1471.  
  1472.   9.1.  Terminal Emulation
  1473.  
  1474.   Since a PC has a screen and keyboard (as does a terminal) but also has
  1475.   much more computing power, it's easy to use some of this computing
  1476.   power to make the PC computer behave like a text terminal.  Software
  1477.   to do this is widely available and comes built-in with recent versions
  1478.   of MS Windows.  Most Linux software can only emulate a VT100, VT102,
  1479.   or VT100/ANSI.  Since most PC's have color monitors but VT100 and
  1480.   VT102 were designed for a monochrome monitor, the emulations usually
  1481.   adds color capabilities (and a choice of colors).  Sometimes the
  1482.   emulation is not 100% perfect but this usually causes few problems.
  1483.  
  1484.  
  1485.   9.1.1.  Communication (Dialing) programs
  1486.  
  1487.   An emulation program is often combined with a modem dialing program
  1488.   (such as Minicom, Seyon, or Kermit) so that one may (for example) dial
  1489.   up public libraries to use their catalogs and indexes, (or even read
  1490.   magazine articles).  Seyon is only for use with X-windows and can
  1491.   emulate Tektronix 4014 terminals.  Emulators exist under DOS such as
  1492.   telix and procomm work just as well.  The terminal emulated is often
  1493.   the old VT100, VT102, or ANSI (like VT100).
  1494.  
  1495.  
  1496.   9.1.2.  Emulation under X-Windows
  1497.  
  1498.   Xterm (obsolete ??) may be run under X-Windows which can emulate a
  1499.   VT102, VT220, or Tektronix 4014.  There is also an xterm emulation
  1500.   (although there is no real terminal named "xterm").   If you don't
  1501.   need the Tektronix 4014 emulation (a vector graphics terminal; see
  1502.   ``Graphics Terminals'') you may use eterm.  Predecessors to eterm are
  1503.   rxvt and xvt.  eterm supports pixmaps.
  1504.  
  1505.   For non-Latin alphabets, kterm is for Kanji terminal emulation (or for
  1506.   other non-Latin alphabets) while xcin is for Chinese.  There is also
  1507.   9term emulation.  This seems to be more than just an emulator as it
  1508.   has a built-in editor and scroll-bars.  It was designed for Plan 9, a
  1509.   Unix-like operating system from AT&T.
  1510.  
  1511.  
  1512.   9.1.3.  Real Terminals Better
  1513.  
  1514.   Unless you are using X-Windows with a large display, a real terminal
  1515.   is often nicer to use than emulating one.  It usually costs less, has
  1516.   better resolution for text, and has no disk drives to make annoying
  1517.   noises.  Some real terminals can emulate various other models of
  1518.   terminals but it's still a real terminal.
  1519.   9.2.  The Linux Console
  1520.  
  1521.   The console for a PC Linux system is the computer monitor  It emulates
  1522.   a terminal of type "Linux".  The emulation is flexible and has
  1523.   features which go well beyond those of the vt102 terminal which it was
  1524.   intended to emulate.  These include the ability to use custom fonts
  1525.   and easily re-map the keyboard (without patching the source code and
  1526.   recompiling the kernel as is required for the case of a real
  1527.   terminal).  These extra features reside in the console driver software
  1528.   and not in the emulation software but the results are like it was part
  1529.   of the emulation.
  1530.  
  1531.   Many commands exist (see Keyboard-and-Console-HOWTO) to utilize these
  1532.   added features.   Real terminals, which use neither scan codes nor VGA
  1533.   cards, unfortunately can't use most of these features.  One may
  1534.   recompile Linux to make a terminal receive the messages which normally
  1535.   go to the console (see ``Make a Terminal the Console'').
  1536.  
  1537.  
  1538.   10.  Flow Control (Handshaking)
  1539.  
  1540.   Flow control (= handshaking = pacing)  is to prevent too fast of a
  1541.   flow of bytes from overrunning a terminal, computer, modem or other
  1542.   device.  Overrunning is when a device can't process what it is
  1543.   receiving quickly enough and thus loses bytes and/or makes other
  1544.   serious errors.  What flow control does is to halt the flow of bytes
  1545.   until the terminal (for example) is ready for some more bytes.  Flow
  1546.   control sends its signal to halt the flow in a direction opposite to
  1547.   the flow of bytes it wants to stop.  Flow control must both be set at
  1548.   the terminal and at the computer.
  1549.  
  1550.   There are 2 types of flow control: hardware and software (Xon/Xoff or
  1551.   DC1/DC3).  Hardware flow control uses dedicated signal wires such as
  1552.   RTS/CTS or DTR while software flow control signals by sending DC1 or
  1553.   DC3 control bytes in the normal data wires.  For hardware flow
  1554.   control, the cable must be correctly wired.
  1555.  
  1556.   The flow of data bytes in the cable between 2 serial ports is bi-
  1557.   directional so there are 2 different flows (and wires) to consider:
  1558.  
  1559.   1. Byte flow from the computer to the terminal
  1560.  
  1561.   2. Byte flow from the terminal keyboard to the computer.
  1562.  
  1563.  
  1564.   10.1.  Why Is Flow Control Needed ?
  1565.  
  1566.   You might ask: "Why not send at a speed slow enough so that the device
  1567.   will not be overrun and then flow control is not needed?"  This is
  1568.   possible but it's usually significantly slower than sending faster and
  1569.   using flow control.  One reason for this is that one can't just set
  1570.   the serial port baud rate at any desired speed such as 14,500, since
  1571.   only a discrete number of choices are available.  The best choice is
  1572.   to select a rate that is a little higher than the device can keep up
  1573.   with but then use flow control to make things work right.
  1574.  
  1575.   If one decides to not use flow control, then the speed must be set low
  1576.   enough to cope with the worst case situation.  For a terminal, this is
  1577.   when one sends escape sequences to it to do complex tasks that take
  1578.   more time than normal.  In the case of a modem (with data compression
  1579.   but no flow control) the speed from the computer to the modem must be
  1580.   slow enough so that this same speed is usable on the phone line, since
  1581.   in the worst case the data is random and can't be compressed.  If one
  1582.   failed to use flow control, the speed (with data compression turned
  1583.   on) would be no faster than without using any compression at all.
  1584.  
  1585.   Buffers are of some help in handling worst case situations of short
  1586.   duration.  The buffer stores bytes that come in too fast to be
  1587.   processed at once, and saves them for processing later.
  1588.  
  1589.  
  1590.   10.2.  Padding
  1591.  
  1592.   Another way to handle a "worst case" situation (without using flow
  1593.   control or buffers) is to add a bunch of nulls (bytes of value zero)
  1594.   to escape sequences.  Sometimes DEL's are used instead provided they
  1595.   have no other function.  See ``Recognize Del''.
  1596.  
  1597.   The escape sequence starts the terminal doing something, and while the
  1598.   terminal is busy doing it, it receives a bunch of nulls which it
  1599.   ignores.  When it gets the last null, it has completed its task and is
  1600.   ready for the next command.  This is called null padding.  These nulls
  1601.   formerly were called "fill characters".  These nulls are added just to
  1602.   "waste" time, but it's not all wasted since the terminal is usually
  1603.   kept busy doing something else while the nulls are being received.  It
  1604.   was much used in the past before flow control became popular.  To be
  1605.   efficient, just the right amount of nulls should be added and figuring
  1606.   out this is tedious.  It was often done by trial and error since
  1607.   terminal manuals are of little or no help.  If flow control doesn't
  1608.   work right or is not implemented, padding is one solution.  Some of
  1609.   the options to the stty command involve padding.
  1610.  
  1611.  
  1612.   10.3.  Overrunning a Serial Port
  1613.  
  1614.   One might wonder how overrunning is possible at a serial port since
  1615.   both the sending and receiving serial ports involved in a transmission
  1616.   of data bytes are set for the same speed (in bits/sec) such as 19,200.
  1617.   The reason is that although the receiving serial port electronics can
  1618.   handle the incoming flow rate, the hardware/software that fetches and
  1619.   processes the bytes from the serial port sometimes can't cope with the
  1620.   high flow rate.
  1621.  
  1622.   One cause of this is that the serial port's hardware buffer is quite
  1623.   small.  Older serial ports had a hardware buffer size of only one byte
  1624.   (inside the UART chip).  If that one received byte of data in the
  1625.   buffer is not removed (fetched) by CPU instructions before the next
  1626.   byte arrives, that byte is lost (the buffer is overrun).  Newer
  1627.   UART's, namely the 16550A, have 16-byte buffers (but may be set to
  1628.   emulate a one-byte buffer) and are less likely to overrun.  It may be
  1629.   set to issue an interrupt when the number of bytes in its buffer
  1630.   reaches 1, 4, 8, or 14 bytes.  It's the job of another computer chip
  1631.   (usually the main CPU chip for a computer) to take these incoming
  1632.   bytes out of this small hardware buffer and process them (as well as
  1633.   perform other tasks).
  1634.  
  1635.   When contents of this small hardware receive buffer reaches the
  1636.   specified limit (one byte for old UART'S) an interrupt is issued.
  1637.   Then the computer interrupts what it was doing and software checks to
  1638.   find out what happened.  It finally determines that it needs to fetch
  1639.   a byte (or more) from the serial port's buffer.  It takes these
  1640.   byte(s) and puts them into a larger buffer (also a serial port buffer)
  1641.   that the kernel maintains in main memory.  For the transmit buffer,
  1642.   the serial hardware issues an interrupt when the buffer is empty (or
  1643.   nearly so) to tell the CPU to put some more bytes into it to send out.
  1644.  
  1645.   Terminals also have serial ports and buffers similar to the computer.
  1646.   Since the flow rate of bytes to the terminal is usually much greater
  1647.   than the flow in the reverse direction from the keyboard to the host
  1648.   computer, it's the terminal that is most likely to suffer overrunning.
  1649.   Of course, if you're using a computer as a terminal (by emulation),
  1650.   then it is likewise subject to overrunning.
  1651.   Risky situations where overrunning is more likely are:  1. When
  1652.   another process has disabled interrupts (for a computer).  2. When the
  1653.   serial port buffer in main (or terminal) memory is about to overflow.
  1654.  
  1655.  
  1656.   10.4.  Stop Sending
  1657.  
  1658.   When its appears that the receiver is about to be overwhelmed by
  1659.   incoming bytes, it sends a signal to the sender to stop sending.  That
  1660.   is flow control and the flow control signals are always sent in a
  1661.   direction opposite to the flow of data which they control (although
  1662.   not in the same channel or wire).  This signal may either be a control
  1663.   character (^S = DC3 = Xoff) sent as an ordinary data byte on the data
  1664.   wire (in-band signalling), or a voltage transition from positive to
  1665.   negative in the dtr-to-cts (or other) signal wire (out-of-band
  1666.   signalling).  Using Xoff is called "software flow control" and using
  1667.   the voltage transition in a dedicated signal wire (inside the cable)
  1668.   is called "hardware flow control".
  1669.  
  1670.  
  1671.   10.5.  Keyboard Lock
  1672.  
  1673.   When a terminal is told to stop sending, the terminal "locks" its
  1674.   keyboard.  This seldom happens but when it does, a message or light
  1675.   should inform you that the keyboard is locked.  Anything you type at a
  1676.   locked keyboard is ignored.  The term "locked" is also used when the
  1677.   computer is told to stop sending to a terminal.  The keyboard is not
  1678.   locked so that whatever you type goes to the computer.  Since the
  1679.   computer can't send anything back to you, characters you type don't
  1680.   display on the screen and it may seem like the keyboard is locked but
  1681.   it's not.
  1682.  
  1683.  
  1684.   10.6.  Resume Sending
  1685.  
  1686.   When the receiver has caught up with its processing and is ready to
  1687.   receive more data bytes it signals the sender.  For software flow
  1688.   control this signal is the control character ^Q = DC1 = Xon which is
  1689.   sent on the regular data line.  For hardware flow control the voltage
  1690.   in a signal line goes from negative (negated) to positive (asserted).
  1691.   If a terminal is told to resume sending the keyboard is then unlocked
  1692.   and ready to use.
  1693.  
  1694.  
  1695.   10.7.  Hardware Flow Control (RTS/CTS etc.)
  1696.  
  1697.   Some older terminals have no hardware flow control while others used a
  1698.   wide assortment of different pins on the serial port for this.  The
  1699.   most popular today seems to be the DTR pin.
  1700.  
  1701.  
  1702.   10.7.1.  RTS/CTS and DTR Flow Control
  1703.  
  1704.   Linux PC's use RTS/CTS, but DTR flow control (used by many terminals)
  1705.   behaves similarly (except it is usually only in one direction).
  1706.   RTS/CTS uses the pins RTS and CTS on the serial (EIA-232) connector.
  1707.   RTS means "Request To Send".  When this pin stays asserted (positive
  1708.   voltage) at the receiver it means: keep sending data to me.  If RTS is
  1709.   negated (voltage goes negative) it negates "Request To Send" which
  1710.   means: request not to send to me (stop sending).  When the receiver is
  1711.   ready for more input, it asserts RTS requesting the other side to
  1712.   resume sending.  For computers and terminals (both DTE type equipment)
  1713.   the RTS pin sends the flow control signal to the CTS pin (Clear To
  1714.   Send) on the other end of the cable.  That is, the RTS pin on one end
  1715.   of the cable is connected to the CTS pin at the other end.
  1716.  
  1717.   For a modem (DCE equipment) it's a different scheme since the modem's
  1718.   RTS pin receives the signal and its CTS pin sends.  While this may
  1719.   seem confusing, there are valid historical reasons for this which are
  1720.   too involved to discuss here.
  1721.  
  1722.   For DTR flow control at a terminal, the DTR signal is like the signal
  1723.   sent from the RTS pin.  This DTR pin should connects to the host's CTS
  1724.   pin.
  1725.  
  1726.  
  1727.   10.7.2.  Connecting Up DTR Flow Control
  1728.  
  1729.   Many terminals use DTR flow control.  This is only one-way flow
  1730.   control to keep the terminal from being overrun.  It doesn't protect
  1731.   the computer from someone typing too fast for the computer to handle
  1732.   it.  In a standard null modem cable the DTR pin at the terminal is
  1733.   connected to the DSR pin at the computer.  But Linux doesn't support
  1734.   DTR/DSR flow control (although drivers for some multiport boards may
  1735.   support DTR/DSR flow control.)  A way around this problem is to simply
  1736.   wire the DTR pin at the computer to connect to the CTS pin at the
  1737.   computer and set RTS/CTS flow control (stty crtscts).  The fact that
  1738.   it's only one way will not affect anything so long as the host doesn't
  1739.   get overwhelmed by your typing speed and drop RTS in a vain attempt to
  1740.   lock your keyboard.  See ``Keyboard Lock''.
  1741.  
  1742.  
  1743.   10.7.3.  Old RTS/CTS Handshaking Is Different
  1744.  
  1745.   What is confusing is that there is the original use of RTS where it
  1746.   means about the opposite of the previous explanation above.  This
  1747.   original meaning is: I Request To Send to you.  This request was
  1748.   intended to be sent from a terminal (or computer) to a modem which, if
  1749.   it decided to grant the request, would send back an asserted CTS from
  1750.   its CTS pin to the CTS pin of the computer: You are Cleared To Send to
  1751.   me.  Note that in contrast to the modern RTS/CTS bi-directional flow
  1752.   control, this only protects the flow in one direction: from the
  1753.   computer (or terminal) to the modem.
  1754.  
  1755.   For older terminals, RTS may have this meaning and goes high when the
  1756.   terminal has data to send out.  The above use is a form of flow
  1757.   control since if the modem wants the computer to stop sending it drops
  1758.   CTS (connected to CTS at the computer) and the computer stops sending.
  1759.  
  1760.  
  1761.   10.7.4.  Reverse Channel
  1762.  
  1763.   Old hard-copy terminals may have a reverse channel pin (such as pin
  1764.   19) which behaves like the RTS pin in RTS/CTS flow control.  This pin
  1765.   but will also be negated if paper or ribbon runs out.  It's often
  1766.   feasible to connect this pin to the CTS pin of the host computer.
  1767.   There may be a dip switch to set the polarity of this signal.
  1768.  
  1769.  
  1770.   10.8.  Is Hardware Flow Control Done by Hardware ?
  1771.  
  1772.   Some think that hardware flow control is done by hardware but (unless
  1773.   you are using an intelligent serial card with several serial ports)
  1774.   it's actually done by your operating system software.  UART chips and
  1775.   associated hardware usually know nothing at all about hardware flow
  1776.   control.  When a hardware flow control signal is received, the signal
  1777.   wire flips polarity and the hardware gives an electrical interrupt
  1778.   signal to the CPU.  However, the hardware has no idea what this
  1779.   interrupt means.  The CPU stops what it was doing and jumps to a table
  1780.   in main memory that tells the CPU where to go to find a program which
  1781.   will find out what happened and what to do about it.
  1782.  
  1783.   It's this program (part of the serial device driver) that stops (or
  1784.   resumes) the sending.  This program checks the contents of registers
  1785.   in the UART chip to find out that a certain wire has changed polarity.
  1786.   Then the software realizes that a flow control signal has been
  1787.   received and goes about stopping (or starting) the flow.  However, if
  1788.   it's a stop signal that has been received, the flow stops almost
  1789.   instantly when the signal arrives because the interrupt has stopped
  1790.   whatever the CPU was doing (including the program that was sending the
  1791.   data and putting it in the serial ports hardware buffers for
  1792.   transmission).  However any bytes (up to 16) which were already in the
  1793.   serial port's hardware transmit buffer will still get transmitted ??
  1794.   Thus the hardware almost instantly stops the flow only because it's
  1795.   reaction to a hardware signal is to interrupt and stop everything the
  1796.   CPU was doing.
  1797.  
  1798.  
  1799.   10.9.  Obsolete ?? ETX/ACK or ENQ/ACK Flow Control
  1800.  
  1801.   This is also software flow control and requires a device driver that
  1802.   knows about it.  Bytes are sent in packets (via the async serial port)
  1803.   with each packet terminated by an ETX (End of Text) control character.
  1804.   When the terminal gets an ETX it waits till it is ready to receive the
  1805.   next packet and then returns an ACK (Acknowledge).  When the computer
  1806.   gets the ACK, it then send the next packet.  And so on.  This is not
  1807.   supported by Linux ??   Some HP terminals use the same scheme but use
  1808.   ENQ instead of ETX.
  1809.  
  1810.  
  1811.   11.  Physical Connection
  1812.  
  1813.   Multiport boards allow many terminals (or modems) to be connected to
  1814.   one PC computer.  A terminal may be connected to its host computer
  1815.   either by a direct cable connection, via a modem, or via a terminal
  1816.   server.
  1817.  
  1818.  
  1819.   11.1.  Multiport I/O Cards (Adapters)
  1820.  
  1821.   Additional serial cards may be purchased which have many serial ports
  1822.   on them called "multiport boards".  These boards are not covered in
  1823.   this HOWTO but there is quite a lot of coverage in the Serial-HOWTO
  1824.   One company which had (in 1998) below average prices is ByteRunner
  1825.   <http://www.byterunner.com/cgi-bin/goto.cgi?FILE=iocards.html>.
  1826.  
  1827.  
  1828.   11.2.  Direct Cable Connection.
  1829.  
  1830.   The simplest way to connect a terminal to a host computer is via a
  1831.   direct connection to a serial port on the computer.  Most PC's come
  1832.   with a couple of serial ports, but one is usually used by a mouse.
  1833.   For the EIA-232 port, you need a null modem cable that crosses over
  1834.   the transmit and receive wires.  If you want hardware flow control,
  1835.   you will probably use the DTR pin.
  1836.  
  1837.   Make sure you have the right kind of cable.  A null modem cable bought
  1838.   at a computer store may do it (if it's long enough), but it probably
  1839.   will not work for hardware flow control.  Such a cable may be labeled
  1840.   as a serial printer cable.  See this to help determine if you should
  1841.   ``Buy or Make'' your own cable.  Make sure you are connecting to your
  1842.   PC's serial port at the male DB25 or the DB9, and not your parallel
  1843.   port (female DB25).
  1844.  
  1845.  
  1846.  
  1847.  
  1848.  
  1849.   11.2.1.  Null Modem Cable Pin-out (3 or 4 conductor)
  1850.  
  1851.   If you don't need hardware flow control you may eliminate the CTS-to-
  1852.   DTR wire.  Then if you have 2@ twisted pairs, you may then use 2 wires
  1853.   for signal ground per ``A Kludge using Twisted-Pair Cable''.  For a
  1854.   DB25 connector on your PC, you need:
  1855.  
  1856.  
  1857.  
  1858.   PC male DB25                            Terminal DB25
  1859.       TxD   Transmit Data       2 --> 3       RxD   Receive Data
  1860.       RxD   Receive Data        3 <-- 2       TxD   Transmit Data
  1861.       SG    Signal Ground       7 --- 7       SG    Signal Ground
  1862.       CTS   Clear To Send       5 <-- 20      DTR   Data Terminal Ready
  1863.  
  1864.  
  1865.   If you have a DB9 connector on your serial port, try the following:
  1866.  
  1867.   PC DB9                                  Terminal DB25
  1868.       RxD   Receive Data        2 <-- 2       TxD   Transmit Data
  1869.       TxD   Transmit Data       3 --> 3       RxD   Receive Data
  1870.       SG    Signal Ground       5 --- 7       SG    Signal Ground
  1871.       CTS   Clear To Send       8 <-- 20      DTR   Data Terminal Ready
  1872.  
  1873.  
  1874.  
  1875.   The above don't have modem control lines so be sure to give a "local"
  1876.   option to getty (which is equivalent to "stty clocal").  Also if you
  1877.   need hardware flow control it must be enabled at your computer (use a
  1878.   -h flag with agetty) ( equivalent to "stty crtscts" ).
  1879.  
  1880.  
  1881.   11.2.2.  Null Modem Cable Pin-out (7 conductor)
  1882.  
  1883.   The following diagrams show full "standard" null modem cables.  One
  1884.   that you purchase is apt to be wired this way.  It will work for
  1885.   terminals using software (Xon/Xoff) flow control (or no flow control).
  1886.   However, it doesn't work for hardware flow control since most
  1887.   terminals support DTR handshaking but Linux doesn't (unless DTR is
  1888.   connected to CTS at the PC).
  1889.  
  1890.  
  1891.   PC male DB25                            Terminal DB25
  1892.   TxD   Transmit Data         2 --> 3     RxD   Receive Data
  1893.   RxD   Receive Data          3 <-- 2     TxD   Transmit Data
  1894.   RTS   Request To Send       4 --> 5     CTS   Clear To Send
  1895.   CTS   Clear To Send         5 <-- 4     RTS   Request To Send
  1896.   DSR   Data Set Ready        6
  1897.                               |
  1898.   DCD   Carrier Detect        8 <-- 20    DTR   Data Terminal Ready
  1899.   SG    Signal Ground         7 --- 7     SG    Signal Ground
  1900.                                     6     DSR   Data Set Ready
  1901.                                     |
  1902.   DTR   Data Terminal Ready  20 --> 8     DCD   Carrier Detect
  1903.  
  1904.  
  1905.  
  1906.   Alternatively, a full DB9-DB25 null modem cable (will not  work with
  1907.   terminal hardware handshaking; see above):
  1908.  
  1909.  
  1910.  
  1911.  
  1912.  
  1913.  
  1914.  
  1915.   PC DB9                                  Terminal DB25
  1916.   RxD   Receive Data          2 <-- 2     TxD   Transmit Data
  1917.   TxD   Transmit Data         3 --> 3     RxD   Receive Data
  1918.                                     6     DSR   Data Set Ready
  1919.                                     |
  1920.   DTR   Data Terminal Ready   4 --> 8     DCD   Carrier Detect
  1921.   GND   Signal Ground         5 --- 7     GND   Signal Ground
  1922.   DCD   Carrier Detect        1
  1923.                               |
  1924.   DSR   Data Set Ready        6 <-- 20    DTR   Data Terminal Ready
  1925.   RTS   Request To Send       7 --> 5     CTS   Clear To Send
  1926.   CTS   Clear To Send         8 <-- 4     RTS   Request To Send
  1927.   (RI   Ring Indicator        9 not needed)
  1928.  
  1929.  
  1930.   (Yes, the pins 2 and 3 really do have the opposite meanings in DB9
  1931.   connectors than in DB25 connectors!)
  1932.  
  1933.   Using the above 2 connections provide full modem control signals and
  1934.   seemingly allow one to set "stty -clocal".  Then one must turn on the
  1935.   terminal first (asserts DTR) before the port may be opened in a normal
  1936.   manner by getty, etc.  But there is likely to be trouble if you fail
  1937.   to turn on the terminal first (see ``Getty Respawning Too Rapidly'').
  1938.   For this reason one should use "stty clocal" which is the default
  1939.   (ignores modem control lines) and the additional wires in these cables
  1940.   then serve no useful purpose.
  1941.  
  1942.   In olden days when it may not have been this easy to ignore modem
  1943.   control signals etc, the following "trick" was done for cables that
  1944.   lacked conductors for modem control: on your computer side of the
  1945.   connector, connect RTS and CTS together, and also connect DSR, DCD and
  1946.   DTR together.  This way, when the computer needs a certain handshaking
  1947.   signal to proceed, it will get it (falsely) from itself.
  1948.  
  1949.  
  1950.   11.2.3.  Length Limitations
  1951.  
  1952.   A cable longer than a 50 feet or so may not work properly at high
  1953.   speed.  Much longer lengths sometimes work OK, especially if the speed
  1954.   is low and/or the cable is a special low-capacitance type and/or the
  1955.   electronics of the receiving end are extra sensitive.  It is claimed
  1956.   that under ideal conditions at 9600 baud, 1000 feet works OK.  One way
  1957.   to cover long distances is to install 2@ line drivers near each serial
  1958.   port so as to convert unbalanced to balanced (and conversely) and then
  1959.   use twisted pair cabling.  But line drivers are expensive.
  1960.  
  1961.  
  1962.   11.2.4.  Hardware Flow Control Cables
  1963.  
  1964.   If you expect to use hardware flow control (handshaking) you will
  1965.   likely need to make up your own cable (or order one made).  Of course,
  1966.   if the connecters on the ends of a used cable remove, you might rewire
  1967.   it.  See ``Installing DB Connectors''.  You will need to determine
  1968.   whether or not the terminal uses the DTR pin for this, and if not,
  1969.   what pin (or pins) it uses.  The set-up menus may give you a clue on
  1970.   this since there may be an option for enabling "DTR handshaking" (or
  1971.   flow control) which of course implies that it uses the DTR pin.  See
  1972.   ``Hardware Flow Control'' for a detailed explanation of it.  Older
  1973.   terminals may have no provision for hardware flow control.
  1974.  
  1975.  
  1976.   11.2.5.  Cable Tips
  1977.  
  1978.   The normal "straight thru" cable will not work unless you are using it
  1979.   as an extension cable in conjunction with either a null modem cable or
  1980.   a null modem adapter.  Make sure that the connectors on the cable ends
  1981.   will mate with the connectors on the hardware.  One may use telephone
  1982.   cable which is at least 4-conductor (and possibly twisted pair).
  1983.   Shielded, special low-capacitance cable computer cable is best.
  1984.  
  1985.  
  1986.   11.2.6.  A Kludge using Twisted-Pair Cable
  1987.  
  1988.   Although none of the EIA-232 signals are balanced for twisted pair one
  1989.   may attempt to use twisted-pair cable with it.  Use one pair for
  1990.   transmit and another for receive.  To do this connect signal ground to
  1991.   one wire in each of these 2 pair.  Only part of the signal ground
  1992.   current flows in the desired wire but it may help.  Due to the lower
  1993.   inductance of the twisted pair circuit (as compared to ground return
  1994.   current by some other path)  more return (ground) current will confine
  1995.   itself to the desired twisted pair than one would expect from only
  1996.   resistance calculations.  This is especially true at higher
  1997.   frequencies since inductive impedance increases with frequency.  The
  1998.   rectangular wave of the serial port contains high frequency harmonics.
  1999.  
  2000.  
  2001.   11.2.7.  Cable Grounding
  2002.  
  2003.   Pin 1 should be chassis ground (also earth ground) but on cheap serial
  2004.   ports it may not even be connected to anything.  The signal ground is
  2005.   pin 7 and is usually grounded to chassis ground.  This means that part
  2006.   of the signal current will flow thru the ground wires of the building
  2007.   wiring (undesirable).  Cable shields are supposed to be only grounded
  2008.   at one end of the cable, but it may be better to ground both ends
  2009.   since it's better to have current in the shield than in the building
  2010.   wiring ??
  2011.  
  2012.  
  2013.   11.3.  Modem Connection
  2014.  
  2015.   Using a terminal-modem combination (without a computer) one may
  2016.   connect to BBS's.  Some BBS's (such a free-nets) permit Internet
  2017.   access via the text browser lynx which will work on text terminals.
  2018.   Thus with an old terminal and external modem, one may connect to the
  2019.   Internet.  If one connects to a host computer on which one has an
  2020.   account, then one may sometimes store ones work (or downloads) on the
  2021.   host computer.
  2022.  
  2023.  
  2024.   11.3.1.  Dialing Out From a Terminal
  2025.  
  2026.   Instead of connecting a terminal (or computer emulating a terminal)
  2027.   directly to a host computer using a cable it may be connected to the
  2028.   host via a telephone line (or dedicated private line) with a modem at
  2029.   each end of the line.  The terminal (or computer) will usually dial
  2030.   out on a phone line to a host computer.
  2031.  
  2032.   This dialing out is commonly done using a PC computer with a modem to
  2033.   call a BBS or ISP where the PC emulates a terminal once it's
  2034.   connected.  If you use a real terminal for this it's more difficult
  2035.   since the real terminal isn't very intelligent and doesn't give as
  2036.   much feedback to the user.  For dialing out, many terminals can store
  2037.   one or more telephone numbers as messages which may be "set-up" into
  2038.   them and are sent out to the modem by pressing certain function keys.
  2039.   Many modems can also store phone numbers.  The modem initiation
  2040.   sequence must precede the telephone number.  The host computer may use
  2041.   "mgetty" (a getty for use with modems) to log in someone who has
  2042.   dialed in to the host.
  2043.  
  2044.  
  2045.  
  2046.  
  2047.   11.3.2.  Terminal Gets Dialed Into
  2048.  
  2049.   It's common for a computer running Linux to get dialed into.  The
  2050.   caller gets a login prompt and logs in.  At first glance, it may seem
  2051.   strange how a dumb terminal (not connected to any computer) could
  2052.   accept an incoming call, but it can.  One possible reason for doing
  2053.   this is to save on phone bills where rates are not symmetric.  Your
  2054.   terminal needs to be set up for dial-in: Set the modem at your
  2055.   terminal for automatic answer (Register S0 set to 2 will answer on the
  2056.   2nd ring).  You turn on the terminal and modem before you expect a
  2057.   call and when the call comes in you get a login prompt and log in.
  2058.  
  2059.   The host computer that dials out to your terminal needs to do
  2060.   something quite unusual.  As soon as your modem answers, it needs to
  2061.   run login (getty).   A host may do this by running the Linux program
  2062.   "callback" sometimes named "cb".  Callback is for having computer A
  2063.   call computer B, and then B hangs up and calls A back.  This is what
  2064.   you want if you are using computer A to emulate a terminal.  For the
  2065.   case of a real terminal this may be too complex a task so the host may
  2066.   utilize only the "back" part of the callback program.  The setup file
  2067.   for callback must be properly configured at the host.  Callback makes
  2068.   the call to the terminal and then has mgetty run a login on that port.
  2069.   Mgetty by itself (as of early 1998) is only for dial-in calls but
  2070.   there is work being done to incorporate callback features into it and
  2071.   thus make it able to dial-out.  By the time you read this, mgetty may
  2072.   be all you need.
  2073.  
  2074.  
  2075.   11.4.  Terminal Server Connection
  2076.  
  2077.   A terminal server is something like an intelligent switch that can
  2078.   connect many terminals (or modems) to one or more computers.  It's not
  2079.   a mechanical switch so it may change the speeds and protocols of the
  2080.   streams of data that go thru it.  A number of companies make terminal
  2081.   servers: Xyplex, Cisco, 3Com, Computone, Livingston, etc.  There are
  2082.   many different types and capabilities.  Another HOWTO is needed to
  2083.   compare and describe them (including the possibility of creating your
  2084.   own terminal server with a Linux PC).  Most are used for modem
  2085.   connections rather than directly connected terminals.
  2086.  
  2087.   One use for them is to connect many terminals (or modems) to a high
  2088.   speed network which connects to host computers.  Of course the
  2089.   terminal server must have the computing power and software to run
  2090.   network protocols so it is in some ways like a computer.  The terminal
  2091.   server may interact with the user and ask what computer to connect to,
  2092.   etc. or it may connect without asking.  One may sometimes send jobs to
  2093.   a printer thru a terminal server.
  2094.  
  2095.   A PC today has enough computing power to act like a terminal server
  2096.   for text terminals except that each serial port should have its own
  2097.   hardware interrupt.  PC's only have a few spare interrupts for this
  2098.   purpose and since they are hard-wired you can't create more by
  2099.   software.  A solution is to use an advanced multiport serial card
  2100.   which has its own system of interrupts (or on lower cost models,
  2101.   shares one of the PC's interrupts between a number of ports).  See
  2102.   Serial-HOWTO for details.  If such a PC runs Linux with getty running
  2103.   on many serial ports it might be thought of as a terminal server.  It
  2104.   is in effect a terminal server if it is linked to other PC's over a
  2105.   network and if its job is mainly to pass thru data and handle the
  2106.   serial port interrupts every 14 (or so) bytes.  Software called
  2107.   "radius" is sometimes used.
  2108.  
  2109.   Today real terminal servers serve more than just terminals.  They also
  2110.   serve PC's which emulate terminals, and are sometimes connected to a
  2111.   bank of modems connected to phone lines.  Some even include built-in
  2112.   modems.  If a terminal (or PC emulating one) is connected directly to
  2113.   a modem, the modem at the other end of the line could be connected to
  2114.   a terminal server.  In some cases the terminal server by default
  2115.   expects the callers to use PPP packets, something that real text
  2116.   terminals don't generate.
  2117.  
  2118.  
  2119.   11.5.  Connector and Adapter Types
  2120.  
  2121.   A connector is more-or-less permanently attached to the end of a cable
  2122.   or to a hardware unit.  There are two basic types of connectors used
  2123.   in serial communications: 1. DBxx with pins (such as DB25) and 2.
  2124.   modular telephone-style connectors.
  2125.  
  2126.   An adapter looks about like a connector but it has two ends.  It is
  2127.   just like a cable that is so short that there is no cable part left at
  2128.   all --just different connectors on each end is all that remains.  The
  2129.   adapter just plugs in on each side.  It allows two incompatible
  2130.   connectors to mate with each other by going in between them.
  2131.   Sometimes the purpose of the adapter is to interchange wires.
  2132.   Obviously, one may use a special cable (perhaps homemade) as a
  2133.   substitute for an adapter.
  2134.  
  2135.  
  2136.   11.5.1.  Sex of Connector/Adapters
  2137.  
  2138.   Connectors (or one side of adapters) are either male or female.  The
  2139.   connectors that have pins are male and the ones that have sockets
  2140.   (sometimes also called pins) are female.  For modular connectors, the
  2141.   ones with exposed contacts are plugs while the ones with internal
  2142.   contacts (not easy to see) are jacks.  Plugs are male; jacks are
  2143.   female.
  2144.  
  2145.  
  2146.   11.5.2.  Types of Adapters
  2147.  
  2148.   There are three basic types of adapters: null modem, gender changers
  2149.   and port adapters.  Some adapters perform more than one of these three
  2150.   functions.
  2151.  
  2152.   ∑  null modem adapter: Reroutes wires.  Like a null modem cable.
  2153.  
  2154.   ∑  gender changer: Changes the sex of a cable end.  Two connectors of
  2155.      the same sex can now connect (mate) with each other.
  2156.  
  2157.   ∑  port adapter: Goes from one type of connector to another (DB9 to DB
  2158.      25, etc.)
  2159.  
  2160.  
  2161.  
  2162.   11.5.3.  DB Connectors
  2163.  
  2164.   (For how to install a DB connector on the ends of a cable see
  2165.   ``Installing DB Connectors''.)  These come in 9 or 25 pins.  The
  2166.   EIA-232 specs. call for 25 pins but since most of these pins are not
  2167.   used on ordinary serial ports, 9 pins is sufficient. See ``DB9-DB25''
  2168.   for the pin-out.  The pins are usually numbered if you look closely
  2169.   enough.
  2170.  
  2171.  
  2172.   11.5.4.  RJ Modular Connectors
  2173.  
  2174.   These look like modern telephone connectors but are sometimes not
  2175.   compatible with telephone connectors.  See also ``Installing RJ
  2176.   Connectors''.  They may be 6, 8, or 10 conductor.  RJ11/14 is a 4-6
  2177.   conductor telephone plug.  A look-alike is a MMJ connector
  2178.   (6-conductor) used on later model VT (and other) terminals.   MMJ has
  2179.   an offset tab and is not compatible with RJ11/14.  However, some
  2180.   connectors have been made that are compatible with both MMJ or
  2181.   RJ11/14.  The MMJ pin-out is: 1-DTR 2-TXD 3-GND 4-COM 5-RXD 6-DSR.
  2182.  
  2183.   A null-modem cable with MMJ (or RJ11/14) connectors will connect: 1-6,
  2184.   2-5, and 3-4.  Note that such a cable support DTR/DSR flow control
  2185.   which is not supported (yet) by Linux.  Making up your own 6-conductor
  2186.   null-modem cable is very simple if you understand that the ordinary
  2187.   4-conductor telephone cable from the wall to your telephone, used in
  2188.   hundreds of millions of homes, is also a null-modem cable.  Find one
  2189.   and wire your cable the same way.
  2190.  
  2191.   If you lay such a cable (or your terminal null-modem cable) flat on
  2192.   the floor (with no twists) you will note that both plugs on the ends
  2193.   have their gold contacts facing up (or both facing down).  Although
  2194.   it's symmetrical, it is also null- modem if you think about it a bit.
  2195.   One may put a few such cables together with inline couplers and
  2196.   everything works OK because each inline coupler is also a null-modem
  2197.   adapter.  Two null-modem devices in series result in a straight-thru
  2198.   connection.
  2199.  
  2200.   RJ45 and RJ48 are 8-conductor (or 10-conductor for some computer
  2201.   applications) telephone plugs.  The 10-conductor ones are allegedly
  2202.   wider and will not mate with 8-conductor ones.  They are used for both
  2203.   flat telephone cable and round twisted pair cable.  The cable end of
  2204.   the connector may be different for round and flat cable and both RJ45
  2205.   and RJ48 may be 8 or 10 conductor so make sure you get the right one.
  2206.   RJ48 has an extra tab so that a RJ48 plug will not push into a RJ45
  2207.   jack (but a RJ45 plug will mate with a RJ48 jack).  They're used on
  2208.   some multiport serial cards and networks.  Heres the pin numbers for
  2209.   an 8-conductor:
  2210.  
  2211.  
  2212.     Plug                          Jack
  2213.     (Looking at the end           (Looking at the cavity
  2214.      end of a cable)               in a wall)
  2215.        .__________.                   .__________.
  2216.        | 87654321 |                   | 12345678 |
  2217.        |__.    .__|                   |__.    .__|
  2218.           |____|                         |____|
  2219.  
  2220.  
  2221.  
  2222.  
  2223.   11.6.  Making or Modifying a Cable
  2224.  
  2225.   11.6.1.  Buy or Make ?
  2226.  
  2227.   You may try to buy a short, null modem cable.  They are often labeled
  2228.   as serial printer cables (but serial printers are not very popular
  2229.   today and neither are the cables).  Unfortunately, they will probably
  2230.   not work for hardware flow control.  Make sure the connectors on the
  2231.   cable ends will fit the connectors on your computer and terminal.
  2232.  
  2233.   But if you need longer cables to connect up terminals or need hardware
  2234.   flow control, how do you get the right cables?  The right ready-made
  2235.   cables may be difficult to find (you might find them by searching the
  2236.   Internet), especially if you want to use a minimum (say 4) of
  2237.   conductors.  One option is to get them custom made, which is likely to
  2238.   be fairly expensive although you might find someone to make them at
  2239.   prices not too much higher than ready-made cable (I did).  Another
  2240.   alternative is to make your own.  This may require special tools.  If
  2241.   you can find it, used cable can be a real bargain but you will
  2242.   probably need to rewire the connectors.  Most connectors that come
  2243.   with short cables are permanently molded to the cable and can't be
  2244.   rewired but most custom-made and homemade cables have connectors that
  2245.   can be rewired.  One advantage of making your own cable is that the
  2246.   skills you learn will come in handy if a cable breaks (or goes bad) or
  2247.   if you need to make up another cable in a hurry.
  2248.  
  2249.  
  2250.   11.6.2.  Installing DB Connectors
  2251.  
  2252.   See ``DB Connectors'' for a brief description of them.  Unfortunately,
  2253.   most cables one purchases today have molded connectors on each end and
  2254.   can't be modified.  Others have connectors which unscrew and can be
  2255.   rewired.  If you are making up cable or modifying an existing one then
  2256.   you need to know about pins.  There are two types: soldered and
  2257.   crimped.
  2258.  
  2259.   The crimped pins require a special crimping tool and also need an
  2260.   "insertion/extraction" tool.  But once you have these tools, making up
  2261.   and modifying cable is a faster than soldering.  To insert pins just
  2262.   push them in by hand or with the tool.  Removing a pin with the tool
  2263.   is a little tricky.  You must insert the tool tip around the back of
  2264.   the pin.  One tool tip requires spreading a little to get it over the
  2265.   wire but for this tip the pin should be easier to remove.  Then pull
  2266.   on both the tool and the wire with a gentle pull.  If it doesn't come
  2267.   out, the tool was likely not inserted correctly so either push it in
  2268.   more or twist it to a different position.   Perhaps you should have
  2269.   used another tip that goes more around the pin.  Using this tool, one
  2270.   may readily convert a straight-thru cable to a null-modem cable, etc.
  2271.  
  2272.   Don't try soldering unless you know what you're doing or have read
  2273.   about how to do it.
  2274.  
  2275.  
  2276.   11.6.3.  Installing RJ Connectors
  2277.  
  2278.   These are telephone modular connecters one type of which is used for
  2279.   most ordinary telephones.  But there are many different types (see
  2280.   ``RJ Modular Connectors'').
  2281.  
  2282.   These are not easy to reuse.  You might be able to pull the wires out,
  2283.   push in something wedged that would lift up the gold-colored contacts
  2284.   and reuse the connector.  There are special crimping tools used to
  2285.   install them; a different tool for each type.
  2286.  
  2287.   If you don't have a crimping tool, installation is still possible (but
  2288.   difficult) using a small screwdriver (and possibly a hammer).  Push in
  2289.   the cable wires and then push each gold-colored contact down hard with
  2290.   a small screwdriver that will just fit between the insulating ridges
  2291.   between the contacts.  You may damage it if you fail to use a
  2292.   screwdriver with a head almost the same thickness as the contacts or
  2293.   if the screwdriver slips off the contact as you are pushing it down.
  2294.   You may also use a small hammer to pound on the screwdriver (push
  2295.   first by hand).
  2296.  
  2297.   Be sure to not hurt the "remove lever" on the connecter when you push
  2298.   in the contacts.  Don't just set it down on a table and push in the
  2299.   contacts.  Instead, put a shim (about 1 mm thick) that fits snugly in
  2300.   the crevice between the lever and the body.  For such a shim you may
  2301.   use thick cardboard, several calling cards, or wood.  Since the bottom
  2302.   of the connector (that you will put on the table) isn't level (due to
  2303.   the "remove lever), make sure that the table top has something a
  2304.   little soft on it (like a sheet of cardboard) to help support the non-
  2305.   level connector.  Even better would be to put another 1mm shim under
  2306.   the first 6mm of the connector, supporting it just under where you see
  2307.   the contacts.  A soft tabletop wouldn't hurt either.  Another method
  2308.   (I've never done this) is to hold the connector in a vice but be
  2309.   careful not to break the connector.
  2310.  
  2311.   As compared to using a crimping tool, installing it per above takes a
  2312.   lot longer and is much more prone to errors and failure but it's
  2313.   sometimes more expedient and a lot cheaper than buying a special tool
  2314.   if you only have one or two connectors to install.
  2315.  
  2316.  
  2317.   12.  Set-Up (Configure) in General
  2318.  
  2319.   12.1.  Introduction
  2320.  
  2321.   Configuring (Set-Up) involves both storing a configuration in the non-
  2322.   volatile memory of the terminal, and putting commands in start-up
  2323.   files (on you hard disk) that will run each time the computer is
  2324.   powered on (or possibly only when the run-level changes).  This
  2325.   section gives an overview of configuring and covers the configuring of
  2326.   the essential communication options for both the terminal and the
  2327.   computer.  The next two major sections cover in detail the
  2328.   configuration of the terminal (see ``Terminal Set-Up'' and the
  2329.   computer (see ``Computer Set-Up (Configure) Details''.
  2330.  
  2331.  
  2332.   12.2.  Terminal Set-Up (Configure) Overview
  2333.  
  2334.   When a terminal is installed it's necessary to configure the physical
  2335.   terminal by saving (in its non-volatile memory which is not lost when
  2336.   the terminal is powered off) the characteristics it will have when it
  2337.   is powered on.  You might be lucky and have a terminal that has
  2338.   already been set-up correctly for your installation so that little or
  2339.   no terminal configuration is required.
  2340.  
  2341.   There are two basic ways of configuring a terminal.  One is to sit at
  2342.   the terminal and go thru a series of set-up menus.  Another is to send
  2343.   escape sequences to it from the host computer.  Before you can send
  2344.   anything to the terminal (such as the above escape sequences), its
  2345.   ``Communication Interface'') options such as the baud rate must be set
  2346.   up to match those of the computer.  This can only be done by sitting
  2347.   at the terminal since the communications must be set up right before
  2348.   the computer and the terminal can "talk" to each other.  See
  2349.   ``Terminal Set-Up''.
  2350.  
  2351.  
  2352.   12.3.  Computer Set-Up (Configure) Overview
  2353.  
  2354.   Besides possibly sending escape sequences from the computer to
  2355.   configure the terminal, there is the configuring of the computer
  2356.   itself to handle the terminal.  If your lucky, all you need to do is
  2357.   to put a "getty" command in the /etc/inittab file so that a "login:"
  2358.   prompt will be sent to the terminal when the computer starts up.  See
  2359.   ``Getty'' for details.
  2360.  
  2361.   The computer communicates with the terminal using the device driver
  2362.   software (part of the kernel).  The serial device driver has a default
  2363.   configuration and is also partly (sometimes fully) configured by the
  2364.   getty program before running "login" at each terminal.  However,
  2365.   additional configuration is sometimes needed using programs named
  2366.   "stty" and "setserial".  These programs (if needed) must be run each
  2367.   time the computer starts up since this configuration is lost each time
  2368.   the computer powers down.  See ``Computer Set-Up (Configure)
  2369.   Details''.
  2370.  
  2371.  
  2372.   12.4.  Many Options
  2373.  
  2374.   There are a great many configuration options for you to choose from.
  2375.   The communication options must be set right or the terminal will not
  2376.   work at all.  Other options may be set wrong, but will cause no
  2377.   problem since the features they set may not be used.  For example, if
  2378.   you don't have a printer connected to the terminal it makes no
  2379.   difference how the printer configuration parameters are set inside the
  2380.   terminal.  This last statement is not 100% correct.  Suppose that you
  2381.   have no printer but the compute (by mistake) sends the terminal a
  2382.   command to redirect all characters (data) from the computer to the
  2383.   printer only.  Then nothing will display on the screen and your
  2384.   terminal will be dead.  Some terminals have a configuration option to
  2385.   inform the terminal that no printer is attached.  In this case the
  2386.   terminal will ignore any command to redirect output to the "printer"
  2387.   and the above problem will never happen.  However, this doesn't help
  2388.   much since there are many other erroneous commands that can be sent to
  2389.   your terminal that will really foul things up.  This is likely to
  2390.   happen if you send the terminal a binary file by accident.
  2391.  
  2392.   In some cases a wrong setting will not cause any problem until you
  2393.   happen to run a rare application program that expects the terminal to
  2394.   be set a certain way.  Other options govern only the appearance of the
  2395.   display and the terminal will work fine if they are set wrong but may
  2396.   not be as pleasant to look at.
  2397.  
  2398.   Some options concern only the terminal and do not need to be set at
  2399.   the computer.  For example: Do you want black letters on a light
  2400.   background?  This is easier on the eyes than a black background.
  2401.   Should a key repeat when held down?  Should the screen wrap when a
  2402.   line runs off the right end of the screen?  Should keys click?
  2403.  
  2404.  
  2405.   12.5.  Communication Interface Options
  2406.  
  2407.   Some of these communication settings (options) are for both the
  2408.   terminal and the computer and they must be set exactly the same for
  2409.   both: speed, parity, bits/character, and flow control.  Other
  2410.   communication options are only set at the terminal (and only a couple
  2411.   of these are essential to establish communications).  Still others
  2412.   such as the address and interrupt (IRQ) of the physical port ttyS2 are
  2413.   set only at the computer using the "setserial" command.  Until all of
  2414.   the above essential options are compatibly set up there can be no
  2415.   satisfactory serial communication (and likely no communication at all)
  2416.   between the terminal and the computer.  For the terminal, one must set
  2417.   these options manually by menus at each terminal (or by using some
  2418.   sort of special cartridge at each terminal).  The host computer is
  2419.   configured by running commands each time the computer is powered up
  2420.   (or when people log in).  Sometimes the getty program (found in the
  2421.   /etc/inittab file) which starts the login process will take care of
  2422.   this for the computer.  See ``Getty (in /etc/inittab)''
  2423.  
  2424.   The settings for both the computer and the terminal are:
  2425.  
  2426.   ∑  ``Speed (bits/second) ''
  2427.  
  2428.   ∑  ``Parity ''
  2429.  
  2430.   ∑  ``Bits per Character ''
  2431.  
  2432.   ∑  ``Flow Control ''
  2433.  
  2434.   Some essential settings for the terminal alone are:
  2435.  
  2436.   ∑  ``Port Select''
  2437.  
  2438.   ∑  Set communication to full duplex (=FDX on Wyse terminals)
  2439.  
  2440.  
  2441.   If the  ``Getty (in /etc/inittab)'' program can't set up the computer
  2442.   side the way you want, then you may need to use one (or both) of the
  2443.   ``Stty & Setserial'' commands.
  2444.  
  2445.  
  2446.   12.5.1.  Speed
  2447.  
  2448.   These must be set the same on both the terminal and the computer.  The
  2449.   speed is the bits/sec (bps or baud rate).  Use the highest speed that
  2450.   works without errors.  Enabling flow control may make higher speeds
  2451.   possible.  There may be two speeds to set at the terminal: Transmit
  2452.   and Receive, sometimes abbreviated T and R.  Usually they are both set
  2453.   the same since stty in Linux doesn't seem to have the option yet of
  2454.   setting them differently.  (There is an option to do this with the
  2455.   "stty" command but it seems to actually set them both the same.)
  2456.   Common speeds are 300, 600, 1200, 2400, 4800, 9600, 19200, 38400, ...
  2457.   The slower speeds (like 600) are for printers and hard-copy terminals.
  2458.  
  2459.  
  2460.   12.5.2.  Parity & Should You Use It ?
  2461.  
  2462.   For a definition see ``Parity Explained''.  Parity-disabled is often
  2463.   the default.  To enable parity, you must both enable it and then
  2464.   select either even or odd parity.  It probably makes no difference if
  2465.   it's odd or even.  For terminals there are sometimes settings for both
  2466.   transmit and receive parity.  You should set both of these the same
  2467.   since stty at the computer doesn't permit setting them differently.
  2468.  
  2469.   Should you use parity  at all?  Parity, while not really necessary, is
  2470.   nice to have.  If you don't have parity, then you may get an incorrect
  2471.   letter here and there and wind up trying to correct spelling errors
  2472.   that don't really exist.  However parity comes at a cost.  First, it's
  2473.   a little more complicated to set up since the default is usually no
  2474.   parity.  Secondly, parity will slow down the speed with which bytes
  2475.   travel over the serial cable since there will be one more bit per
  2476.   byte.  This may or may not slow down the effective speed.
  2477.  
  2478.   For example, a hard-copy terminal is usually limited by the mechanics
  2479.   of the printing process.  Increasing the bytes/sec when the computer
  2480.   (its UART chip) is transmitting only results in more flow-control
  2481.   "halt" signals to allow the mechanical printing to catch up.  Due to
  2482.   more flow-control waits the effective speed is no better without
  2483.   parity than with it.  The situation is similar for some terminals:
  2484.   After you implement parity there may be fewer flow-control waits per
  2485.   unit time resulting in more bits/sec (average).  However, due to the
  2486.   added parity bits the bytes/sec (average) stays the same.
  2487.  
  2488.   One option is to install terminals with no parity.  Then if parity
  2489.   errors are noticed, it can be implemented later.  To spot possible
  2490.   errors with no parity, look for any spelling errors you don't think
  2491.   you made.  If you spot such an error, refresh the screen (retransmit
  2492.   from the computer).  If the error goes away, then it's likely a parity
  2493.   error.  If too many such errors happen (such as more than one every
  2494.   few hundred screens) then corrective action is needed such as:  Enable
  2495.   parity and/or reduce speed, and/or use a shorter/better cable.
  2496.   Enabling parity will not reduce the number of errors but it will tell
  2497.   you when an error has happened.
  2498.  
  2499.   Just the opposite policy is to initially enable parity.  Then if no
  2500.   parity errors (error symbols on the CRT) are ever seen (over a
  2501.   reasonable period of time, say a month or two) it may be safely
  2502.   disabled.
  2503.  
  2504.  
  2505.   12.5.3.  Bits/Character
  2506.  
  2507.   This is the character size (the number of data bits per character
  2508.   excluding any parity bit).  For ASCII it's 7,  but it's 8 for ISO
  2509.   character sets.  If you are only going to use ASCII characters, then
  2510.   select 7-bits since it's faster to transmit 7 bits than 8.  Some older
  2511.   terminals will only display 7-bit characters.
  2512.  
  2513.  
  2514.   12.5.4.  Which Flow Control (Handshaking) ?
  2515.  
  2516.   The choice is between "hardware" (for example rts/cts or dtr/cts) or
  2517.   "software" (Xon/Xoff) flow control.  (The Adds terminal menu
  2518.   incorrectly use "Xon/Xoff" to mean any kind of flow control.)  While
  2519.   hardware flow control may be faster (if the one or two extra wires for
  2520.   it are available in the cable and if the terminal supports it) in most
  2521.   cases Xon/Xoff should work OK.  Some people report that they solved
  2522.   disturbing problems (see below) by converting to hardware flow control
  2523.   but software flow control has worked fine at other installations (and
  2524.   for me personally).
  2525.  
  2526.   If you use software (Xon/Xoff) flow control and have users who don't
  2527.   know about it, then they may accidentally send an Xoff to the host and
  2528.   lock up their terminal.  While it's locked, they may type frantically
  2529.   in a vain attempt to unlock it.  Then when Xon is finally sent to
  2530.   restore communication, all that was typed in haste gets executed,
  2531.   perhaps with unexpected results.  They can't do this with hardware
  2532.   flow control.  See ``Flow Control'' for an explanation of flow
  2533.   control.
  2534.  
  2535.  
  2536.   12.5.5.  Port Select
  2537.  
  2538.   Since most terminals have two or more connectors on the back, it is
  2539.   usually possible to assign one of these connecters to connect to the
  2540.   host computer and assign another connector to be the printer port.
  2541.   The connector may have a name next to it (inspect it) and this name
  2542.   (such as Aux, Serial 2, or Modem) may be assigned to either be the
  2543.   main host connection or the printer connection (or the like).
  2544.  
  2545.  
  2546.   12.6.  Quick Attempt
  2547.  
  2548.   While all the above may seem overly complex, to get a terminal working
  2549.   is often fairly simple.  The ``Quick Install'' section describes a
  2550.   simple way to try to do this.  But if that doesn't work or if you want
  2551.   to make the display look better and perform better, more reading will
  2552.   be needed.
  2553.  
  2554.  
  2555.   13.  Terminal Set-Up (Configure) Details
  2556.  
  2557.   Except for the next subsection on sending escape sequences to the
  2558.   terminal, this section mainly presents the details of setting up the
  2559.   terminal manually by sitting at the terminal and going thru menus.  If
  2560.   you haven't already done so, you should read ``Terminal Set-Up
  2561.   (Configure) Overview''.  It's best if you have a terminal manual, but
  2562.   even it you don't there is information here on many of the options
  2563.   which you might possibly need to set.
  2564.  
  2565.   The communication parameters such as its baud rate must always be set
  2566.   up at the terminal since if this is not done there can be no
  2567.   communication with the terminal.   Once communication is established
  2568.   you have two choices for doing the rest the terminal configuration.
  2569.   You may continue to configure manually at the terminal and save the
  2570.   results in the terminal's non-volatile memory or you may do this by
  2571.   sending escape sequences to the terminal from the computer each time
  2572.   the terminal is powered on (or the like).
  2573.  
  2574.  
  2575.   If you know how to set up and save a good configuration inside the
  2576.   terminal it may be the best way.  If you don't, you might want to just
  2577.   send the init string from terminfo to your terminal each time you use
  2578.   the terminal.  Perhaps doing nothing will still give you a usable
  2579.   terminal.  You (or an application program) can always change things by
  2580.   sending certain escape sequences to the terminal.
  2581.  
  2582.  
  2583.   13.1.  Send Escape Sequences to the Terminal
  2584.  
  2585.   Once the communication interface is established, the rest of the
  2586.   configuration of the terminals may sometimes be done by sending escape
  2587.   sequences to the terminals from the computer.  If you have a large
  2588.   number of terminals, it may be worthwhile to write (or locate) a shell
  2589.   script to automatically do this.  There may (or may not) be a command
  2590.   you can send to a terminal to tell it to save its current set-up in
  2591.   its non-volatile memory so that it will be present the next time the
  2592.   terminal is powered on.
  2593.  
  2594.   There is an simple way to send these escape sequences and a complex
  2595.   way.  For the simple way you never look up escape sequences but issue
  2596.   commands that automatically find an appropriate escape sequence in the
  2597.   terminfo database and send that.  Unfortunately, not all the escape
  2598.   sequences which you might want to send are always in the terminfo
  2599.   database.  Thus the more complex (but possibly better) way is to
  2600.   directly send escape sequences.
  2601.  
  2602.   For this complex method you'll need an advanced manual.  Old terminal
  2603.   manuals once included a detailed list of escape sequences but newer
  2604.   ones usually don't.  To find them you may need to purchase another
  2605.   manual called the "programmers manual" (or the like) which is not
  2606.   supplied with the terminal.  A ``Esc Sequence List'' for some
  2607.   terminals is on the Internet but it's terse and likely incomplete.
  2608.  
  2609.   Even without a manual or the like, you may still send commands to
  2610.   configure the terminal by using the programs "tput" and "setterm".
  2611.   See ``Changing the Terminal Settings''.  You could just send the
  2612.   terminal an init string from the terminfo entry if the init string
  2613.   sets up the terminal the way want it.  See ``Init String''.  Unless
  2614.   you plan to have these sequences sent from the computer to the
  2615.   terminal each time the terminal is powered on, you must somehow save
  2616.   the settings in the non-volatile memory of the terminal.
  2617.  
  2618.  
  2619.   13.2.  Older Terminals Set-Up
  2620.  
  2621.   On older terminals look at the keyboard for labels just above the top
  2622.   row of numeric keys.  If they exist, these labels may be what these
  2623.   keys do in set-up mode.  Some older terminals may only have only one
  2624.   "set-up" menu.  Still older ones have physical switches.  In some
  2625.   cases not all the switches are well labeled but they may be well
  2626.   concealed.  Of course, if you set something with a switch, it's
  2627.   "saved" and there is no need to save the setting in non-volatile
  2628.   memory.
  2629.  
  2630.  
  2631.   13.3.  Getting Into Set-Up (Configuration) Mode
  2632.  
  2633.   To select options (configure) at the terminal, you must first enter
  2634.   "set-up" mode and then select options (i.e. configure) using menus
  2635.   stored inside the terminal and displayed on the screen.  To do this,
  2636.   the terminal does not even need to be connected to a computer.  How to
  2637.   get into set-up mode is covered in the terminal's manual, but here's
  2638.   some hints:
  2639.  
  2640.  
  2641.   If there's a "set-up" key try pressing it.  Also try it shifted.
  2642.  
  2643.   ∑  Wyse: First try the shifted "Select" key; then substitute Ctrl for
  2644.      shifted in all of the above.
  2645.  
  2646.   ∑  VT, Dorio: F3 may be the set-up key.  On VT420 and later models
  2647.      this key may have been programmed to do something else so turn off
  2648.      the power.  When you turn on the power again, hit the F3 key as
  2649.      soon as you get an initial screen message.
  2650.  
  2651.   ∑  IBM: 3151: Ctrl-ScrollLock.  3153: Ctrl-Minus_on_Keypad (or like
  2652.      3151)
  2653.  
  2654.   To move around in the set-up menus, try the arrow keys.  Use Return,
  2655.   Space, or a special key ("toggle" on old terminals) to select.  To
  2656.   exit set-up mode select exit from a menu (or on some older terminals
  2657.   press the set-up key again).
  2658.  
  2659.  
  2660.   13.4.  Communication Options
  2661.  
  2662.   For the terminal to work at all, speed, parity, bits/character, and
  2663.   communication mode must be set correctly.  Incorrect flow control may
  2664.   cause loss and/or corruption of data seen on the screen. The essential
  2665.   communication options were dealt with (for both the terminal and
  2666.   computer) in another section:  See "``Communication Interface''.  The
  2667.   following list provides some links to that section, as well as some
  2668.   additional communication options set only at the terminal.
  2669.  
  2670.  
  2671.   ∑  ``Speed (bits/second) '' (baud rate): 9600, 19200, etc.
  2672.  
  2673.   ∑  ``Parity:'' none, even, odd, mark, space
  2674.  
  2675.   ∑  ``Bits per Character '' {Data}: 7 or 8
  2676.  
  2677.   ∑  ``Flow Control:'' or Handshake {Hndshk}: none, Xon-Xoff, or
  2678.      hardware (DTR, etc).
  2679.  
  2680.   ∑  Receiver Handshake {Rcv Hndshk} protects data being Received by the
  2681.      terminal by transmitting flow-control signals to the host.
  2682.  
  2683.   ∑  Transmitter Handshake {Xmt Hndshk} is protection of data being
  2684.      Transmitted by the terminal.   The terminal receives flow-control
  2685.      signals (and locks/unlocks the keyboard).  Includes "Incoming
  2686.      Xon/Xoff".
  2687.  
  2688.   ∑  number of stop bits: 1 or 2. See ``Voltage Sequence for a Byte''
  2689.  
  2690.   ∑  Flow control level {Rcv Hndshk Level} {{Xoff at ...}}: Flow control
  2691.      will send "stop" when this number of bytes in the terminal's buffer
  2692.      is exceeded.
  2693.  
  2694.   ∑  ``Communication Mode'' {Comm}: ``Full Duplex {FDX}, Half Duplex
  2695.      {HDX}'' {{Local Echo}}, ``Local Mode'' {{Online/Local}}
  2696.  
  2697.   ∑  Transmit Rate (Speed) Limit {Xmt Lim}: limits the transmit rate to
  2698.      the specified cps (chars/sec) even though the baud rate setting may
  2699.      be at a higher speed.
  2700.  
  2701.   ∑  Function-Key Rate Limit: as above but for function key messages.
  2702.  
  2703.   ∑  ``Port Select'': Which physical connecter is for the host {Host
  2704.      Port} ?
  2705.  
  2706.  
  2707.   13.5.  Saving the Set-up
  2708.  
  2709.   Your set-up must be saved in the non-volatile memory of the terminal
  2710.   so that it will be effective the next time you turn on the terminal.
  2711.   If you fail to save it, then the new settings will be lost when you
  2712.   turn off the terminal.  Before you go to the trouble of setting up a
  2713.   terminal, make sure that you know how to save the settings.  For
  2714.   modern terminals the save command is done via a menu.  In some older
  2715.   terminals, only the manual tells how to save.  For many of these you
  2716.   press Ctrl-S to save.
  2717.  
  2718.  
  2719.   13.6.  Set-Up Options/Parameters
  2720.  
  2721.   See the Teemworld's Set-Up <http://www.pericom-
  2722.   usa.com/twdocs/doc/twusec7.htm> for a description of many of these
  2723.   parameter as used in terminal emulation.  Emulation is often a little
  2724.   different than an actual terminal.
  2725.  
  2726.   What follows in this section describes some of the options which are
  2727.   available in the set-up menus of many terminals.  Options are also
  2728.   called parameters or features.  Many options may be called "modes".
  2729.   Setting options is often called "configuring".  Many of these options
  2730.   may also be set by sending certain escape sequences to the terminal.
  2731.   Different models and brands of terminals have various options and the
  2732.   same option may be called by different names (not all of which are
  2733.   given here) Terse names used by Wyse are enclosed in { }.  Names used
  2734.   mostly for VT terminals are enclosed in {{ }}.
  2735.  
  2736.  
  2737.   13.7.  Emulation {Personality} {{Terminal Modes}}
  2738.  
  2739.   Most modern terminals can emulate several other terminals.  The
  2740.   terminal can likely do more if it is set to emulate itself (actually
  2741.   no emulation) {native personality}.   Sometimes there are 2 different
  2742.   emulations for the same model of terminal.  For example VT220-7
  2743.   emulates a VT200 with 7-bits/byte while VT220-8 emulates a VT220 with
  2744.   8-bits/byte (256 possible characters).
  2745.  
  2746.   Older models of terminals usually have fewer features than newer
  2747.   models.  Suppose one wanted to emulate an old terminal but also wanted
  2748.   some of the advanced capabilities of the later model terminal they are
  2749.   sitting at.  This is sometimes possible (to some degree).  This
  2750.   feature is sometimes called {Enhance} (or Enhanced ??).
  2751.  
  2752.  
  2753.   13.8.  Display Options
  2754.  
  2755.   13.8.1.  Character Cell Size {Char Cell}
  2756.  
  2757.   This is the size of the cell in which a character fits.  It is
  2758.   measured in pixels (=tiny dots).  The more dots, the better the
  2759.   resolution.   10x16 is 10 dots wide by 16 dots high (16 rows and 10
  2760.   columns).  Note the notation is inverted as compared to the notation
  2761.   for matrix dimensions which gives rows (height) first..  Also, the
  2762.   character cell includes rows and columns of pixels allocated for the
  2763.   space between adjacent characters so the cell size which defines the
  2764.   boundaries of an actual character may be smaller.
  2765.  
  2766.  
  2767.   13.8.2.  Columns/Lines
  2768.  
  2769.   Usually 80 columns and 24 or 25 lines.  This means that there may be
  2770.   up to 80 characters in a row (line) on the screen.   Many terminals
  2771.   have a 132 column option but unless you have a large screen, the tiny
  2772.   characters may be hard to read. {{Set 132 column mode}}
  2773.   13.8.3.  Cursor
  2774.  
  2775.   The cursor may be set to appear as a rectangle (= block) {Blk}.  Other
  2776.   options are underline {Line} or blinking.  I prefer non-blinking
  2777.   {Steady} block since it's big enough to find quickly but there is no
  2778.   distractive blinking.  If you set it invisible (an option on some
  2779.   terminals) it will disappear but new letters will appear on the screen
  2780.   as you type at the invisible cursor.
  2781.  
  2782.  
  2783.   13.8.4.  Display Attributes (Magic Cookies)
  2784.  
  2785.   ``Display Attributes'' may either be magic cookies or be attribute
  2786.   bytes assigned to each character.  For magic cookies, there is a limit
  2787.   to their extent: Are they in effect to the end of the line or to the
  2788.   end of the page?  It's best to use attribute bytes (which could
  2789.   actually be half-bytes = nibbles).
  2790.  
  2791.  
  2792.   13.8.5.  Display Control Characters {Monitor}
  2793.  
  2794.   May be called various names such as "Display Controls".  When off
  2795.   (normal) it's "Interpret Controls".  When set on, you see the escape
  2796.   sequences from the host (which you normally never see on the screen).
  2797.   So that these sequences may be viewed in sequence on a line, they are
  2798.   not acted upon (interpreted) by the terminal.  Except that a CR LF
  2799.   sequence creates a new line.  See ``Control Codes''.
  2800.  
  2801.  
  2802.   13.8.6.  Double Width/Height
  2803.  
  2804.   Some terminals can have their characters double width and/or double
  2805.   height.  This feature is seldom needed.  When changing a line to
  2806.   double width (DW) the right half (RH) is pushed off the screen and
  2807.   there is the question of whether or not to delete (erase) it.
  2808.   "Preserve" means to keep the RH of DW lines.  When in double height
  2809.   mode, it may be necessary to send each such line twice (the 2nd time
  2810.   down one row) in order to get a double-height line on the screen.
  2811.  
  2812.  
  2813.   13.8.7.  Reverse Video {Display} (Background Light/Dark)
  2814.  
  2815.   Normal video is light (white, green, amber) letters (foreground) on a
  2816.   dark (black) background.  Reverse video {Display Light} is the
  2817.   opposite: black text on a light background.  This is easier on the
  2818.   eyes (unless the room is dark).
  2819.  
  2820.  
  2821.   13.8.8.  Status Line
  2822.  
  2823.   A status line is a line at the top or bottom of the screen that
  2824.   displays info about the application program you are running.  It's
  2825.   often highlighted in some way.  With a status line enabled, an
  2826.   application can send the terminal a special escape sequence which
  2827.   means that the text that follows is for the status line.  However,
  2828.   many applications don't use this feature but instead only simulate a
  2829.   real status line by direct cursor positioning.  The ordinary user
  2830.   looking at it doesn't know the difference.
  2831.  
  2832.  
  2833.   13.8.9.  Upon 80/132 Change: Clear or Preserve?
  2834.  
  2835.   When switching the number of columns from 80 to 132 (or conversely)
  2836.   should the data displayed in the old format be erased (cleared) or
  2837.   preserved? {80/132 Clr} {{Screen Width Change}}.  It should make no
  2838.   difference how you set this option since if an application program
  2839.   uses 132 columns, it should set this option appropriately via a
  2840.   control sequence.
  2841.  
  2842.  
  2843.   13.9.  Page Related Options
  2844.  
  2845.   For a Wyse terminal to be able to access multiple pages of display
  2846.   memory {Multipage} must be set to on.
  2847.  
  2848.  
  2849.   13.9.1.  Page Size
  2850.  
  2851.   The terminal memory may be divided up into a number of pages.  See
  2852.   ``Pages'' and ``Pages'' for explanations of pages.  You may partition
  2853.   the page memory into a number of pages of selected length.  Linux
  2854.   applications don't seem to use pages at present so it shouldn't make
  2855.   much difference how you set this up.
  2856.  
  2857.  
  2858.   13.9.2.  Coupling (of cursor & display)
  2859.  
  2860.   The terminal memory may be divided up into a number of pages.  See
  2861.   ``Pages'' and ``Pages'' for explanations of pages.  When the cursor is
  2862.   moved to a location in video memory not currently displayed (such as
  2863.   another page, or on the same page but to a location not displayed on
  2864.   the screen) should the display change to let one view the new cursor
  2865.   location?  If so, this is called "Coupling".  For cursor movement
  2866.   within the same page there is "Vertical Coupling" and "Horizontal
  2867.   Coupling".  For movement to another page there is "Page Coupling".
  2868.  
  2869.  
  2870.   13.10.  Reporting and Answerback
  2871.  
  2872.   The terminal will identify itself and its state, or send out a pre-
  2873.   recorded message in response to certain escape sequences.
  2874.  
  2875.  
  2876.   13.10.1.  Answerback Message (String)
  2877.  
  2878.   You may write a short message during set-up which may optionally be
  2879.   sent to the host at power-up or be sent to the host in response to a
  2880.   request from the host (perhaps the ENQ (inquire) control character).
  2881.  
  2882.  
  2883.   13.10.2.  Auto Answerback
  2884.  
  2885.   If set, sends the answerback message to the host at power-on without
  2886.   the host asking for it.  Do any "getty" processes look for this ??
  2887.  
  2888.  
  2889.   13.10.3.  Answerback Concealed
  2890.  
  2891.   If set, will never let anyone see the answerback message (except of
  2892.   course the host computer).  If it needs to be changed, deselect
  2893.   "answerback concealed" and the formerly concealed message will be
  2894.   destroyed so you then may enter a new message (but you don't get to
  2895.   see the old one).
  2896.  
  2897.  
  2898.   13.10.4.  Terminal ID {ANSI ID}
  2899.  
  2900.   The terminal send this reply in answer to a request for identity.
  2901.  
  2902.  
  2903.  
  2904.  
  2905.   13.11.  Keyboard Options
  2906.  
  2907.   13.11.1.  Keyclick
  2908.  
  2909.   When set, pressing any key makes a click (broadcast by a tiny
  2910.   loudspeaker in the keyboard).  These clicks annoy some people and I
  2911.   think it's best to set keyclick off.
  2912.  
  2913.  
  2914.   13.11.2.  Caps Lock {Keylock}
  2915.  
  2916.   When the Caps-Lock key is down, should only the alphabetic keys
  2917.   generate shifted characters?  If set to {Caps} or upper-case-only then
  2918.   hitting a number key with the Caps-Lock on will type the number.  To
  2919.   get the symbol above the number one must manually hold down the shift
  2920.   key.  This is the normal mode.  If set to {Shift} then all keys type
  2921.   the shifted character when Caps-Lock is on (hitting the 5 key should
  2922.   type % without holding down Shift, etc.).
  2923.  
  2924.  
  2925.   13.11.3.  Auto Repeat {Repeat}
  2926.  
  2927.   If a key is held down then that key is repeatedly "typed".  This is
  2928.   handy for repeatedly typing the same character to create a line across
  2929.   the page.
  2930.  
  2931.  
  2932.   13.11.4.  Margin Bell
  2933.  
  2934.   When the cursor is 8 columns away from the right side of the display,
  2935.   a bell is rung (like on an old typewriter).  Almost all editors will
  2936.   automatically create a new line if needed (no need to hit the Return
  2937.   key) so this feature is seldom needed.
  2938.  
  2939.  
  2940.   13.11.5.  Remapping the Keys
  2941.  
  2942.   The code sent to the host when a key is pressed is normally the ASCII
  2943.   code for that key (depends also on Shift and Control key).  On some
  2944.   terminals you may make any key send any code you wish.  That is, you
  2945.   may completely remap the keyboard by setting up the terminal that way.
  2946.   This may be useful for some foreign languages and Dvorak keyboard
  2947.   layouts, etc. which permit one to type faster.
  2948.  
  2949.  
  2950.   13.11.6.  Corner Key (for Wyse only)
  2951.  
  2952.   Wyse terminals have a key near the lower left corner which may be set
  2953.   to assume various functions.  Its either labelled "Funct", "Compose
  2954.   Character" or "Alt".  When set to {Hold} No-Scroll it stops the flow
  2955.   of data (using flow control) to the terminal.  Hitting the key again
  2956.   restores normal flow.  When set to {Compose} it permits one to
  2957.   generate a limited number of pre-defined non-Latin characters.  When
  2958.   set to Meta, it makes it a meta shift key which sets the high-order
  2959.   bit on each byte.  When set to {Funct} (and pressed) any alphanumeric
  2960.   key pressed gets a header (SOH) and trailer (CR) byte framing the
  2961.   ASCII byte code.  When set to {Kpd Compose} (and pressed) then typing
  2962.   a decimal number on the numeric keys (followed by "enter") sends out
  2963.   the same number in hexadecimal ??
  2964.  
  2965.  
  2966.   13.11.7.  Numeric Keypad or Arrow Keys Sends
  2967.  
  2968.   The numeric keypad (the rectangle of mostly numeric keys to the right
  2969.   of the main part of the keyboard) can be set to send special codes
  2970.   which will do special things in certain application programs.  Ditto
  2971.   for the arrow keys.  There is thus a "normal" mode where they send
  2972.   what is shown on the keycap (or the normal code sequence for an arrow-
  2973.   key) and an "application" mode where a special escape sequence is
  2974.   sent.  In some cases there is a "hex" numeric mode which is almost
  2975.   like normal numeric mode except that 6 non-numeric keys send the
  2976.   letters A-F.  Thus one may type for example "B36F" on the numeric
  2977.   keypad.
  2978.  
  2979.  
  2980.   13.11.8.  What does shifted-del and shifted-bs send?
  2981.  
  2982.   Depending on how they're set up shifted-del sometimes sends the
  2983.   control character CAN and shifted backspace sometimes sends DEL.
  2984.  
  2985.  
  2986.   13.11.9.  PC Scan Codes
  2987.  
  2988.   Newer terminals can emulate a PC keyboard by sending PC scan codes
  2989.   (see Keyboard-and-Console-HOWTO) instead of ASCII codes.  This would
  2990.   be used if you were directly connected to a PC running Dos/Windows.
  2991.   Set {Keycode} to {Scan}.  Emulating the Dec "PCTerm" should do this
  2992.   and more.  A serial port under Linux can't cope with such scan codes.
  2993.  
  2994.  
  2995.   13.11.10.  Alternate Characters
  2996.  
  2997.   Some keys may have alternative letters on them.  When keys is set to
  2998.   "Typewriter" they send what they would normally send on a typewriter.
  2999.   When keys is set to something else the alternative characters are
  3000.   sent.
  3001.  
  3002.  
  3003.   13.12.  Meaning of Received Control Codes
  3004.  
  3005.   13.12.1.  Auto New Line {Newline}
  3006.  
  3007.   In this case "New Line" means a new line starting at the left margin
  3008.   below the current line.  In Linux and C "new line" (NL) may have a
  3009.   different meaning: the line-feed control character LF also called new-
  3010.   line or NL.  This is because in Linux text files, the LF character
  3011.   means a "new line starts here" so it's labeled NL.  Normally, a LF
  3012.   (NL) sent to a terminal only results in the cursor jumping down one
  3013.   line below where is was and does not result in a new line.
  3014.  
  3015.   If Auto New Line is set, the above "normal" situation is canceled and
  3016.   a physical new line is created on the display upon receiving a LF from
  3017.   the host.  This is exactly what one wants in Linux.  Except that (when
  3018.   Auto New Line is set) the Return (or Enter) key sends a CR LF sequence
  3019.   to the host (for Wyse and VT100, but for VT420 ??).  Since Linux uses
  3020.   LF as a "new line" marker in files, Linux would like only a LF to be
  3021.   sent (and not a CR LF).  Thus the "New Line" option is seldom used.
  3022.   Instead, the required translations are made by the serial port device
  3023.   driver by default.  It is as if one gave the command "stty onlcr
  3024.   icrnl" but you don't need to do this since it's the default.
  3025.  
  3026.  
  3027.   13.12.2.  Auto Line Feed {Rcv CR}
  3028.  
  3029.   This is just another type of "Auto New Line".  When a CR (carriage
  3030.   return) character is received, a LF (line feed) action is added
  3031.   resulting in a new line being displayed.  Since Linux marks the end of
  3032.   lines with LF, this option is not used.
  3033.  
  3034.  
  3035.  
  3036.  
  3037.   13.12.3.  Recognize Del (Wyse Only ??) or Null
  3038.  
  3039.   If off, the DEL character received by the terminal is ignored.  If on
  3040.   the DEL performs a destructive backspace.  Null characters are usually
  3041.   ignored in any case.  Both DEL and NULL are sometimes used for
  3042.   padding.  See ``Padding''
  3043.  
  3044.  
  3045.   13.13.  Where New Text Goes
  3046.  
  3047.   13.13.1.  Line Wrap
  3048.  
  3049.   Also called "Auto Wrap(around)".  What happens when the right edge of
  3050.   the screen is reached (col. 80, etc) and no return character (or the
  3051.   like) has been sent from the host?  If Line Wrap is set, then the rest
  3052.   of the line displays on the line below, etc.  Otherwise, the rest of
  3053.   the line is lost and is not seen on the screen.  Any good application
  3054.   should provide "return" characters so that wrap happens before the end
  3055.   of the screen is reached.  But a raw copy command (and other
  3056.   situations) may not do this so it's usually best to set line wrap.
  3057.  
  3058.   For an 80 col. screen, most terminals only wrap if the 81st character
  3059.   from the host is a graphic (printable) character.  This allows for the
  3060.   case where 81st character from the host might be "return" or a
  3061.   "newline" (non-graphic characters) which means that the application is
  3062.   handing the wrapping OK and intervention by the terminal is not
  3063.   needed.
  3064.  
  3065.  
  3066.   13.13.2.  Scrolling
  3067.  
  3068.   Scrolling {Scrl} is where all the lines on the screen move up or down.
  3069.   Its also called "panning" which includes movement sideways.  In
  3070.   ordinary scrolling lines roll off the bottom or top of the screen and
  3071.   disappear, and new lines from the host appear at the opposite edge
  3072.   (top or bottom).  There are 3 types of this: smooth, jump, or burst.
  3073.   Burst is not really scrolling since its an instant replacement of an
  3074.   old screenfull by a new one (although some lines on the new screen may
  3075.   be from the old screen).  Jump is where new lines jump into view one
  3076.   at a time.  Smooth {Smth} is where the text moves at a steady speed
  3077.   upward or downward.  If the smooth scroll rate is slow enough, one may
  3078.   read the newly visible lines when they are still scrolling (in
  3079.   motion).
  3080.  
  3081.   Smooth scrolling on slow terminals was once useful since one could
  3082.   continue reading as the display was scrolling.  But with higher baud
  3083.   rates, jump scroll is so fast that little time is lost as the new
  3084.   display appears.  Since it takes a little longer to read scrolling
  3085.   text than fixed text, it may actually waste more time if smooth
  3086.   scrolling is selected.
  3087.  
  3088.   If (auto)scrolling {Autoscrl} is disabled, then new text from the host
  3089.   must go somewhere so it is put at the top of the display.  If the old
  3090.   text is not erased, the new text merges (nonsensically) into the old.
  3091.   If the old text is erased, then the new text is out of context.  So
  3092.   keep (auto)scrolling enabled.
  3093.  
  3094.  
  3095.   13.13.3.  New Page?
  3096.  
  3097.   See ``Pages'' and ``Pages'' for explanations of pages.  When the
  3098.   current page is full (the last line is finished) should the page
  3099.   scroll, or should a new page be created (leaving the previous page
  3100.   stored in the terminal's display memory).  If {Autopage} is set, then
  3101.   a new page is created.  Since you are probably not using pages, you
  3102.   should probably set this to off.
  3103.   13.14.  Function Keys
  3104.  
  3105.   These are the keys labeled F1, F2, etc.  On older terminals they may
  3106.   be labeled PF1, PF2, etc. where the P stands for Programmable.  Some
  3107.   keyboards have both.  One may program (redefine) these keys to send
  3108.   out a string of user-defined bytes.  They may often be easily
  3109.   "programmed" using a certain set-up menu {FKey}.  On some terminals,
  3110.   one may also specify where this string is sent to when the key is
  3111.   pressed.  In "normal" mode, pressing the key is just like typing the
  3112.   string at the keyboard.  In "local" mode pressing the key sends it to
  3113.   the terminal (just like if the terminal was in local mode).  This may
  3114.   be used to send escape sequences to the terminal so as to configure it
  3115.   in a special way.  In "remote" mode, the string is always sent out the
  3116.   serial port to the host computer (even if the terminal is in local
  3117.   mode).
  3118.  
  3119.  
  3120.   13.15.  Block Mode Options
  3121.  
  3122.   Some options are only for the case of ``Block Mode''.  This option is
  3123.   powerful since it provides forms and takes load off the host computer
  3124.   by transmitting in bursts.  But it's more complicated to set up and is
  3125.   thus not used too much.
  3126.  
  3127.  
  3128.   13.15.1.  Forms Display
  3129.  
  3130.   In block mode some regions of the screen are for the text of forms and
  3131.   are thus write-protected "Prot" {WPRT}.  Options may set the
  3132.   characters in these regions to appear dim, reverse video {WPRT Rev},
  3133.   and/or underlined {WPRT Undrln}.  {WPRT Intensity} may be set to dim,
  3134.   normal, or even blank (invisible)
  3135.  
  3136.  
  3137.   13.15.2.  Send Entire Block ?
  3138.  
  3139.   Should write-protected text (the original text in the form) be sent to
  3140.   the host upon transmission of a block: {Send All} or is write-
  3141.   protected text also read-protected: {Send Erasable}
  3142.  
  3143.  
  3144.   13.15.3.  Region to Send
  3145.  
  3146.   Should the entire screen be sent or just the scrolling region?  {Send
  3147.   Area}.  Should the sending stop when the current cursor position is
  3148.   reached?  If {Xfer Term} is set to Cursor, only the data on the screen
  3149.   up to the cursor is sent.
  3150.  
  3151.  
  3152.   13.15.4.  Block/Page terminator
  3153.  
  3154.   What is the termination symbol to be appended to a block of data?
  3155.   {Blk End} or at the end of a page {Send Term}ination.
  3156.  
  3157.  
  3158.   13.16.  Locks
  3159.  
  3160.   There are various types of Locks.  One is the Locked keyboard due to
  3161.   flow control.  See ``Keyboard Lock'' Another lock {Feature Lock} is
  3162.   that which prohibits the host computer from changing the terminal set-
  3163.   up by sending certain escape sequences to the terminal.  Placing such
  3164.   a lock may result in unexpected behavior as application programs send
  3165.   escape sequences to the terminals that are ignored.  Not all set-up
  3166.   parameters lock.  Unless you have a good reason to do so, you should
  3167.   not enable such locking.
  3168.  
  3169.   A Function Key lock will prohibit the computer from redefining what a
  3170.   programmable function key sends.  You may want to use this if you have
  3171.   something important programmed into the function keys.
  3172.  
  3173.  
  3174.   13.17.  Screen Saver {Scrn Saver}
  3175.  
  3176.   Also called "CRT Saver".  This turns off (or dims) the screen after
  3177.   the terminal is not used for a period of time.  It prolongs the life
  3178.   of the screen and may save some energy.  Hitting any key will usually
  3179.   restore the screen and may "execute" that key so it's best to hit the
  3180.   shift-key, etc.
  3181.  
  3182.  
  3183.   13.18.  Printer
  3184.  
  3185.   For Wyse, if there is no {Printer Attached} set it to Off.  It's not
  3186.   essential to do this, but if you do it any escape sequence to send
  3187.   text to the printer (instead of the terminal) will be ignored.
  3188.  
  3189.   Setting up the printer port is about the same (usually simpler) as
  3190.   setting up the communications on the main port.  There are a couple of
  3191.   options specific to the printer.  Is the printer a serial or parallel
  3192.   printer?  If it's parallel it should be designated as such in setup
  3193.   and connected to the parallel port on the terminal (if there is one).
  3194.   Should a FF (form feed) be sent to the printer at the end of a print
  3195.   job?  If {Print Term} is set to FF, this will happen.
  3196.  
  3197.  
  3198.   14.  Computer Set-Up (Configure) Details
  3199.  
  3200.   There are various files to edit to set up the computer for terminals.
  3201.   If you're lucky, you'll only need to edit /etc/inittab.  One does this
  3202.   by editing at the console (or from any working terminal).
  3203.  
  3204.  
  3205.   14.1.  Getty (in /etc/inittab)
  3206.  
  3207.   In order to have a login process run on a serial port when the
  3208.   computer starts up (or switches run levels) a getty command must be
  3209.   put into the /etc/inittab file.  Getty GETs a TTY (a terminal) going.
  3210.   Each terminal needs its own getty command.  There is also at least one
  3211.   getty command for the console in every /etc/inittab file.  Find this
  3212.   and put the getty commands for the real terminals next to it.  This
  3213.   file may contain sample getty lines for text terminals that are
  3214.   commented out so that all you need to do is to uncomment them (remove
  3215.   the leading #) and change a few arguments.
  3216.  
  3217.   The arguments which are permitted depend on which getty you use.
  3218.  
  3219.   ∑  The gettys best for directly connected terminals are:
  3220.  
  3221.   ∑  agetty (sometimes just called getty): Easy to set up. No config
  3222.      files.  Simple to use with modems.  See ``Agetty''
  3223.  
  3224.   ∑  ``getty (part of getty_ps)''
  3225.  
  3226.      Two gettys best for modem lines are:
  3227.  
  3228.   ∑  mgetty: for modems; use with terminals possible but poorly
  3229.      documented
  3230.  
  3231.   ∑  uugetty: for modems only; part of getty_ps package
  3232.  
  3233.      A simple getty to use for console login:
  3234.  
  3235.   ∑  mingetty: for consoles only
  3236.  
  3237.  
  3238.  
  3239.   If you don't have the getty you want, it may be downloaded from Serial
  3240.   Software <http://sunsite.unc.edu/pub/Linux/system/serial/!Index.html>.
  3241.  
  3242.   If you are not using modem control lines (for example if you only use
  3243.   the minimum number of 3 conductors: transmit, receive, and common
  3244.   signal ground) you should let getty know this by using a "local" flag.
  3245.   The format of this depends on which getty you use.
  3246.  
  3247.  
  3248.   14.1.1.  Agetty (may be named getty)
  3249.  
  3250.   An example line in /etc/inittab:
  3251.   S1:23:respawn:/sbin/getty -L 19200 ttyS1 vt102
  3252.   S1 is from ttyS1.  23 means that getty is run upon entering run levels
  3253.   2 or 3.  respawn means that if getty is killed, it will automatically
  3254.   start up (respawn) again.  /sbin/getty is the getty command.  The -L
  3255.   means Local (ignore modem control signals).  19200 is the baud rate.
  3256.   ttyS1 means /dev/ttyS1 (COM2 in MS-DOS).  vt102 is the type of
  3257.   terminal and this getty will set the environment variable TERM to this
  3258.   value.  There are no configuration files.  Type "init q" on the
  3259.   command line after editing getty and you should see a login prompt.
  3260.  
  3261.   The agetty program will auto-detect any parity set inside the
  3262.   terminal.  If you use stty to set parity, agetty will automatically
  3263.   unset it since it doesn't want the serial driver stripping off the
  3264.   parity bit since it to see it as part of an 8-bit character in order
  3265.   to detect parity.  Thus if you use parity, enable it only at the
  3266.   terminals and let agetty auto-detect it and set it at the computer.
  3267.   The login prompt will look garbled until you type something and getty
  3268.   sets the parity.  Let me know if you find a way to get a clean-looking
  3269.   login prompt with parity using agetty.  The garbled prompt will deter
  3270.   visitors, etc. from trying to login (if that's what you want).
  3271.  
  3272.  
  3273.   14.1.2.  getty (part of getty_ps)
  3274.  
  3275.   (This is from the old Serial-HOWTO by Greg Hankins)
  3276.   Add entries for getty to use for your terminal in  the configuration
  3277.   file /etc/gettydefs if there they aren't already there:
  3278.  
  3279.  
  3280.  
  3281.        # 38400 bps Dumb Terminal entry
  3282.        DT38400# B38400 CS8 CLOCAL # B38400 SANE -ISTRIP CLOCAL #@S @L login: #DT38400
  3283.  
  3284.        # 19200 bps Dumb Terminal entry
  3285.        DT19200# B19200 CS8 CLOCAL # B19200 SANE -ISTRIP CLOCAL #@S @L login: #DT19200
  3286.  
  3287.        # 9600 bps Dumb Terminal entry
  3288.        DT9600# B9600 CS8 CLOCAL # B9600 SANE -ISTRIP CLOCAL #@S @L login: #DT9600
  3289.  
  3290.  
  3291.  
  3292.  
  3293.   If you want, you can make getty print interesting things in the login
  3294.   banner.  In my examples, I have the system name and the serial line
  3295.   printed.  You can add other things:
  3296.  
  3297.  
  3298.  
  3299.  
  3300.  
  3301.   @B    The current (evaluated at the time the @B is seen) bps rate.
  3302.   @D    The current date, in MM/DD/YY.
  3303.   @L    The serial line to which getty is attached.
  3304.   @S    The system name.
  3305.   @T    The current time, in HH:MM:SS (24-hour).
  3306.   @U    The number of currently signed-on users.  This is  a
  3307.         count of the number of entries in the /etc/utmp file
  3308.         that have a non-null ut_name field.
  3309.   @V    The value of VERSION, as given in the defaults file.
  3310.   To display a single '@' character, use either '\@' or '@@'.
  3311.  
  3312.  
  3313.  
  3314.  
  3315.   When you are done editing /etc/gettydefs, you can verify that the
  3316.   syntax is correct by doing:
  3317.  
  3318.  
  3319.        linux# getty -c /etc/gettydefs
  3320.  
  3321.  
  3322.  
  3323.  
  3324.   Make sure there is no getty or uugetty config file for the serial port
  3325.   that your terminal is attached to (/etc/default/{uu}getty.ttySN or
  3326.   /etc/conf.{uu}getty.ttySN), as this will probably interfere with
  3327.   running getty on a terminal.  Remove the file if it exits.
  3328.  
  3329.   Edit your /etc/inittab file to run getty on the serial port
  3330.   (substituting in the correct information for your environment - port,
  3331.   speed, and default terminal type):
  3332.  
  3333.  
  3334.        S1:23:respawn:/sbin/getty ttyS1 DT9600 vt100
  3335.  
  3336.  
  3337.  
  3338.  
  3339.   Restart init:
  3340.  
  3341.  
  3342.        linux# init q
  3343.  
  3344.  
  3345.  
  3346.  
  3347.   At this point, you should see a login prompt on your terminal.  You
  3348.   may have to hit return to get the terminal's attention.
  3349.  
  3350.  
  3351.   14.1.3.  Mgetty
  3352.  
  3353.   The m stands for modem.  This program is primarily for modems but it
  3354.   will work for text-terminals.  It's poorly documented (as of mid 1998)
  3355.   for terminals and you may need to wade thru much documentation for
  3356.   modems in order to figure out how to use it for terminals.  Look at
  3357.   /etc/mgetty/mgetty.config for an example of configuring a terminal.
  3358.  
  3359.  
  3360.   14.2.  Stty & Setserial
  3361.  
  3362.   There is both a "stty" command and a "setserial" command for setting
  3363.   up the serial ports.   Some (or all) of the needed stty settings can
  3364.   be done via getty and there may be no need to use setserial so you may
  3365.   not need to use either command.  These two commands (stty and
  3366.   setserial) set up different aspects of the serial port.  Stty does the
  3367.   most while setserial configures the low-level stuff such as interrupts
  3368.   and port addresses.  To "save" the settings, these commands must be
  3369.   written in certain files (shell scripts) which run each time the
  3370.   computer starts up.  You may also use the stty and setserial commands
  3371.   on the command line but such settings will be lost as soon at you turn
  3372.   off the computer.
  3373.  
  3374.  
  3375.   14.2.1.  Setserial
  3376.  
  3377.   Setserial can change both the interrupt (IRQ) number and the port
  3378.   address.  It can tell you what type of UART chips you have.  It can
  3379.   set the time that the port will keep operating after it's closed (in
  3380.   order to output any characters still in its buffer in main RAM).  This
  3381.   is needed at slow baud rates of 1200 or lower.  For setserial to work,
  3382.   the serial module (for the Linux kernel) must be loaded.  If you use
  3383.   more than 2 serial ports and want to assign unique IRQ numbers, then
  3384.   you need to use setserial.
  3385.  
  3386.  
  3387.   14.2.2.  Where to Run Setserial ?
  3388.  
  3389.   To modify (or add) a setserial command, edit the shell script that
  3390.   runs setserial.  Where it resides depends on your distribution.  It
  3391.   might be in a /etc/rc.d directory in a "rc.local" or "rc.serial" file.
  3392.   In the Debian distribution it was the 0setserial file in /etc/rc.boot
  3393.   but this eventually should change to a file in /etc/init.d.
  3394.  
  3395.  
  3396.   14.2.3.  Stty
  3397.  
  3398.   You probably don't need to use the "stty" command to configure if you
  3399.   use one of the two suggested gettys to do the equivalent of stty ...
  3400.   You still may need to use the stty command to see how the serial port
  3401.   is configured and may need to consult the stty man page.
  3402.  
  3403.   Stty does most of the configuration of the serial port (but the
  3404.   default plus what you change with getty should set things up OK).  To
  3405.   see how it's now set for the terminal (or console) you're now at type
  3406.   at the shell prompt: stty -a.  For other terminals (such as ttyS1)
  3407.   type: stty -a < /dev/ttyS1.  Here are some of the items stty
  3408.   configures: speed (bits/sec), parity, bits/byte, # of stop bits, strip
  3409.   8th bit?, modem control signals, flow control, break signal, end-of-
  3410.   line markers, change case, padding, beep if buffer overrun?, echo,
  3411.   allow background tasks to write to terminal?, define special (control)
  3412.   characters (such as what keys to press for interrupt).  See the stty
  3413.   man or info page for more details.  Also see the man page: termios
  3414.   which covers the same options set by stty but (as of mid 1998) covers
  3415.   features which the stty man page fails to mention.  For use of some
  3416.   special characters see ``Special (Control) Characters''
  3417.  
  3418.   With some implementations of getty (getty_ps package), the commands
  3419.   that one would normally give to stty are typed into a getty
  3420.   configuration file: /etc/gettydefs.  Even without this configuration
  3421.   file, the getty command line may be sufficient to set things up so
  3422.   that you don't need stty.
  3423.  
  3424.   One may write C programs which change the stty configuration, etc.
  3425.   Looking at the documentation for this may help one better understand
  3426.   the use of the stty command (and its many possible arguments).
  3427.   Serial-Programming-HOWTO is useful.  The manual page: termios contains
  3428.   a description of the C-language structure (of type termios) which
  3429.   stores the stty configuration in computer memory.  Many of the flag
  3430.   names in this C-structure are almost the same (and do the same thing)
  3431.   as the arguments to the stty command.
  3432.  
  3433.   14.2.4.  Where to Put the Stty Command ?
  3434.  
  3435.   If getty sets up things OK, then you may skip this sub-section.  To
  3436.   have stty set up the terminal each time the computer starts up you
  3437.   need to put the stty command in a file that will be executed each time
  3438.   the computer is started up (Linux boots).  This file should be run
  3439.   before getty starts.  There are many possible places to put it.  If it
  3440.   gets put in more than one place and you only know about (or remember)
  3441.   one of those places, then a conflict is likely.  So make sure to
  3442.   document (perhaps in your terminal manual) where it's located.
  3443.  
  3444.   One good place to put it would be in the same file that runs setserial
  3445.   when the system is booted.  See ``Where to Run Setserial?''.  It would
  3446.   seem best to put it after the setserial command so that the low level
  3447.   stuff is done first.  In the Debian distribution there is an
  3448.   /etc/init.d/bootmisc.sh script but it currently runs before 0setserial
  3449.   does.
  3450.  
  3451.  
  3452.   14.3.  Terminfo & Termcap (brief)
  3453.  
  3454.   See ``Terminfo and Termcap (detailed)'' for a more detailed discussion
  3455.   of termcap.  Many application programs that you run use the terminfo
  3456.   (formerly termcap) data base.  This has an entry for each model or
  3457.   type (such as vt100) of terminal and tells what the terminal can do,
  3458.   what codes to send for various actions, and what codes to send to the
  3459.   terminal to initialize it.
  3460.  
  3461.   Since many terminals (and PC's also) can emulate other terminals and
  3462.   have various "modes" of operation, there may be several terminfo
  3463.   entries from which to choose for a given physical terminal.  They
  3464.   usually will have similar names.  The last parameter of getty (for
  3465.   both agetty and getty_ps) should be the terminfo name of the terminal
  3466.   (or terminal emulation) that you are using (such as vt100).
  3467.  
  3468.   The terminfo does more than just specify what the terminal is capable
  3469.   of doing and disclose what codes to send to the terminal to get it to
  3470.   do those things.  It also specifies what "bold" will look like (will
  3471.   it be reverse video or will it be high intensity, etc.), what the
  3472.   cursor will look like, if the letters will be black, white, or some
  3473.   other color, etc.  In PC terminology these are called "preferences".
  3474.   It also specifies initialization codes to send to the terminal
  3475.   (analogous to the init strings sent to modems).  Such strings are not
  3476.   automatically sent to the terminal by Linux.  See ``Init String''.  If
  3477.   you don't like the way the display on the screen looks and behaves you
  3478.   may need to edit (and then update) the terminfo (or termcap) file.
  3479.   See ``Terminfo Compiler (tic)'' for how to update.
  3480.  
  3481.  
  3482.   14.4.  Setting TERM and TERMINFO
  3483.  
  3484.   These are two environment variables for terminals, but you may not
  3485.   need to do anything about them.  TERM must always be set to the name
  3486.   of the terminal you are using.  TERMINFO contains the path to the
  3487.   terminfo data base, but may not be needed if the database is in a
  3488.   default location (or TERMINFO could be set automatically by a file
  3489.   that comes with your distribution of Linux).
  3490.  
  3491.   Fortunately, the getty program usually sets TERM for you just before
  3492.   login.  This  permits application programs to find the name of your
  3493.   terminal and then look up the terminal capabilities in the terminfo
  3494.   data base.  See ``TERM Variable'' for more details on TERM.
  3495.  
  3496.   If your terminfo data base can't be found you may see an error message
  3497.   about it on your terminal.  If this happens it's time to check out
  3498.   where terminfo resides and set TERMINFO if needed.  You may find out
  3499.   where the terminfo database is by searching for a common terminfo file
  3500.   such as "vt100" using the "locate" command.  Make sure that your
  3501.   terminal is in this database.  An example of setting TERMINFO is:
  3502.   export TERMINFO=/usr/share/terminfo (put this in /etc/profile or the
  3503.   like).  If the data for your terminal in this data base is not to your
  3504.   liking, you may need to edit it.  See ``Terminfo & Termcap (brief)''.
  3505.  
  3506.  
  3507.   14.5.  Rarely Needed /etc/ttytype File
  3508.  
  3509.   The configuration file /etc/ttytype is used to map /dev/ttySn's to
  3510.   terminal names per terminfo.  tset uses it, but if the TERM
  3511.   environment variable is already set correctly, then this file is not
  3512.   needed.  Since the Linux getty sets TERM for each tty, you don't need
  3513.   this file.  In other Unix-like systems such as FreeBSD, the file
  3514.   /etc/ttys maps ttys to much more, such as the appropriate getty
  3515.   command, and the category of connection (such as "dialup").  An
  3516.   example line of Linux ttytype: vt220 ttyS1
  3517.  
  3518.  
  3519.   14.6.  Login Restrictions
  3520.  
  3521.   By default, the root user may not login from a terminal.  To permit
  3522.   this you must create (or edit) the file /etc/securetty per the manual
  3523.   page "securetty".  To restrict logins of certain users and/or certain
  3524.   terminals, etc. edit /etc/login.access (this replaces the old
  3525.   /etc/usertty file ??).  /etc/login.def determines if /etc/securetty is
  3526.   to be used and could be edited so as to make /etc/securetty not needed
  3527.   (or not used).  /etc/porttime restricts the times at which certain
  3528.   ttys and users may use the computer.  If there are too many failed
  3529.   login attempt by a user, that user may be prohibited from ever logging
  3530.   in again.  See the man page "faillog" for how to control this.
  3531.  
  3532.  
  3533.   14.7.  Run Command Only If TERM=my_term_type
  3534.  
  3535.   Sometimes there are commands that one wants to execute at start-up
  3536.   only for a certain type of terminal.  To do this for the stty command
  3537.   is no problem since one uses the redirection operator < to specify
  3538.   which terminal the command is for.  But what about shell aliases or
  3539.   functions?  You may want to make a function for the ls command so it
  3540.   will color-code the listing of directories only on color terminals or
  3541.   consoles.  For monochrome terminals you want the same function name
  3542.   (but a different function body) which will use symbols as a substitute
  3543.   for color-coding.  Where to put such function definitions that are to
  3544.   be different for different terminals?
  3545.  
  3546.   You may put them inside an "if" statement in /etc/profile which runs
  3547.   at startup each time one logs on.  The conditional "if" statement
  3548.   defines certain functions, etc. only if the terminal is of a specified
  3549.   type.  While much of what this if statement does could be done in the
  3550.   configuration file for dircolors, here's an example for the case of
  3551.   the bash shell:
  3552.  
  3553.  
  3554.   ______________________________________________________________________
  3555.   if [ $TERM = linux ]; then
  3556.       eval `dircolors`;
  3557.   elif [ $TERM = vt220 ]; then
  3558.       ls () { command ls -F $* ; }
  3559.   # to export the function ls():
  3560.       declare -xf ls
  3561.   else echo "From /etc/profile: Unknown terminal type $TERM"
  3562.   fi
  3563.   ______________________________________________________________________
  3564.  
  3565.   15.  Terminfo and Termcap (detailed)
  3566.  
  3567.   15.1.  Introduction
  3568.  
  3569.   Terminfo (formerly Termcap) is a database of terminal capabilities and
  3570.   more.  For every (well almost) model of terminal it tells application
  3571.   programs what the terminal is capable of doing.  It tells what escape
  3572.   sequences (or control characters) to send to the terminal in order to
  3573.   do things such as move the cursor to a new location, erase part of the
  3574.   screen, scroll the screen, change modes, change appearance (colors,
  3575.   brightness, blinking, underlining, reverse video etc.).  After about
  3576.   1980, many terminals supported over a hundred different commands (some
  3577.   of which take numeric parameters).
  3578.  
  3579.   The terminfo abbreviations are usually longer than those of termcap
  3580.   and thus it's easier to guess what they mean.  The manual pages for
  3581.   terminfo are more detailed (and include the old termcap
  3582.   abbreviations).  Thus, unless you are already committed to termcap,
  3583.   you should use the terminfo files.
  3584.  
  3585.  
  3586.   15.2.  Terminfo Database
  3587.  
  3588.   The terminfo database is compiled and thus has a source part and a
  3589.   compiled part.  The old termcap database has only a source part but
  3590.   this source can, by a single command, be both converted to terminfo
  3591.   source and then compiled.  Thus you may get by without having any
  3592.   terminfo source since the termcap source can create the compiled
  3593.   terminfo database.
  3594.  
  3595.   To see if your terminal (say vt100) is in the terminfo data base type
  3596.   "locate vt100".  It may show /usr/lib/terminfo/v/vt100 or
  3597.   /usr/share/terminfo/v/vt100 which are possible locations of the
  3598.   compiled terminfo files.  Some older programs may expect it to be in
  3599.   the /etc/terminfo directory.  Unless this terminfo data base happens
  3600.   to be  located where every program that needs it expects to find it,
  3601.   then the environment variable TERMINFO should be set to the path to
  3602.   this database.  Example: TERMINFO=/usr/share/terminfo
  3603.  
  3604.   The source code you use may reside in /etc/termcap and/or in
  3605.   terminfo.src (or another name).  See the man pages: terminfo(5) or
  3606.   termcap(5) for the format required to create (or modify) these files.
  3607.   The file terminfo.src may be in various locations on your computer or
  3608.   it may not be included with your linux distribution.  Use the locate
  3609.   command to try to find it.  It is available for downloading (under the
  3610.   name termtypes.ti) from  <http://sagan.earthspace.net/terminfo>
  3611.  
  3612.  
  3613.   15.2.1.  Terminfo Compiler (tic)
  3614.  
  3615.   The data in the source files is compiled with the "tic" program which
  3616.   is capable of converting between termcap format and terminfo format.
  3617.   Thus you can create a compiled terminfo data base from termcap source.
  3618.   The installation program which was used to install Linux probably
  3619.   installed the compiled files on your hard disk so you don't need to
  3620.   compile anything unless you modify /etc/termcap (or terminfo.src ).
  3621.   "tic" will automatically install the resulting compiled files into a
  3622.   terminfo directory ready to be used by application programs.
  3623.  
  3624.  
  3625.   15.2.2.  Look at Your Terminfo
  3626.  
  3627.   It's a good idea to take a look at the terminfo entry for the terminal
  3628.   you are using (source code of course) and read the comments.  A quick
  3629.   way to inspect it without comments is to just type "infocmp".  But the
  3630.   comments may tell you something special about the terminal such as how
  3631.   you need to set it up so that it will work correctly with the terminfo
  3632.   database.
  3633.  
  3634.  
  3635.   15.2.3.  Deleting Data Not Needed
  3636.  
  3637.   In order to save disk space, one may delete all of the database except
  3638.   for the terminals types that you have (or might need in the future).
  3639.   Don't delete any of the termcaps for a "Linux terminal" (the console)
  3640.   or the xterm ones if you use X-Windows.  The terminal type "dumb" may
  3641.   be needed when an application program can't figure out what type of
  3642.   terminal you are using.  It would save disk space if install programs
  3643.   only installed the terminfo for the terminals that you have and if you
  3644.   could get a termcap for a newly installed terminal over the Internet
  3645.   in a few seconds.
  3646.  
  3647.  
  3648.   15.3.  Modifying Terminfo Files
  3649.  
  3650.   Some of the supplied terminfo entries can be improved.  For example,
  3651.   most terminals have a graphics character set which may be used for
  3652.   drawing boxes with solid lines (not dashed lines).  If you see dashed
  3653.   lines in application programs like minicom, then perhaps the reason is
  3654.   that the graphics capability was not put into the terminfo file.  You
  3655.   may add it by finding out what symbols to use from the manual (in this
  3656.   case you must assign values to: enacs, rmacs, and smacs) and then edit
  3657.   the source file.  Then by using "tic" you may compile it.  "tic"
  3658.   should automatically put the compiled terminfo file in the correct
  3659.   directory reserved for it.
  3660.  
  3661.   If you would like to find a better terminfo than the one supplied, you
  3662.   might try searching the Internet (but what you find may be worse).  If
  3663.   your new terminfo entry is better than the old one and it seems stable
  3664.   (you've used it for a while with no problems) then you should send a
  3665.   copy to the maintainer of terminfo as noted at the start of the source
  3666.   file for terminfo (or termcap).
  3667.  
  3668.  
  3669.   15.4.  Init String
  3670.  
  3671.   Included in the terminfo are often a couple of initialization strings
  3672.   which may be sent to the terminal to initialize it.  This may change
  3673.   the appearance of the screen, change what mode the terminal is in,
  3674.   and/or make the terminal emulate another terminal.  An initialization
  3675.   string is not automatically sent to the terminal to initialize it.
  3676.   One might expect that the getty program should do this but if it did,
  3677.   one could make a change to the set-up at the terminal and this change
  3678.   wouldn't be implemented because the init string would automatically
  3679.   cancel it.  You must use a command given on the command line (or in a
  3680.   shell script) to send the init string such.  Such commands are:
  3681.   "tset", "tput init", or "setterm -initialize".  Sometimes there is no
  3682.   need to send the init string since the terminal may set itself up
  3683.   correctly when it is powered on (using options/preferences one has set
  3684.   up and saved in non-volatile memory of the terminal).
  3685.  
  3686.  
  3687.   15.5.  TERM Variable
  3688.  
  3689.   The Environment variable TERM should be set to the type of terminal
  3690.   which you are using.  It is normally set by the terminal_type
  3691.   parameter passed to the getty program (look at it in the /etc/inittab
  3692.   file).  This name must be in the Terminfo data base.  Just type "set"
  3693.   at the command line to see what TERM is set to (or type: tset -q).  At
  3694.   a console (monitor) TERM is set to "linux" which is the PC monitor
  3695.   emulating a fictitious terminal model named "linux".  Since "linux" is
  3696.   close to a vt100 terminal and many text terminals are also, the
  3697.   "linux" designation will sometimes work as a temporary expedient with
  3698.   a text terminal.
  3699.  
  3700.   If more than one type of terminal may be connected to the same port
  3701.   (/dev/tty...) (for example, if there is a switch to permit different
  3702.   terminal types to use the same serial port, or if the port is
  3703.   connected to a modem to which people call in from different types of
  3704.   terminals) then TERM needs to be set each time someone connects to the
  3705.   serial port.  There is often a query escape sequence so that the
  3706.   computer may ask the terminal what type it is.  Another way is to ask
  3707.   the user to type in (or select) the type of terminal s/he is using.
  3708.   You may need to use tset for this or write a short shell script to
  3709.   handle this.
  3710.  
  3711.  
  3712.   One way to do this is to use "tset" (see the manual page).  tset tries
  3713.   to determine the terminal name of the terminal you are using.  Then it
  3714.   looks up the data in terminfo and sends your terminal an init string.
  3715.   It can also set the value of TERM.  For example, a user dials in and
  3716.   logs in.  The .profile login script is executed which contains within
  3717.   it the following statement: eval `tset -s ?vt100`.  This results in:
  3718.   The user is asked if s/he is using a vt100.  The user either responds
  3719.   yes or types in the actual terminal type s/he is using.  Then tset
  3720.   sends the init string and sets TERM to this terminal name (type).
  3721.  
  3722.  
  3723.   15.6.  Terminfo/Termcap Documents
  3724.  
  3725.  
  3726.  
  3727.   ∑
  3728.  
  3729.   ∑  manual pages for terminfo(5) (best) and/or termcap(5).  The Termcap
  3730.      Manual <http://www.delorie.com/gnu/docs/termcap/termcap_toc.html>
  3731.      (2nd ed.) by Richard M. Stallman is a GNU manual which is somewhat
  3732.      obsolete.  Although dated 1992, it fails to even mention terminfo.
  3733.  
  3734.   ∑  the files: terminfo.src and /etc/termcap have info about various
  3735.      versions of termcap files, naming conventions for terminals, and
  3736.      special capabilities code named u6-u9. If you don't have one, go to
  3737.      <http://sagan.earthspace.net/terminfo>
  3738.  
  3739.   ∑  "Termcap and Terminfo" is a book published by O'Reilly in 1988.
  3740.  
  3741.  
  3742.   16.  Using the Terminal
  3743.  
  3744.   16.1.  Introduction
  3745.  
  3746.   This section is about controlling the terminal-computer interface
  3747.   and/or changing the terminal set-up while using the terminal.  It
  3748.   explains (or points to explanations of) how the user of a terminal can
  3749.   control and inspect the interface and how to use various commands
  3750.   provided by the device driver.  It does not explain how to use the
  3751.   many application programs, shells or most Linux utilities.  Two
  3752.   commands commonly used at the terminal are:
  3753.  
  3754.  
  3755.   ∑  clear (to clear the screen)
  3756.  
  3757.   ∑  reset (to reset the terminal)
  3758.  
  3759.  
  3760.  
  3761.  
  3762.  
  3763.   16.2.  Starting Up the Terminal
  3764.  
  3765.   You should be able to turn on the power to the terminal, hit the
  3766.   "return" (or "enter") key and then get a login prompt.  Then type your
  3767.   account name and your password when prompted for it.  If nothing
  3768.   happens, make sure the host computer is OK.  If the host computer is
  3769.   shut down (no power) what you type at the terminal keyboard may appear
  3770.   on the screen since the transmit and receive pins at the computer may
  3771.   be connected together resulting in echoing of characters by an "off"
  3772.   computer.  If you can't log in when the host computer is running, see
  3773.   ``Trouble-Shooting''.
  3774.  
  3775.  
  3776.   16.3.  Terminal Device Driver
  3777.  
  3778.   When typing at the command line, the shell (such as the Bash shell) is
  3779.   reading what you type and reacting to it.  What you type first passes
  3780.   thru the terminal driver part of your operating system.  This driver
  3781.   may translate certain characters (such as changing the "return"
  3782.   character generated by the "return" key into a "new-line" character
  3783.   for Linux files).  It also recognizes certain control codes which you
  3784.   may type at the keyboard such as ^C to interrupt the execution of a
  3785.   program.  It also normally echos what you type back to the display.
  3786.   ``Stty'' may be used to configure how this terminal driver behaves,
  3787.   including disabling some (or all) of its functionality.
  3788.  
  3789.  
  3790.   16.4.  Problems with Editors
  3791.  
  3792.   There may be some problems with using both emacs and vi on some
  3793.   terminals.
  3794.  
  3795.  
  3796.   16.4.1.  emacs and ^Q
  3797.  
  3798.   If software flow control exists, then the ^Q command in emacs will
  3799.   freeze the display.  The fix is to map this to another key-press by
  3800.   configuring emacs that way.
  3801.  
  3802.  
  3803.   16.4.2.  vi and Cursor-Keys
  3804.  
  3805.   Vi uses the esc-key as a command to exit insert mode.  If one hits an
  3806.   arrow-key (cursor-key) an escape sequence (starting with the ESC
  3807.   character) is sent to the host.  Vi must distinguish between these two
  3808.   meanings of ESC.  A smart vi (such as vim) should be able to detect
  3809.   the difference by noting the key that follows the esc-key.
  3810.  
  3811.   On VT terminals the left-arrow-key may be either set to send ESC [ D
  3812.   or ESC O D.  The other arrow keys are similar but use A, B, and C
  3813.   instead of D.  If you're having problems, choose ESC [ D since the "O"
  3814.   in the other alternative could be interpreted by vi as a command to
  3815.   "Open a line".  The "[" should be interpreted by vi to mean that an
  3816.   arrow-key has been pressed.  ESC [ D will be sent provided "Cursor Key
  3817.   Application Mode" has not been set.  ESC [ D is normally the default
  3818.   so everything is seemingly OK.  Except that many termcaps contain a
  3819.   string (not the init string) which sets what you want to avoid:
  3820.   "Application Mode".  Editors may send this string to the terminal when
  3821.   the editor starts up.  Now you are in trouble.
  3822.  
  3823.   This string has the termcap code "ks" (smkx in terminfo) meaning
  3824.   enable the function (and related) keys (including the arrow keys).  An
  3825.   application enables these keys by sending the "ks" string to the
  3826.   terminal.  Whoever wrote the termcap reasoned that if an application
  3827.   wants to enable these keys, then they should be put into "Application
  3828.   Mode" since this is an "application", but you don't want this.
  3829.   The Linux console has no "ks" string so you can't fall into this trap
  3830.   at the console.  For other terminals you may need to edit the termcap
  3831.   (or terminfo) or use another termcap entry.  You need to change not
  3832.   only the "ks" string but also the termcap definitions of what they
  3833.   send: kd, kl, kr, ku.  Then run tic to install it.
  3834.  
  3835.   For vim (vi iMproved) there is a way to set it up to work OK with ESC
  3836.   O D (so you don't need to edit termcap): See vim help for
  3837.   "vt100-cursor-keys".  You may run "gitkeys" and then press your cursor
  3838.   keys to see what they send but they may be set to send something
  3839.   different when you're in an editor.
  3840.  
  3841.  
  3842.   16.5.  Display Freezes (hung terminal)
  3843.  
  3844.   The symptom of a hung terminal is where what you type doesn't display
  3845.   on the terminal (or in some cases displays but doesn't do anything).
  3846.   If what you type is invisible (or does nothing) type ^Q to restart
  3847.   flow (if flow control stopped it).  Hanging may also be due to:
  3848.   ``Sent Terminal Binary'' or ``Abnormally Exited a Program''
  3849.   If you didn't do any of these two, then your program could by buggy or
  3850.   you interaction with it fatally illegal.
  3851.  
  3852.   If you want to quit the program you were running and you can't do it
  3853.   by the usual methods (some programs have special keys you must hit to
  3854.   exit) then try killing it from another terminal using "top" or "kill".
  3855.   If the process refuses to die, you may try sending it signal 9 from
  3856.   top which should force it to exit.  The "9" type of forced exit may
  3857.   leave some temporary files lying around as well as a corrupted
  3858.   interface.  Killing the login shell should result in a startup of
  3859.   getty with a new login prompt.
  3860.  
  3861.  
  3862.   People new to Linux may unintentionally press Ctrl-S (^S) (or the "No
  3863.   Scroll" key) which mysteriously freezes the screen (although that is
  3864.   what this key is supposed to do if you use software flow-control).  To
  3865.   restore normal screen interaction, press Ctrl-Q (^Q).  Note that
  3866.   everything typed during the "freeze" gets executed but you don't see
  3867.   any report of this until you hit ^Q.  Thus when it's frozen, don't
  3868.   type anything drastic that might destroy files, etc.  One argument for
  3869.   using hardware flow-control is to prevent such freezes.
  3870.  
  3871.  
  3872.   16.6.  Corrupted Terminal Interface
  3873.  
  3874.   This includes the case of a "frozen display" = "hung terminal" of the
  3875.   previous section.
  3876.  
  3877.  
  3878.   16.6.1.  Symptoms
  3879.  
  3880.   When the display doesn't look right, or when what you type doesn't
  3881.   display correctly (if at all), or nothing happens when you type a
  3882.   command, you may have a corrupted terminal interface.  In rare cases
  3883.   when the serial port hardware gets itself corrupted, the only fix may
  3884.   be to cycle power (turn off the PC and reboot).  The corruption may be
  3885.   due to things such as bug in the program you're using, a hardware
  3886.   failure (including an obscure hardware defect that you can normally
  3887.   live with), or possibly an incorrect configuration.  If everything was
  3888.   working normally but it suddenly goes bad, it may be that the
  3889.   interface got corrupted by something you did.  Three mistakes you
  3890.   might have made to corrupt the interface are:
  3891.  
  3892.  
  3893.   ∑  ``Sent Terminal Binary''
  3894.  
  3895.   ∑  ``Abnormally Exited a Program''
  3896.  
  3897.   ∑  ``Typed ctrl-S by mistake''
  3898.  
  3899.  
  3900.   16.6.2.  Sent Terminal Binary Characters
  3901.  
  3902.   Your terminal will change its characteristics if sent certain escape
  3903.   sequences or control characters.  It you inadvertently try to display
  3904.   a binary file, it might by chance contain such sequences which may put
  3905.   your terminal into some strange mode of operation or even make it
  3906.   unusable.  Always view or edit a binary file with programs designed
  3907.   for that purpose so that this doesn't happen.  Most editors and pagers
  3908.   will handle binary OK so as not to corrupt the interface.  Some may
  3909.   display a message telling you that they can't edit binary.  But using
  3910.   "cat ...." or "cp .... /dev/tty.." where .... is a binary file, will
  3911.   send the binary to the terminal and likely corrupt things.
  3912.  
  3913.   Corruption it can also happen when using a communications program
  3914.   where a remote computer may send binary to your screen.  There are
  3915.   numerous other ways it can happen so be prepared for it.  Even a
  3916.   supposed ASCII file may contain unwanted control codes.
  3917.  
  3918.   To fix this problem reset the terminal.  You may try typing either
  3919.   "reset" or "setterm -reset" (although you may not be able to see what
  3920.   you're typing).  This will send the reset string from the terminfo
  3921.   entry to the terminal.  If the correct set-up has been saved inside
  3922.   the terminal, then pressing a special key(s) (perhaps in setup mode)
  3923.   may restore this setting.  Then you might still need to use "reset" to
  3924.   send the init string if you use it to set up your terminal.
  3925.  
  3926.  
  3927.   16.6.3.  Abnormally Exited a Program
  3928.  
  3929.   Large application programs (such as editors) often use the stty
  3930.   command (or the like) in their code to temporarily change the stty
  3931.   configuration when you are running the program.  This may put the
  3932.   device driver into "raw" mode so that every character you type goes
  3933.   directly thru to the application program.  Echoing by the driver is
  3934.   disabled so that everything you see on the screen comes directly from
  3935.   the application program.  Thus many control commands (such as ^C) may
  3936.   not work within such applications.
  3937.  
  3938.   When you tell such an application to quit, the application program
  3939.   first restores the stty settings to what they were before the
  3940.   application program started.  If you abnormally exit the program (you
  3941.   may guess this has happened when what you type no longer displays on
  3942.   the screen) then you may still be in "raw mode" on the command line.
  3943.  
  3944.   To get out of raw mode and restore the normal stty settings type "stty
  3945.   sane".  However, you must type this just after a "return" and end it
  3946.   with a "return".   But hitting the "return" key doesn't do the job
  3947.   since the "return" code no longer gets translated to the new-line
  3948.   characters that the shell is waiting for.  So just type new-line (^J)
  3949.   instead of "return".  The "sane" terminal interface may not be exactly
  3950.   the same as the normal one but it usually works.  "stty sane" may also
  3951.   be useful to get out of a corrupted interface due to other causes.
  3952.  
  3953.  
  3954.   16.7.  Special (Control) Characters
  3955.  
  3956.   A number of control characters which you may type at the keyboard are
  3957.   "caught" by the terminal driver and perform various tasks.  To see
  3958.   these control commands type: stty -a and look at lines 2-4.  They are
  3959.   tersely explained in the stty manual pages.  They may be changed to
  3960.   different control characters or disabled using the stty command.  Thus
  3961.   your control characters might be different than those described below.
  3962.   They are used for command-line editing, interrupting, scrolling, and
  3963.   to pass the next character thru transparently.
  3964.  
  3965.  
  3966.   16.7.1.  Command-Line Editing
  3967.  
  3968.   While the terminal driver has a few commands for command-line editing,
  3969.   some shells have a built-in real editor (such as "readline" in the
  3970.   Bash shell).  Such an editor is normally on by default so you don't
  3971.   need to do anything to enable it.  If it's available you don't need to
  3972.   learn many of the following commands although they often still work
  3973.   along with the command-line editor.  The most important to learn are
  3974.   ^C (interrupt), ^D, and how to stop scrolling.
  3975.  
  3976.  
  3977.   ∑  Delete-key (shown by stty as ^?) erases the last character
  3978.  
  3979.   ∑  ^U kills (deletes) the line
  3980.  
  3981.   ∑  ^W deletes a word backwards
  3982.  
  3983.   ∑  ^R reprints the line.  Useful mainly on hard copy terminals ??
  3984.  
  3985.  
  3986.   16.7.2.  Interrupting (& Quit, Suspend, EOF, Flush)
  3987.  
  3988.  
  3989.  
  3990.   ∑  ^C interrupts.  Exits the program and returns you to the command-
  3991.      line prompt.
  3992.  
  3993.   ∑  ^/ quits.  Same as interrupt ^C but weaker.  Also dumps a "core"
  3994.      file (which you likely have no use for) into your working
  3995.      directory.
  3996.  
  3997.   ∑  ^Z suspends.  Stops the program and puts it in the background.
  3998.      Type fg to restart it.
  3999.  
  4000.   ∑  ^D end of file.  If typed at the command-line prompt, exits the
  4001.      shell and goes to where you were before the shell started.
  4002.  
  4003.   ∑  ^O flush.  Not implemented in Linux.  Sends output to /dev/null.
  4004.  
  4005.  
  4006.   16.7.3.  Scrolling
  4007.  
  4008.   If what you want to see scrolls off the bottom of the screen, you may
  4009.   prevent this by sending a "stop" signal (^S or Xoff) to the host
  4010.   (provided Xon-Xoff ``Flow Control'' is enabled).  Send a "start signal
  4011.   to resume (^Q or Xon).  Some terminals have a "No Scroll" key which
  4012.   will alternately send Xoff and Xon or possibly send the hardware flow
  4013.   control signals ??   Here's what ctrl-S (^S) and ctrl-Q (^Q) do:
  4014.  
  4015.  
  4016.   ∑  ^S stops scrolling (Xoff)
  4017.  
  4018.   ∑  ^Q resume scrolling (Xon)
  4019.  
  4020.   If you want to both stop scrolling and quit, use ^C.  If you want to
  4021.   stop scrolling to do something else but want to keep the program that
  4022.   was generating the output in memory so you can resume scrolling later,
  4023.   use ^Z suspend.
  4024.  
  4025.   An alternative scrolling method is to pipe the output thru a pager
  4026.   such as more, less, or most.  However, the output might not be
  4027.   standard output but could be error output which the pager doesn't
  4028.   recognize.  To fix this you may need to use redirection "2>&1" to get
  4029.   the pager to work OK.  It is often simpler to just use ^S and ^Q
  4030.   unless you need to scroll backwards.
  4031.  
  4032.   At a PC console (emulating a terminal) you may scroll backwards by
  4033.   using Shift-PageUp.  This is frequently needed since the scrolling is
  4034.   often too fast to stop using ^S.  Once you've scrolled backwards
  4035.   Shift-PageDown will scroll forward again.
  4036.  
  4037.  
  4038.   16.7.4.  Take Next Character Literally
  4039.  
  4040.   ^V sends the next character typed (usually a control character)
  4041.   directly thru the device driver with no action or interpretation.
  4042.   Echoed back are two ASCII characters such as ^C.
  4043.  
  4044.  
  4045.   16.8.  Viewing Latin-1 Files on a 7-bit Terminal
  4046.  
  4047.   Some "text" files are 8-bit Latin1 (see ``Character-Sets'').  If you
  4048.   have a terminal that will not display Latin1 (or don't have the Latin1
  4049.   character set selected), then a bullet symbol will display as a 7,
  4050.   etc.  When viewing manual pages (they are Latin1) you may give the
  4051.   option -7 to man so as to translate the 7's, etc. to something close
  4052.   to a bullet (in ASCII).  Are there some pagers that make these
  4053.   translations ??
  4054.  
  4055.  
  4056.   16.9.  Inspecting the Interface
  4057.  
  4058.   These utility programs will provide information about the terminal
  4059.   interface:
  4060.  
  4061.   ∑  gitkeys: shows what byte(s) each key sends to the host.
  4062.  
  4063.   ∑  tty: shows what tty port you are connected to.
  4064.  
  4065.   ∑  set: shows the value of TERM (the terminfo entry name)
  4066.  
  4067.   ∑  stty -a: shows all stty settings.
  4068.  
  4069.   ∑  setserial -g /dev/tty?? (you fill in ??) shows UART type, port
  4070.      address and IRQ number.
  4071.  
  4072.   ∑  infocmp: shows the current terminfo entry (less comments)
  4073.  
  4074.  
  4075.   16.10.  Changing the Terminal Settings
  4076.  
  4077.   The terminal settings are normally set once when the terminal is
  4078.   installed using the setup procedures in the terminal manual.  However,
  4079.   some settings may be changed when the terminal is in use.  You
  4080.   normally would not give any "stty" of "setserial" commands when the
  4081.   terminal is in use as they are likely to corrupt the terminal
  4082.   interface.  However, there are changes you may make to the appearance
  4083.   of the terminal screen or to its behavior without destroying the
  4084.   integrity of the interface.  Sometimes these changes are made
  4085.   automatically by application programs so you may not need to deal with
  4086.   them.
  4087.  
  4088.   One direct method of making such changes is to use the setup key (or
  4089.   the like) at the terminal and then use menus or the like to make the
  4090.   changes.  To do this you may need to be familiar with the terminal.
  4091.   The other 3 methods send an escape sequence from the computer to the
  4092.   terminal to make the changes.  These 3 examples show different methods
  4093.   of doing this to set reverse video:
  4094.  
  4095.  
  4096.   1. setterm -reverse
  4097.  
  4098.   2. tput -rev
  4099.  
  4100.   3. echo ^[[7m
  4101.  
  4102.  
  4103.   16.10.1.  setterm
  4104.  
  4105.   This is the easiest command to use.  It uses long options (but doesn't
  4106.   use the -- before them).  It consults the terminfo database to
  4107.   determine what code to send.  You may change the color, brightness,
  4108.   linewrap, keyboard repeat, cursor appearance, etc.
  4109.  
  4110.  
  4111.   16.10.2.  tput
  4112.  
  4113.   The "tput" command is similar to "setterm" but instead of using
  4114.   ordinary words as arguments, you must use the abbreviations used by
  4115.   terminfo.  Many of the abbreviations are quite terse and hard to
  4116.   remember.
  4117.  
  4118.  
  4119.   16.10.3.  echo
  4120.  
  4121.   In the example "echo ^[[7m" to set reverse video, the ^[ is the escape
  4122.   character.  To type it type ^V^[ (or ^V followed by the escape key).
  4123.   To use this "echo" method you must find out what code to use from a
  4124.   terminal manual or from terminfo or termcap.  It's simpler to use
  4125.   setterm or tput although echo will execute a little faster.  So you
  4126.   might use echo ... in shell scripts which deal with only one type of
  4127.   terminal.
  4128.  
  4129.  
  4130.   16.10.4.  Saving Changes
  4131.  
  4132.   When you turn off the terminal the changes you made will be lost
  4133.   (unless you saved them in non-volatile terminal memory by going into
  4134.   set-up mode and saving it).  If you want to use them again without
  4135.   having to retype them, put the commands in a shell script or make it a
  4136.   shell function.  Then run it when you want to make the changes.  One
  4137.   way to make the changes semi-permanent is to put the commands in a
  4138.   file that runs each time you login or start up the computer.
  4139.  
  4140.  
  4141.   16.11.  Make a Terminal the Console
  4142.  
  4143.   Many messages from the system are normally only sent to the console.
  4144.   While the messages generated at boot-time appear on the console, they
  4145.   may also be seen on a terminal after the boot succeeds by typing the
  4146.   command: dmesg.  If the boot fails this will not be of any use, so you
  4147.   may want to have a terminal display the messages during the booting.
  4148.  
  4149.   It's possible to patch the Linux kernel to do this and recompile it.
  4150.   This will send a terminal the messages which are normally sent only to
  4151.   the console.  It doesn't fully make the terminal into a console since
  4152.   one can't re-map the keyboard nor change colors like most consoles
  4153.   can.  The Linux Journal in April 1997 had an article on this.  To
  4154.   patch the Linux kernel add a couple of #defines at the start of
  4155.   src/linux/drivers/char/console.c:
  4156.  
  4157.  
  4158.  
  4159.   ______________________________________________________________________
  4160.   <item> #define CONFIG_SERIAL_ECHO
  4161.   <item> #define SERIAL_ECHO_PORT 0x2f8  /* Serial port address  */
  4162.   ______________________________________________________________________
  4163.  
  4164.  
  4165.  
  4166.   If you currently use the console to select which operating system to
  4167.   boot (using LILO), but would like to do this from a terminal, then you
  4168.   need to add a line to the /etc/lilo.conf file.   See the manual page
  4169.   for lilo.conf and search for "serial=".
  4170.  
  4171.  
  4172.   17.  Trouble-Shooting (software)
  4173.  
  4174.   If you suspect that the problem is a hardware problem, see ``Repair
  4175.   and Diagnose'' section .
  4176.  
  4177.   Here is a list of possible problems:
  4178.  
  4179.   ∑  ``Is the Terminal OK ?''  Suspect the terminal is defective.
  4180.  
  4181.   ∑  ``Missing Text'' Either skips over some text or displays some text
  4182.      OK and hangs.
  4183.  
  4184.   ∑  ``Getty Respawning Too Rapidly'' (console error message)
  4185.  
  4186.   ∑  ``Fails Just After Login''
  4187.  
  4188.   ∑  ``Can't Login'' but login prompt is OK.
  4189.  
  4190.   ∑  ``Garbled Login Prompt''
  4191.  
  4192.   ∑  ``No Sign of any Login Prompt''
  4193.  
  4194.   There are two cases where the terminal goes bad.  One is when it's
  4195.   been recently working OK and suddenly goes bad.  This is discussed in
  4196.   the next sub-section.  The other case is where things don't work right
  4197.   just after you install a terminal.  For this case you may skip over
  4198.   the next section.
  4199.  
  4200.  
  4201.   17.1.  Terminal Was Working OK
  4202.  
  4203.   When a formerly working terminal suddenly goes bad it is often easy to
  4204.   find the problem.  That's because if you think about what recently
  4205.   happened it will likely give a clue to the cause of the problem.
  4206.  
  4207.   The problem may be obvious such as an error message when the terminal
  4208.   is first turned on.  If it makes a noise it likely needs repair.  See
  4209.   ``Repair & Diagnose''.  First, think about what has been done or
  4210.   changed recently as it's likely the cause of the problem.  Did the
  4211.   problem happen just after new system software was installed or after a
  4212.   change in the configuration?
  4213.  
  4214.   If the terminal isn't responding correctly (if at all) to what you
  4215.   type to it, you may have a ``Corrupted Terminal Interface''.
  4216.  
  4217.  
  4218.   17.2.  Terminal Newly Installed
  4219.  
  4220.   If you've just connected up a terminal to a computer per instructions
  4221.   and it doesn't work this section is for you.  If a terminal that
  4222.   formerly worked OK doesn't work now then see ``Terminal Was Working
  4223.   OK'' If you suspect that the serial port on your computer may be
  4224.   defective you might try running a diagnostic test program on it.  At
  4225.   present (June 1998) it seems that Linux doesn't yet have such a
  4226.   diagnostic program so you may need to run diagnostics under MS
  4227.   DOS/Windows.  There are some programs to monitor the various serial
  4228.   lines such at DTR, CTS, etc. and this may help.  See ``Serial
  4229.   Monitoring/Diagnostics''
  4230.  
  4231.   One approach is to first see if the the terminal will work by trying
  4232.   to copy a file to the terminal (cp my_file /dev/ttyS?) under the most
  4233.   simple situation.  This means with the modem control lines disabled
  4234.   and at a show speed that doesn't need flow control (make sure that any
  4235.   hardware flow control is disabled).  If this copy works, then make the
  4236.   situation a little more complicated and see if it still works, etc.,
  4237.   etc.  When the trouble appears just after you made a change, then that
  4238.   change is likely the source of the trouble.  Actually, its more
  4239.   efficient (but more complex) to jump from the simple situation to
  4240.   about half way to the final configuration so that the test eliminates
  4241.   about half of the remaining possible causes of the problem.  Then
  4242.   repeat this methodology for the next test.  This way it would only
  4243.   take about 10 tests to find the cause out of a thousand possible
  4244.   causes.  You should deviate a little from this method based on hunches
  4245.   and clues.
  4246.  
  4247.  
  4248.   17.3.  Is the Terminal OK ?
  4249.  
  4250.   A good terminal will usually start up with some words on the screen.
  4251.   If these words convey no error message, its probably OK.  If there is
  4252.   no sign of power (no lights on, etc.) re-plug in the computer power
  4253.   cord at both ends.  Make sure there is power at the wall jack (or at
  4254.   the extension cord end).  Try another power cord if you have one.
  4255.   Make sure the terminal is turned on and that its fuse is not blown.  A
  4256.   blank (or dim) screen may sometimes be fixed by just turning up the
  4257.   brightness and contrast using knobs or a keyboard key in set-up mode.
  4258.   If it still won't work See ``Repair & Diagnose'' for tips on repairing
  4259.   it.
  4260.  
  4261.   If the terminal starts up OK, but you suspect that something may be
  4262.   wrong with it, go into "local mode" where is works like a typewriter
  4263.   and try typing on it.  See ``Local Mode''.
  4264.  
  4265.  
  4266.   17.4.  Missing Text
  4267.  
  4268.   If some text displays on the terminal OK and then it stops without
  4269.   finishing (in the middle of a word, etc.) or if chunks of text are
  4270.   missing, you likely have a problem with flow control.  If you can't
  4271.   figure out right away what's causing it, decrease the speed.  If that
  4272.   fixes it, it's likely a flow control problem.  It may be that flow
  4273.   control is not working at all due to failure to configure it
  4274.   correctly, or due to incorrect cable wiring (for hardware flow
  4275.   control).  See ``Flow Control''
  4276.  
  4277.   If single characters are missing, perhaps the serial port is being
  4278.   overrun by too fast a speed.  Try a slower baud rate.
  4279.  
  4280.   If you are using a baud rate under 1200 (very slow, mostly used for
  4281.   old hard-copy terminals and printers) and the text gets truncated,
  4282.   then the problem may be in the serial device driver.  See Printing-
  4283.   HOWTO under "Serial devices" on how to fix this.
  4284.  
  4285.  
  4286.   17.5.  Getty Respawning Too Rapidly
  4287.  
  4288.  
  4289.  
  4290.  
  4291.   17.5.1.  No Modem Control Voltage
  4292.  
  4293.   If getty can't open and/or use a port because of the lack of a
  4294.   positive modem control voltage on one of the pins, then getty might be
  4295.   killed.  Then, per the instructions in inittab, getty respawns and
  4296.   tries again, only to be killed again, etc., etc.  You may see an error
  4297.   message indicating that due to getty respawning too rapidly it has
  4298.   been temporarily disabled.  Try using the "local" option with getty
  4299.   and/or check the modem control settings and voltages.
  4300.  
  4301.  
  4302.   17.5.2.  Key Shorted
  4303.  
  4304.   Another possible cause of getty respawning is if a keyboard key is
  4305.   shorted, giving the same result as if the key was continuously held
  4306.   down.  With auto-repeat enabled, this "types" thousands characters to
  4307.   the login prompt.  Look for a screen filled with all the same
  4308.   character (in some cases with 2 or more different characters).
  4309.  
  4310.  
  4311.   17.6.  Fails Just After Login
  4312.  
  4313.   If you can login OK but then you can't use the terminal it may be
  4314.   because the starting of the login shell has reconfigured the terminal
  4315.   (to an incorrect setting) by a command which someone put into one of
  4316.   the files that are run when you login and a shell starts.  These files
  4317.   include /etc/profile and  /.bashrc.  Look for a command starting with
  4318.   "stty" or "setserial" and make sure that it's correct.  Even if it's
  4319.   done OK in one initialization file, it may be reset incorrectly in
  4320.   another initialization file that you are not aware of.  Ways to get
  4321.   into the systems to fix it are to use another terminal or console, use
  4322.   a rescue diskette, or type: "linux single" at the lilo prompt which
  4323.   puts you into single user mode without running startup files.
  4324.  
  4325.  
  4326.   17.7.  Can't Login
  4327.  
  4328.   If you get a login prompt but get no response (or perhaps a garbled
  4329.   response) to your login attempts a possible cause is that the
  4330.   communication is bad one-way from the terminal to the computer.  If
  4331.   you're not already using the "local" option with getty, do so to
  4332.   disable the modem control lines.  See ``Getty (in /etc/inittab)''.
  4333.   You might also disable hardware flow control (stty -crtscts) if it was
  4334.   enabled.  If it now works OK then your modem control lines are likely
  4335.   either not wired correctly or there's a mistake in your set-up.  Some
  4336.   terminals allow setting different values (such as baud rate) for send
  4337.   and receive so the receive could be OK but the send bad.
  4338.  
  4339.   If you get a message saying something like "login failed" then if
  4340.   there is no error in typing or in the password, there may be some
  4341.   restrictions on logins which will not allow you to log in.
  4342.   Unfortunately, this message, may not tell you why it failed.  See
  4343.   ``Login Restrictions''
  4344.  
  4345.  
  4346.   17.8.  Garbled Login Prompt
  4347.  
  4348.   This may be due to using the wrong character set, transmission errors
  4349.   due to too high of a baud rate, incompatible baud rates or
  4350.   incompatible parity.  If it's a variety of strange characters you have
  4351.   the wrong character set or a high order bit is being set by mistake.
  4352.   If words are misspelled, try a lower baud rate.  For baud or parity
  4353.   incompatibilities you see a lot of the same "error character" which
  4354.   represents a real character that can't be displayed correctly due to
  4355.   an error in parity or baud rate.
  4356.  
  4357.   If you are using agetty (often just named getty), the agetty program
  4358.   will detect and set parity if you type something.   Try it with a
  4359.   return to see if it fixes possible parity errors.
  4360.  
  4361.  
  4362.   17.9.  No Sign of any Login Prompt
  4363.  
  4364.   This is when nothing at all happens at the terminal, but the terminal
  4365.   seems to be working OK.  One of the first things to do is to make sure
  4366.   that all cable connections are tight and connected correctly.  Other
  4367.   problems could be: A baud rate mismatch, broken hardware, or Getty not
  4368.   running.  At this point two different avenues of approach are (you may
  4369.   pursue more than one at a time).
  4370.  
  4371.  
  4372.   ∑  ``Diagnose Problem from the Console''
  4373.  
  4374.   ∑  Measure Voltages I ``Measure  Voltages''
  4375.  
  4376.  
  4377.   17.9.1.  Diagnose Problem from the Console
  4378.  
  4379.   At the console (or another working terminal), use "top" or "ps -al" to
  4380.   see if getty is running on the port.  Don't confuse it with getty
  4381.   programs running on other ports or on the virtual consoles.  You will
  4382.   not get a login prompt unless getty runs.  If it's running then you
  4383.   may disable it so that you can try to copy a file to the terminal as a
  4384.   test.
  4385.  
  4386.   To disable getty, edit /etc/inittab and comment out the getty command
  4387.   with an initial # so that it will not respawn after you kill it.  Then
  4388.   kill the old getty using the k key while in "top".
  4389.  
  4390.   To copy a short file to the terminal (It might be a good idea to try
  4391.   this near the start of the installation process before setting up
  4392.   getty) use the Linux copy command such as: cp file_name /dev/ttyS1.
  4393.   If it doesn't work, use stty to make the interface as simple as
  4394.   possible with everything disabled (such as hardware flow control:
  4395.   -crtscts; parity, and modem control signals: clocal).  Be sure the
  4396.   baud rates and the bits/byte are the same.  If nothing happens verify
  4397.   that the port is alive with a voltmeter per the next section.
  4398.  
  4399.  
  4400.   17.9.2.  Measure Voltages
  4401.  
  4402.   If you have a voltmeter handy check for -12 V (-5 to -15) at pin 3
  4403.   (receive data) at the terminal side of the null modem cable.  The
  4404.   positive lead of the meter should be connected to a good ground (the
  4405.   metal connectors on the ends of cables are often not grounded).  If
  4406.   there is no such negative voltage then check for it at the transmit
  4407.   pin (TxD) on the computer (see ``DB9-DB25'' for the pin-out).  If it's
  4408.   present there but not at the receive pin (RxD) at the terminal, then
  4409.   the cable is bad (loose connection, broken wire, or not a null modem).
  4410.   If voltage is absent, then the serial port on the computer is dead.
  4411.   Test it with software diagnostics or replace it.
  4412.  
  4413.   If the serial port is alive, you may want to send a file to it (with
  4414.   modem controls disabled) and see if anything gets to it.  To check for
  4415.   a transmitted signal with an analog voltmeter, look at the needle at
  4416.   -12 V when the line is idle.  Then start sending a file (or start
  4417.   getty).  You should see the needle dropping to 0 and fluttering about
  4418.   0 as it measures short-run averages of the bit stream.  You can see
  4419.   this also on the AC scale provided that your meter has a capacitor to
  4420.   block out DC voltages when on the AC scale.  If it doesn't, then the
  4421.   idle DC of -12 V will cause a high false AC reading.  Without a meter,
  4422.   you could connect a good device (such as another terminal or an
  4423.   external  modem) to the serial port and see if it works OK.
  4424.  
  4425.  
  4426.   17.10.  Serial Monitoring/Diagnostics
  4427.  
  4428.   A few Linux programs will monitor the modem control lines and indicate
  4429.   if they are positive (1) or negative (0).
  4430.  
  4431.   ∑  statserial (in Debian distribution)
  4432.  
  4433.   ∑  serialmon (doesn't monitor RTS, CTS, DSR but logs other functions)
  4434.  
  4435.   ∑  modemstat (only works on Linux PC consoles.  Will coexist with
  4436.      command line)
  4437.  
  4438.      You may already have them.  If not, go to Serial Software
  4439.      <http://sunsite.unc.edu/pub/Linux/system/serial/!Index.html>.  When
  4440.      using these, bear in mind that what you see is the state of the
  4441.      lines at the host computer.  The situation at the terminal will be
  4442.      different since some wires are often missing from cables while
  4443.      other wires cross over.  As of June 1998, I know of no diagnostic
  4444.      program in Linux for the serial port.
  4445.  
  4446.  
  4447.   17.11.  Local Mode
  4448.  
  4449.   In local mode, the terminal disconnects from the computer and behaves
  4450.   like a typewriter (only it doesn't type on paper but on the screen).
  4451.   Going back into on-line reconnects to the computer allowing you to
  4452.   resume activities at the same point where you left off when you went
  4453.   into "local".  This is useful both for testing the terminal and for
  4454.   educational purposes.  When in local mode you may type escape
  4455.   sequences (starting with the ESC key) and observe what they do.  If
  4456.   the terminal doesn't work correctly in local mode, it's unlikely that
  4457.   it will work correctly when connected to the computer.  If you're not
  4458.   exactly sure what an escape sequence does, you can try it out in local
  4459.   mode.  You might also use it for trying out a terminal that is for
  4460.   sale.  To get into local mode you first enter set-up mode and then
  4461.   select "local" from a menu (or press a certain key).  See ``Getting
  4462.   Into Set-Up (Configuration) Mode''.
  4463.  
  4464.  
  4465.   17.12.  Serial Electrical Test Equipment
  4466.  
  4467.   17.12.1.  Breakout Gadgets, etc.
  4468.  
  4469.   While a multimeter (used as a voltmeter) may be all that you need for
  4470.   just a few terminals, simple special test equipment has been made for
  4471.   testing serial port lines.  Some are called "breakout ... " where
  4472.   breakout means to break out conductors from a cable.  These gadgets
  4473.   have a couple of connectors on them and insert into the serial cable.
  4474.   Some have test points for connecting a voltmeter.  Others have LED
  4475.   lamps which light when certain modem control lines are asserted
  4476.   (turned on).  Still others have jumpers so that you can connect any
  4477.   wire to any wire.  Some have switches.
  4478.  
  4479.   Radio Shack sells (in 1998) a "RS-232 Troubleshooter" or "RS-232 Line
  4480.   Tester" which checks TD, RD, CD, RTS, CTS, DTR, and DSR.  A green
  4481.   light means on (+12 v) while red means off (-12 v).  They also sell a
  4482.   "RS-232 Serial Jumper Box" which permits connecting the pins anyway
  4483.   you choose.
  4484.  
  4485.  
  4486.  
  4487.  
  4488.  
  4489.   17.12.2.  Measuring Voltages
  4490.  
  4491.   Any voltmeter or multimeter, even the cheapest that sells for about
  4492.   $10, should work fine.  Trying to use other methods for checking
  4493.   voltage is tricky.  Don't use a LED unless it has a series resistor to
  4494.   reduce the voltage across the LED.  A 470 ohm resistor is used for a
  4495.   20 ma LED (but not all LED's are 20 ma).  The LED will only light for
  4496.   a certain polarity so you may test for + or - voltages.  Does anyone
  4497.   make such a gadget for automotive circuit testing??  Logic probes may
  4498.   be damaged if you try to use them since the TTL voltages for which
  4499.   they are designed are only 5 volts.  Trying to use a 12 V incandescent
  4500.   light bulb is not a good idea.  It won't show polarity and due to
  4501.   limited output current of the UART it probably will not even light up.
  4502.  
  4503.   To measure voltage on a female connector you may plug in a bent paper
  4504.   clip into the desired opening.  The paper clip's diameter should be no
  4505.   larger than the pins so that it doesn't damage the contact.  Clip an
  4506.   alligator clip (or the like) to the paper clip to connect up.
  4507.  
  4508.  
  4509.   17.12.3.  Taste Voltage
  4510.  
  4511.   As a last resort, if you have no test equipment and are willing to
  4512.   risk getting shocked (or even electrocuted) you can always taste the
  4513.   voltage.  Before touching one of the test leads with your tongue, test
  4514.   them to make sure that there is no high voltage on them.  Touch both
  4515.   leads (at the same time) to one hand to see if they shock you.  Then
  4516.   if no shock, wet the skin contact points by licking and repeat.  If
  4517.   this test gives you a shock, you certainly don't want to use your
  4518.   tongue.
  4519.  
  4520.   For the test for 12 V, Lick a finger and hold one test lead in it.
  4521.   Put the other test lead on your tongue.  If the lead on your tongue is
  4522.   positive, there will be a noticeable taste.  You might try this with
  4523.   flashlight batteries first so you will know what taste to expect.
  4524.  
  4525.  
  4526.   18.  Repair & Diagnose
  4527.  
  4528.   Repairing a terminal has much in common with repairing a monitor
  4529.   and/or keyboard.  Sometimes the built-in diagnostics of the terminal
  4530.   will tell you what is wrong on the screen.  If not, then by the
  4531.   symptoms, one may often isolate the trouble to one of the following:
  4532.   bad keyboard, CRT dead, terminal digital electronics failure.  It's
  4533.   best to have a service manual, but even if you don't have one, many
  4534.   terminals may still be repaired.
  4535.  
  4536.  
  4537.   18.1.  Repair Books & Websites
  4538.  
  4539.   18.1.1.  Books
  4540.  
  4541.   Bigelow, Stephen J.: Troubleshooting & Repairing Computer Monitors,
  4542.   2nd edition, McGraw-Hill, 1997.  Doesn't cover the character
  4543.   generation electronics nor the keyboard.
  4544.  
  4545.  
  4546.   18.1.2.  Websites
  4547.  
  4548.   The FAQ  <http://www.repairfaq.org> for the newsgroup:
  4549.   sci.electronics.repair is long and comprehensive, although it doesn't
  4550.   cover terminals per se.  See the section "Computer and Video
  4551.   Monitors".  Much of this information is applicable to terminals as are
  4552.   the sections: "Testing Capacitors", "Testing Flyback Transformers",
  4553.   etc.  Perhaps in the future, the "info" on repair in this HOWTO will
  4554.   consist mainly of links to the above FAQ (or the like).  Shuford's
  4555.   repair archive
  4556.   <http://www.cs.utk.edu/~shuford/terminal/repair_hints_news.txt> of
  4557.   newsgroup postings on terminal repair is another source of info.
  4558.  
  4559.  
  4560.   18.2.  Safety
  4561.  
  4562.   CRT's use high voltage of up to 30,000 volts for color (less for
  4563.   monochrome).  Be careful not to touch this voltage if the set is on
  4564.   and the cover off.  It probably won't kill you even if you do since
  4565.   the amount of current it can supply is limited.  But it is likely to
  4566.   badly burn and shock you, etc.  High voltage can jump across air gaps
  4567.   and go thru cracked insulation so keep your hands a safe distance from
  4568.   it.  You should notice the well-insulated high voltage cable connected
  4569.   to one side of the picture tube.  Even when the set is off, there is
  4570.   still enough residual voltage on the picture tube cable connection to
  4571.   give you quite a shock.  To discharge this voltage when the set is
  4572.   unplugged use a screwdriver (insulated handle) with the metal blade
  4573.   grounded to the picture tube ground cable with a jumper wire.  Don't
  4574.   use chassis ground.
  4575.  
  4576.   The lower voltages (of hundreds of volts) can be even more dangerous
  4577.   since they are not current limited.  It is even more dangerous if your
  4578.   hands are wet or if you are wearing a metal watchband, ring or the
  4579.   like.  In rare cases people have been killed by it so be careful.  The
  4580.   lowest voltages of only several volts on digital circuitry are fairly
  4581.   safe but don't touch anything (except with a well insulated tool)
  4582.   unless you know for sure.
  4583.  
  4584.  
  4585.   18.3.  Appearance of Display
  4586.  
  4587.   If the display is too dim, turn up the brightness and/or contrast.
  4588.   using knobs on the exterior of the unit (if they exist).  If the
  4589.   width, height or centering is incorrect, there are often control knobs
  4590.   for these.  For some older terminals one must press an arrow key (or
  4591.   the like) in set-up mode.
  4592.  
  4593.   You may need to remove the cover to make adjustments, especially on
  4594.   older models.  You could arrange things so that a large mirror is in
  4595.   front of the terminal so as to view the display in the mirror while
  4596.   making adjustments.  The adjustments to turn may be on a printed
  4597.   circuit board.  While a screwdriver (possibly Phillips-head) may be
  4598.   all that's needed, inductors may require special TV alignment tools
  4599.   (plastic hex wrenches, etc.).  The abbreviated name of the adjustment
  4600.   should be printed on the circuit board.  For example, here are some
  4601.   such names:
  4602.  
  4603.  
  4604.   ∑  V-Size adjusts the Vertical height (Size)
  4605.  
  4606.   ∑  H-Size adjusts the Horizontal width (Size).  It may be an inductor.
  4607.  
  4608.   ∑  V-Pos adjusts the Vertical Position
  4609.  
  4610.   ∑  H-Pos adjusts the Horizontal Position
  4611.  
  4612.   ∑  V-Lin adjusts Vertical Linearity (Use if width of scan lines
  4613.      differs at the top and bottom of the screen)
  4614.  
  4615.   ∑  V-Hold adjusts Vertical Hold (Use if screen is uncontrollable
  4616.      scrolling)
  4617.  
  4618.   ∑  Bright adjusts brightness (an external knob may also exist)
  4619.  
  4620.  
  4621.   ∑  Sub-Bright adjusts brightness of subdued intensity mode (often the
  4622.      normal mode: dimmer than bold or bright mode).
  4623.  
  4624.   Changing linearity may change the size so that it will need to be
  4625.   readjusted.  A terminal that has been stored for some time may have a
  4626.   small display rectangle on the screen surrounded by a large black
  4627.   border.  If it's difficult to adjust, wait a while before adjusting it
  4628.   since it will likely recover some with use (the black borders will
  4629.   shrink).
  4630.  
  4631.  
  4632.   18.4.  Diagnose
  4633.  
  4634.   18.4.1.  Terminal Made a Noise
  4635.  
  4636.   If the terminal made some noise just before it failed (or when you
  4637.   turn it on after it failed) that noise is a clue to what is wrong.  If
  4638.   you hear a sparking noise or see/smell smoke, immediately turn the
  4639.   terminal off to prevent further damage.  The problem is likely in the
  4640.   high voltage power supply of several thousand volts.  Remove the cover
  4641.   and if the bad spot is not evident, turn it on again for a short time
  4642.   in a dimly lit room to look for arcing.  The high voltage cable (runs
  4643.   between the flyback transformer and the side of the picture tube) may
  4644.   have broken insulation that arcs to ground.  Fix it with high-voltage
  4645.   insulating dope, or special electrical tape designed say for 10,000
  4646.   volts.
  4647.  
  4648.   The flyback transformer (high voltage) may make only a faint clicking
  4649.   or sparking noise if it fails.  You may not hear it until you turn the
  4650.   terminal off for a while to rest and then turn it back on again.  To
  4651.   track down the noise you may use a piece of small rubber tubing (such
  4652.   as used in automobiles) as a stethoscope  to listen to it.  But while
  4653.   you are listening for the noise, the terminal is suffering more damage
  4654.   so try find it fast (but not so fast as to risk getting shocked).
  4655.  
  4656.   A short in the power supply may cause a fuse to blow with a pop.
  4657.   Replacing a blown fuse may not solve the problem as the same short may
  4658.   blow the fuse again.  Inspect for any darkened spots due to high heat
  4659.   and test those components.  Shorted power transistors may cause the
  4660.   fuse to blow.  They may be tested with a transistor checker or even
  4661.   with an ohm-meter.  Use the low ohm scale on an ohm-meter so that the
  4662.   voltage applied by the meter is low.  This will reduce the possible
  4663.   damage to good components caused by this test voltage.
  4664.  
  4665.   If the terminal has been exposed to dampness such as being stored in a
  4666.   damp place or near a kitchen with steam from cooking, a fix may be to
  4667.   dry out the unit.  Heating a "failed" flyback transformer with a blow
  4668.   dryer for several minutes may restore it.
  4669.  
  4670.  
  4671.   18.4.2.  Terminal Made No Noise
  4672.  
  4673.   A blank screen may be due to someone turning the brightness control to
  4674.   the lowest level or to aging.  The next thing to do is to check the
  4675.   cables for loose or broken connections.  If there is no sign of power,
  4676.   substitute a new power cord after making sure that the power outlet on
  4677.   the wall is "hot".
  4678.  
  4679.   If the keyboard is suspected, try it on another terminal of the same
  4680.   type or substitute a good keyboard.  Wiggle the keyboard cable ends
  4681.   and the plug.  Wires inside cables may break, especially near their
  4682.   ends.  If the break is verified by wiggling it (having the problem go
  4683.   on and off in synchronization with the wiggles), then one may either
  4684.   get a new cable or cut into the cable and re-solder the breaks, etc.
  4685.  
  4686.  
  4687.   One of the first things to do if the keyboard works is to put the
  4688.   terminal into ``Local Mode''.  If it works OK in local, then the
  4689.   problem is likely in the connection to the host computer (or incorrect
  4690.   interface) or in the UART chips of the terminal.
  4691.  
  4692.   By carefully inspecting the circuitry, one may often find the cause of
  4693.   the problem.  Look for discoloration, cracks, etc.  An intermittent
  4694.   problem may sometimes be found by tapping on components with a ball-
  4695.   point pen (not the metal tip of course).  A break in the conductor of
  4696.   a printed circuit board may sometimes be revealed by flexing the
  4697.   board.  Solder that looks like it formed a drop or a solder joint with
  4698.   little solder may need re-soldering.  Soldering may heat up
  4699.   transistors (and other components) and damage them so use a heat sink
  4700.   if feasible.
  4701.  
  4702.   If you have a common brand of terminal, you may be able to search
  4703.   newsgroup postings on the Internet to find out what the most frequent
  4704.   types of problems are for your terminal and perhaps information on how
  4705.   to fix them.
  4706.  
  4707.   To see if the digital electronics work, try (using a good keyboard)
  4708.   typing at the bad terminal.   Try to read this typing at a good
  4709.   terminal (or the console) using the copy command or with a terminal
  4710.   communication program such as Minicom.  You may need to hit the return
  4711.   key at the terminal in order to send a line.  One may ask the bad
  4712.   terminal for its identity etc. from another terminal.  This will show
  4713.   if two-way communication works.
  4714.  
  4715.  
  4716.   18.5.  Capacitors
  4717.  
  4718.   Electrolytic capacitors have a metal shell and are may become weak or
  4719.   fail if they set for years without being used.  Sometimes just leaving
  4720.   the terminal on for a while will help partially restore them.  If you
  4721.   can, exercise any terminals you have in storage by turning them on for
  4722.   a while every year or two.
  4723.  
  4724.  
  4725.   18.6.  Keyboards
  4726.  
  4727.   18.6.1.  Interchangeability
  4728.  
  4729.   The keyboards for terminals are not the same as keyboards for PC's.
  4730.   The difference is not only in the key layout but in the codes
  4731.   generated when a key is pressed.  Also, keyboards for various brands
  4732.   and models of terminals are not always interchangeable with each
  4733.   other.  Sometimes one get an "incompatible" keyboard to partially work
  4734.   on a terminal.  All the ASCII keys will work OK, but special keys such
  4735.   as set-up and break will not work correctly.
  4736.  
  4737.  
  4738.   18.6.2.  How They Work
  4739.  
  4740.   Most keyboards just make a simple contact between two conductors when
  4741.   you press a key.  Electronics inside a chip in the keyboard converts
  4742.   this contact closure into a code sent over the keyboard's external
  4743.   cable.  Instead of having a separate wire (or conductor) going from
  4744.   each key to the chip, the following type scheme is used.  Number the
  4745.   conductors say from 1-10 and A-J.  For example: conductor 3 goes to
  4746.   several keys and conductor B goes to several keys, but only one key
  4747.   has both conductors 3 and B going to it.  When that key is pressed, a
  4748.   short circuit is established between 3 and B.  The chip senses this
  4749.   short and knows what key has been pressed.  Such a scheme reduces the
  4750.   number of conductors needed (and  reduces the number of pins needed on
  4751.   the chip).  It's a similar scheme to what is called a "crossbar
  4752.   switch".
  4753.   18.6.3.  One Press Types 2 Different Characters
  4754.  
  4755.   If, due to a defect, conductors 3 and 4 become shorted together then
  4756.   pressing the 3-B key will also short 4 and B and the chip will think
  4757.   that both keys 3-B and 4-B have been pressed.  This is likely to type
  4758.   2 different characters when all you wanted was one character.
  4759.  
  4760.  
  4761.   18.6.4.  Modern vs Old Keyboards
  4762.  
  4763.   While the modern keyboard and the old fashioned type look about the
  4764.   same, the mechanics of operation are different.  The old ones have
  4765.   individual key switches under the key-caps with each switch enclosed
  4766.   in a hard plastic case.  The modern ones use large flexible plastic
  4767.   sheets (membrane) the size of the keyboard.  A plastic sheet with
  4768.   holes in it is sandwiched between two other plastic sheets containing
  4769.   printed circuits (including contact points).  When you press a key,
  4770.   the two "printed" sheets are pressed together at a certain point,
  4771.   closing the contacts printed on the sheets at that point.
  4772.  
  4773.  
  4774.   18.6.5.  Keyboard Doesn't Work At All
  4775.  
  4776.   If none of the keys work try another keyboard (if you have one) to
  4777.   verify that the keyboard is the problem.  The most likely cause is a
  4778.   broken wire inside the cord (cable) that connects it to the terminal.
  4779.   The most likely location of the break is at either end of the cord.
  4780.   Try wigging the ends of the cord while tapping on a key to see if it
  4781.   works intermittently.  If you find a bad spot, you may carefully cut
  4782.   into the cord with a knife at the bad spot and splice the broken
  4783.   conductor.  Sometimes just a drop of solder will splice it.  Seal up
  4784.   the cord with electrical tape, glue, or caulk.
  4785.  
  4786.  
  4787.   18.6.6.  Typing b Displays bb, etc. (doubled)
  4788.  
  4789.   If all characters appear double there is likely nothing wrong with the
  4790.   keyboard.  Instead, your terminal has likely been incorrectly set up
  4791.   for half-duplex (HDX or local echo=on) and every character you type is
  4792.   echoed back both from the electronics inside your terminal and from
  4793.   your host computer.  If the two characters are not the same, there may
  4794.   be a short circuit inside your keyboard.  See ``One Press Types 2
  4795.   Different Characters''
  4796.  
  4797.  
  4798.   18.6.7.  The Keyboard Types By Itself
  4799.  
  4800.   If a key is shorted out it is likely to type out a large number of the
  4801.   same character if auto-repeat is enabled.  If more than one key is
  4802.   shorted out then repeating sequences of a few characters will be
  4803.   typed.  This may cause getty to respawn too fast if it happens at the
  4804.   login prompt.  See ``Key Shorted''.  The fix is to clean the contacts
  4805.   per ``Cleaning Keyboard Contacts''.
  4806.  
  4807.  
  4808.   18.6.8.  Liquid Spilled on the Keyboard
  4809.  
  4810.   If water or watery liquid has been spilled on the keyboard (or if it
  4811.   was exposed to rain, heavy dew, or dampness) some keys may not work
  4812.   right.  The dampness may cause a key to short out (like it was pressed
  4813.   down all the time) and you may see the screen fill up with that letter
  4814.   if auto-repeat is enabled.  If it's gotten wet and then partially (or
  4815.   fully) dried out, certain keys may not work due to deposits on the
  4816.   contact surfaces.  For the modern type of keyboard, one may readily
  4817.   take apart the plastic sheets inside and dry/clean them.  For the old
  4818.   type one may let it dry out in the sun or oven (low temp.).  When it's
  4819.   dry it may still need contact cleaner on some keys as explained below.
  4820.  
  4821.  
  4822.   18.6.9.  Cleaning Keyboard Contacts
  4823.  
  4824.   18.6.9.1.  Keyboards with Membranes
  4825.  
  4826.   On some newer keyboards, the plastic sheets (membranes) are easy to
  4827.   remove for inspection and cleaning if needed.  You only need to remove
  4828.   several screws to take apart the keyboard and get to the sheets.  On
  4829.   some old IBM keyboards the sheets can't be removed without breaking
  4830.   off many plastic tabs which will need to be repaired with glue to put
  4831.   back (probably not worthwhile to repair).  Such a keyboard may
  4832.   sometimes be made to work by flexing, twisting, and/or pounding the
  4833.   assembly containing the plastic sheets.
  4834.  
  4835.  
  4836.   18.6.9.2.  Keyboards with Individual Switches
  4837.  
  4838.   What follows is for older keyboards that have separate hard plastic
  4839.   switches for each key.  Before going to all the work of cleaning
  4840.   electrical contacts first try turning the keyboard upside-down and
  4841.   working the bad keys.  This may help dislodge dirt, especially if you
  4842.   press the key hard and fast to set up vibration.
  4843.  
  4844.   Often the key-caps may be removed by prying them upward using a small
  4845.   screwdriver as a lever while preventing excessive tilting with a
  4846.   finger.  There exists a special tool known as keycap puller but you
  4847.   can get by without it.  (Warning: Key-caps on modern keyboards don't
  4848.   pry up.)  The key-cap may tilt a bit and wobble as it comes loose.  It
  4849.   may even fly up and onto the floor.  Then you have two choices on how
  4850.   to clean the contacts: Use contact cleaner spray directly on top of
  4851.   the key switch, or take the key switch apart and clean it.  Still
  4852.   another choice is to replace the key switch with a new or used one.
  4853.  
  4854.   Directly spraying contact cleaner or the like (obtained at an
  4855.   electronics store) into the top of the key switch is the fastest
  4856.   method but may not work and it also might damage the plastic.  With
  4857.   the keyboard live (or with the key contacts connected to an ohm-meter)
  4858.   use the tube which came with the spray to squirt cleaner inside the
  4859.   key switch.  Tilt the keyboard so that the cleaner flows into the
  4860.   contacts.  For the CIT101e terminal with an Alps keyboard, this means
  4861.   tilting the digit row up toward the ceiling.  Work the key switch up
  4862.   and down with a pen or small screwdriver handle to avoid getting the
  4863.   toxic cleaner liquid on your skin (or wear gloves).  Finally turn the
  4864.   keyboard upside-down while working the key to drain off remaining
  4865.   cleaner.  The more cleaner you squirt in the more likely it will fix
  4866.   it but it is also more likely to do more damage to the plastic, so use
  4867.   what you think is just enough to do the job.  Once the key works OK,
  4868.   work it up and down a little more and test it a half minute later,
  4869.   etc. to make sure it will still work OK.
  4870.  
  4871.   Sometimes a key works fine when the contacts inside are saturated with
  4872.   contact cleaner liquid, but when the liquid dries a few minutes later
  4873.   then the resulting scale on the contacts prevents good contact and the
  4874.   key works erratically (if at all).  Operating the key when the liquid
  4875.   is drying inside may help.  Some switches have the contacts nearly
  4876.   sealed inside so little if any contact cleaner reaches the contacts.
  4877.   The cleaner that does get to the contacts may carry contamination with
  4878.   it.
  4879.  
  4880.   If you need to disassemble the key switch, first inspect it to see how
  4881.   it is installed and comes apart.  Sometimes one may remove the cover
  4882.   of the switch without removing the switch from the keyboard.  To do
  4883.   this pry up (or pull up) the top of the key switch after prying apart
  4884.   thin plastic tabs that retain it.  Don't pry too hard or you may break
  4885.   the thin plastic.  If this can't be done, you may have to unsolder the
  4886.   switch and remove it in order to take it apart (or replace it).  Once
  4887.   the switch has been taken apart you still may not be able to see the
  4888.   contacts if the contact surfaces are sandwiched together (nearly
  4889.   touching).  You may get contact cleaner on the contacts by slightly
  4890.   prying apart the conducting surfaces and squirting cleaner between
  4891.   them.  There may be some kind of clip holding the contact surfaces
  4892.   together which needs to be removed before prying these surfaces apart.
  4893.   With cleaner on the contacts, work them.  Tilting the keyboard or
  4894.   inverting it may help.  Take care not to loose small parts as they may
  4895.   fly up into the air when taking apart a key switch.
  4896.  
  4897.  
  4898.   19.  Appendix A: General
  4899.  
  4900.   19.1.  List of Linux Terminal Commands
  4901.  
  4902.   19.1.1.  Sending a Command to the Terminal
  4903.  
  4904.  
  4905.   ∑  ``setterm'': long options
  4906.  
  4907.   ∑  ``tput'': terse options
  4908.  
  4909.   ∑  tset: initializes only
  4910.  
  4911.   ∑  clear: clears screen
  4912.  
  4913.   ∑  reset: sends reset string
  4914.  
  4915.  
  4916.   19.1.2.  Configuring the Terminal Device Driver
  4917.  
  4918.  
  4919.   ∑  ``setserial'':
  4920.  
  4921.   ∑  ``stty''
  4922.  
  4923.  
  4924.   19.1.3.  Terminfo
  4925.  
  4926.  
  4927.   ∑  ``Terminfo Compiler (tic)'' terminfo compiler & translator
  4928.  
  4929.   ∑  toe: shows list of terminals for which you have terminfo files
  4930.  
  4931.   ∑  ``infocmp'' compares or displays terminfo entries
  4932.  
  4933.  
  4934.   19.1.4.  Other
  4935.  
  4936.  
  4937.   ∑  gitkeys: shows what bytes each key sends to the host.
  4938.  
  4939.   ∑  tty: shows what tty port you are connected to.
  4940.  
  4941.   ∑  set (or tset -q): shows the value of TERM, the terminfo entry name
  4942.  
  4943.   ∑  ``tset'': sets TERM interactively and initializes
  4944.  
  4945.  
  4946.   19.2.  The Internet and Books
  4947.  
  4948.  
  4949.  
  4950.  
  4951.   19.2.1.  Terminal Info on the Internet
  4952.  
  4953.  
  4954.  
  4955.   ∑  Shuford's Website
  4956.      <http://www.cs.utk.edu/~shuford/terminal_index.html> at the
  4957.      University of Tennessee has a great deal of useful information
  4958.      about text terminals.
  4959.  
  4960.   ∑  Boundless <http://www.boundless.com/textterm/> purchased the VT and
  4961.      Dorio terminal business from DEC.
  4962.  
  4963.   ∑  Wyse <http://www.wyse.com/terminal/> is a major manufacturer of
  4964.      terminals.
  4965.  
  4966.   ∑  Escape Seqs.; N. America <http://www.pericom-
  4967.      usa.com/twdocs/doc/twproae.htm> or Escape Seqs.; Europe
  4968.      <http://www.pericom.co.uk/teemworld/doc/twproae.htm> is a list of
  4969.      escape sequences (and control codes) for some terminal emulations
  4970.      (including VT 100, 300, 420, and Wyse).
  4971.  
  4972.   ∑  comp.terminals is the newsgroup for terminals
  4973.  
  4974.  
  4975.   19.2.2.  Books Related to Terminals
  4976.  
  4977.  
  4978.  
  4979.   ∑  EIA-232 serial port see ``EIA-232 (RS-232) Books''.
  4980.  
  4981.   ∑  Repair see ``Repair Books &  Websites''.
  4982.  
  4983.   ∑  Terminfo database see ``Termcap Documents''
  4984.  
  4985.  
  4986.   19.2.3.  Entire Books on Terminals
  4987.  
  4988.   As far as I know, there is no satisfactory book on text terminals
  4989.   (unless you are interested in antique terminals of the 1970's).
  4990.  
  4991.   ∑  Handbook of Interactive Computer Terminals by Duane E. Sharp;
  4992.      Reston Publishing Co. 1977. (mostly obsolete)
  4993.  
  4994.   ∑  Communicating with Display Terminals by Roger K. deBry; McGraw-Hill
  4995.      1985.  (mostly on IBM synchronous terminals)
  4996.  
  4997.   The "HANDBOOK ... " presents brief specifications of over 100
  4998.   different models of antique terminals made in the early 1970's by over
  4999.   60 different companies.  It also explains how they work physically but
  5000.   incorrectly shows a diagram for a CRT which uses electrostatic
  5001.   deflection of the electron beam (p. 36).  Terminals actually used
  5002.   magnetic deflection (even in the 1970's).  This book explains a number
  5003.   of advanced technical concepts such as "random scan" and "color
  5004.   penetration principle".
  5005.  
  5006.   The "COMMUNICATING ... " book in contrast to the "Handbook ... "
  5007.   ignores the physical and electronic details of terminals.  It has an
  5008.   entire chapter explaining binary numbers (which is not needed in a
  5009.   book on terminals since this information is widely available
  5010.   elsewhere).  It seems to mostly cover old IBM terminals (mainly the
  5011.   3270) in block and synchronous modes of operation.  It's of little use
  5012.   for the commonly used ANSI terminals used today on Unix-like systems.
  5013.   Although it does discuss them a little it doesn't show the various
  5014.   wiring schemes used to connect them to serial ports.
  5015.  
  5016.  
  5017.   19.2.4.  Books with Chapters on Terminals
  5018.  
  5019.   These chapters cover almost nothing about the terminals themselves and
  5020.   their capabilities.  Rather, these chapters are mostly about how to
  5021.   set up the computer (and its terminal driver) to work with terminals.
  5022.   Due to the differences of different Unix-like systems, much of the
  5023.   information does not not apply to Linux.
  5024.  
  5025.  
  5026.   ∑  Unix Power Tools by Jerry Peck et. al.  O'Reilly 1998.  Ch. 5
  5027.      Setting Up Your Terminal, Ch. 41: Terminal and Serial Line
  5028.      Settings, Ch. 42: Problems With Terminals
  5029.  
  5030.   ∑  Advanced Programming in the Unix Environment by W. Richard Stevens
  5031.      Addison-Wesley, 1993.  Ch. 11: Terminal I/O, Ch. 19: Pseudo
  5032.      Terminals
  5033.  
  5034.   ∑  Essential System Administration by Aleen Frisch, 2nd ed.  O'Reilly,
  5035.      1998.  Ch. 11: Terminals and Modems.
  5036.  
  5037.   The "UNIX POWER TOOLS" book has 3 short chapters on text terminals.
  5038.   It covers less ground than this HOWTO but gives more examples to help
  5039.   you.
  5040.  
  5041.   The "ADVANCED PROGRAMMING ... " Chapter 11 covers only the device
  5042.   driver included in the operating system to deal with terminals).  It
  5043.   explains the parameters one gives to the stty command to configure the
  5044.   terminal.
  5045.  
  5046.   The "ESSENTIAL SYSTEM ..." book's chapter has more about terminals
  5047.   than modems.  It seems well written.
  5048.  
  5049.  
  5050.   19.3.  Non-Linux OS's
  5051.  
  5052.   The configuration of the host computer for terminals for non-Linux
  5053.   operating systems is usually significantly different than for Linux.
  5054.   Here are some links to on-line manuals for Unix-like systems.
  5055.  
  5056.  
  5057.   ∑  SCO's OpenServer Adding Serial Terminals
  5058.      <http://38.180.207.226/www2.sco.com/HANDBOOK/serial_terminal_adding.html>
  5059.      in SCO OpenServer Handbook.
  5060.  
  5061.   ∑  Hewlett-Packard's HP-UX Configuring Terminals and Modems
  5062.      <http://www.software.hp.com/OS_transition/DOCS/PERIPH/TERMS3.HTM>
  5063.  
  5064.  
  5065.  
  5066.   20.  Appendix B: Escape Sequence Commands Terminology
  5067.  
  5068.   These are sometimes called "control sequences".  This section of Text-
  5069.   Terminal-HOWTO is incomplete (and may never be complete as there are
  5070.   such a huge number of control sequences).  This section is for
  5071.   reference and perhaps really belongs in something that would be called
  5072.   "Text-Terminal-Programming-HOWTO".
  5073.  
  5074.   An example of an ANSI standard escape sequence is ESC[5B which moves
  5075.   the cursor down 5 lines.  ESC is the Escape character.  The parameter
  5076.   5 is included in the sequence.  If it were 7 the cursor would move
  5077.   down 7 lines, etc.  A listing for this sequence as "move cursor down x
  5078.   lines: ESC[xB" is easy to to understand.  But command jargon such as:
  5079.   "tertiary device attribute request" is less comprehensible.  This
  5080.   section will try to explain some of the more arcane jargon used for
  5081.   escape sequence commands.  A full listing (including the escape
  5082.   sequence codes for the ANSI standard) is a "wish list" project.  Since
  5083.   many escape sequences do the same thing as is done when setting up the
  5084.   terminal with ``Set-Up Options'', such escape sequences options will
  5085.   not be repeated here.
  5086.  
  5087.  
  5088.   20.1.  Esc Sequence List
  5089.  
  5090.   For a list of many (but not all) escape sequences for various
  5091.   terminals see Escape Seqs.; N. America <http://www.pericom-
  5092.   usa.com/twdocs/doc/twproae.htm> or Escape Seqs.; Europe
  5093.   <http://www.pericom.co.uk/teemworld/doc/twproae.htm>.  These are  used
  5094.   for terminal emulation and are not always the same as on the
  5095.   corresponding real terminal..
  5096.  
  5097.  
  5098.   20.2.  Printer Esc
  5099.  
  5100.  
  5101.  
  5102.   ∑  Auto Print on/off: When on, data from the host is also teed (sent)
  5103.      to the printer port of the terminal (and also shows on the terminal
  5104.      screen).
  5105.  
  5106.   ∑  Print Controller on/off: When on, data from the host is sent only
  5107.      to the printer (nothing shows on the terminal screen).
  5108.  
  5109.  
  5110.   20.3.  Reports
  5111.  
  5112.   These sequences are usually a request sent from the host to request a
  5113.   report from the terminal.  The terminal responds by sending a report
  5114.   (actually another escape sequence) to the host which has embedded in
  5115.   it certain values telling the host about the current state of the
  5116.   terminal.  In some cases a report may be sent to the host even if it
  5117.   wasn't asked for.  This sometimes happens when set-up is exited.  By
  5118.   default no unsolicited reports should be sent.
  5119.  
  5120.  
  5121.   ∑  Request for Status (Report Operating Status):  Meaning of replies
  5122.      for VT100 is either "I'm OK" or "I'm not OK"
  5123.  
  5124.   ∑  Request for Device Attributes:  The "device" is usually the
  5125.      printer.  Is there a printer?  Is it ready?
  5126.  
  5127.   ∑  Reqest for Tertiary Device Attributes (VT):  Reply is report that
  5128.      was entered during set-up.  The tertiary device is the 3rd device
  5129.      (the printer or auxiliary port device ??).  The 1st device may be
  5130.      the host computer and the 2nd device the terminal.
  5131.  
  5132.   ∑  Request for Terminal Parameters:  What is the parity, baud rate,
  5133.      byte width, etc.  This request doesn't seem to make much sense,
  5134.      since if the host didn't already know this it couldn't communicate
  5135.      with the terminal or send a reply.
  5136.  
  5137.  
  5138.  
  5139.   20.4.  Cursor Movements
  5140.  
  5141.   The cursor is where the next character received from the host will be
  5142.   displayed.  Most of the cursor movements are self-explanatory.  "index
  5143.   cursor" means to move the cursor down one line.  Cursor movements may
  5144.   be relative to the current position such as "move 4 spaces left" or
  5145.   absolute such as "move to row 3, column 39".  Absolute is called
  5146.   "Direct Cursor Positioning" or "Direct Cursor Addressing".
  5147.  
  5148.  
  5149.   The home position is row 1 col. 1 (index origin is 1).  But where this
  5150.   home position is on the physical screen is not completely clear.  If
  5151.   "Cursor Origin Mode" = "Relative Origin Mode" is set, then home is at
  5152.   the top of the scrolling region (not necessarily the top of the
  5153.   screen) at the left edge of the screen.  If "Absolute Origin Mode" is
  5154.   set (the same as unsetting any of the two modes in the previous
  5155.   sentence) then home is at the upper left corner of the screen.  On
  5156.   some old terminals if "Cursor Origin Mode" is set it means that it's
  5157.   relative.
  5158.  
  5159.  
  5160.   20.5.  Pages
  5161.  
  5162.   See ``Pages'' for an explanation of pages.  There are a number of
  5163.   escape sequences to deal with pages.  Text may be copied from one page
  5164.   to another and one may move the cursor from page to page.  Switching
  5165.   pages may or may not be automatic: when the screen becomes full (page
  5166.   1) then more data from the host goes to page 2.  The cursor may only
  5167.   be on one page at a time and characters which are sent to the terminal
  5168.   go there.  If that page is not being displayed, new text will be
  5169.   received by the terminal and go into display memory, but you will not
  5170.   see it (until the terminal is switched to that page).
  5171.  
  5172.  
  5173.   21.  Appendix C: Serial Communications on EIA-232 (RS-232)
  5174.  
  5175.   21.1.  Introduction
  5176.  
  5177.   (Eventually, much of this section should be put into the Serial-
  5178.   HOWTO.)  Text terminals on Unix-like systems (and on PC's) are usually
  5179.   connected to an asynchronous 232 serial port of a computer.  It's
  5180.   usually a RS-232-C, EIA-232-D, or EIA-232-E.  These three are almost
  5181.   the same thing.  The original RS prefix became EIA (Electronics
  5182.   Industries Association) and later EIA/TIA after EIA merged with TIA
  5183.   (Telecommunications Industries Association).  The EIA-232 spec
  5184.   provides also for synchronous (sync) communication but the hardware to
  5185.   support sync is almost always missing on PC's.  The RS designation is
  5186.   obsolete but is still in use.  EIA will be used in this article.
  5187.  
  5188.   The serial port is more than just a physical connector on the back of
  5189.   a computer or terminal.  It includes the associated electronics which
  5190.   must produce signals conforming to the EIA-232 specification.  The
  5191.   standard connector has 25 pins, most of which are unused.  An
  5192.   alternative connector has only 9 pins.  One pin is used to send out
  5193.   data bytes and another to receive data bytes.  Another pin is a common
  5194.   signal ground.  The other "useful" pins are used mainly for signalling
  5195.   purposes with a steady negative voltage meaning "off" and a steady
  5196.   positive voltage meaning "on".
  5197.  
  5198.   The UART (Universal Asynchronous Receiver-Transmitter) chip does most
  5199.   of the work.  Today, the functionality of this chip is usually built
  5200.   into another chip.
  5201.  
  5202.  
  5203.   21.2.  Voltages
  5204.  
  5205.   21.2.1.  Voltage for a Bit
  5206.  
  5207.   At the EIA-232 serial port, voltages are bipolar (positive or negative
  5208.   with respect to ground) and should be about 12 volts in magnitude
  5209.   (some are 5 or 10 volts).   For the transmit and receive pins +12
  5210.   volts is a 0-bit (sometimes called "space") and -12 volts is a 1-bit
  5211.   (sometimes called "mark").  This is known as inverted logic since
  5212.   normally a 0-bit is both false and negative while a one is normally
  5213.   both true and positive.  Although the receive and transmit pins are
  5214.   inverted logic, other pins (modem control lines) are normal logic with
  5215.   a positive voltage being true (or "on" or "asserted") and a negative
  5216.   voltage being false (or "off" or "negated").  Zero voltage has no
  5217.   meaning (except it usually means that the unit is powered off).
  5218.  
  5219.   A range of voltages is allowed.  The specs say the magnitude of a
  5220.   transmitted signal should be between 5 and 15 volts but must never
  5221.   exceed 25 V.  Any voltage received under 3 V is undefined (but some
  5222.   terminals will accept a lower voltage as valid).  One sometimes sees
  5223.   erroneous claims that the voltage is commonly 5 volts (or even 3
  5224.   volts) but it's usually 11-12 volts.  If you are using a EIA-422 port
  5225.   on a Mac computer as an EIA-232 (requires a special cable) or EIA-423
  5226.   then the voltage will actually be only 5 V.  The discussion here
  5227.   assumes 12 V.  There is much confusion about voltages on the Internet.
  5228.  
  5229.   Note that normal computer logic normally is just a few volts (5 volts
  5230.   was once the standard) so that if you try to use test equipment
  5231.   designed for testing 3-5 volt computer logic (TTL) on the 12 volts of
  5232.   a serial port, it may damage the test equipment.
  5233.  
  5234.  
  5235.   21.2.2.  Voltage Sequence for a Byte
  5236.  
  5237.   The transmit pin (TxD) is held at -12 V (mark) at idle when nothing is
  5238.   being sent.  To start a byte it jumps to +12 V (space) for the start
  5239.   bit and remains at +12 V for the duration (period) of the start bit.
  5240.   Next comes the low-order bit of the data byte.  If it's a 0-bit
  5241.   nothing changes and the line remains at +12 V for another bit-period.
  5242.   Then comes the next bit, etc.  Finally, a parity bit may be sent and
  5243.   then a -12 V (mark) stop bit.  The line remains at -12 V (idle) until
  5244.   the next start bit.  Note that there is no return to 0 volts and thus
  5245.   there is no simple way (except by a synchronizing signal) to tell
  5246.   where one bit ends and the next one begins for the case where 2
  5247.   consecutive bits are the same polarity (both zero or both one).
  5248.  
  5249.   A 2nd stop bit would also be -12 V, just the same as the first stop
  5250.   bit.  Since there is no signal to mark the boundaries between these
  5251.   bits, the only effect of the 2nd stop bit is that the line must remain
  5252.   at -12 V idle twice as long.  The receiver has no way of detecting the
  5253.   difference between a 2nd stop bit and a longer idle time between
  5254.   bytes.  Thus communications works OK if one end uses one stop bit and
  5255.   the other end uses 2 stop bits, but using only one stop bit is
  5256.   obviously faster.  In rare cases 1 1/2 stop bits are used.  This means
  5257.   that the line is kept at -12 V for 1 1/2 time periods (like a stop bit
  5258.   50% wider than normal).
  5259.  
  5260.  
  5261.   21.3.  Parity Explained
  5262.  
  5263.   Characters are normally transmitted with either 7 or 8 bits (of data).
  5264.   An additional parity bit may (or may not) be appended to this
  5265.   resulting in a byte length of 7, 8 or 9 bits.  Some terminal emulators
  5266.   and older terminals do not allow 9 bits.  Some prohibit 9 bits if 2
  5267.   stop bits are used (since this would make the total number of bits too
  5268.   large: 12 bits total).
  5269.  
  5270.   The parity may be set to odd, even or none (mark and space parity may
  5271.   be options on some terminals).  With odd parity, the parity bit is
  5272.   selected so that the number of 1-bits in a byte, including the parity
  5273.   bit, is odd.  If a such a byte gets corrupted by a bit being flipped,
  5274.   the result is an illegal byte of even parity.  This error will be
  5275.   detected and if it's an incoming byte to the terminal an error-
  5276.   character symbol will appear on the screen.  Even parity works in a
  5277.   similar manner with all legal bytes (including the parity bit) having
  5278.   an even number of 1-bits.  During set-up, the number of bits per
  5279.   character usually means only the number of data bits per byte (7 for
  5280.   true ASCII and 8 for various ISO character sets).
  5281.   A "mark" is a 1-bit (or logic 1) and a "space" is a 0-bit (or logic
  5282.   0).  For mark parity, the parity bit is always a one-bit.  For space
  5283.   parity it's always a zero-bit.  Mark or space parity only wastes
  5284.   bandwidth and should be avoided when feasible.  "No parity" means that
  5285.   no parity bit is added.   For terminals that don't permit 9 bit bytes,
  5286.   "no parity" must be selected when using 8 bit character sets since
  5287.   there is no room for a parity bit.
  5288.  
  5289.  
  5290.   21.4.  Forming a Byte (Framing)
  5291.  
  5292.   In serial transmission of bytes via EIA-232 ports, the low-order bit
  5293.   is always sent first.  Serial ports on PC's use asynchronous
  5294.   communication where there is a start bit and a stop bit to mark the
  5295.   beginning and end of a byte.  This is called framing and the framed
  5296.   byte is sometimes called a frame.  As a result a total of 9, 10, or 11
  5297.   bits are sent per byte with 10 being the most common.   8-N-1 means 8
  5298.   data bits, No parity, 1 stop bit.  This adds up to 10 bits total when
  5299.   one counts the start bit.  One stop bit is almost universally used.
  5300.   At 110 bits/sec (and sometimes at 300 bits/sec) 2 stop bits were once
  5301.   used but today the 2nd stop bit is used only in very unusual
  5302.   situations (or by mistake since it seemingly still works OK that way).
  5303.  
  5304.  
  5305.   21.5.  Limitations of EIA-232
  5306.  
  5307.   21.5.1.  Low Speed & Short Distance
  5308.  
  5309.   The conventional EIA-232 serial port is inherently low speed and is
  5310.   severely limited in distance.  Ads often read "high speed" but it can
  5311.   only work at high speed over very short distances such as to a modem
  5312.   located right next to the computer.  All of the wires use a common
  5313.   ground return so that twisted-pair technology (needed for high speeds)
  5314.   can't be used without additional hardware.  However some computers and
  5315.   terminals have more modern interfaces.  See ``Successors to EIA-232''.
  5316.  
  5317.   It is somewhat tragic that the RS-232 standard from 1969 did not use
  5318.   twisted pair technology which could operate about a hundred times
  5319.   faster.  Twisted pairs have been used in telephone cables since the
  5320.   late 1800's.  In 1888 (over 110 years ago) the "Cable Conference"
  5321.   reported its support of twisted-pair (for telephone systems) and
  5322.   pointed out its advantages.  But over 80 years after this approval by
  5323.   the "Cable Conference", RS-232 failed to utilize it.   Since RS-232
  5324.   was originally designed for connecting a terminal to a low speed modem
  5325.   located nearby, the need for high speed and longer distance
  5326.   transmission was apparently not recognized.
  5327.  
  5328.  
  5329.   21.5.2.  Successors to EIA-232
  5330.  
  5331.   A number of EIA standards have been established for higher speeds and
  5332.   longer distances using twisted-pair (balanced) technology.  Balanced
  5333.   transmission can sometimes be a hundred times faster than unbalanced
  5334.   EIA-232.  For a given speed, the distance (maximum cable length) may
  5335.   be many times longer with twisted pair.  But PC-s keep being made with
  5336.   the "obsolete" EIA-232 since it works OK with modems connected to slow
  5337.   telephone lines, and it works OK with mice.
  5338.  
  5339.   One exception is Apple's Mac computer with its EIA-232/EIA-422 GeoPort
  5340.   which provides twisted-pairs (balanced) for transmit and receive.  It
  5341.   uses a small round "mini-DIN" connector.  It also provides
  5342.   conventional EIA-232 but only at 5 volts (which is still legal
  5343.   EIA-232).  However, due to the fact that Macs cost more than PC's,
  5344.   they are seldom used as a host computer for terminals.  Some newer
  5345.   terminals use EIA-423 but this is just like the unbalanced EIA-232 and
  5346.   can be connected to a EIA-232 port.  This EIA-423 is only 5 volts, but
  5347.   the specs call for higher speeds than the EIA-232 (which will be of no
  5348.   help on a long run where it's the unbalance that causes interference).
  5349.  
  5350.   EIA-530-A (balanced but can also be used unbalanced) at 2Mbits/s
  5351.   (balanced) was intended to be a replacement for EIA-232 but few have
  5352.   been installed.  It uses the same 25-pin connector as EIA-232.  The
  5353.   High Speed Serial Interface ( HSSI = EIA-612/613) uses a 50-pin
  5354.   connector and goes up to about 50 Mbits/s but the distance is limited
  5355.   to only several meters.  The Universal Serial Bus (USB) is being built
  5356.   into PCI chips.  It is 12 Mbits/s over a twisted pair with a 4-pin
  5357.   connector (2 wires are power supply) but it also is limited to short
  5358.   distances of at most 5 meters (depends on configuration).
  5359.  
  5360.  
  5361.   21.5.3.  Line Drivers
  5362.  
  5363.   For a text terminal, the EIA-232 speeds are fast enough but the usable
  5364.   cable length is often too short.  Balanced technology could fix this.
  5365.   The common method of obtaining balanced communication with a text
  5366.   terminal is to install 2@ line drivers in the serial line to convert
  5367.   unbalanced to balanced (and conversely).  They are a specialty item
  5368.   and are expensive if purchased new.
  5369.  
  5370.  
  5371.   21.6.  Synchronization & Synchronous
  5372.  
  5373.   21.6.1.  How "Asynchronous" is Synchronized
  5374.  
  5375.   Per EIA-232 there are only two states of the transmit (or receive)
  5376.   wire: mark (-12 V) or space (+12 V).  There is no state of 0 V.  Thus
  5377.   a sequence of 1-bits is transmitted by just a steady -12 V with no
  5378.   markers of any kind between bits.  For the receiver to detect
  5379.   individual bits it must always have a clock signal which is in
  5380.   synchronization with the transmitter clock.  Such clocks generate a
  5381.   "tick" in synchronization with each transmitted (or received) bit.
  5382.  
  5383.   For asynchronous transmission, synchronization is achieved by framing
  5384.   each byte with a start bit and a stop bit (done by hardware).  The
  5385.   receiver listens on the line for a start bit and when it detects one
  5386.   it starts its clock ticking.  It uses this clock tick to time the
  5387.   reading of the next 7, 8 or 9 bits.  (It actually is a little more
  5388.   complex than this since several samples of a bit are often taken and
  5389.   this requires additional timing ticks.)  Then the stop bit is read,
  5390.   the clock stops and the receiver waits for the next start bit.  Thus
  5391.   async is actually synchronized during the reception of a single byte
  5392.   but there is no synchronization between one byte and the next byte.
  5393.  
  5394.  
  5395.   21.6.2.  Defining Asynchronous vs Synchronous
  5396.  
  5397.   Asynchronous (async) means "not synchronous".  In practice, an async
  5398.   signal is what the async serial port sends and receives which is a
  5399.   stream of bytes each delimited by a start and stop bit.  Synchronous
  5400.   (sync) is most everything else.  But this doesn't explain the basic
  5401.   concepts.
  5402.  
  5403.   In theory, synchronous means that bytes are sent out at a constant
  5404.   rate one after another (in step with a clock signal tick ).
  5405.   Asynchronous bytes may be sent out erratically with various time
  5406.   intervals between bytes (like someone typing characters at a
  5407.   keyboard).
  5408.  
  5409.   There are borderline situations that need to be classified as either
  5410.   sync or async.  The async serial port often sends out bytes in a
  5411.   steady stream which would make this a synchronous case but since they
  5412.   still have the start/stop bits (which makes it possible to send them
  5413.   out erratically) its called async.  Another case is where data bytes
  5414.   (without any start-stop bits) are put into packets with possible
  5415.   erratic spacing between one packet and the next.  This is called sync
  5416.   since the bytes within each packet must be transmitted synchronously.
  5417.  
  5418.  
  5419.   21.6.3.  Synchronous Communication
  5420.  
  5421.   Did you ever wonder what all the unused pins are for on a 25-pin
  5422.   connector for the serial port?  Most of them are for use in
  5423.   synchronous communication which is seldom implemented on PC's.  There
  5424.   are pins for sync timing signals as well as for a sync reverse
  5425.   channel.  The EIA-232 spec provides for both sync and async but PC's
  5426.   use a UART (Universal Asynchronous Receiver/Transmitter) chip such as
  5427.   a 16450, 16550A, or 16650 and can't deal with sync.  For sync one
  5428.   needs a USART chip or the equivalent where the "S" stands for
  5429.   Synchronous.  Since sync is a niche market, a sync serial port is
  5430.   likely to be quite expensive.
  5431.  
  5432.   Besides the sync part of the EIA-232, there are various other EIA
  5433.   synchronous standards.  For EIA-232, 3 pins of the connector are
  5434.   reserved for clock (or timing) signals.  Sometimes it's a modem's task
  5435.   to generate some timing signals making it impossible to use
  5436.   synchronous communications without a synchronous modem (or without a
  5437.   device called a "synchronous modem eliminator" which provides the
  5438.   timing signals).
  5439.  
  5440.   Although few serial ports are sync, synchronous communication does
  5441.   often take place over telephone lines using modems which use V.42
  5442.   error correction.  This strips off the start/stop bits and puts the
  5443.   date bytes in packets resulting in synchronous operation over the
  5444.   phone line.
  5445.  
  5446.  
  5447.   21.7.  Block Mode
  5448.  
  5449.   21.7.1.  Introduction
  5450.  
  5451.   Block mode is seldom used with Linux.  In block mode when one types at
  5452.   a terminal, the results are saved in the terminal memory and are not
  5453.   sent just yet to the host computer.  Such terminals often have built-
  5454.   in editing capabilities.  When the user presses certain keys (such as
  5455.   the send key) what has been saved in the terminal memory is sent to
  5456.   the host computer.  Now the Linux editors vi and emacs, react
  5457.   instantly to pressing certain keys but in the above situation such
  5458.   keys will be pressed and nothing will happen since nothing is sent
  5459.   when a key is pressed.  Thus using a block mode terminal will not
  5460.   allow the use of such interactive programs.  The old IBM mainframe
  5461.   interface uses block mode so many IBM terminals are block-mode only
  5462.   and also synchronous (see Section ``Synchronization & Synchronous'').
  5463.  
  5464.  
  5465.   21.7.2.  Types of Block Modes, Forms
  5466.  
  5467.   Block mode may itself have various sub-modes such as "page" (a page at
  5468.   a time) and "line" (a line at a time).  Some terminals have both block
  5469.   transmission modes and conventional character modes and may be
  5470.   switched from one mode to another.  Async terminals which have block
  5471.   modes include HP2622A, VT130, VT131, VT330, VT340, and Visual500.
  5472.   Many later model terminals can emulate block mode.  Block modes may
  5473.   include a forms capability where the host computer sends a form to the
  5474.   terminal.  Then the user fills it out and hits the send key which
  5475.   sends only the data in the form back to the host computer.  The form
  5476.   itself (not the data) is displayed on the screen in protected fields
  5477.   which don't get transmitted to the host.
  5478.  
  5479.   21.7.3.  Efficiency
  5480.  
  5481.   Block mode takes a great deal of load off the host computer,
  5482.   especially if the host computer's hardware is designed for block modes
  5483.   (as IBM mainframes were).  In character mode every character typed is
  5484.   sent immediately to the serial port and usually causes an interrupt at
  5485.   the host computer.  The host that receives the byte must stop whatever
  5486.   it is doing and fetch that character from the port hardware.  Even
  5487.   with UART's that have larger hardware buffers the timeout may be such
  5488.   that it issues an interrupt for every character typed.
  5489.  
  5490.   In true block mode a long block of characters is received using only
  5491.   one interrupt.  If block mode is used with conventional async serial
  5492.   ports newer models can now get by with issuing an interrupt every 14
  5493.   bytes since they have 16-byte hardware buffers.  Thus much of the load
  5494.   and overhead of interrupt handling is eliminated and the computer has
  5495.   more time to do other tasks when block mode is used.
  5496.  
  5497.   A significant savings for block mode occurs if the terminal is
  5498.   connected to its host via a network.  Without block mode, every
  5499.   character (byte) typed is sent in its own packet including all the
  5500.   overhead bytes (40 in a TCP/IP packet as used on the Internet).  With
  5501.   block mode, a large number of characters are sent in a single packet.
  5502.  
  5503.  
  5504.   21.8.  EIA-232 (RS-232) Books
  5505.  
  5506.   (Note: The first book covers much more than just EIA-232.)
  5507.  
  5508.   ∑  Black, Uyless D.: Physical Layer Interfaces & Protocols, IEEE
  5509.      Computer Society Press, Los Alamitos, CA, 1996.
  5510.  
  5511.   ∑  Campbell, Joe: The RS-232 Solution, 2nd ed., Sybex, 1982.
  5512.  
  5513.   ∑  Putnam, Byron W.: RS-232 Simplified, Prentice Hall, 1987.
  5514.  
  5515.   ∑  Seyer, Martin D.: RS-232 Made Easy, 2nd ed., Prentice Hall, 1991.
  5516.  
  5517.  
  5518.   21.9.  Serial Software
  5519.  
  5520.   See Serial Software <ftp://sunsite.unc.edu/pub/Linux/system/serial/>
  5521.   for Linux software for the serial ports including getty and port
  5522.   monitors.
  5523.  
  5524.  
  5525.   22.  Appendix D: Notes by Brand Name
  5526.  
  5527.   Here are notes by brand name that were too specific to a certain
  5528.   terminal to be put elsewhere in this HOWTO.  If you have some info to
  5529.   contribute on a certain terminal that is not covered elsewhere, it
  5530.   could go here.  Various models and brands often have much in common
  5531.   which only need be written about in one place.  It would be nice to
  5532.   have for each terminal model, a large set of links linking to the
  5533.   documentation relevant to that model (including escape codes).  There
  5534.   are so many models of terminals that such a task would be quite
  5535.   onerous and I, David Lawyer (as of 1998), have no intention of
  5536.   attempting this.  If terminal manufacturers would only make their
  5537.   manuals available on the net, then all this might not be needed.
  5538.  
  5539.  
  5540.   22.1.  CIT
  5541.  
  5542.   CIT terminals were made in Japan in the 1980's for CIE Terminals.
  5543.   They ceased to be imported in the late 1980's.  The company, CIE,
  5544.   still makes CItoh printers (in 1997) but has no parts for its
  5545.   abandoned terminals.  Ernie at (714) 453-9555 in Irvine CA sells (in
  5546.   1997) some parts for models 224, 326, etc. but has nothing for the 80
  5547.   and 101.  (The document you are now reading was written mostly on the
  5548.   101e.)
  5549.  
  5550.   To save the Set-Up parameters press ^S when in Set-Up mode.  cit80:
  5551.   Contrast: knob on rear of terminal, cit101e: Brightness: use up/down
  5552.   arrow keys in Set-Up mode.
  5553.  
  5554.  
  5555.   22.2.  IBM
  5556.  
  5557.   Don't confuse IBM terminals with IBM PC monitors.  Many IBM terminals
  5558.   don't use ASCII but instead use an 8-bit EBCDIC code.  It's claimed
  5559.   that in EBCDIC the bit order of transmission is reversed from normal
  5560.   with the high-order bit going first.  The IBM mainframe communication
  5561.   standards are a type of synchronous communication in block mode (sends
  5562.   large packets of characters).  Two standards are "BISYNC" and "SNA"
  5563.   (which includes networking standards).  Many of their terminals
  5564.   connect with coax cable (RG62A/U) and naive persons may think the
  5565.   "BNC" connecter on the terminal is for ethernet (but it's not).
  5566.  
  5567.   While this IBM system is actually  more efficient than what is
  5568.   normally used in Linux, terminals meeting this IBM standard will not
  5569.   currently work with Linux.  However, some IBM terminals are
  5570.   asynchronous ASCII terminals and should work with Linux on PC's.  The
  5571.   numbers 31xx may work with the exception that 317x and 319x are not
  5572.   ASCII terminals.  Before getting an IBM terminal, make sure there is a
  5573.   termcap (terminfo) for it.  If their isn't, it likely will not work
  5574.   with Linux.  Even if there is a terminfo, it may not work.  For
  5575.   example, there is a termcap for 327x but the 3270 is an EBCDIC
  5576.   synchronous terminal.
  5577.  
  5578.   The 3270 series includes the 3278 (late 1970's), 3279 with color and
  5579.   graphics, and the 3274 terminal controller (something like the 3174).
  5580.   They may be used for both BISYNC and SNA.  The 3290 has a split screen
  5581.   (splits into quarters).
  5582.  
  5583.   The synchronous IBM terminals don't connect directly to the IBM
  5584.   mainframe, but connect to a "terminal controller" (sometimes called
  5585.   "cluster controller" or "communication controller").  Some of these
  5586.   controllers can convert a synchronous signal to asynchronous so that
  5587.   in this case a synchronous terminal could indirectly connect to a
  5588.   Unix-like host computer via its serial port.  But there is still a
  5589.   major problem and that is block transmission.  See section ``Block
  5590.   Mode''.
  5591.  
  5592.  
  5593.   22.2.1.  IBM 3153
  5594.  
  5595.   It's claimed that the Aux port is DCE and uses a straight-thru cable.
  5596.  
  5597.  
  5598.   22.3.  Teletypes
  5599.  
  5600.   These are antiques and represent the oldest terminals.  They are like
  5601.   remotely controlled typewriters but are large and noisy.  Made by the
  5602.   Teletype Corp., the first models were made in the 1920's and predate
  5603.   the computer by over 30 years.  Early models used electro-mechanical
  5604.   relays and rotating distributors instead of electronics.  Their Baudot
  5605.   code was only 5-bits per character as compared to 7-bit ASCII.  See
  5606.   the book "Small Computer Systems Handbook" by Sol Libes, Hayden Books,
  5607.   1978: pp. 138-141 ("Teletypes").
  5608.  
  5609.  
  5610.  
  5611.   22.4.  VT (DEC)
  5612.  
  5613.   Digital Equipment Corporation made the famous VT series of terminals
  5614.   including the commonly emulated VT100.  In 1995 they sold their
  5615.   terminal business to SunRiver which is now named Boundless
  5616.   Technologies.  More information is available at Shuford's Website
  5617.   <http://www.cs.utk.edu/~shuford/terminal_index.html> Information on
  5618.   current products is available from the Boundless website.  See
  5619.   ``Terminal Info on the Internet''.
  5620.  
  5621.   VT220: Some have a BNC connector for video output (not for input).
  5622.   Sometimes people erroneously think this is for an ethernet connection.
  5623.  
  5624.  
  5625.   22.5.  Wyse
  5626.  
  5627.   Wyse has some FAQ's for terminal numbers under 100 (such as WY60).
  5628.   See  <http://www.wyse.com/service/faq/wysetterl.htm> For the specs on
  5629.   more recent terminals see See  <http://www.wyse.com/terminal/>.
  5630.  
  5631.  
  5632.   22.5.1.  Wyse 99-GT
  5633.  
  5634.   Here is the setup Menus of the Wyse99GT (late 1980's).  Note that TERM
  5635.   means "termination" (character) and not "terminal".
  5636.  
  5637.  
  5638.  
  5639.  
  5640.  
  5641.  
  5642.  
  5643.  
  5644.  
  5645.  
  5646.  
  5647.  
  5648.  
  5649.  
  5650.  
  5651.  
  5652.  
  5653.  
  5654.  
  5655.  
  5656.  
  5657.  
  5658.  
  5659.  
  5660.  
  5661.  
  5662.  
  5663.  
  5664.  
  5665.  
  5666.  
  5667.  
  5668.  
  5669.  
  5670.  
  5671.  
  5672.  
  5673.  
  5674.  
  5675.  
  5676.  
  5677.           WYSE 99-GT Terminal Set-Up as used at the University of CA, Irvine
  5678.                   by David Lawyer, April 1990
  5679.  
  5680.                           F1 DISP:
  5681.   COLUMNS=80              LINES=24                CELL SIZE=10 X 13
  5682.   STATUS LINE=STANDARD    BACKGROUND=DARK         SCROLL SPEED=JUMP
  5683.   SCREEN SAVER=OFF        CURSOR=BLINK BLOCK      DISPLAY CURSOR=ON
  5684.   ATTRIBUTE=CHAR          END OF LINE WRAP=ON     AUTO SCROLL=ON
  5685.   ----------------------------------------------------------------------------
  5686.                           F2  GENERAL:
  5687.   PERSONALITY=VT 100      ENHANCE=ON              FONT LOAD=OFF
  5688.   COMM MODE=FULL DUPLEX   RCVD CR=CR              SEND ACK=ON
  5689.   RESTORE TABS=ON         ANSWERBACK MODE=OFF     ANSWERBACK CONCEAL=OFF
  5690.   WIDTH CHANGE CLEAR=OFF  MONITOR=OFF             TEST=OFF
  5691.   ----------------------------------------------------------------------------
  5692.                           F3 KEYBRD:
  5693.   KEYCLICK=OFF            KEYLOCK=CAPS            KEY REPEAT=ON
  5694.   RETURN=CR               ENTER=CR                FUNCT KEY=HOLD
  5695.   XMT LIMIT=NONE          FKEY XMT LIMIT=NONE     BREAK=170MS
  5696.   LANGUAGE=US             MARGIN BELL=OFF         PRINTER RCV=OFF
  5697.   ----------------------------------------------------------------------------
  5698.                           F4 COMM:
  5699.   DATA/PRINTER=AUX/MODEM    MDM RCV BAUD RATE=9600  MDM XMT BAUD RATE=9600
  5700.   MDM DATA/STOP BITS=8/1    MDM RCV HNDSHAKE=NONE   MDM XMT HNDSHAKE=NONE
  5701.   MDM PARITY=NONE           AUX BAUD RATE=9600      AUX DATA/STOP BITS=8/1
  5702.   AUX RCV HNDSHAKE=NONE     AUX XMT HNDSHAKE=NONE   AUX PARITY=NONE
  5703.   (There is a main port (Modem=MDM) and an Auxiliary Port (AUX)
  5704.   ----------------------------------------------------------------------------
  5705.                           F5 MISC 1:
  5706.   WARNING BELL=ON         FKEY LOCK=OFF           FEATURE LOCK=ON
  5707.   KEYPAD=NUMERIC          DEL=DEL/CAN             XFER TERM=EOS
  5708.   CURSOR KEYS=NORMAL      MARGIN CTRL=0           DEL FOR LOW Y=ON
  5709.   GIN TERM=CR             CHAR MODE=MULTINATIONAL
  5710.   ----------------------------------------------------------------------------
  5711.                           F6 MISC 2:
  5712.   LOCAL=OFF               SEND=ALL                PRINT=NATIONAL
  5713.   PORT=EIA DATA           SEND AREA=SCREEN        PRINT AREA=SCREEN
  5714.   DISCONNECT=60 MSEC      SEND TERM=NONE          PRINT TERM=NONE
  5715.   PRINT MODE=NORMAL       VT100 ID=VT100          POUND=US
  5716.   ----------------------------------------------------------------------------
  5717.   F7 TABS: You should see several "T" characters spaced 8 dots apart.
  5718.       If you don't, hit (backspace>.
  5719.   F8 F/KEYS: Normally you will see no definitions for the Function Keys
  5720.       here (unless someone has set them up and saved them).  This means that
  5721.       they will normally generate their default settings (not displayed here).
  5722.       <ctrl><F5> shows the "user defined definition" of the F5 key, etc.
  5723.   F9 A/BACK: Normally not defined: ANSWERBACK =
  5724.   F10 EXIT: Selecting "DEFAULT ALL" will make the factory default settings
  5725.       the default.
  5726.  
  5727.  
  5728.  
  5729.   HINTS on use of WY-99GT User's Guide: Note that much that is missing
  5730.   from this Guide may be found in the WY-99GT Programmer's Guide.  The
  5731.   VT100 emulation (personality) is known as ANSI and uses ANSI key codes
  5732.   per p. A-10+ even though the keyboard may be ASCII.  A sub-heading on
  5733.   p. A-13 "ASCII Keyboard" also pertains to VT100 because it has an
  5734.   "ANSI KEY ..." super-heading a few pages previously.  But not all
  5735.   ASCII keyboard headings pertain to VT100 since they may fall under a
  5736.   non-ANSI personality super-heading which may found be a few pages
  5737.   previously.  Appendix H is the "ANSI Command Guide" except for the
  5738.   VT52 (ANSI) personality which is found in Appendix G.
  5739.  
  5740.  
  5741.  
  5742.  
  5743.   22.5.2.  Wyse 150
  5744.  
  5745.   When exiting set-up using F12, hitting space changes "no" to "yes" to
  5746.   save the set-up.  The sentence to the left of this no/yes is about
  5747.   "vertical alignment" and has nothing to do with this no/yes for saving
  5748.   the set-up (confusing menu design).
  5749.  
  5750.  
  5751.  
  5752.  
  5753.  
  5754.  
  5755.  
  5756.  
  5757.  
  5758.  
  5759.  
  5760.  
  5761.  
  5762.  
  5763.  
  5764.  
  5765.  
  5766.  
  5767.  
  5768.  
  5769.  
  5770.  
  5771.  
  5772.  
  5773.  
  5774.  
  5775.  
  5776.  
  5777.  
  5778.  
  5779.  
  5780.  
  5781.  
  5782.  
  5783.  
  5784.  
  5785.  
  5786.  
  5787.  
  5788.  
  5789.  
  5790.  
  5791.  
  5792.  
  5793.  
  5794.  
  5795.  
  5796.  
  5797.  
  5798.  
  5799.  
  5800.  
  5801.  
  5802.  
  5803.  
  5804.  
  5805.  
  5806.  
  5807.  
  5808.  
  5809.