NAME
syscons
, sc
— the console driver
SYNOPSIS
options MAXCONS=N
options SC_ALT_MOUSE_IMAGE
options SC_DISABLE_DDBKEY
options SC_DISABLE_REBOOT
options SC_HISTORY_SIZE=N
options SC_MOUSE_CHAR=C
options SC_NO_CUTPASTE
options SC_NO_FONT_LOADING
options SC_NO_HISTORY
options SC_NO_SYSMOUSE
options SC_PIXEL_MODE
options SC_TWOBUTTON_MOUSE
options SC_NORM_ATTR=_attribute_
options SC_NORM_REV_ATTR=_attribute_
options SC_KERNEL_CONS_ATTR=_attribute_
options SC_KERNEL_CONS_REV_ATTR=_attribute_
options SC_BORDER_COLOR=_attribute_
options SC_DFLT_FONT
makeoptions SC_DFLT_FONT=_font_name_
device sc0 at isa?
[flags
flags]
DESCRIPTION
The syscons
driver provides multiple
virtual terminals. It resembles the SCO color console driver.
The syscons
driver is implemented on top
of the keyboard driver
(atkbd(4)) and the video card drivers
(i915kms(4),
radeonkms(4), or
vga(4)). Please see DRIVER
CONFIGURATION below on how to make the console work with
i915kms(4) or
radeonkms(4).
There can be only one syscons
device
defined in the system.
Virtual Terminals
The syscons
driver provides multiple
virtual terminals which appear as if they were separate terminals. One
virtual terminal is considered current and exclusively occupies the screen
and the keyboard; the other virtual terminals are placed in the
background.
In order to use virtual terminals, they must be individually marked ``on'' in /etc/ttys so that getty(8) will recognize them to be active and run login(1) to let the user log in to the system. By default, only the first eight virtual terminals are activated in /etc/ttys.
You press the Alt
key and a switch key to
switch between virtual terminals. The following table summarizes the
correspondence between the switch key and the virtual terminal.
Alt-F1 ttyv0 Alt-F7 ttyv6 Shift-Alt-F1 ttyv10 Alt-F2 ttyv1 Alt-F8 ttyv7 Shift-Alt-F2 ttyv11 Alt-F3 ttyv2 Alt-F9 ttyv8 Shift-Alt-F3 ttyv12 Alt-F4 ttyv3 Alt-F10 ttyv9 Shift-Alt-F4 ttyv13 Alt-F5 ttyv4 Alt-F11 ttyv10 Shift-Alt-F5 ttyv14 Alt-F6 ttyv5 Alt-F12 ttyv11 Shift-Alt-F6 ttyv15
You can also use the ``nscr'' key (usually the
PrintScreen
key on the AT Enhanced keyboard) to
cycle available virtual terminals.
The default number of available virtual terminals is 16. This can
be changed with the kernel configuration option
MAXCONS
(see below).
Note that the X server usually requires a virtual terminal for display purposes, so at least one terminal must be left unused by getty(8) so that it can be used by the X server.
Key Definitions and Function Key Strings
The syscons
driver, in conjunction with
the keyboard driver, allows the user to change key definitions and function
key strings. The
kbdcontrol(1) command will load a key definition file (known
as ``keymap'' file), dump the current keymap, and assign a string to a
function key. See
keyboard(4) and
kbdmap(5) for the keymap file.
You may want to set the keymap variable in /etc/rc.conf.local to the desired keymap file so that it will be automatically loaded when the system starts up.
Software Font
For most modern video cards, e.g. VGA, the
syscons
driver and the video card driver allow the
user to change the font used on the screen. The
vidcontrol(1) command can be used to load a font file from
/usr/share/syscons/fonts.
The font comes in various sizes: 8x8, 8x14 and 8x16. The 8x16 font is typically used for the VGA card in the 80-column-by-25-line mode. Other video modes may require different font sizes. It is better to always load all three sizes of the same font.
You may set font8x8, font8x14 and font8x16 variables in /etc/rc.conf to the desired font files so that they will be automatically loaded when the system starts up.
Optionally you can specify a particular font file as the default.
See the SC_DFLT_FONT
option below.
Screen Map
If your video card does not support software fonts, you may still be able to achieve a similar effect by re-mapping the font built into your video card. Use vidcontrol(1) to load a screen map file which defines the mapping between character codes.
Mouse Support and Copy-and-Paste
You can use your mouse to copy text on the screen and paste it as if it was typed by hand. You must be running the mouse daemon moused(8) and enable the mouse cursor in the virtual terminal via vidcontrol(1).
Pressing mouse button 1 (usually the left button) will start selection. Releasing button 1 will end the selection process. The selected text will be marked by inverting foreground and background colors. You can press button 3 (usually the right button) to extend the selected region. The selected text is placed in the copy buffer and can be pasted at the cursor position by pressing button 2 (usually the middle button) as many times as you like.
If your mouse has only two buttons, you may want to use the
SC_TWOBUTTON_MOUSE
option below to make the right
button to paste the text. Alternatively you can make the mouse daemon
emulate the middle button. See the man page for
moused(8) for more details.
Back Scrolling
The syscons
driver allows the user to
browse the output which has ``scrolled off'' the top of the screen.
Press the ``slock'' key (usually ScrllLock
/ Scroll Lock
or Pause
on
many keyboards) and the terminal is in the ``scrollback'' mode. It is
indicated by the Scroll Lock
LED. Use the arrow
keys, the Page Up/Down
keys and the
Home/End
keys to scroll buffered terminal output.
Press the ``slock'' key again to get back to the normal terminal mode.
The size of the scrollback buffer can be set by the
SC_HISTORY_SIZE
option described below.
Screen Saver
The syscons
driver can be made to put up
the screen saver if the current virtual terminal is idle, that is, the user
is not typing on the keyboard nor moving the mouse. See
splash(4) and
vidcontrol(1) for more details.
DRIVER CONFIGURATION
Loader Tunables
The following tunables are available and can be set in loader.conf(5).
- kern.kms_console
- Setting this tunable to 0 disables experimental framebuffer support in conjunction with the i915kms(4) or radeonkms(4) drivers. It is 1 by default.
- kern.kms_columns
- The number of columns to use in conjunction with the
i915kms(4) and
radeonkms(4) drivers. The font size is scaled to match the
requested number of columns. This requires
kern.kms_console to be set to 1. By default,
syscons
tries to find a more or less pleasant looking default. Setting kern.kms_columns to a negative value turns off scaling.
Sysctl Variables
The following sysctl(8) variable is available and can be either set via sysctl.conf(5) or from the command line.
- kern.syscons_async
- Set to 1 to enable asynchronous bulk framebuffer updates. It is intended
to help with
sound(4) stuttering when a high resolution
syscons
scrolls during playback. It is not enabled by default because on certain machines it has lead to subtle issues with for example ddb(4).
Kernel Configuration Options
The following kernel configuration options control the
syscons
driver.
MAXCONS=N
- This option sets the number of virtual terminals to N. The default value is 16.
SC_ALT_MOUSE_IMAGE
- This option selects the alternative way of displaying the mouse cursor in
the virtual terminal. It may be expensive for some video cards to draw the
arrow-shaped cursor, and you may want to try this option. However, the
appearance of the alternative mouse cursor may not be very appealing. Note
that if you use the
SC_NO_FONT_LOADING
option then you must also use this option if you wish to be able to use the mouse. SC_DISABLE_DDBKEY
- This option disables the ``debug'' key combination (by default, it is
Alt-Esc
, orCtl-PrintScreen
). It will prevent users from entering the kernel debugger (DDB) by pressing the key combination. DDB will still be invoked when the kernel panics or hits a break point if it is included in the kernel. SC_DISABLE_REBOOT
- This option disables the ``reboot'' key (by default, it is
Ctl-Alt-Del
), so that the casual user may not accidentally reboot the system. SC_HISTORY_SIZE=N
- Sets the size of back scroll buffer to N lines. The default value is 100.
SC_MOUSE_CHAR=C
- Unless the
SC_ALT_MOUSE_IMAGE
option above is specified, thesyscons
driver reserves four consecutive character codes in order to display the mouse cursor in the virtual terminals in some systems. This option specifies the first character code to C to be used for this purpose. The default value is 0xd0. A good candidate is 0x03. SC_PIXEL_MODE
- Adds support for pixel (raster) mode console. This mode is useful on some
laptop computers, but less so on most other systems, and it adds
substantial amount of code to
syscons
. If this option is NOT defined, you can reduce the kernel size a lot. SC_TWOBUTTON_MOUSE
- If you have a two button mouse, you may want to add this option to use the right button of the mouse to paste text. See Mouse Support and Copy-and-Paste above.
SC_NORM_ATTR=_attribute_
SC_NORM_REV_ATTR=_attribute_
SC_KERNEL_CONS_ATTR=_attribute_
SC_KERNEL_CONS_REV_ATTR=_attribute_
SC_BORDER_COLOR=_attribute_
- These options will set the default colors. Available colors are defined in
<machine/pc/display.h>
. See EXAMPLES below. SC_DFLT_FONT
- This option will specify the default font. Available fonts are: iso, iso2,
koi8-r, koi8-u, cp437, cp850, cp865, cp866 and cp866u. 16-line, 14-line
and 8-line font data will be compiled in. Without this option, the
syscons
driver will use whatever font is already loaded in the video card, unless you explicitly load a software font at startup. See EXAMPLES below.
The following options will remove some features from the
syscons
driver and save kernel memory.
SC_NO_CUTPASTE
- This option disables ``copy and paste'' operation in virtual terminals.
SC_NO_FONT_LOADING
- The
syscons
driver can load software fonts on some video cards. This option removes this feature. Note that if you still wish to use the mouse with this option then you must also use theSC_ALT_MOUSE_IMAGE
option. SC_NO_HISTORY
- This option disables back-scrolling in virtual terminals.
SC_NO_SYSMOUSE
- This option removes mouse support in the
syscons
driver. The mouse daemon moused(8) will fail if this option is defined. This option implies theSC_NO_CUTPASTE
option too.
Driver Flags
The following driver flags can be used to control the
syscons
driver. They can be set either in the kernel
configuration file (see
config(8)), or else in the User Configuration Menu at boot time (see
boot(8)).
- 0x0100 (AUTODETECT_KBD)
- This option instructs the
syscons
driver to periodically scan for a keyboard device if it is not currently attached to one. Otherwise, the driver only probes for a keyboard once during bootup.
IOCTLS
The following
ioctl(2) commands are defined for the syscons
driver in
<sys/consio.h>
.
KDGETMODE
int *modeKDSETMODE
int *mode- Get or set the mode of the current (virtual) console. The
mode
can be one of:KD_TEXT
- same as
KD_TEXT0
KD_TEXT0
- Text mode, restore fonts and palette
KD_GRAPHICS
- Graphics mode
KD_TEXT1
- Text mode, don't restore fonts and palette
KD_PIXEL
- Raster (pixel) text mode
KDSBORDER
int *color- Set the border color of the current (virtual) console.
KDRASTER
scr_size_t *sizes- Set raster (pixel) text mode and adjust the current (virtual) console's
geometry and font size. The scr_size_t argument
structure is as follows:
struct _scr_size { int scr_size[3]; };
GIO_SCRNMAP
scrmap_t *mapPIO_SCRNMAP
scrmap_t *map- Get or set the screen map for the current (virtual) console. The
scrmap_t argument structure is defined as follows:
struct _scrmap { char scrmap[256]; };
GIO_ATTR
int *attr- Get the current text attribute.
GIO_COLOR
int *color- Get the current text color.
CONS_CURRENT
int *type- Get the adapter type. This is equivalent to
FBIO_ADPTYPE
. CONS_GET
int *mode- Get the current video mode. This is equivalent to
FBIO_GETMODE
. CONS_SET
int *mode- Set the current video mode. This is equivalent to
FBIO_SETMODE
. CONS_BLANKTIME
int *time- Set the screen saver blank interval (in seconds).
CONS_CURSORTYPE
int *type- Set the text cursor shape. The argument
type
can be one or more of the following:CONS_BLINK_CURSOR
- Set for a blinking cursor, unset for a non-blinking cursor.
CONS_CHAR_CURSOR
- Set for an underscore-shaped cursor, unset for a rectangle.
CONS_BELLTYPE
int *type- Set the bell type. The argument
type
is one or more of:CONS_VISUAL_BELL
- Set for a visual bell, unset for an audible bell.
CONS_QUIET_BELL
- Set to enable the bell, unset to disable it.
CONS_HISTORY
int *size- Set the history (scroll back) buffer size (in lines).
CONS_CLRHIST
- Clear the history (scroll back) buffer.
CONS_IDLE
int *idle- Check if the (virtual) console has been idle.
CONS_SAVERMODE
int *mode- Set the screen saver mode. The argument
mode
can be one of:CONS_NO_SAVER
- Disable screen saver
CONS_USR_SAVER
- Enable screen saver
CONS_LKM_SAVER
- Add a new screen saver
CONS_SAVERSTART
int *start- Start or stop the screen saver.
PIO_FONT8x8
fnt8_t *fontGIO_FONT8x8
fnt8_t *font- Get or set the 8x8 font. The fnt8_t argument
structure is defined as follows:
struct fnt8 { char fnt8x8[8*256]; };
PIO_FONT8x14
fnt14_t *fontGIO_FONT8x14
fnt14_t *font- Get or set the 8x14 font. The fnt14_t argument
structure is defined as follows:
struct fnt14 { char fnt8x14[14*256]; };
PIO_FONT8x16
fnt16_t *fontGIO_FONT8x16
fnt16_t *font- Get or set the 8x16 font. The fnt16_t argument
structure is defined as follows:
struct fnt16 { char fnt8x16[16*256]; };
CONS_GETINFO
vid_info_t *info- Get information about the current video mode. The
vid_info_t structure is defined as follows:
struct vid_info { short size; short m_num; u_short font_size; u_short mv_row, mv_col; u_short mv_rsz, mv_csz; struct colors mv_norm, mv_rev, mv_grfc; u_char mv_ovscan; u_char mk_keylock; };
CONS_GETVERS
int *version- Get the version of the driver.
CONS_CURRENTADP
int *adapter- Get the video adapter index. This is equivalent to
FBIO_ADAPTER
. CONS_ADPINFO
video_adapter_info_t *info- Get the video adapter information. This is equivalent to
FBIO_ADPINFO
. CONS_MODEINFO
video_info_t *info- Get the video mode information. This is equivalent to
FBIO_MODEINFO
. CONS_FINDMODE
video_info_t *info- Find a video mode. This is equivalent to
FBIO_FINDMODE
. CONS_SETWINORG
u_int *origin- Set the frame buffer window origin. This is equivalent to
FBIO_SETWINORG
. CONS_SETKBD
int *kbd- Set a new keyboard.
CONS_RELKBD
- Release the current keyboard.
CONS_SCRSHOT
scrshot_t *data- Make a snapshot of the current video buffer. The
scrshot_t structure is defined as:
struct scrshot { int xsize; int ysize; u_int16_t* buf; };
CONS_GETTERM
term_info_t *infoCONS_SETTERM
term_info_t *info- Get or set terminal characteristics. The term_info_t
structure is defined as:
struct term_info { int ti_index; int ti_flags; u_char ti_name[TI_NAME_LEN]; u_char ti_desc[TI_DESC_LEN]; };
VT_OPENQRY
int *term- Get the next available terminal.
VT_SETMODE
vtmode_t *modeVT_GETMODE
vtmode_t *mode- Get or set the terminal switching mode. The vtmode_t
argument structure is defined as follows:
struct vt_mode { char mode; char waitv; short relsig; short acqsig; short frsig; };
VT_RELDISP
int *ack- Acknowledge the release or acquisition of a terminal. The
ack
argument can be one of:VT_FALSE
- The user refuses to release the screen, abort
VT_TRUE
- The user has released the screen, go on
VT_ACKACQ
- Acquisition of the screen acknowledged, switch completed
VT_ACTIVATE
int *term- Activate the specified terminal.
VT_WAITACTIVE
int *term- Wait until the specified terminal is active.
VT_GETACTIVE
int *term- Get the currently active terminal.
VT_GETINDEX
int *index- Get the index of the terminal.
VT_LOCKSWITCH
int *lock- Prevent or permit terminal switching.
FILES
- /dev/console
- /dev/consolectl
- /dev/ttyv?
- virtual terminals
- /etc/ttys
- terminal initialization information
- /usr/share/syscons/fonts/*
- font files
- /usr/share/syscons/keymaps/*
- key map files
- /usr/share/syscons/scrmaps/*
- screen map files
EXAMPLES
As the syscons
driver requires the
keyboard driver and the video card driver, the kernel configuration file
should contain the following lines.
device atkbdc0 at isa? port
IO_KBD
device atkbd0 at atkbdc? irq
1
device vga0 at isa?
device sc0 at isa?
pseudo-device splash
If you do not intend to load the splash image or use the screen saver, the last line is not necessary, and can be omitted.
Note that the keyboard controller driver
atkbdc
is required by the keyboard driver
atkbd
.
The following lines will set the default colors. The normal text will be green on black background. The reversed text will be yellow on green background. Note that you cannot put any white space inside the quoted string, because of the current implementation of config(8).
options
SC_NORM_ATTR=(FG_GREEN|BG_BLACK)
options
SC_NORM_REV_ATTR=(FG_YELLOW|BG_GREEN)
The following lines will set the default colors of the kernel message. The kernel message will be printed bright red on black background. The reversed message will be black on red background.
options
SC_KERNEL_CONS_ATTR=(FG_LIGHTRED|BG_BLACK)
options
SC_KERNEL_CONS_REV_ATTR=(FG_BLACK|BG_RED)
The following line will set the default border color of the terminal. If the console is in framebuffer mode, or in raster (pixel) text mode, a thin green border will be visible around the terminal if the screen size is not an exact multiple of the font size. This border area can be much larger if the column or row count is explicitly specified (for example when using the kern.kms_columns tunable).
options
SC_BORDER_COLOR=FG_GREEN
The following example adds the font files cp850-8x16.fnt, cp850-8x14.font and cp850-8x8.font to the kernel.
options SC_DFLT_FONT
makeoptions
SC_DFLT_FONT=cp850
device sc0 at isa?
CAVEATS
The amount of data that is possible to insert from the cut buffer
is limited by the {MAX_INPUT
}, a system limit on the
number of bytes that may be stored in the terminal input queue - usually
1024 bytes (see
termios(4)).
SEE ALSO
kbdcontrol(1), login(1), vidcontrol(1), atkbd(4), atkbdc(4), keyboard(4), screen(4), splash(4), sysmouse(4), ukbd(4), vga(4), kbdmap(5), rc.conf(5), ttys(5), config(8), getty(8), kldload(8), moused(8)
HISTORY
The syscons
driver first appeared in
FreeBSD 1.0.
AUTHORS
The syscons
driver was written by
Søren Schmidt
<sos@FreeBSD.org>.
This manual page was written by Kazutaka Yokota
<yokota@FreeBSD.org>
and Sascha Wildner.
BUGS
This manual page is incomplete and needs revision.