console" -- Device Driver" "
Console device driver
/dev/console is the device driver for the
console of a COHERENT system. It is currently assigned
major device number 2 and minor device number 0.
/dev/console interprets escape sequences in
console output to control output on the console monitor.
These escape sequences include the sequences from ANSI
3.4-1977 and ANSI X3.64-1979 that deal with terminal
control. Thus, they are similar to those used by the DEC
VT-100 and VT-220 terminals.
Escape Sequences
In addition to the ASCII control characters BEL, BS, CR, FF,
HT, LF, and VT, /dev/console recognizes a
number of special sequences, each of which is introduced by
the ASCII character ESC. You can type these on the
keyboard, or write them in a file and invoke them by
cating the file to the standard output.
The following gives the escape sequences that
/dev/console recognizes. The text in
parentheses gives the ANSI mnemonic for this escape
sequence. Note that in this table, ESC
represents the ASCII character ESC (i.e., 0x1B).
CSI stands for Control Sequence Introducer,
which here consists of the character ESC followed by the
character `[' (0x5B). Note, too, that this table inserts
spaces between characters. This is simply for the sake of
legibility; at present, no escape sequence can contain a
literal space character.
- EESSCC ==
- Enter alternate keypad mode. This escape sequence is
non-standard and is slated for removal; you should avoid
embedding it in scripts or programs.
- EESSCC &&ggtt;;
- Exit alternate keypad mode. This escape sequence is
non-standard and is slated for removal; you should avoid
embedding it in scripts or programs.
- EESSCC _n
- Print the special graphics character n.
- EESSCC 77
- Save the current cursor position. This escape sequence
is non-standard and is slated for removal; you should avoid
embedding it in scripts or programs.
- EESSCC 88
- Restore the previously saved cursor position. This
escape sequence is non-standard and is slated for removal;
you should avoid embedding it in scripts or programs.
- EESSCC DD (IND, Index)
- Move the cursor down one line without changing the
column position. This command moves the scrolling region
text up and inserts blank lines if required. Although this
escape sequence now moves the cursor down, it may not do so
in the future when COHERENT supports writing systems other
than left-to-right, top-to-bottom. Furthermore, this
control sequence has been marked for removal from future
international standards. This escape sequence has been
slated for removal; you should avoid embedding it in scripts
or programs.
- EESSCC EE (NEL, Next Line)
- Move the cursor to the first column of the next line.
This command move the scrolling region down and inserts
blank line if required.
- EESSCC MM (RI, Reverse Index)
- Move the cursor up one line without changing column
position. As with IND, the direction of motion depends on
the writing system currently in use.
- CCSSII _n @@ (ICH, Insert Character)
- Insert n characters at the current position
(default, one).
- CCSSII _n AA (CUU, Cursor Up)
- Move the cursor up n rows (default, one).
Stop at top of page.
- CCSSII _n BB (CUD, Cursor Down)
- Move the cursor down n rows (default, one).
Stop at bottom edge of scrolling region.
- CCSSII _n CC (CUF, Cursor Forward)
- Move the cursor n columns forward (default,
one). Stop at right bottom corner of scrolling region.
- CCSSII _n DD (CUB, Cursor Backwards)
- Move the cursor n columns backwards (default,
one).
- CCSSII _n EE (CNL, Cursor Next Line)
- Move the cursor n rows down (default, one).
Move scrolling region up and insert a blank line if
required.
- CCSSII _n FF (CPL, Cursor Preceding Line)
- Move the cursor n rows up (default, one).
Move the scrolling-region text down and insert a blank line
if required.
- CCSSII _n GG (CHA, Cursor Character Absolute)
- Move the cursor to column n of the current
line.
- CCSSII _n ;; _m HH (CUP, Cursor Position)
- Move the cursor to column m of row
n. Position is relative to the scrolling
region.
- CCSSII _n II (CHT, Cursor Horizontal Tabulation)
- Move the cursor n tabulation stops forward
(default, one).
- CCSSII _c JJ (ED, Erase in Display)
- Erase display, where c is one of the following
characters:
- 00
- Erase from cursor to end of screen.
- 11
- Erase from beginning of screen to cursor.
- 22
- Erase the entire screen.
- CCSSII _c KK (EL, Erase in Line)
- Erase line, where c is one of the following
characters:
- 00
- Erase from cursor to end of line.
- 11
- Erase from beginning of line to cursor.
- 22
- Erase entire line.
- CCSSII _n LL (IL, Insert Line)
- Insert n blanks lines (default, one).
- CCSSII _n MM (DL, Delete Line)
- Delete n lines (default, one).
- CCSSII _c OO (EA, Erase in Area)
- Erase scrolling region, where c is one of the
following characters:
- 00
- Erase from cursor to end of scrolling region.
- 11
- Erase from beginning of scrolling region to cursor.
- 22
- Erase entire scrolling region. Reposition cursor at
top left corner of scrolling region.
- CCSSII _n PP (DC, Delete Character)
- Delete n characters at the current position
(default, one).
- CCSSII _n SS (SU, Scroll Up)
- Scroll the characters in the scrolling region up by
n lines (default, one). The bottom of the
scrolling region is cleared to blanks.
- CCSSII _n TT (SD, Scroll Down)
- Scroll the characters in the scrolling region down
n lines (default, one). The top line of the
scrolling region is cleared to blanks.
- CCSSII _n XX (ECH, Erase Character)
- Erase n characters at the current position
(default, one).
- CCSSII _n ZZ (CBT, Cursor Backward Tabulation)
- Move the cursor backwards by n tabulation
stops (default, one).
- CCSSII _n `` (HPA, Horizontal Position Absolute)
- Move the cursor to column n of the current
line.
- CCSSII _n aa (HPR, Horizontal Position Relative)
- Move the cursor forward (i.e., to the right) n
columns in the current line.
- CCSSII _n dd (VPA, Vertical Position Absolute)
- Move the cursor to row n of the display.
- CCSSII _n ee (VPR, Vertical Postition Relative)
- Move the cursor down n rows.
- CCSSII _n ;; _m ff (HVP, Horizontal and Vertical Position)
- Move the cursor to column m of row
n.
- CCSSII _s_1 ;; ... _s_N mm (SGR, Select Graphic Rendition)
- Select graphics rendition on the terminal. This
command takes one or more colon-separated parameters
s1 through sN, each of which is one
of the following strings:
- 00
- All attributes off.
- 11
- Bold intensity.
- 44
- Underlining on. On color terminals, underlining
rendered as white characters on a red background, in
compliance with UNIX practices.
- 55
- Blink on.
- 77
- Reverse video.
- 1100
- Select primary font (see notes, below).
- 1111
- Select first alternative font (see notes, below).
- 1122
- Select second alternative font (see notes, below).
- 3300
- Black foreground.
- 3311
- Red foreground.
- 3322
- Green foreground.
- 3333
- Brown foreground.
- 3344
- Blue foreground.
- 3355
- Magenta foreground.
- 3366
- Cyan foreground.
- 3377
- White foreground.
- 4400
- Black background.
- 4411
- Red background.
- 4422
- Green background.
- 4433
- Brown background.
- 4444
- Blue background.
- 4455
- Magenta background.
- 4466
- Cyan background.
- 4477
- White background.
-
- For example, the following command sets the foreground
color to cyan and the background to black:
echo '\033[36;40m'
-
- The following codes are not standard, and are slated
for modification. Do not embed these codes in scripts or
programs:
-
- In the default font (font 0),
/dev/console ignores control characters
other than BEL, BS, CR, ESC, FF, HT, LF and VT and prints
all other ASCII characters.
-
- In font 1, /dev/console prints all
characters (including control characters), except ESC.
-
- In font 2, /dev/console prints every
character except ESC with the high bit toggled. This
provides access to the IBM graphics character set using
ordinary ASCII characters.
- CCSSII _n ;; _m rr
- Make rows n through m of the display
into the scrolling region. This is not a standard control
sequence. It implements functionality included in standard
sequences, and will be removed from a future console driver
that implements the standard sequence.
- CCSSII _c vv
- Select cursor rendition, where c is one of the
following characters:
- 00
- Cursor visible.
- 11
- Cursor invisible.
-
- This is not a standard sequence. It implements
functionality not provided by any standard sequence.
Developers are cautioned that there is no truly portable
equivalent (although on many systems positioning the cursor
off the screen has the same effect).
- CCSSII ?? 44 hh (SM, Set Mode)
- Enable smooth scrolling. This eliminates ``snow'' from
the screen, but slows down the speed at which the console
scrolls. The mode selected by the private-use parameter
?4 is not a standard mode.
-
- Note that the term ``smooth'' is somewhat misleading;
it means that the driver waits for vertical retrace before
it updates video memory. The reason for waiting for retrace
was that the old CGA tubes were poorly designed -- the CRT
logic and the main CPU were allowed simultaneous access to
the video memory, with the result that direct-memory screen
writes often produced static (snow). Having code wait for
vertical retrace obviates the problem, but it also slows
down the screen.
- CCSSII ?? 44 ll (RM, Reset Mode)
- Disable smooth scrolling. This is the default. The
mode selected by the private-use parameter
?4 is not a standard mode.
- CCSSII ?? 77 hh (SM, Set Mode)
- Enable wraparound. Typing past column 80 moves the
cursor to the first column of the next line, scrolling if
necessary. The mode selected by the private-use parameter
?7 is not a standard mode, but is mandated
by iBCS2.
- CCSSII ?? 77 ll (RM, Reset Mode)
- Disable wraparound. The cursor will not move past
column 80. This is useful if the screen is being used as a
block-mode interface. The mode selected by the private-use
parameter ?7 is not a standard mode, but is
mandaetd by iBCS2.
- CCSSII ?? 88 hh (SM, Set Mode)
- Erase in the current foreground color.
- CCSSII ?? 88 ll (RM, Reset Mode)
- Erase in the original foreground color, even if the
current mode is reverse video.
- CCSSII ?? 2255 hh (SM, Set Mode)
- Enable line 25.
- CCSSII ?? 2255 ll (RM, Reset Mode)
- Disable line 25.
- CCSSII &&ggtt;; 1133 hh (SM, Set Mode)
- Enable the screen saver. This is not standard.
- CCSSII &&ggtt;; 1133 ll (RM, Reset Mode)
- Disable the screen saver. This is not standard.
- EESSCC `` (DMI, Disable Manual Input)
- Disable manual input. Terminal ``beeps'' (outputs
&&lltt;;ccttrrll--GG&&ggtt;;) when you press a key on the keyboard.
Interrupt and quit signals are still passed to the terminal
process. Input may be renabled via EESSCC cc (power up reset)
or EESSCC bb (enable manual input).
- EESSCC bb (EMI, Enable Manual Input)
- Enable keyboard input that has been disabled by EESSCC ``.
- EESSCC cc (RIS, Reset to Initial State)
- Reset to power-up configuration
- EESSCC tt
- Enter keypad-shifted mode. This is a non-standard
sequence that conflicts with explicit provisions of the
relevant standards. It will be removed from future versions
of the console driver in favor of a sequence that does not
conflict.
- EESSCC uu
- Exit keypad-shifted mode. This is a non-standard
sequence that conflicts with explicit provisions of the
relevant standards. It will be removed from future versions
of the console driver in favor of a sequence that does not
conflict.
Numeric Keypad
The following describes the sequences sent by the numeric
keypad.
The keypad sends the following escape sequences:
- KKeeyy 00
- Send CCSSII LL.
- KKeeyy 11
- Send CCSSII FF.
- KKeeyy 22
- Send CCSSII BB.
- KKeeyy 33
- Send CCSSII GG.
- KKeeyy 44
- Send CCSSII DD.
- KKeeyy 55
- Send EESSCC 77.
- KKeeyy 66
- Send CCSSII CC.
- KKeeyy 77
- Send CCSSII HH.
- KKeeyy 88
- Send CCSSII AA.
- KKeeyy 99
- Send CCSSII II.
- KKeeyy ..
- Send ASCII DEL.
When the <shift> key is pressed or
the <num-lock> key is set, the keypad
sends the literal characters `0' through `9' and `.'. If
the <num-lock> key is set, pressing
<shift> restores the escape sequences
shown above.
The escape sequence EESSCC == sets the alternate-keypad mode.
In this mode, the keypad sends the following escape
sequences when the <num-lock> key is
not set:
- KKeeyy 00
- Send EESSCC ?? pp.
- KKeeyy 11
- Send EESSCC ?? qq.
- KKeeyy 22
- Send EESSCC ?? rr.
- KKeeyy 33
- Send EESSCC ?? ss.
- KKeeyy 44
- Send EESSCC ?? tt.
- KKeeyy 55
- Send EESSCC ?? uu.
- KKeeyy 66
- Send EESSCC ?? vv.
- KKeeyy 77
- Send EESSCC ?? ww.
- KKeeyy 88
- Send EESSCC ?? xx.
- KKeeyy 99
- Send EESSCC ?? yy.
- KKeeyy ..
- Send EEsscc ?? nn.
The escape sequence EESSCC &&ggtt;; resets this mode.
Other Special Keys
The following gives the escape sequences sent by the
keyboard's special keys:
- &&lltt;;hhoommee&&ggtt;;
- Send ``cursor home'' ( CCSSII HH).
- &&lltt;;uupp&&ggtt;;
- Send ``cursor up'' (CCSSII AA).
- &&lltt;;ppgg uupp&&ggtt;;
- Send CCSSII II.
- &&lltt;;lleefftt&&ggtt;;
- Send ``cursor left'' (CCSSII DD).
- &&lltt;;rriigghhtt&&ggtt;;
- Send ``cursor right'' (CCSSII CC).
- &&lltt;;eenndd&&ggtt;;
- Send CCSSII FF. Note that this escape sequence does not do
what users normally expect: to send cursor to bottom left of
screen, send the escape sequence CCSSII 2244 HH.
- &&lltt;;ddoowwnn&&ggtt;;
- Send ``cursor down'' (CCSSII BB).
- &&lltt;;ppgg ddnn&&ggtt;;
- Move cursor to previous page (CCSSII GG).
- &&lltt;;iinnss&&ggtt;;
- Send CCSSII LL. Note that this escape sequence does not do
what users normally expect.
- &&lltt;;ddeell&&ggtt;;
- Send ASCII DEL.
- FF11
- Send CCSSII MM.
- FF22
- Send CCSSII NN.
- FF33
- Send CCSSII OO.
- FF44
- Send CCSSII PP.
- FF55
- Send CCSSII QQ.
- FF66
- Send CCSSII RR.
- FF77
- Send CCSSII SS.
- FF88
- Send CCSSII TT.
- FF99
- Send CCSSII UU.
- FF1100
- Send CCSSII VV.
- &&lltt;;sshhiifftt&&ggtt;;FF11
- Send CSI Y.
- &&lltt;;sshhiifftt&&ggtt;;FF22
- Send CSI Z.
- &&lltt;;sshhiifftt&&ggtt;;FF33
- Send CSI a.
- &&lltt;;sshhiifftt&&ggtt;;FF44
- Send CSI b.
- &&lltt;;sshhiifftt&&ggtt;;FF55
- Send CSI c.
- &&lltt;;sshhiifftt&&ggtt;;FF66
- Send CSI d.
- &&lltt;;sshhiifftt&&ggtt;;FF77
- Send CSI e.
- &&lltt;;sshhiifftt&&ggtt;;FF88
- Send CSI f.
- &&lltt;;sshhiifftt&&ggtt;;FF99
- Send CSI g.
- &&lltt;;sshhiifftt&&ggtt;;FF1100
- Send CSI h.
- &&lltt;;ccttrrll&&ggtt;;FF11
- Send CSI k.
- &&lltt;;ccttrrll&&ggtt;;FF22
- Send CSI l.
- &&lltt;;ccttrrll&&ggtt;;FF33
- Send CSI m.
- &&lltt;;ccttrrll&&ggtt;;FF44
- Send CSI n.
- &&lltt;;ccttrrll&&ggtt;;FF55
- Send CSI o.
- &&lltt;;ccttrrll&&ggtt;;FF66
- Send CSI p.
- &&lltt;;ccttrrll&&ggtt;;FF77
- Send CSI q.
- &&lltt;;ccttrrll&&ggtt;;FF88
- Send CSI r.
- &&lltt;;ccttrrll&&ggtt;;FF99
- Send CSI s.
- &&lltt;;ccttrrll&&ggtt;;FF1100
- Send CSI t.
- &&lltt;;ccttrrll&&ggtt;;&&lltt;;sshhiifftt&&ggtt;;FF11
- Send CSI w.
- &&lltt;;ccttrrll&&ggtt;;&&lltt;;sshhiifftt&&ggtt;;FF22
- Send CSI x.
- &&lltt;;ccttrrll&&ggtt;;&&lltt;;sshhiifftt&&ggtt;;FF33
- Send CSI y.
- &&lltt;;ccttrrll&&ggtt;;&&lltt;;sshhiifftt&&ggtt;;FF44
- Send CSI z.
- &&lltt;;ccttrrll&&ggtt;;&&lltt;;sshhiifftt&&ggtt;;FF55
- CSI @.
- &&lltt;;ccttrrll&&ggtt;;&&lltt;;sshhiifftt&&ggtt;;FF66
- CSI [.
- &&lltt;;ccttrrll&&ggtt;;&&lltt;;sshhiifftt&&ggtt;;FF77
- CSI \.
- &&lltt;;ccttrrll&&ggtt;;&&lltt;;sshhiifftt&&ggtt;;FF88
- CSI ].
- &&lltt;;ccttrrll&&ggtt;;&&lltt;;sshhiifftt&&ggtt;;FF99
- CSI ^.
- &&lltt;;ccttrrll&&ggtt;;&&lltt;;sshhiifftt&&ggtt;;FF1100
- CSI _.
- &&lltt;;aalltt&&ggtt;;FF11
- Send CSI 1 y.
- &&lltt;;aalltt&&ggtt;;FF22
- Send CSI 2 y.
- &&lltt;;aalltt&&ggtt;;FF33
- Send CSI 3 y.
- &&lltt;;aalltt&&ggtt;;FF44
- Send CSI 4 y.
- &&lltt;;aalltt&&ggtt;;FF55
- Send CSI 5 y.
- &&lltt;;aalltt&&ggtt;;FF66
- Send CSI 6 y.
- &&lltt;;aalltt&&ggtt;;FF77
- Send CSI 7 y.
- &&lltt;;aalltt&&ggtt;;FF88
- Send CSI 8 y.
- &&lltt;;aalltt&&ggtt;;FF99
- Send CSI 9 y.
- &&lltt;;aalltt&&ggtt;;FF1100
- Send CSI 0 y.
- &&lltt;;eesscc&&ggtt;;
- Send ASCII ESC (0x1B).
- &&lltt;;ttaabb&&ggtt;;
- Send ASCII HT.
- &&lltt;;ccttrrll&&ggtt;;
- When combined with `A' through `_', send the
corresponding ASCII control character; when combined with
the <> key, send ASCII LF; when combined with the key
<backspace>, send ASCII DEL ; when
combined with <alt> and
<del>, issue system reset.
- &&lltt;;sshhiifftt&&ggtt;;
- Change alphabetic keys from lower case to upper case.
If the <caps-lock> is set, shift from
upper case to lower case.
- &&lltt;;aalltt&&ggtt;;
- When combined with <ctrl> and
<del>, issue a system reset.
- &&lltt;;bbaacckkssppaaccee&&ggtt;;
- Send ASCII BS; when combined with
<ctrl>, send ASCII DEL.
- &&lltt;;rreettuurrnn&&ggtt;;
- Send ASCII CR; when combined with
<ctrl>, send ASCII LF.
- **
- Send ASCII `*'.
- &&lltt;;ccaappss--lloocckk&&ggtt;;
- Toggle ``caps lock'' mode.
- &&lltt;;nnuumm--lloocckk&&ggtt;;
- Toggle the interpretation of the numeric keypad, as
described above.
- &&lltt;;ssccrroollll--lloocckk&&ggtt;;
- Send <ctrl-S> and toggle the
Scroll Lock LED.
- --
- Send `-'.
- ++
- Send `+'.
Altering Console Configuration
To change the hardware configuration of your console (i.e.,
to switch from a monochrome to a color console, or modify
your keyboard or configuration of virtual consoles), log in
as the superuser root and type the
following commands:
cd /etc/conf
console/mkdev
bin/idmkcoh -o /_k_e_r_n_e_l___n_a_m_e
where kernel_name is what you wish to name the
newly built kernel. When you reboot, invoke
kernel_name in the usual manner and your new
configuration will have been implemented.
The following tunable kernel variables affect the behavior
of the console driver:
- CCOONN__BBEEEEPP__SSPPEECC
- This tunable kernel parameter lets you toggle whether
the console can beep. If you set it to zero, the console
will not beep, no matter what. By default, this is set to
one, which enables beeping.
- SSEEPP__SSHHIIFFTT
- This tunable kernel variable permits each virtual-
console session to have its own settings for the keyboard's
shift keys. When this variable is set to one, you can have
<CAPS LOCK> turned on in one screen
and <NUM LOCK> in another, and the
driver correctly remembers the proper shift state when you
switch sessions. The default for this variable is zero --
that is, the keyboard uses the same settings for the shift
keys in every virtual-console session.
See Also
Notes
Under COHERENT release 4.2, the codes sent by the keys
F1 through F10, <pg
up>, <pg dn>,
<ins>, <del>, and
<end> have changed from those sent
under previous releases. This was done so that COHERENT can
more closely conform to the standard expected by many third-
party packages. If this presents a problem, you can use the
COHERENT command fnkey to change the codes
sent by the function.
A
If you are using the keyboard driver vtnkb,
you can remap the keyboard and (within limits) change the
codes sent by some keys. For details, see the Lexicon entry
vtnkb.
A
Beginning with COHERENT release 4.2, the console uses a
25-line screen, rather than the 24-lines used in previous
releases. This is to support the numerous third-party
packages that assume a 25-line display. A variant form of
the tteerrmmccaapp and tteerrmmiinnffoo entries for ansipc
returns the screen to 24 lines, should you need that
feature.
A
Please note that as of this writing (March 1994), the
sequences CSI _n _m;; do not work, where
n is between 50 and 57. This is being worked
repaired.