home *** CD-ROM | disk | FTP | other *** search
/ Freelog Special Edition 1: Linux / CD1.iso / doc / HOWTO / Keyboard-and-Console-HOWTO < prev    next >
Text File  |  1998-10-14  |  65KB  |  1,981 lines

  1.   The Linux keyboard and console HOWTO
  2.   Andries Brouwer, aeb@cwi.nl
  3.   v2.8, 25 February 1998
  4.  
  5.   This note contains some information about the Linux keyboard and con-
  6.   sole, and the use of non-ASCII characters.  It describes Linux 2.0.
  7.   ______________________________________________________________________
  8.  
  9.   Table of Contents
  10.  
  11.  
  12.  
  13.  
  14.  
  15.  
  16.  
  17.  
  18.  
  19.  
  20.  
  21.  
  22.  
  23.  
  24.  
  25.  
  26.  
  27.  
  28.  
  29.  
  30.  
  31.  
  32.  
  33.  
  34.  
  35.  
  36.  
  37.  
  38.  
  39.  
  40.  
  41.  
  42.  
  43.  
  44.  
  45.  
  46.  
  47.  
  48.  
  49.  
  50.  
  51.  
  52.  
  53.  
  54.  
  55.  
  56.  
  57.  
  58.  
  59.  
  60.  
  61.  
  62.  
  63.  
  64.  
  65.  
  66.  
  67.   1. Useful programs
  68.  
  69.   2. Keyboard generalities
  70.  
  71.   3. Console generalities
  72.  
  73.   4. Resetting your terminal
  74.  
  75.      4.1 Keyboard hardware reset
  76.  
  77.   5. Delete and Backspace
  78.  
  79.      5.1 How to tell Unix what character you want to use to delete the last typed character
  80.         5.1.1 `Getty used to do the right thing with DEL and BS but is broken now?'
  81.         5.1.2 `Login behaves differently at the first and second login attempts?'
  82.      5.2 How to tell Linux what code to generate when a key is pressed
  83.         5.2.1 `Why doesn't the Backspace key generate BackSpace by default?'
  84.      5.3 How to tell X to interchange Delete and Backspace
  85.      5.4 How to tell emacs what to do when it receives a Delete or Backspace
  86.      5.5 How to tell emacs to interchange Delete and Backspace
  87.      5.6 How to tell kermit to interchange Delete and Backspace
  88.      5.7 How to tell xterm about your favourite tty modes
  89.      5.8 How to tell xmosaic that the Backspace key generates a DEL
  90.      5.9 A better solution for Motif-using programs, like netscape
  91.      5.10 What about termcap and terminfo?
  92.  
  93.   6. The console character sets
  94.  
  95.   7. Console switching
  96.  
  97.      7.1 Changing the number of Virtual Consoles
  98.  
  99.   8. Ctrl-Alt-Del and other special key combinations
  100.  
  101.      8.1 Ctrl-Alt-Del (Boot)
  102.      8.2 Other combinations
  103.      8.3 X Combinations
  104.      8.4 Dosemu Combinations
  105.      8.5 Composing symbols
  106.      8.6 The SysRq key
  107.  
  108.   9. How to get out of raw mode
  109.  
  110.   10. The keyboard LEDs
  111.  
  112.   11. The TERM variable
  113.  
  114.      11.1 Terminfo
  115.  
  116.   12. How to make other programs work with non-ASCII chars
  117.  
  118.   13. What precisely does XFree86-2.1 do when it initializes its keymap?
  119.  
  120.   14. Unusual keys and keyboards
  121.  
  122.   15. Examples of use of loadkeys and xmodmap
  123.  
  124.      15.1 `I can use only one finger to type with'
  125.  
  126.   16. Changing the video mode
  127.  
  128.      16.1 Instructions for the use of resizecons
  129.  
  130.   17. Changing the keyboard repeat rate
  131.  
  132.   18. Scrolling
  133.   19. Screensaving
  134.  
  135.   20. Screen dumps
  136.  
  137.   21. Some properties of the VT100 - application key mode
  138.  
  139.   22. Hardware incompatibility
  140.  
  141.   23. Copyright
  142.  
  143.  
  144.  
  145.   ______________________________________________________________________
  146.  
  147.   1.  Useful programs
  148.  
  149.  
  150.   The following packages contain keyboard or console related programs.
  151.  
  152.   kbd-0.95.tar.gz contains loadkeys, dumpkeys, showkey, setmetamode,
  153.   setleds, setfont, showfont, mapscrn, kbd_mode, loadunimap, chvt,
  154.   resizecons, deallocvt, getkeycodes, setkeycodes.
  155.  
  156.   util-linux-2.6 contains setterm, kbdrate.  (Yes, the more in util-
  157.   linux-2.6 dumps core due to a name conflict. Preserve your old copy,
  158.   or use util-linux-2.5, or change `savetty' to `my_savetty' in more.c.)
  159.  
  160.   sh-utils-1.12 contains stty.
  161.  
  162.   open-1.4.tgz contains open (that should be renamed to openvt). (See
  163.   also dynamic-vc-1.1.tar.gz.)
  164.  
  165.   SVGATextMode-1.8.tar.gz contains SVGATextMode, a program that
  166.   obsoletes resizecons.
  167.  
  168.   The X distribution contains xmodmap, xset, kbd_mode.  (See also
  169.   X386keybd(1) for the situation under XFree86 1.3, and Xserver(1) for
  170.   the XKEYBOARD extension under X11R6.)
  171.  
  172.   termcap-2.0.8.tar.gz contains termcap, an old terminal capabilities
  173.   data base. ncurses-1.9.9e.tar.gz contains the termlib data base which
  174.   obsoletes termcap. (However, there are still many programs using
  175.   termcap.)
  176.  
  177.   See loadkeys(1), setleds(1) and setmetamode(1) for the codes generated
  178.   by the various keys and the setting of leds when not under X. Under X,
  179.   see xmodmap(1) and xset(1).
  180.  
  181.   See setfont(8) for loading console fonts. Many people will want to
  182.   load a font like iso01.f16 because the default font is the hardware
  183.   font of the video card, and often is a `Code Page 437' font missing
  184.   accented characters and other Latin-1 symbols.
  185.  
  186.   See setterm(1) and kbdrate(8) for properties such as foreground and
  187.   background colors, screen blanking and character repeat rate when not
  188.   under X.  Under X, see xset(1), also for key click and bell volume.
  189.  
  190.   The file /etc/termcap defines the escape sequences used by many
  191.   programs addressing the console (or any other terminal).  See
  192.   termcap(5).  A more modern version is found in /usr/lib/terminfo.  See
  193.   terminfo(5). Terminfo files are compiled by the terminfo compiler
  194.   /usr/lib/terminfo/tic, see tic(1).  Their contents can be examined
  195.   using the program infocmp, see infocmp(1).  The Linux console
  196.   sequences are documented in console_codes(4).
  197.  
  198.  
  199.   2.  Keyboard generalities
  200.  
  201.  
  202.   You press a key, and the keyboard controller sends scancodes to the
  203.   kernel keyboard driver. Some keyboards can be programmed, but usually
  204.   the scancodes corresponding to your keys are fixed.  The kernel
  205.   keyboard driver just transmits whatever it receives to the application
  206.   program when it is in scancode mode, like when X is running.
  207.   Otherwise, it parses the stream of scancodes into keycodes,
  208.   corresponding to key press or key release events.  (A single key press
  209.   can generate up to 6 scancodes.)  These keycodes are transmitted to
  210.   the application program when it is in keycode mode (as used, for
  211.   example, by showkey).  Otherwise, these keycodes are looked up in the
  212.   keymap, and the character or string found there is transmitted to the
  213.   application, or the action described there is performed.  (For
  214.   example, if one presses and releases the a key, then the keyboard
  215.   produces scancodes 0x1e and 0x9e, this is converted to keycodes 30 and
  216.   158, and then transmitted as 0141, the ASCII or latin-1 code for `a';
  217.   if one presses and releases Delete, then the keyboard produces
  218.   scancodes 0xe0 0x53 0xe0 0xd3, these are converted to keycodes 111 and
  219.   239, and then transmitted as the 4-symbol sequence ESC [ 3 ~, all
  220.   assuming a US keyboard and a default keymap. An example of a key
  221.   combination to which an action is assigned is Ctrl-Alt-Del.)
  222.  
  223.   The translation between unusual scancodes and keycodes can be set
  224.   using the utility setkeycodes - only very few people will need it.
  225.   The translation between keycodes and characters or strings or actions,
  226.   that is, the keymap, is set using the utilities loadkeys and
  227.   setmetamode.  For details, see getkeycodes(8), setkeycodes(8),
  228.   dumpkeys(1), loadkeys(1), setmetamode(1). The format of the files
  229.   output by dumpkeys and read by loadkeys is described in keytables(5).
  230.  
  231.   Where it says `transmitted to the application' in the above
  232.   description, this really means `transmitted to the terminal driver'.
  233.   That is, further processing is just like that of text that comes in
  234.   over a serial line.  The details of this processing are set by the
  235.   program stty.
  236.  
  237.  
  238.   3.  Console generalities
  239.  
  240.  
  241.   Conversely, when you output something to the console, it first
  242.   undergoes the standard tty processing, and then is fed to the console
  243.   driver.  The console driver emulates a VT100, and parses the input in
  244.   order to recognize VT100 escape sequences (for cursor movement, clear
  245.   screen, etc.).  The characters that are not part of an escape sequence
  246.   are first converted into Unicode, using one of four mapping tables if
  247.   the console was not in UTF-8 mode to start with, then looked up in the
  248.   table describing the correspondence between Unicode values and font
  249.   positions, and the obtained 8- or 9-bit font indices are then written
  250.   to video memory, where they cause the display of character shapes
  251.   found in the video card's character ROM.  One can load one's own fonts
  252.   into character ROM using setfont, load the corresponding Unicode map
  253.   with loadunimap, and load a user mapping table using mapscrn.  More
  254.   details will be given below.
  255.  
  256.   There are many consoles (called Virtual Consoles or Virtual Terminals,
  257.   abbreviated VCs or VTs) that share the same screen. You can use them
  258.   as independent devices, either to run indendent login sessions, or
  259.   just to send some output to, perhaps from top, or the tail of the
  260.   system log or so.  See below (`Console switching') on how to set them
  261.   up and switch between them.
  262.  
  263.  
  264.  
  265.   4.  Resetting your terminal
  266.  
  267.  
  268.   There is garbage on the screen, or all your keystrokes are echoed as
  269.   line drawing characters. What to do?
  270.  
  271.   Many programs will redraw the screen when ^L is typed. This might help
  272.   when there is some modem noise or broadcast message on your screen.
  273.   The command clear will clear the screen.
  274.  
  275.   The command reset will reset the console driver. This helps when the
  276.   screen is full of funny graphic characters, and also if it is reduced
  277.   to the bottom line. If you don't have this command, or if it does
  278.   something else, make your own by putting the following two lines in an
  279.   executable file reset in your PATH:
  280.  
  281.  
  282.                #!/bin/sh
  283.                echo -e \\033c
  284.  
  285.  
  286.  
  287.  
  288.   that is, you want to send the two characters ESC c to the console.
  289.  
  290.   Why is it that the display sometimes gets confused and gives you a
  291.   24-line or 1-line screen, instead of the usual 25 lines?  Well, the
  292.   main culprit is the use of TERM=vt100 (or some other entry with 24
  293.   lines) instead of TERM=linux when logged in remotely.  If this happens
  294.   on /dev/tty2 then typing
  295.  
  296.  
  297.                % cat > /dev/tty2
  298.                ^[c
  299.                ^D
  300.  
  301.  
  302.  
  303.  
  304.   on some other VT (where 4 symbols are typed to cat: ESC, c, ENTER,
  305.   Ctrl-D) and refreshing the screen on /dev/tty2 (perhaps using ^L) will
  306.   fix things. Of course the permanent fix is to use the right termcap or
  307.   terminfo entry.
  308.  
  309.   Why is it that you sometimes get a lot of line-drawing characters,
  310.   e.g., after catting a binary to the screen?  Well, there are various
  311.   character set changing escape sequences, and by accident your binary
  312.   might contain some of these.  The ESC c is a general reset, a cure for
  313.   all, but if you know precisely what went wrong you can repair it
  314.   without resetting other console attributes. For example, after
  315.  
  316.  
  317.                % cat
  318.                ^N
  319.                ^D
  320.  
  321.  
  322.  
  323.  
  324.   your shell prompt will be all line-drawing characters.  Now do (typing
  325.   blindly)
  326.  
  327.  
  328.  
  329.  
  330.  
  331.           % cat
  332.           ^O
  333.           ^D
  334.  
  335.  
  336.  
  337.  
  338.   and all is well again. (Three symbols typed to each cat: ^N (or ^O),
  339.   ENTER, Ctrl-D.) To understand what is happening, see `The console
  340.   character sets' below.
  341.  
  342.   If you loaded some strange font, and want to return to the default,
  343.  
  344.  
  345.                % setfont
  346.  
  347.  
  348.  
  349.  
  350.   will do (provided you stored the default font in the default place).
  351.   If this default font does not contain an embedded Unicode map (and
  352.   gives the wrong symbols for accented characters), then say
  353.  
  354.  
  355.                % loadunimap
  356.  
  357.  
  358.  
  359.  
  360.   For example, if I do
  361.  
  362.  
  363.                % loadkeys de-latin1
  364.  
  365.  
  366.  
  367.  
  368.   then I have a German keyboard, and the key left of the Enter key gives
  369.   me a-umlaut. This works, because the a-umlaut occurs on the CP437 code
  370.   page and the kernel Unicode map is initialized to CP437, and my video
  371.   card has a CP437 font built-in.  If I now load an ISO 8859-1 font with
  372.  
  373.  
  374.                % setfont iso01.f16
  375.  
  376.  
  377.  
  378.  
  379.   then everything still works, because setfont invalidates the kernel
  380.   Unicode map (if there is no Unicode map attached to the font), and
  381.   without map the kernel goes directly to the font, and that is pre-
  382.   cisely correct for an ISO 8859-1 system with iso01.f16 font.  But
  383.   going back to the previous font with
  384.  
  385.  
  386.                % setfont
  387.  
  388.  
  389.  
  390.  
  391.   gives capital Sigma's instead of a-umlaut - all accented letters are
  392.   mixed up because also this font has no embedded Unicode map. After
  393.  
  394.  
  395.                % loadunimap
  396.  
  397.   which loads the default Unicode map (which is right for the default
  398.   font) all works correctly again. Usually loadunimap is not invoked
  399.   directly, but via setfont. Thus, the previous two commands may be
  400.   replaced by
  401.  
  402.  
  403.                % setfont -u def
  404.  
  405.  
  406.  
  407.  
  408.   The Ethiopian fonts and the lat1u*.psf fonts have embedded Unicode
  409.   code map. Most of the others don't.
  410.  
  411.   On old terminals output involving tabs may require a delay, and you
  412.   have to say
  413.  
  414.  
  415.                % stty tab3
  416.  
  417.  
  418.  
  419.  
  420.   (see stty(1)).
  421.  
  422.   You can change the video mode using resizecons or SVGATextMode.  This
  423.   usually settles the output side.  On the input side there are many
  424.   things that might be wrong. If X or DOOM or some other program using
  425.   raw mode crashed, your keyboard may still be in raw (or mediumraw)
  426.   mode, and it is difficult to give commands.  (See "How to get out of
  427.   raw mode" below.)  If you loaded a bad keymap, then
  428.  
  429.  
  430.                % loadkeys -d
  431.  
  432.  
  433.  
  434.  
  435.   loads the default map again, but it may well be difficult to type `-'!
  436.   An alternative is
  437.  
  438.  
  439.                % loadkeys defkeymap
  440.  
  441.  
  442.  
  443.  
  444.   Sometimes even the letters are garbled. It is useful to know that
  445.   there are four main types of keyboards: QWERTY, QWERTZ, AZERTY and
  446.   DVORAK.  The first three are named after the first six letter keys,
  447.   and roughly represent the English, German and French speaking coun-
  448.   tries.  Compared to QWERTY, the QWERTZ map interchanges Y and Z.  Com-
  449.   pared to QWERTY, the AZERTY map interchanges Q and A, W and Z, and has
  450.   its M right of the L, at the semicolon position.  DVORAK has an
  451.   entirely different letter ordering.
  452.  
  453.  
  454.   4.1.  Keyboard hardware reset
  455.  
  456.  
  457.   Things may be wrong on a lower level than Linux knows about.  There
  458.   are at least two distinct lower levels (keyboard and keyboard
  459.   controller) where one can give the command "keyboard disable" to the
  460.   keyboard hardware.  Keyboards can often be programmed to use one out
  461.   of three different sets of scancodes.
  462.  
  463.   However, I do not know of cases where this turned out to be a problem.
  464.  
  465.   Some keyboards have a remapping capability built in.  Stormy Henderson
  466.   (stormy@Ghost.Net) writes: `If it's your keyboard accidently being
  467.   reprogrammed, you can (on a Gateway AnyKey keyboard) press control-
  468.   alt-suspend_macro to reset the keys to normal.'
  469.  
  470.  
  471.   5.  Delete and Backspace
  472.  
  473.  
  474.   Getting Delete and Backspace to work just right is nontrivial,
  475.   especially in a mixed environment, where you talk to console, to X, to
  476.   bash, to emacs, login remotely, etc.  You may have to edit several
  477.   configuration files to tell all of the programs involved precisely
  478.   what you want.  On the one hand, there is the matter of which keys
  479.   generate which codes (and how these codes are remapped by e.g. kermit
  480.   or emacs), and on the other hand the question of what functions are
  481.   bound to what codes.
  482.  
  483.   People often complain `my backspace key does not work', as if this key
  484.   had a built-in function `delete previous character'.  Unfortunately,
  485.   all this key, or any key, does is producing a code, and one only can
  486.   hope that the kernel tty driver and all application programs can be
  487.   configured such that the backspace key indeed does function as a
  488.   `delete previous character' key.
  489.  
  490.   Most Unix programs get their tty input via the kernel tty driver in
  491.   `cooked' mode, and a simple stty command determines the erase
  492.   character. However, programs like bash and emacs and X do their own
  493.   input handling, and have to be convinced one-by-one to do the right
  494.   thing.
  495.  
  496.  
  497.   5.1.  How to tell Unix what character you want to use to delete the
  498.   last typed character
  499.  
  500.  
  501.  
  502.  
  503.                % stty erase ^?
  504.  
  505.  
  506.  
  507.  
  508.   If the character is erased, but in a funny way, then something is
  509.   wrong with your tty settings. If echoprt is set, then erased charac-
  510.   ters are enclosed between \ and /.  If echoe is not set, then the
  511.   erase char is echoed (which is reasonable when it is a printing char-
  512.   acter, like #).  Most people will want stty echoe -echoprt. Saying
  513.   stty sane will do this and more. Saying stty -a shows your current
  514.   settings.  How come this is not right by default? It is, if you use
  515.   the right getty.
  516.  
  517.   Note that many programs (like bash, emacs etc.) have their own
  518.   keybindings (defined in ~/.inputrc, ~/.emacs etc.) and are unaffected
  519.   by the setting of the erase character.
  520.  
  521.   The standard Unix tty driver does not recognize a cursor, or keys
  522.   (like the arrow keys) to move the current position, and hence does not
  523.   have a command `delete current character' either. But for example you
  524.   can get bash on the console to recognize the Delete key by putting
  525.  
  526.  
  527.  
  528.  
  529.           set editing-mode emacs
  530.           "\e[3~":delete-char
  531.  
  532.  
  533.  
  534.  
  535.   into ~/.inputrc.
  536.  
  537.  
  538.   5.1.1.  `Getty used to do the right thing with DEL and BS but is bro-
  539.   ken now?'
  540.  
  541.  
  542.   Earlier, the console driver would do BS Space BS (\010\040\010) when
  543.   it got a DEL (\177).  Nowadays, DEL's are ignored (as they should be,
  544.   since the driver emulates a vt100). Get a better getty, i.e., one that
  545.   does not output DEL.
  546.  
  547.  
  548.   5.1.2.  `Login behaves differently at the first and second login
  549.   attempts?'
  550.  
  551.  
  552.   At the first attempt, you are talking to getty. At the second attempt,
  553.   you are talking to login, a different program.
  554.  
  555.  
  556.   5.2.  How to tell Linux what code to generate when a key is pressed
  557.  
  558.  
  559.   On the console, or, more precisely, when not in (MEDIUM)RAW mode, use
  560.  
  561.  
  562.                % loadkeys mykeys.map
  563.  
  564.  
  565.  
  566.  
  567.   and under X use
  568.  
  569.  
  570.                % xmodmap mykeys.xmap
  571.  
  572.  
  573.  
  574.  
  575.   Note that (since XFree86-2.1) X reads the Linux settings of the
  576.   keymaps when initialising the X keymap. Although the two systems are
  577.   not 100% compatible, this should mean that in many cases the use of
  578.   xmodmap has become superfluous.
  579.  
  580.   For example, suppose that you would like the Backspace key to send a
  581.   BackSpace (^H, octal 010) and the grey Delete key a DEL (octal 0177).
  582.   Add the following to /etc/rc.local (or wherever you keep your local
  583.   boot-time stuff):
  584.  
  585.  
  586.                /usr/bin/loadkeys << EOF
  587.                keycode 14 = BackSpace
  588.                keycode 111 = Delete
  589.                EOF
  590.  
  591.  
  592.  
  593.  
  594.   Note that this will only change the function of these keys when no
  595.   modifiers are used. (You need to specify a keymaps line to tell which
  596.   keymaps should be affected if you want to change bindings on more
  597.   keymaps.)  The Linux kernel default lets Ctrl-Backspace generate
  598.   BackSpace - this is sometimes useful as emergency escape, when you
  599.   find you can only generate DELs.
  600.  
  601.   The left Alt key is sometimes called the Meta key, and by default the
  602.   combinations AltL-X are bound to the symbol MetaX.  But what character
  603.   sequence is MetaX?  That is determined (per-tty) by the Meta flag, set
  604.   by the command setmetamode. The two choices are: ESC X or X or-ed with
  605.   0200.
  606.  
  607.  
  608.   5.2.1.  `Why doesn't the Backspace key generate BackSpace by default?'
  609.  
  610.  
  611.   (i) Because the VT100 had a Delete key above the Enter key.
  612.  
  613.   (ii) Because Linus decided so.
  614.  
  615.  
  616.   5.3.  How to tell X to interchange Delete and Backspace
  617.  
  618.  
  619.  
  620.  
  621.                % xmodmap -e "keysym BackSpace = Delete" -e "keysym Delete = BackSpace"
  622.  
  623.  
  624.  
  625.  
  626.   Or, if you just want the Backspace key to generate a BackSpace:
  627.  
  628.  
  629.                % xmodmap -e "keycode 22 = BackSpace"
  630.  
  631.  
  632.  
  633.  
  634.   Or, if you just want the Delete key to generate a Delete:
  635.  
  636.  
  637.                % xmodmap -e "keycode 107 = Delete"
  638.  
  639.  
  640.  
  641.  
  642.   (but usually this is the default binding already).
  643.  
  644.  
  645.   5.4.  How to tell emacs what to do when it receives a Delete or
  646.   Backspace
  647.  
  648.  
  649.   Put in your .emacs file lines like
  650.  
  651.  
  652.                (global-set-key "\?" 'help-command)
  653.                (global-set-key "\C-h" 'delete-backward-char)
  654.  
  655.  
  656.  
  657.  
  658.   Of course you can bind other commands to other keys in the same way.
  659.   Note that various major and minor modes redefine keybindings.  For
  660.   example, in incremental search mode one finds the code
  661.                (define-key map "\177" 'isearch-delete-char)
  662.                (define-key map "\C-h" 'isearch-mode-help)
  663.  
  664.  
  665.  
  666.  
  667.   This means that it may be a bad idea to use the above two global-set-
  668.   key commands. There are too many places where there are built-in
  669.   assumptions about ^H = help and DEL = delete.  That doesn't mean that
  670.   you have to setup keys so that Backspace generates DEL. But if it
  671.   doesn't then it is easiest to remap them at the lowest possible level
  672.   in emacs.
  673.  
  674.  
  675.   5.5.  How to tell emacs to interchange Delete and Backspace
  676.  
  677.  
  678.   Put in your .emacs file lines
  679.  
  680.  
  681.                (setq keyboard-translate-table (make-string 128 0))
  682.                (let ((i 0))
  683.                  (while (< i 128)
  684.                    (aset keyboard-translate-table i i)
  685.                    (setq i (1+ i))))
  686.                (aset keyboard-translate-table ?\b ?\^?)
  687.                (aset keyboard-translate-table ?\^? ?\b)
  688.  
  689.  
  690.  
  691.  
  692.   Recent versions of emacs have a function keyboard-translate and one
  693.   may simplify the above to
  694.  
  695.  
  696.                (keyboard-translate ?\C-h ?\C-?)
  697.                (keyboard-translate ?\C-? ?\C-h)
  698.  
  699.  
  700.  
  701.  
  702.   Note that under X emacs can distinguish between Ctrl-h and the
  703.   Backspace key (regardless of what codes these produce on the console),
  704.   and by default emacs will view the Backspace key as DEL (and do dele-
  705.   tion things, as bound to that character, rather than help things,
  706.   bound to ^H). One can distinguish Backspace and Delete, e.g. by
  707.  
  708.  
  709.                (global-unset-key [backspace] )
  710.                (global-set-key [backspace] 'delete-backward-char)
  711.                (global-unset-key [delete] )
  712.                (global-set-key [delete] 'delete-char)
  713.  
  714.  
  715.  
  716.  
  717.  
  718.   5.6.  How to tell kermit to interchange Delete and Backspace
  719.  
  720.  
  721.   Put in your .kermrc file the lines
  722.  
  723.  
  724.                set key \127 \8
  725.                set key \8 \127
  726.  
  727.   5.7.  How to tell xterm about your favourite tty modes
  728.  
  729.  
  730.   Normally xterm will inherit the tty modes from its invoker.  Under
  731.   xdm, the default erase and kill characters are # and @, as in good old
  732.   Unix Version 6.  If you don't like that, you might put something like
  733.  
  734.  
  735.                XTerm*ttymodes: erase ^? kill ^U intr ^C quit ^\ eof ^D \
  736.                                susp ^Z start ^Q stop ^S eol ^@
  737.  
  738.  
  739.  
  740.  
  741.   in /usr/lib/X11/app-defaults/XTerm or in $HOME/.Xresources, assuming
  742.   that you have a line
  743.  
  744.  
  745.                xrdb $HOME/.Xresources
  746.  
  747.  
  748.  
  749.  
  750.   in your $HOME/.xinitrc or $HOME/.xsession.
  751.  
  752.  
  753.   5.8.  How to tell xmosaic that the Backspace key generates a DEL
  754.  
  755.  
  756.   Putting
  757.  
  758.  
  759.                *XmText.translations: #override\n\
  760.                   <Key>osfDelete: delete-previous-character()
  761.                *XmTextField.translations: #override\n\
  762.                   <Key>osfDelete: delete-previous-character()
  763.  
  764.  
  765.  
  766.  
  767.   in your $HOME/.Xresources helps.
  768.  
  769.   The netscape FAQ, however, says:
  770.  
  771.           Why doesn't my Backspace key work in text fields?
  772.           By default, Linux and XFree86 come with the Backspace and Delete keys
  773.           misconfigured. All Motif programs (including, of course, Netscape
  774.           Navigator) will malfunction in the same way.
  775.  
  776.           The Motif spec says that Backspace is supposed to delete the previous
  777.           character and Delete is supposed to delete the following character.
  778.           Linux and XFree86 come configured with both the Backspace and Delete
  779.           keys generating Delete.
  780.  
  781.           You can fix this by using any one of the xmodmap, xkeycaps, or
  782.           loadkeys programs to make the key in question generate the BackSpace
  783.           keysym instead of Delete.
  784.  
  785.           You can also fix it by having a .motifbind file; see the man page
  786.           for VirtualBindings(3).
  787.  
  788.           Note: Don't use the *XmText.translations or *XmTextField.translations
  789.           resources to attempt to fix this problem. If you do, you will blow
  790.           away Netscape Navigator's other text-field key bindings.
  791.  
  792.  
  793.   5.9.  A better solution for Motif-using programs, like netscape
  794.  
  795.  
  796.   Ted Kandell (ted@tcg.net) suggests the following:
  797.  
  798.   Somewhere in your .profile add the following:
  799.  
  800.  
  801.        stty erase ^H
  802.  
  803.  
  804.  
  805.  
  806.   If you are using bash, add the following lines to your .inputrc:
  807.  
  808.  
  809.        "\C-?": delete-char
  810.        "\C-h": backward-delete-char
  811.  
  812.  
  813.  
  814.  
  815.   Add the following lines to your .xinitrc file:
  816.  
  817.  
  818.        xmodmap <<-EOF
  819.        keycode 22  =  BackSpace osfBackSpace
  820.        keycode 107 =  Delete
  821.        EOF
  822.  
  823.        # start your window manager here,  for example:
  824.        #(fvwm) 2>&1 | tee /dev/tty /dev/console
  825.  
  826.        stty sane
  827.        stty erase ^H
  828.        loadmap <<-EOF
  829.        keycode 14  = BackSpace
  830.        keycode 111 = Delete
  831.        EOF
  832.  
  833.  
  834.  
  835.  
  836.   This will definitely work for a PC 101 or 102 key keyboard with any
  837.   Linux/XFree86 layout.
  838.  
  839.   The important part to making Motif apps like Netscape work properly is
  840.   adding osfBackSpace to keycode 22 in addition to BackSpace.
  841.  
  842.   Note that there must be spaces on either side of the = sign.
  843.  
  844.  
  845.  
  846.   5.10.  What about termcap and terminfo?
  847.  
  848.  
  849.   When people have problems with backspace, they tend to look at their
  850.   termcap (or terminfo) entry for the terminal, and indeed, there does
  851.   exist a kb (or kbs) capability describing the code generated by the
  852.   Backspace key.  However, not many programs use it, so unless you are
  853.   having problems with one particular program only, probably the fault
  854.   is elsewhere.  Of course it is a good idea anyway to correct your
  855.   termcap (terminfo) entry.  See also below under "The TERM variable".
  856.  
  857.  
  858.  
  859.   6.  The console character sets
  860.  
  861.  
  862.   The kernel first tries to figure out what symbol is meant by any given
  863.   user byte, and next where this symbol is located in the current font.
  864.  
  865.   The kernel knows about 5 translations of bytes into console-screen
  866.   symbols.  In Unicode (UTF-8) mode, the UTF-8 code is just converted
  867.   directly into Unicode. The assumption is that almost all symbols one
  868.   needs are present in Unicode, and for the cases where this does not
  869.   hold the codes 0xff** are reserved for direct font access.  When not
  870.   in Unicode mode, one of four translation tables is used.  The four
  871.   tables are: a) Latin1 -> Unicode,  b) VT100 graphics -> Unicode, c) PC
  872.   -> Unicode, d) user-defined.
  873.  
  874.   There are two character sets, called G0 and G1, and one of them is the
  875.   current character set. (Initially G0.)  Typing ^N causes G1 to become
  876.   current, ^O causes G0 to become current.
  877.  
  878.   These variables G0 and G1 point at a translation table, and can be
  879.   changed by the user. Initially they point at tables a) and b),
  880.   respectively.  The sequences ESC ( B and ESC ( 0 and ESC ( U and ESC (
  881.   K cause G0 to point at translation table a), b), c) and d),
  882.   respectively.  The sequences ESC ) B and ESC ) 0 and ESC ) U and ESC )
  883.   K cause G1 to point at translation table a), b), c) and d),
  884.   respectively.
  885.  
  886.   The sequence ESC c causes a terminal reset, which is what you want if
  887.   the screen is all garbled. The oft-advised echo ^V^O will only make G0
  888.   current, but there is no guarantee that G0 points at table a).  In
  889.   some distributions there is a program reset(1) that just does echo
  890.   ^[c.  If your termcap entry for the console is correct (and has an
  891.   entry :rs=\Ec:), then also setterm -reset will work.
  892.  
  893.   The user-defined mapping table can be set using mapscrn(8).  The
  894.   result of the mapping is that if a symbol c is printed, the symbol s =
  895.   map[c] is sent to the video memory. The bitmap that corresponds to s
  896.   is found in the character ROM, and can be changed using setfont(8).
  897.  
  898.  
  899.   7.  Console switching
  900.  
  901.  
  902.   By default, console switching is done using Alt-Fn or Ctrl-Alt-Fn.
  903.   Under X (or recent versions of dosemu), only Ctrl-Alt-Fn works.  Many
  904.   keymaps will allow cyclic walks through all allocated consoles using
  905.   Alt-RightArrow and Alt-LeftArrow.
  906.  
  907.   XFree86 1.3 does not know that Alt is down when you switch to the X
  908.   window. Thus, you cannot switch immediately to some other VT again but
  909.   have to release Alt first.  In the other direction this should work:
  910.   the kernel always keeps track of the up/down status of all keys. (As
  911.   far as possible: on some keyboards some keys do not emit a scancode
  912.   when pressed (e.g.: the PFn keys of a FOCUS 9000) or released (e.g.:
  913.   the Pause key of many keyboards).)
  914.  
  915.   XFree86 1.3 saves the fonts loaded in the character ROMs when started,
  916.   and restores it on a console switch. Thus, the result of setfont on a
  917.   VT is wiped out when you go to X and back.  Using setfont under X will
  918.   lead to funny results.
  919.  
  920.   One can change VT under program control using the chvt command.
  921.  
  922.  
  923.  
  924.  
  925.   7.1.  Changing the number of Virtual Consoles
  926.  
  927.  
  928.   This question still comes up from time to time, but the answer is: you
  929.   already have enough of them.  Since kernel version 1.1.54, there are
  930.   between 1 and 63 virtual consoles. A new one is created as soon as it
  931.   is opened. It is removed by the utility deallocvt (but it can be
  932.   removed only when no processes are associated to it anymore, and no
  933.   text on it has been selected by programs like selection or gpm).
  934.  
  935.   For older kernels, change the line
  936.  
  937.  
  938.                #define NR_CONSOLES     8
  939.  
  940.  
  941.  
  942.  
  943.   in include/linux/tty.h (don't increase this number beyond 63), and
  944.   recompile the kernel.
  945.  
  946.   If they do not exist yet, create the tty devices with MAKEDEV or mknod
  947.   ttyN c 4 N where N denotes the tty number. For example,
  948.  
  949.  
  950.                for i in 9 10 11 12; do mknod /dev/tty$i c 4 $i; done
  951.  
  952.  
  953.  
  954.  
  955.   or, better (since it also takes care of owner and permissions),
  956.  
  957.  
  958.                for i in 9 10 11 12; do /dev/MAKEDEV tty$i; done
  959.  
  960.  
  961.  
  962.  
  963.   If you want the new VCs to run getty, add lines in /etc/inittab.  (But
  964.   it is much better to have only two getty's running, and to create more
  965.   consoles dynamically as the need arises.  That way you'll have more
  966.   memory when you don't use all these consoles, and also more consoles,
  967.   in case you really need them.  Edit /etc/inittab and comment out all
  968.   getty's except for the first two.)
  969.  
  970.   When the consoles are allocated dynamically, it is usually easiest to
  971.   have only one or two running getty. More are opened by open -l -s
  972.   bash. Unused consoles (without associated processes) are deallocated
  973.   using deallocvt (formerly disalloc).  But, you say, I am involved in
  974.   activities when I suddenly need more consoles, and do not have a bash
  975.   prompt available to give the open command.  Fortunately it is possible
  976.   to create a new console upon a single keystroke, regardless of what is
  977.   happening at the current console.
  978.  
  979.   If you have spawn_login from kbd-0.95.tar.gz and you put
  980.  
  981.  
  982.                loadkeys << EOF
  983.                alt keycode 103 = Spawn_Console
  984.                EOF
  985.                spawn_login &
  986.  
  987.  
  988.  
  989.  
  990.   in /etc/rc.local, then typing Alt-UpArrow will create a fresh VC
  991.   running login (and switch to it). With spawn_console & instead of
  992.   spawn_login & you'll have bash running there.  See also open-1.4.tgz
  993.   and dynamic-vc-1.1.tar.gz.
  994.  
  995.   What action should be taken upon this Spawn_Console keypress can also
  996.   be set in /etc/inittab under kbrequest, if you have a recent init. See
  997.   inittab(5).
  998.  
  999.   (This action can be something entirely different - I just called the
  1000.   key Spawn_Console because that is what I used it for.  When used for
  1001.   other purposes it is less confusing to use its synonym KeyboardSignal.
  1002.   For example, some people like to put the lines
  1003.  
  1004.  
  1005.                kb::kbrequest:/sbin/shutdown -h now
  1006.  
  1007.  
  1008.  
  1009.  
  1010.   in /etc/inittab, and
  1011.  
  1012.  
  1013.                control alt keycode 79 = KeyboardSignal
  1014.                control alt keycode 107 = KeyboardSignal
  1015.  
  1016.  
  1017.  
  1018.  
  1019.   in their keymap. Now Ctrl-Alt-End will do a system shutdown.)
  1020.  
  1021.   You can only login as "root" on terminals listed in /etc/securetty.
  1022.   There exist programs that read terminal settings from files /etc/ttys
  1023.   and /etc/ttytype. If you have such files, and create additional
  1024.   consoles, then it might be a good idea to also add entries for them in
  1025.   these files.
  1026.  
  1027.  
  1028.   8.  Ctrl-Alt-Del and other special key combinations
  1029.  
  1030.  
  1031.  
  1032.   8.1.  Ctrl-Alt-Del (Boot)
  1033.  
  1034.  
  1035.   If you press Ctrl-Alt-Del (or whatever key was assigned the keysym
  1036.   Boot by loadkeys) then either the machine reboots immediately (without
  1037.   sync), or init is sent a SIGINT. The former behaviour is the default.
  1038.   The default can be changed by root, using the system call reboot(),
  1039.   see ctrlaltdel(8).  Some init's change the default. What happens when
  1040.   init gets SIGINT depends on the version of init used - often it will
  1041.   be determined by the pf entry in /etc/inittab (which means that you
  1042.   can run an arbitrary program in this case).  In the current kernel
  1043.   Ctrl-AltGr-Del is no longer by default assigned to Boot.
  1044.  
  1045.  
  1046.   8.2.  Other combinations
  1047.  
  1048.  
  1049.  
  1050.  
  1051.  
  1052.  
  1053.  
  1054.  
  1055.  
  1056.  
  1057.   Name            Default binding
  1058.   -------------------------------
  1059.   Show_Memory     Shift-Scrollock
  1060.   Show_Registers  AltGr-ScrollLock
  1061.   Show_State      Ctrl-ScrollLock
  1062.   Console_n       Alt-Fn and Ctrl-Alt-Fn  (1 <= n <= 12)
  1063.   Console_{n+12}  AltGr-Fn                (1 <= n <= 12)
  1064.   Incr_Console    Alt-RightArrow
  1065.   Decr_Console    Alt-LeftArrow
  1066.   Last_Console    Alt[Gr]-PrintScreen
  1067.   Scroll_Backward Shift-PageUp
  1068.   Scroll_Forward  Shift-PageDown
  1069.   Caps_On                                 (CapsLock is a toggle; this key sets)
  1070.   Compose         Ctrl-.
  1071.  
  1072.  
  1073.  
  1074.  
  1075.   8.3.  X Combinations
  1076.  
  1077.  
  1078.  
  1079.   Ctrl-Alt-Fn     Switch to VT n
  1080.   Ctrl-Alt-KP+    Next mode
  1081.   Ctrl-Alt-KP-    Previous mode
  1082.   Ctrl-Alt-Backspace      Kill X
  1083.  
  1084.  
  1085.   On some motherboards, Ctrl-Alt-KP- and Ctrl-Alt-KP+ will be equivalent
  1086.   to pressing the Turbo button. That is, both will produce the scancodes
  1087.   1d 38 4a ca b8 9d and 1d 38 4e ce b8 9d, and both will switch between
  1088.   Turbo (>= 25MHz) and non-Turbo (8 or 12 MHz).  (Often these key combi-
  1089.   nations only function this way when enabled by jumpers on the mother-
  1090.   board.)
  1091.  
  1092.   Perry F Nguyen (pfnguyen@netcom22.netcom.com) writes: AMI BIOS has a
  1093.   feature that locks up the keyboard and flashes the LED's if the Ctrl-
  1094.   Alt-Backspace combination is pressed while a BIOS password is enabled,
  1095.   until the CMOS/BIOS password is typed in.
  1096.  
  1097.  
  1098.   8.4.  Dosemu Combinations
  1099.  
  1100.  
  1101.  
  1102.   Ctrl-Alt-Fn     Switch to VT n (from version 0.50; earlier Alt-Fn)
  1103.   Ctrl-Alt-PgDn   Kill dosemu (when in RAW keyboard mode)
  1104.   (and many other combinations - see the dosemu documentation)
  1105.  
  1106.  
  1107.  
  1108.  
  1109.   8.5.  Composing symbols
  1110.  
  1111.  
  1112.   One symbol may be constructed using several keystrokes.
  1113.  
  1114.   o  LeftAlt-press, followed by a decimal number typed on the keypad,
  1115.      followed by LeftAlt-release, yields the symbol with code given by
  1116.      this number.  (In Unicode mode this same mechanism, but then with 4
  1117.      hexadecimal digits, may be used to define a Unicode symbol.)
  1118.  
  1119.   o  A dead diacritic followed by a symbol, yields that symbol adorned
  1120.      with that diacritic. If the combination is undefined, both keys are
  1121.      taken separately.  Which keys are dead diacritics is user-settable;
  1122.      none is by default.  Five (since 2.0.25 six) dead diacritics can be
  1123.      defined (using loadkeys(1)): dead_grave, dead_acute,
  1124.      dead_circumflex, dead_tilde, dead_diaeresis (and dead_cedilla).
  1125.      Precisely what this adorning means is also user-settable: dead-
  1126.      diacritic, symbol is equivalent to Compose + diacritic + symbol.
  1127.  
  1128.   o  Compose followed by two symbols yields a combination symbol. These
  1129.      combinations are user-settable. Today there are 68 combinations
  1130.      defined by default; you can see them by saying "dumpkeys | grep
  1131.      compose".
  1132.  
  1133.   o  Then there are `Sticky' modifier keys (since 1.3.33). For example,
  1134.      one can type ^C as SControl, C and Ctrl-Alt-BackSpace as SControl,
  1135.      SAlt, BackSpace.
  1136.  
  1137.   Note that there are at least three such composition mechanisms:
  1138.  
  1139.   1. The Linux keyboard driver mechanism, used in conjunction with
  1140.      loadkeys.
  1141.  
  1142.   2. The X mechanism - see X386keybd(1), later XFree86kbd(1).  Under
  1143.      X11R6: edit /usr/X11R6/lib/X11/locale/iso8859-1/Compose.
  1144.  
  1145.      See also Andrew D. Balsa's comments at
  1146.      http://wauug.erols.com/~balsa/linux/deadkeys/index.html.
  1147.  
  1148.   3. The emacs mechanism obtained by loading "iso-insert.el" or calling
  1149.      `iso-accents-mode'.
  1150.  
  1151.      For X the order of the two symbols is arbitrary: both Compose-,-c
  1152.      and Compose-c-, yield a c-cedilla; for Linux and emacs only the
  1153.      former sequence works by default. For X the list of compose
  1154.      combinations is fixed. Linux and emacs are flexible.  The three
  1155.      default lists are somewhat similar, but the details are different.
  1156.  
  1157.  
  1158.   8.6.  The SysRq key
  1159.  
  1160.   In case your kernel was compiled with CONFIG_MAGIC_SYSRQ enabled (a
  1161.   feature that is present since Linux 2.1.43) there is a single key
  1162.   (defined in <linux/keyboard.h>) to which special system functions are
  1163.   attached, regardless of the current keyboard mode. For the PC
  1164.   architecture this special key is, naturally, the Alt+SysRq key, and
  1165.   any of the two Alt keys will work.  (Note that if CONFIG_MAGIC_SYSRQ
  1166.   was not enabled, the default action of this key is to return to the
  1167.   previous console.)
  1168.  
  1169.   If you press this key, do not release it, and hit another key, a
  1170.   corresponding action is performed. The action is performed whether
  1171.   anybody is logged in or not, is root or not. For the details, see
  1172.   drivers/char/sysrq.c. Since this feature is meant only for kernel
  1173.   hackers, that should suffice. Still, let me add a few remarks.
  1174.  
  1175.   For the key r the keyboard mode is reset to K_XLATE.  For the key k a
  1176.   SAK and console reset is done.  For the key b the machine is rebooted
  1177.   immediately.  (See, not something you want to have enabled on a
  1178.   production machine.)  For the key o the power is turned off (when the
  1179.   machine is capable of that).  For the key s an emergency sync is
  1180.   scheduled.  For the key u an emergency read-only remount is scheduled.
  1181.   For the keys p,t,m various information is shown (namely the same
  1182.   information also shown for RAlt,RCtrl,RShift+ScrollLock).  For the
  1183.   keys e,i,l all processes get a SIG_TERM or SIG_KILL, respectively; for
  1184.   l even the init process is killed.  Digits set the log level. Anything
  1185.   else prints a short summary: SysRq: unRaw saK Boot Off Sync Unmount
  1186.   showPc showTasks showMem loglevel0-8 tErm kIll killalL.
  1187.  
  1188.  
  1189.   Note: These are very dangerous actions! And they do not use your
  1190.   keymap - indeed, are meant for emergency cases where the state of your
  1191.   keymap, or even of the entire kernel, is uncertain.  If you use a
  1192.   dvorak keyboard - bad luck! Most other people will be able to survive:
  1193.   the dangerous letters A,M,Q,W,Y,Z that are differently placed on
  1194.   English, French and German keyboards, are not used for actions.
  1195.  
  1196.  
  1197.   9.  How to get out of raw mode
  1198.  
  1199.  
  1200.   If some program using K_RAW keyboard mode exits without restoring the
  1201.   keyboard mode to K_XLATE, then it is difficult to do anything - not
  1202.   even Ctrl-Alt-Del works. However, it is sometimes possible to avoid
  1203.   hitting the reset button.  (And desirable as well: your users may get
  1204.   angry if you kill their Hack game by rebooting; you might also damage
  1205.   your file system.)  Easy solutions involve logging in from another
  1206.   terminal or another machine and doing kbd_mode -a.  The procedure
  1207.   below assumes that no X is running, that the display is in text mode,
  1208.   and that you are at your bash prompt, that you are using a US keyboard
  1209.   layout, and that your interrupt character is Ctrl-C.
  1210.  
  1211.   Step 1. Start X.  As follows: press 2 (and don't release), press F12
  1212.   (and don't release) and immediately afterwards press = . This starts
  1213.   X.  (Explanation: if a key press produces keycode K, then the key
  1214.   release produces keycode K+128. Probably your shell does not like
  1215.   these high characters, so we avoid generating them by not releasing
  1216.   any key.  However, we have to be quick, otherwise key repeat starts.
  1217.   The digit 2 produces a Ctrl-C that discards previous junk, the F12
  1218.   produces an X and the = a Return.)  Probably your screen will be grey
  1219.   now, since no .xinitrc was specified.  However, Ctrl-Alt-Fn will work
  1220.   and you can go to another VT.  (Ctrl-Alt-Backspace also works, but
  1221.   that exits X, and gets you back into the previous state, which is not
  1222.   what you want.)
  1223.  
  1224.   Step 2. Setup to change the keyboard mode.  (For example, by sleep 5;
  1225.   kbd_mode -a.)
  1226.  
  1227.   Step 3. Leave X again.  Alt-Fx (often Alt-F7) brings you back to X,
  1228.   and then Ctrl-Alt-Backspace exits X. Within 5 seconds your keyboard
  1229.   will be usable again.
  1230.  
  1231.   If you want to prepare for the occasion, then make \215A\301 (3
  1232.   symbols) an alias for kbd_mode -a.  Now just hitting = F7 = (3
  1233.   symbols) will return you to sanity.
  1234.  
  1235.  
  1236.   10.  The keyboard LEDs
  1237.  
  1238.  
  1239.   1. There are per-tty keyboard flags: each VC has its own NumLock,
  1240.   CapsLock, ScrollLock.  By default these keyboard flags are shown in
  1241.   the LEDs.  The usual way to change them is by pressing the
  1242.   corresponding key.  (Side remark: pressing the NumLock key when in
  1243.   application key mode will not change the NumLock status, but produce
  1244.   an escape sequence.  If you want the NumLock key to always change the
  1245.   Numlock status, bind it to Bare_Num_Lock.)
  1246.  
  1247.   2. Next, there are per-tty default keyboard flags, to initialize the
  1248.   keyboard flags when a reset occurs.  Thus if you want NumLock on all
  1249.   the time, that is possible.  The usual way to change them is by
  1250.   `setleds -D ...'.
  1251.  
  1252.   3. There is the possibility that the leds do not reflect the keyboard
  1253.   flags, but something else.
  1254.  
  1255.   3A. This something else can be three bits somewhere in the kernel -
  1256.   which can be used if you want to monitor some hardware or software
  1257.   status bit(s). If you want this, edit the kernel source to call
  1258.   register_leds() somewhere.
  1259.  
  1260.   3B. This something else can also be whatever some user program wants
  1261.   to show in the LEDs. Thus, people who like such things can make nice
  1262.   patterns of lights. If you want this, use the KDSETLED ioctl.
  1263.  
  1264.   This latter use is not per-tty, but the choice between former and
  1265.   latter use is per-tty.
  1266.  
  1267.   Summarizing: Each tty has a flag kbd->ledmode.  If this has the value
  1268.   LED_SHOW_FLAGS then the keyboard flags (NumLock etc.) of that tty are
  1269.   shown.  If this has the value LED_SHOW_MEM then three selected memory
  1270.   addresses are shown.  If this has the value LED_SHOW_IOCTL then the
  1271.   leds show whatever value was last assigned to them using the KDSETLED
  1272.   ioctl.
  1273.  
  1274.   One may add that X uses ioctl's to set the LEDs, but fails to reset
  1275.   its VT when it exits, so after using X there may be one VT that is not
  1276.   in the default LED_SHOW_FLAGS state.  This can be fixed by doing
  1277.   `setleds -L' on that VT.  See setleds(1).
  1278.  
  1279.  
  1280.   11.  The TERM variable
  1281.  
  1282.  
  1283.   Many programs use the TERM variable and the database /etc/termcap or
  1284.   /usr/lib/terminfo/* to decide which strings to send for clear screen,
  1285.   move cursor, etc., and sometimes also to decide which string is sent
  1286.   by the users backspace key, function keys etc.  This value is first
  1287.   set by the kernel (for the console).  Usually, this variable is re-set
  1288.   by getty, using /etc/ttytype or the argument specified in
  1289.   /etc/inittab.  Sometimes, it is also set in /etc/profile.
  1290.  
  1291.   Older systems use TERM=console or TERM=con80x25. Newer systems (with
  1292.   ncurses 1.8.6) use the more specific TERM=linux or TERM=linux-80x25.
  1293.   However, old versions of setterm test for TERM=con* and hence fail to
  1294.   work with TERM=linux.
  1295.  
  1296.   Since kernel version 1.3.2, the kernel default for the console is
  1297.   TERM=linux.
  1298.  
  1299.   If you have a termcap without entry for linux, add the word linux to
  1300.   the entry for the console:
  1301.  
  1302.  
  1303.                console|con80x25|linux:\
  1304.  
  1305.  
  1306.  
  1307.  
  1308.   and make /usr/lib/terminfo/l/linux a copy of or symbolic link to
  1309.   /usr/lib/terminfo/c/console.
  1310.  
  1311.  
  1312.   11.1.  Terminfo
  1313.  
  1314.  
  1315.   The terminfo entry for the linux console from ncurses 1.8.6 misses the
  1316.   entry kich1=\E[2~, needed by some programs.  Edit the file and tic it.
  1317.  
  1318.  
  1319.  
  1320.  
  1321.   12.  How to make other programs work with non-ASCII chars
  1322.  
  1323.  
  1324.   In the bad old days this used to be quite a hassle. Every separate
  1325.   program had to be convinced individually to leave your bits alone.
  1326.   Not that all is easy now, but recently a lot of gnu utilities have
  1327.   learned to react to LC_CTYPE=iso_8859_1 or LC_CTYPE=iso-8859-1.  Try
  1328.   this first, and if it doesn't help look at the hints below.  Note that
  1329.   in recent versions of libc the routine setlocale() only works if you
  1330.   have installed the locale files (e.g. in /usr/lib/locale).
  1331.  
  1332.   First of all, the 8-th bit should survive the kernel input processing,
  1333.   so make sure to have stty cs8 -istrip -parenb set.
  1334.  
  1335.   A. For emacs the details strongly depend on the version.  The
  1336.   information below is for version 19.34. Put lines
  1337.  
  1338.  
  1339.                (set-input-mode nil nil 1)
  1340.                (standard-display-european t)
  1341.                (require 'iso-syntax)
  1342.  
  1343.  
  1344.  
  1345.  
  1346.   into your $HOME/.emacs.  The first line (to be precise: the final 1)
  1347.   tells emacs not to discard the 8-th bit from input characters.  The
  1348.   second line tells emacs not to display non-ASCII characters as octal
  1349.   escapes.  The third line specifies the syntactic properties and case
  1350.   conversion table for the Latin-1 character set These last two lines
  1351.   are superfluous if you have something like LC_CTYPE=ISO-8859-1 in your
  1352.   environment.  (The variable may also be LC_ALL or even LANG.  The
  1353.   value may be anything with a substring `88591' or `8859-1' or
  1354.   `8859_1'.)
  1355.  
  1356.   This is a good start.  On a terminal that cannot display non-ASCII ISO
  1357.   8859-1 symbols, the command
  1358.  
  1359.  
  1360.                (load-library "iso-ascii")
  1361.  
  1362.  
  1363.  
  1364.  
  1365.   will cause accented characters to be displayed comme {,c}a.  If your
  1366.   keymap does not make it easy to produce non-ASCII characters, then
  1367.  
  1368.  
  1369.                (load-library "iso-transl")
  1370.  
  1371.  
  1372.  
  1373.  
  1374.   will make the 2-character sequence Ctrl-X 8 a compose character, so
  1375.   that the 4-character sequence Ctrl-X 8 , c produces c-cedilla.  Very
  1376.   inconvenient.
  1377.  
  1378.   The command
  1379.  
  1380.  
  1381.                (iso-accents-mode)
  1382.  
  1383.  
  1384.  
  1385.  
  1386.   will toggle ISO-8859-1 accent mode, in which the six characters ', `,
  1387.   ", ^, ~, / are dead keys modifying the following symbol.  Special com-
  1388.   binations: ~c gives a c with cedilla, ~d gives an Icelandic eth, ~t
  1389.   gives an Icelandic thorn, "s gives German sharp s, /a gives a with
  1390.   ring, /e gives an a-e ligature, ~< and ~> give guillemots, ~! gives an
  1391.   inverted exclamation mark, ~? gives an inverted question mark, and ''
  1392.   gives an acute accent.  This is the default mapping of accents.  The
  1393.   variable iso-languages is a list of pairs (language name, accent map-
  1394.   ping), and a non-default mapping can be selected using
  1395.  
  1396.  
  1397.                (iso-accents-customize LANGUAGE)
  1398.  
  1399.  
  1400.  
  1401.  
  1402.   Here LANGUAGE can be one of "portuguese", "irish", "french",
  1403.   "latin-2", "latin-1".
  1404.  
  1405.   Since the Linux default compose character is Ctrl-.  it might be
  1406.   convenient to use that everywhere. Try
  1407.  
  1408.  
  1409.                (load-library "iso-insert.el")
  1410.                (define-key global-map [?\C-.] 8859-1-map)
  1411.  
  1412.  
  1413.  
  1414.  
  1415.   The latter line will not work under xterm, if you use emacs -nw, but
  1416.   in that case you can put
  1417.  
  1418.  
  1419.                XTerm*VT100.Translations:       #override\n\
  1420.                      Ctrl <KeyPress> . : string("\0308")
  1421.  
  1422.  
  1423.  
  1424.  
  1425.   in your .Xresources.)
  1426.  
  1427.   B. For less, put LESSCHARSET=latin1 in the environment.  This is also
  1428.   what you need if you see \255 or <AD> in man output: some versions of
  1429.   less will render the soft hyphen (octal 0255, hex 0xAD) this way when
  1430.   not given permission to output Latin-1.
  1431.  
  1432.   C. For ls, give the option -N. (Probably you want to make an alias.)
  1433.  
  1434.   D. For bash (version 1.13.*), put
  1435.  
  1436.  
  1437.                set meta-flag on
  1438.                set convert-meta off
  1439.  
  1440.  
  1441.  
  1442.  
  1443.   and, according to the Danish HOWTO,
  1444.  
  1445.  
  1446.                set output-meta on
  1447.  
  1448.  
  1449.  
  1450.  
  1451.   into your $HOME/.inputrc.
  1452.  
  1453.   E. For tcsh, use
  1454.  
  1455.  
  1456.                setenv LANG     US_en
  1457.                setenv LC_CTYPE iso_8859_1
  1458.  
  1459.  
  1460.  
  1461.  
  1462.   If you have nls on your system, then the corresponding routines are
  1463.   used.  Otherwise tcsh will assume iso_8859_1, regardless of the values
  1464.   given to LANG and LC_CTYPE. See the section NATIVE LANGUAGE SYSTEM in
  1465.   tcsh(1).  (The Danish HOWTO says: setenv LC_CTYPE ISO-8859-1; stty
  1466.   pass8)
  1467.  
  1468.   F. For flex, give the option -8 if the parser it generates must be
  1469.   able to handle 8-bit input. (Of course it must.)
  1470.  
  1471.   G. For elm, set displaycharset to ISO-8859-1.  (Danish HOWTO: LANG=C
  1472.   and LC_CTYPE=ISO-8859-1)
  1473.  
  1474.   H. For programs using curses (such as lynx) David Sibley reports: The
  1475.   regular curses package uses the high-order bit for reverse video mode
  1476.   (see flag _STANDOUT defined in /usr/include/curses.h).  However,
  1477.   ncurses seems to be 8-bit clean and does display iso-latin-8859-1
  1478.   correctly.
  1479.  
  1480.   I. For programs using groff (such as man), make sure to use -Tlatin1
  1481.   instead of -Tascii. Old versions of the program man also use col, and
  1482.   the next point also applies.
  1483.  
  1484.   J. For col, make sure 1) that it is fixed so as to do
  1485.   setlocale(LC_CTYPE,""); and 2) put LC_CTYPE=ISO-8859-1 in the
  1486.   environment.
  1487.  
  1488.   K. For rlogin, use option -8.
  1489.  
  1490.   L. For joe,
  1491.   sunsite.unc.edu:/pub/Linux/apps/editors/joe-1.0.8-linux.tar.gz is said
  1492.   to work after editing the configuration file. Someone else said: joe:
  1493.   Put the -asis option in /isr/lib/joerc in the first column.
  1494.  
  1495.   M. For LaTeX: \documentstyle[isolatin]{article}.  For LaTeX2e:
  1496.   \documentclass{article}\usepackage{isolatin} where isolatin.sty is
  1497.   available from ftp://ftp.vlsivie.tuwien.ac.at/pub/8bit.
  1498.  
  1499.   A nice discussion on the topic of ISO-8859-1 and how to manage 8-bit
  1500.   characters is contained in the file grasp.insa-
  1501.   lyon.fr:/pub/faq/fr/accents (in French). Another fine discussion (in
  1502.   English) can be found in ftp.vlsivie.tuwien.ac.at:/pub/8bit/FAQ-
  1503.   ISO-8859-1, which is mirrored in rtfm.mit.edu:pub/usenet-by-
  1504.   group/comp.answers/character-sets/iso-8859-1-faq.
  1505.  
  1506.   If you need to fix a program that behaves badly with 8-bit characters,
  1507.   one thing to keep in mind is that if you have a signed char type then
  1508.   characters may be negative, and using them as an array index will
  1509.   fail.  Several programs can be fixed by judiciously adding (unsigned
  1510.   char) casts.
  1511.  
  1512.  
  1513.   13.  What precisely does XFree86-2.1 do when it initializes its
  1514.   keymap?
  1515.  
  1516.  
  1517.   Since version 2.1, XFree86 will initialize its keymap from the Linux
  1518.   keymap, as far as possible. However, Linux had 16 entries per key (one
  1519.   for each combination of the Shift, AltGr, Ctrl, Alt modifiers) and
  1520.   presently has 256 entries per key, while X has 4 entries per key (one
  1521.   for each combination of Shift, Mod), so some information is
  1522.   necessarily lost.
  1523.  
  1524.   First X reads the Xconfig file, where definitions of the LeftAlt,
  1525.   RightAlt, RightCtl, ScrollLock keys as Meta, ModeShift, Compose,
  1526.   ModeLock or ScrollLock might be found - see X386keybd(1), later
  1527.   XFree86kbd(1).
  1528.  
  1529.   For Mod the LeftAlt key is taken, unless RightCtl was defined as
  1530.   ModeShift or ModeLock, in which case RightCtl is taken, or RightAlt
  1531.   was so defined, in which case RightAlt is taken.  This determines how
  1532.   the 4 XFree86 meanings of a key are selected from the 16 Linux
  1533.   meanings.  Note that Linux today does not distinguish by default
  1534.   between the two Ctrl keys or between the two Shift keys. X does
  1535.   distinguish.
  1536.  
  1537.   Now the kernel keymap is read and the usually obvious corresponding X
  1538.   bindings are made. The bindings for the "action keys" Show_Memory,
  1539.   Show_State, Show_Registers, Last_Console, Console_n, Scroll_Backward,
  1540.   Scroll_Forward, Caps_On and Boot are ignored, as are the dead
  1541.   diacriticals, and the locks (except for ShiftLock), and the "ASCII-x"
  1542.   keys.
  1543.  
  1544.   Next, the definitions in the Xconfig file are used. (Thus, a
  1545.   definition of Compose in Xconfig will override its value as found in
  1546.   the Linux keymap.)
  1547.  
  1548.   What happens to the strings associated with the function keys?
  1549.   Nothing, X does not have such a concept. (But it is possible to define
  1550.   strings for function keys in xterm - note however that the window
  1551.   manager gets the keys first.)
  1552.  
  1553.   I don't know how to convince xterm that it should use the X keymap
  1554.   when Alt is pressed; it seems just to look at its resource
  1555.   eightBitInput, and depending on whether that is true or false either
  1556.   set the high order bit of the character, or generate an additional
  1557.   Escape character (just like setmetamode(1) does for the console).
  1558.  
  1559.  
  1560.   14.  Unusual keys and keyboards
  1561.  
  1562.  
  1563.   The two keys PrintScrn/SysRq and Pause/Break are special in that they
  1564.   have two keycodes: the former has keycode 84 when Alt is pressed
  1565.   simultaneously, and keycode 99 otherwise; the latter has keycode 101
  1566.   when Ctrl is pressed simultaneously, and keycode 119 otherwise.
  1567.   (Thus, it makes no sense to bind functions to Alt keycode 99 or Ctrl
  1568.   keycode 119.)
  1569.  
  1570.   If you have strange keys, that do not generate any code under Linux
  1571.   (or generate messages like "unrecognized scancode"), and your kernel
  1572.   is 1.1.63 or later, then you can use setkeycodes(1) to tell the kernel
  1573.   about them. They won't work under X, however.  Once they have gotten a
  1574.   keycode from setkeycodes, they can be assigned a function by loadkeys.
  1575.  
  1576.  
  1577.   15.  Examples of use of loadkeys and xmodmap
  1578.  
  1579.  
  1580.   Switching Caps Lock and Control on the keyboard (assuming you use
  1581.   keymaps 0-15; check with dumpkeys | head -1)
  1582.  
  1583.  
  1584.  
  1585.           % loadkeys
  1586.           keymaps 0-15
  1587.           keycode 58 = Control
  1588.           keycode 29 = Caps_Lock
  1589.           %
  1590.  
  1591.  
  1592.  
  1593.  
  1594.   Switching them under X only:
  1595.  
  1596.  
  1597.                % xmodmap .xmodmaprc
  1598.  
  1599.  
  1600.  
  1601.  
  1602.   where .xmodmaprc contains lines
  1603.  
  1604.  
  1605.                remove Lock = Caps_Lock
  1606.                remove Control = Control_L
  1607.                keysym Control_L = Caps_Lock
  1608.                keysym Caps_Lock = Control_L
  1609.                add Lock = Caps_Lock
  1610.                add Control = Control_L
  1611.  
  1612.  
  1613.  
  1614.  
  1615.   What is this about the key numbering? Backspace is 14 under Linux, 22
  1616.   under X?  Well, the numbering can best be regarded as arbitrary; the
  1617.   Linux number of a key can be found using showkey(1), and the X number
  1618.   using xev(1). Often the X number will be 8 more than the Linux number.
  1619.  
  1620.   Something else people like to change are the bindings of the function
  1621.   keys.  Suppose that you want to make F12 produce the string "emacs ".
  1622.   Then
  1623.  
  1624.  
  1625.                % loadkeys
  1626.                keycode 88 = F12
  1627.                string F12 = "emacs "
  1628.                %
  1629.  
  1630.  
  1631.  
  1632.  
  1633.   will do this. More explicitly, the procedure is like this: (i) find
  1634.   the keycodes of the keys to be remapped, using showkey(1).  (ii) save
  1635.   the current keymap, make a copy and edit that:
  1636.  
  1637.  
  1638.                % dumpkeys > my_keymap
  1639.                % cp my_keymap trial_keymap
  1640.                % emacs trial_keymap
  1641.                % loadkeys trial_keymap
  1642.                %
  1643.  
  1644.  
  1645.  
  1646.  
  1647.   The format of the table can be guessed by looking at the output of
  1648.   dumpkeys, and is documented in keytables(5).  When the new keymap
  1649.   functions as desired, you can put an invocation
  1650.  
  1651.           loadkeys my_new_keymap
  1652.  
  1653.  
  1654.  
  1655.  
  1656.   in /etc/rc.local or so, to execute it automatically at boot-up.  Note
  1657.   that changing modifier keys is tricky, and a newbie can easily get
  1658.   into a situation only an expert can get out of.
  1659.  
  1660.   The default directory for keymaps is /usr/lib/kbd/keytables.  The
  1661.   default extension for keymaps is .map.  Thus, loadkeys uk would
  1662.   probably load /usr/lib/kbd/keytables/uk.map.
  1663.  
  1664.   (On my machine) /dev/console is a symbolic link to /dev/tty0, and the
  1665.   kernel regards /dev/tty0 as a synonym for the current VT.  XFree86 1.3
  1666.   changes the owner of /dev/tty0, but does not reset this after
  1667.   finishing. Thus, loadkeys or dumpkeys might fail because someone else
  1668.   owns /dev/tty0; in such a case you might run X first.  Note that you
  1669.   cannot change keyboard mappings when not at the console (and not
  1670.   superuser).
  1671.  
  1672.  
  1673.   15.1.  `I can use only one finger to type with'
  1674.  
  1675.  
  1676.   "Can the Shift, Ctrl and Alt keys be made to behave as toggles?"
  1677.  
  1678.   Yes, after saying
  1679.  
  1680.  
  1681.                % loadkeys
  1682.                keymaps 0-15
  1683.                keycode 29 = Control_Lock
  1684.                keycode 42 = Shift_Lock
  1685.                keycode 56 = Alt_Lock
  1686.                %
  1687.  
  1688.  
  1689.  
  1690.  
  1691.   the left Control, Shift and Alt keys will act as toggles.  The numbers
  1692.   involved are revealed by showkey (and usually are 29, 97, 42, 54, 56,
  1693.   100 for left and right control, shift and alt, respectively), and the
  1694.   functions are Control_Lock, Shift_Lock, Alt_Lock, ALtGr_Lock.
  1695.  
  1696.   "What about `sticky' modifier keys?"
  1697.  
  1698.   Since version 1.3.33, the kernel knows about `sticky' modifier keys.
  1699.   These act on the next key pressed. So, where one earlier needed the
  1700.   3-symbol sequence Shift_Lock a Shift_Lock to type `A', one can now use
  1701.   the 2-symbol sequence SShift_Lock a.  Versions of the kbd package
  1702.   older than 0.93 do not yet include code for these sticky modifiers,
  1703.   and have to invoke them using their hexadecimal codes. For example,
  1704.  
  1705.  
  1706.                % loadkeys
  1707.                keymaps 0-15
  1708.                keycode 54 = 0x0c00
  1709.                keycode 97 = 0x0c02
  1710.                keycode 100 = 0x0c03
  1711.                %
  1712.  
  1713.  
  1714.  
  1715.  
  1716.   will make the right Shift, Ctrl, Alt sticky versions of the left ones.
  1717.   >From 0.93 on you can say
  1718.  
  1719.  
  1720.                % loadkeys
  1721.                keymaps 0-15
  1722.                keycode 54 = SShift
  1723.                keycode 97 = SCtrl
  1724.                keycode 100 = SAlt
  1725.                %
  1726.  
  1727.  
  1728.  
  1729.  
  1730.   to obtain the same result.  This will allow you to type Ctrl-Alt-Del
  1731.   in three keystrokes with one hand.
  1732.  
  1733.   The keymaps line in these examples should cover all keymaps you have
  1734.   in use.  You find what keymaps you have in use by
  1735.  
  1736.  
  1737.                % dumpkeys | head -1
  1738.  
  1739.  
  1740.  
  1741.  
  1742.  
  1743.   16.  Changing the video mode
  1744.  
  1745.  
  1746.   As far as I know there are 6 ways to change resolution:
  1747.  
  1748.   1. At compile time: change the line
  1749.  
  1750.  
  1751.                SVGA_MODE=      -DSVGA_MODE=NORMAL_VGA
  1752.  
  1753.  
  1754.  
  1755.  
  1756.   in /usr/src/linux/Makefile.
  1757.  
  1758.   1A. After compilation: use rdev -v - a terrible hack, but it exists.
  1759.  
  1760.   2. At boot time: put vga=ask in the lilo config file, and lilo will
  1761.   ask you what video mode you want. Once you know, put vga=mypreference.
  1762.  
  1763.   3. At run time: A. Use the resizecons command. (This is a very
  1764.   primitive wrapper around the VT_RESIZE ioctl.)  B. Use the
  1765.   SVGATextMode command. (This is a less primitive wrapper around the
  1766.   VT_RESIZE ioctl.)
  1767.  
  1768.   4. Not "on the console": Under dosemu, or with svgalib etc. you can
  1769.   change the hardware video mode without the console driver being aware
  1770.   of it. Sometimes this is useful in getting resizecons or SVGATextMode
  1771.   set up: use dosemu and some DOS program to get into the desired
  1772.   videomode, dump (say from another VT) the contents of all video
  1773.   hardware registers, and use that in the initialization that resizecons
  1774.   and SVGATextMode require.  In some cases where the video mode has
  1775.   gotten into some unusable state, starting dosemu, relying on the BIOS
  1776.   to set up the video mode, and then killing dosemu (with kill -9), is
  1777.   the easiest way to get into shape again.
  1778.  
  1779.  
  1780.  
  1781.  
  1782.  
  1783.   16.1.  Instructions for the use of resizecons
  1784.  
  1785.  
  1786.   Get svgalib and compile the program restoretextmode.  Boot up your
  1787.   machine in all possible video modes (using vga=ask in the lilo config
  1788.   file), and write the video hardware register contents to files CxR
  1789.   (C=cols, R=rows), e.g., 80x25, 132x44, etc.  Put these files in
  1790.   /usr/lib/kbd/videomodes.  Now resizecons 132x44 will change videomode
  1791.   for you (and send SIGWINCH to all processes that need to know about
  1792.   this, and load another font if necessary).
  1793.  
  1794.   At present, resizecons only succeeds when there is memory enough for
  1795.   both the old and the new consoles at the same time.
  1796.  
  1797.  
  1798.   17.  Changing the keyboard repeat rate
  1799.  
  1800.  
  1801.   At startup, the Linux kernel sets the repeat rate to its maximal
  1802.   value.  For most keyboards this is reasonable, but for some it means
  1803.   that you can hardly touch a key without getting three copies of the
  1804.   corresponding symbol. Use the program kbdrate(8) to change the repeat
  1805.   rate, or, if that doesn't help, edit or remove the section
  1806.  
  1807.   ______________________________________________________________________
  1808.        ! set the keyboard repeat rate to the max
  1809.  
  1810.            mov     ax,#0x0305
  1811.            xor     bx,bx           ! clear bx
  1812.            int     0x16
  1813.   ______________________________________________________________________
  1814.  
  1815.  
  1816.   of /usr/src/linux/[arch/i386/]boot/setup.S.
  1817.  
  1818.  
  1819.   18.  Scrolling
  1820.  
  1821.  
  1822.   There are two ways to get a screen to scroll.  The first, called `hard
  1823.   scrolling', is to leave the text in video memory as it is, but change
  1824.   the viewing origin. This is very fast.  The second, called `soft
  1825.   scrolling', involves moving all screen text up or down. This is much
  1826.   slower.  The kernel console driver will write text starting at the top
  1827.   of the video memory, continuing to the bottom, then copy the bottom
  1828.   part to the top again, and continue, all the time using hard scrolling
  1829.   to show the right part on the screen.  You can scroll back until the
  1830.   top op the video memory by using Shift-PageUp (the grey PageUp) and
  1831.   scroll down again using Shift-PageDown (the grey PageDown), assuming a
  1832.   default keymap.  The amount of scrollback is thus limited to the
  1833.   amount of video memory you happen to have and you cannot increase this
  1834.   amount.  If you need more scrollback, use some program that buffers
  1835.   the text, like less or screen - by using a buffer on disk you can go
  1836.   back to what you did last week.  (One can set the amount of scrollback
  1837.   for xterm by adding a line like XTerm*saveLines: 2500 in .Xresources.)
  1838.  
  1839.   Upon changing virtual consoles, the screen content of the old VT is
  1840.   copied to kernel memory, and the screen content of the new VT is
  1841.   copied from kernel memory to video memory. Only the visible screen is
  1842.   copied, not all of video memory, so switching consoles means losing
  1843.   the scrollback information.
  1844.  
  1845.   Sometimes, hard scrolling is undesirable, for example when the
  1846.   hardware does not have the possibility to change viewing origin. The
  1847.   first example was a Braille machine that would render the top of video
  1848.   memory in Braille. There is a kernel boot-time option no-scroll to
  1849.   tell the console driver not to use hard scrolling.  See bootparam(7).
  1850.  
  1851.  
  1852.   19.  Screensaving
  1853.  
  1854.  
  1855.   setterm -blank nn will tell the console driver to blank the screen
  1856.   after nn minutes of inactivity. (With nn = 0, screensaving is turned
  1857.   off. In some old kernels this first took effect after the next
  1858.   keyboard interrupt.)
  1859.  
  1860.   The s option of xset(1) will set the X screensaving parameters: xset s
  1861.   off turns off the screensaver, xset s 10 blanks the screen after 10
  1862.   minutes.
  1863.  
  1864.   The video hardware powersaving modes can be enabled/disabled using the
  1865.   setvesablank program given in the starting comment of
  1866.   /usr/src/linux/drivers/char/vesa_blank.c.
  1867.  
  1868.  
  1869.   20.  Screen dumps
  1870.  
  1871.  
  1872.   setterm -dump N will dump the contents of the screen of /dev/ttyN to a
  1873.   file screen.dump in the current directory. See setterm(1).
  1874.  
  1875.   The current contents of the screen of /dev/ttyN can be accessed using
  1876.   the device /dev/vcsN (where `vcs' stands for `virtual console
  1877.   screen').  For example, you could have a clock program that displays
  1878.   the current time in the upper right hand corner of the console screen
  1879.   (see the program vcstime in kbd-0.95.tar.gz).  Just dumping the
  1880.   contents goes with cat /dev/vcsN.  These device files /dev/vcsN do not
  1881.   contain newlines, and do not contain attributes, like colors. From a
  1882.   program it is usually better to use /dev/vcsaN (`virtual console
  1883.   screen with attributes') instead - it starts with a header giving the
  1884.   number of rows and columns and the location of the cursor.  See
  1885.   vcs(4).
  1886.  
  1887.  
  1888.   21.  Some properties of the VT100 - application key mode
  1889.  
  1890.  
  1891.   : Sometimes my cursor keys or keypad keys produce strange codes?
  1892.  
  1893.   When the terminal is in application cursor key mode the cursor keys
  1894.   produce  Esc O x  and otherwise  Esc [ x  where x is one of A,B,C,D.
  1895.   Certain programs put the terminal in application cursor key mode; if
  1896.   you kill them with kill -9, or if they crash, then the mode will not
  1897.   be reset.
  1898.  
  1899.           % echo -e '\033c'
  1900.  
  1901.  
  1902.   resets all properties of the current VC. Just changing the cursor
  1903.   application key mode is done by
  1904.  
  1905.           % echo -e '\033[?1h'
  1906.  
  1907.  
  1908.   (set) and
  1909.  
  1910.           % echo -e '\033[?1l'
  1911.  
  1912.  
  1913.   (clear).
  1914.  
  1915.   When the terminal is in application keypad key mode the keypad keys
  1916.   produce  Esc O y  and otherwise  Esc [ z ~  for certain y and z.
  1917.   Setting application keypad key mode is done by
  1918.  
  1919.           % echo -e '\033='
  1920.  
  1921.  
  1922.   and
  1923.  
  1924.           % echo -e '\033>'
  1925.  
  1926.  
  1927.   clears it again.
  1928.  
  1929.  
  1930.   22.  Hardware incompatibility
  1931.  
  1932.  
  1933.   Several people have noticed that they lose typed characters when a
  1934.   floppy disk is active. It seems that this might be a problem with
  1935.   Uni-486WB motherboards.  (Please mail me (aeb@cwi.nl) to confirm [yes,
  1936.   I have the same problem], deny [no, nothing wrong with my Uni-486WB],
  1937.   modify [My Xyzzy machine has the same problem].)
  1938.  
  1939.   Tjalling Tjalkens (tjalling@ei.ele.tue.nl) reports very similar
  1940.   problems with "a no-brand GMB-486 UNP Vesa motherboard with AMD
  1941.   486DX2-66 CPU" - during floppy activity some keystrokes are lost,
  1942.   during floppy tape streamer (Conner C 250 MQ) activity many keystrokes
  1943.   are lost.
  1944.  
  1945.   Some people experience sporadic lockups - sometimes associated to hard
  1946.   disk activity or other I/O.
  1947.  
  1948.   Ulf Tietz (ulf@rio70.bln.sni.de) wrote: `I have had the same problems,
  1949.   when I had my motherboard tuned too fast.  So I reset all the timings
  1950.   ( CLK, wait statements etc ) to more conventional values, and the
  1951.   problems are gone.'
  1952.  
  1953.   Bill Hogan (bhogan@crl.com) wrote: `If you have an AMI BIOS, you might
  1954.   try setting the Gate A20 emulation parameter to "chipset" (if you have
  1955.   that option). Whenever I have had that parameter set to any of the
  1956.   other options on my machine ("fast", "both", "disabled") I have had
  1957.   frequent keyboard lockups.'
  1958.  
  1959.  
  1960.   23.  Copyright
  1961.  
  1962.   Copyright (c) 1993-1998 by Andries Brouwer.  This document may be
  1963.   distributed under the terms set forth in the LDP license at
  1964.   http://sunsite.unc.edu/LDP/COPYRIGHT.html or
  1965.   ftp://www.win.tue.nl/pub/linux/LDP/COPYRIGHT.txt.
  1966.  
  1967.   Additions and corrections are welcome.  Andries Brouwer - aeb@cwi.nl
  1968.  
  1969.  
  1970.  
  1971.  
  1972.  
  1973.  
  1974.  
  1975.  
  1976.  
  1977.  
  1978.  
  1979.  
  1980.  
  1981.