xref: /freebsd/share/man/man4/syscons.4 (revision 907b59d76938e654f0d040a888e8dfca3de1e222)
1.\"
2.\" Copyright (c) 1999
3.\" Kazutaka YOKOTA <yokota@zodiac.mech.utsunomiya-u.ac.jp>
4.\" All rights reserved.
5.\"
6.\" Redistribution and use in source and binary forms, with or without
7.\" modification, are permitted provided that the following conditions
8.\" are met:
9.\" 1. Redistributions of source code must retain the above copyright
10.\"    notice, this list of conditions and the following disclaimer as
11.\"    the first lines of this file unmodified.
12.\" 2. Redistributions in binary form must reproduce the above copyright
13.\"    notice, this list of conditions and the following disclaimer in the
14.\"    documentation and/or other materials provided with the distribution.
15.\"
16.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
17.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
18.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
19.\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
20.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
21.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
22.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
23.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
25.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26.\"
27.\" $FreeBSD$
28.\"
29.Dd June 21, 2016
30.Dt SYSCONS 4
31.Os
32.Sh NAME
33.Nm syscons ,
34.Nm sc
35.Nd the console driver
36.Sh SYNOPSIS
37.Cd "options MAXCONS=N"
38.Cd "options SC_ALT_MOUSE_IMAGE"
39.Cd "options SC_CUT_SEPCHARS=_characters_"
40.Cd "options SC_CUT_SPACES2TABS"
41.Cd "options SC_DISABLE_KDBKEY"
42.Cd "options SC_DISABLE_REBOOT"
43.Cd "options SC_HISTORY_SIZE=N"
44.Cd "options SC_MOUSE_CHAR=C"
45.Cd "options SC_NO_CUTPASTE"
46.Cd "options SC_NO_FONT_LOADING"
47.Cd "options SC_NO_HISTORY"
48.Cd "options SC_NO_PALETTE_LOADING"
49.Cd "options SC_NO_SUSPEND_VTYSWITCH"
50.Cd "options SC_NO_SYSMOUSE"
51.Cd "options SC_PIXEL_MODE"
52.Cd "options SC_TWOBUTTON_MOUSE"
53.Cd "options SC_NORM_ATTR=_attribute_"
54.Cd "options SC_NORM_REV_ATTR=_attribute_"
55.Cd "options SC_KERNEL_CONS_ATTR=_attribute_"
56.Cd "options SC_KERNEL_CONS_REV_ATTR=_attribute_"
57.Cd "options SC_DFLT_FONT"
58.Cd "makeoptions SC_DFLT_FONT=_font_name_"
59.Cd "device sc"
60.Pp
61In
62.Pa /boot/device.hints :
63.Cd hint.sc.0.at="isa"
64.Cd hint.sc.0.vesa_mode=0x103
65.Pp
66In
67.Pa /boot/loader.conf :
68.Cd kern.vty=sc
69.Sh DESCRIPTION
70The
71.Nm
72driver provides multiple virtual terminals.
73It resembles the SCO color console driver.
74.Pp
75The
76.Nm
77driver is implemented on top of the keyboard driver
78.Pq Xr atkbd 4
79and the video card driver
80.Pq Xr vga 4
81and so requires both of them to be configured in the system.
82.Pp
83There can be only one
84.Nm
85device defined in the system.
86.Ss Virtual Terminals
87The
88.Nm
89driver provides multiple virtual terminals which appear as if they were
90separate terminals.
91One virtual terminal is considered current and exclusively
92occupies the screen and the keyboard; the other virtual terminals
93are placed in the background.
94.Pp
95In order to use virtual terminals, they must be individually
96marked ``on'' in
97.Pa /etc/ttys
98so that
99.Xr getty 8
100will recognize them to be active and run
101.Xr login 1
102to let the user log in to the system.
103By default, only the first eight virtual terminals are activated in
104.Pa /etc/ttys .
105.Pp
106You press the
107.Dv Alt
108key and a switch key to switch between
109virtual terminals.
110The following table summarizes the correspondence between the switch
111key and the virtual terminal.
112.Bd -literal -offset indent
113Alt-F1   ttyv0      Alt-F7   ttyv6      Shift-Alt-F1   ttyva
114Alt-F2   ttyv1      Alt-F8   ttyv7      Shift-Alt-F2   ttyvb
115Alt-F3   ttyv2      Alt-F9   ttyv8      Shift-Alt-F3   ttyvc
116Alt-F4   ttyv3      Alt-F10  ttyv9      Shift-Alt-F4   ttyvd
117Alt-F5   ttyv4      Alt-F11  ttyva      Shift-Alt-F5   ttyve
118Alt-F6   ttyv5      Alt-F12  ttyvb      Shift-Alt-F6   ttyvf
119.Ed
120.Pp
121You can also use the ``nscr'' key (usually the
122.Dv PrintScreen
123key on the AT Enhanced keyboard) to cycle available virtual terminals.
124.Pp
125The default number of available virtual terminals is 16.
126This can be changed with the kernel configuration option
127.Dv MAXCONS
128(see below).
129.Pp
130Note that the X server usually requires a virtual terminal for display
131purposes, so at least one terminal must be left unused by
132.Xr getty 8
133so that it can be used by the X server.
134.Ss Key Definitions and Function Key Strings
135The
136.Nm
137driver, in conjunction with the keyboard driver, allows the user
138to change key definitions and function key strings.
139The
140.Xr kbdcontrol 1
141command will load a key definition file (known as ``keymap'' file),
142dump the current keymap, and assign a string to a function key.
143See
144.Xr keyboard 4
145and
146.Xr kbdmap 5
147for the keymap file.
148.Pp
149You may want to set the
150.Ar keymap
151variable in
152.Pa /etc/rc.conf.local
153to the desired keymap file so that it will be automatically loaded
154when the system starts up.
155.Ss Software Font
156For most modern video cards, e.g., VGA, the
157.Nm
158driver and the video card driver allow the user to change
159the font used on the screen.
160The
161.Xr vidcontrol 1
162command can be used to load a font file from
163.Pa /usr/share/syscons/fonts .
164.Pp
165The font comes in various sizes: 8x8, 8x14 and 8x16.
166The 8x16 font is typically used for the VGA card in the
16780-column-by-25-line mode.
168Other video modes may require different font sizes.
169It is better to always load all three sizes of the same font.
170.Pp
171You may set
172.Ar font8x8 ,
173.Ar font8x14
174and
175.Ar font8x16
176variables in
177.Pa /etc/rc.conf
178to the desired font files so that they will be automatically loaded
179when the system starts up.
180.Pp
181Optionally you can specify a particular font file as the default.
182See the
183.Dv SC_DFLT_FONT
184option below.
185.Ss Screen Map
186If your video card does not support software fonts, you may still be able
187to achieve a similar effect by re-mapping the font built into your video card.
188Use
189.Xr vidcontrol 1
190to load a screen map file which defines the mapping between character codes.
191.Ss Mouse Support and Copy-and-Paste
192You can use your mouse to copy text on the screen and paste it as if
193it was typed by hand.
194You must be running the mouse daemon
195.Xr moused 8
196and enable the mouse cursor in the virtual terminal via
197.Xr vidcontrol 1 .
198.Pp
199Pressing mouse button 1 (usually the left button) will start selection.
200Releasing button 1 will end the selection process.
201The selected text will be marked by inverting foreground and
202background colors.
203You can press button 3 (usually the right button) to extend
204the selected region.
205The selected text is placed in the copy buffer and can be pasted
206at the cursor position by pressing button 2 (usually the
207middle button) as many times as you like.
208.Pp
209If your mouse has only two buttons, you may want to use the
210.Dv SC_TWOBUTTON_MOUSE
211option below to make the right button to paste the text.
212Alternatively you can make the mouse daemon
213emulate the middle button.
214See the man page for
215.Xr moused 8
216for more details.
217.Ss Back Scrolling
218The
219.Nm
220driver allows the user to browse the output which has ``scrolled off''
221the top of the screen.
222.Pp
223Press the ``slock'' key (usually
224.Dv ScrllLock
225/
226.Dv Scroll Lock
227or
228.Dv Pause
229on many keyboards) and the terminal is
230in the ``scrollback'' mode.
231It is indicated by the
232.Dv Scroll Lock
233LED.
234Use the arrow keys, the
235.Dv Page Up/Down
236keys and the
237.Dv Home/End
238keys to scroll buffered terminal output.
239Press the ``slock'' key again to get back to the normal terminal mode.
240.Pp
241The size of the scrollback buffer can be set by the
242.Dv SC_HISTORY_SIZE
243option described below.
244.Ss Screen Saver
245The
246.Nm
247driver can be made to put up the screen saver if the current
248virtual terminal is idle, that is, the user is not typing
249on the keyboard nor moving the mouse.
250See
251.Xr splash 4
252and
253.Xr vidcontrol 1
254for more details.
255.Sh DRIVER CONFIGURATION
256.Ss Kernel Configuration Options
257The following kernel configuration options control the
258.Nm
259driver.
260.Bl -tag -width MOUSE
261.It Dv MAXCONS=N
262This option sets the number of virtual terminals to
263.Fa N .
264The default value is 16.
265.It Dv SC_ALT_MOUSE_IMAGE
266This option selects the alternative way of displaying the mouse cursor
267in the virtual terminal.
268It may be expensive for some video cards to draw the arrow-shaped
269cursor, and you may want to try this option.
270However, the appearance of the alternative mouse cursor may not be
271very appealing.
272Note that if you use the
273.Dv SC_NO_FONT_LOADING
274option then you must also use this option if you wish to be able to use
275the mouse.
276.It Dv SC_CUT_SEPCHARS=_characters_
277This options specifies characters that will be looked for when the
278driver searches for words boundaries when doing cut operation.
279By default, its value is
280.Qq Li \ex20
281\(em a space character.
282.It Dv SC_CUT_SPACES2TABS
283This options instructs the driver to convert leading spaces into tabs
284when copying data into cut buffer.
285This might be useful to preserve
286indentation when copying tab-indented text.
287.It Dv SC_DISABLE_KDBKEY
288This option disables the ``debug'' key combination (by default, it is
289.Dv Alt-Esc ,
290or
291.Dv Ctl-PrintScreen ) .
292It will prevent users from
293entering the kernel debugger (KDB) by pressing the key combination.
294KDB will still be invoked when the kernel panics or hits a break point
295if it is included in the kernel.
296If this option is not defined, this behavior may be controlled at runtime
297by the
298.Xr sysctl 8
299variable
300.Va hw.syscons.kbd_debug .
301.It Dv SC_DISABLE_REBOOT
302This option disables the ``reboot'' key (by default, it is
303.Dv Ctl-Alt-Del ) ,
304so that the casual user may not accidentally reboot the system.
305If this option is not defined, this behavior may be controlled at runtime
306by the
307.Xr sysctl 8
308variable
309.Va hw.syscons.kbd_reboot .
310.It Dv SC_HISTORY_SIZE=N
311Sets the size of back scroll buffer to
312.Fa N
313lines.
314The default value is 100.
315.It Dv SC_MOUSE_CHAR=C
316Unless the
317.Dv SC_ALT_MOUSE_IMAGE
318option above is specified, the
319.Nm
320driver reserves four consecutive character codes in order to display the
321mouse cursor in the virtual terminals in some systems.
322This option specifies the first character code to
323.Fa C
324to be used for this purpose.
325The default value is 0xd0.
326A good candidate is 0x03.
327.It Dv SC_PIXEL_MODE
328Adds support for pixel (raster) mode console.
329This mode is useful on some laptop computers, but less so on
330most other systems, and it adds substantial amount of code to syscons.
331If this option is NOT defined, you can reduce the kernel size a lot.
332See the
333.Dv VESAMODE
334flag below.
335.It Dv SC_TWOBUTTON_MOUSE
336If you have a two button mouse, you may want to add this option
337to use the right button of the mouse to paste text.
338See
339.Sx Mouse Support and Copy-and-Paste
340above.
341.It Dv SC_NORM_ATTR=_attribute_
342.It Dv SC_NORM_REV_ATTR=_attribute_
343.It Dv SC_KERNEL_CONS_ATTR=_attribute_
344.It Dv SC_KERNEL_CONS_REV_ATTR=_attribute_
345These options will set the default colors.
346Available colors are defined in
347.In machine/pc/display.h .
348See
349.Sx EXAMPLES
350below.
351.It Dv SC_DFLT_FONT
352This option will specify the default font.
353Available fonts are: iso, iso2, koi8-r, koi8-u, cp437, cp850, cp865,
354cp866 and cp866u.
35516-line, 14-line and 8-line font data will be compiled in.
356Without this option, the
357.Nm
358driver will use whatever font is already loaded in the video card,
359unless you explicitly load a software font at startup.
360See
361.Sx EXAMPLES
362below.
363.It Dv SC_NO_SUSPEND_VTYSWITCH
364This option, which is also available as
365.Xr loader 8
366tunable and
367.Xr sysctl 8
368variable
369.Va hw.syscons.sc_no_suspend_vtswitch ,
370disables switching between virtual terminals (graphics <-> text) during
371suspend/resume (ACPI and APM).
372Use this option if your system is freezing
373when you are running X and trying to suspend.
374.El
375.Pp
376The following options will remove some features from the
377.Nm
378driver and save kernel memory.
379.Bl -tag -width MOUSE
380.It Dv SC_NO_CUTPASTE
381This option disables ``copy and paste'' operation in virtual
382terminals.
383.It Dv SC_NO_FONT_LOADING
384The
385.Nm
386driver can load software fonts on some video cards.
387This option removes this feature.
388Note that if you still wish to use
389the mouse with this option then you must also use the
390.Dv SC_ALT_MOUSE_IMAGE
391option.
392.It Dv SC_NO_HISTORY
393This option disables back-scrolling in virtual terminals.
394.\".It Dv SC_NO_PALETTE_LOADING
395.It Dv SC_NO_SYSMOUSE
396This option removes mouse support in the
397.Nm
398driver.
399The mouse daemon
400.Xr moused 8
401will fail if this option is defined.
402This option implies the
403.Dv SC_NO_CUTPASTE
404option too.
405.El
406.Ss Driver Flags
407The following driver flags can be used to control the
408.Nm
409driver.
410Driver flags can be set with the
411.Cd hint.sc.0.flags
412tunable, either in
413.Pa /boot/device.hints ,
414or else at the loader prompt (see
415.Xr loader 8 ) .
416.Bl -tag -width bit_0
417.\".It bit 0 (VISUAL_BELL)
418.\"Uses the ``visual'' bell.
419.\"The screen will blink instead of generating audible sound.
420.\".It bit 1,2 (CURSOR_TYPE)
421.\"This option specifies the cursor appearance.
422.\"Possible values are:
423.\".Bl -tag -width TYPE -compact
424.\".It Dv 0
425.\"normal block cursor
426.\".It Dv 2
427.\"blinking block cursor
428.\".It Dv 4
429.\"underline cursor
430.\".It Dv 6
431.\"blinking underline (aka destructive) cursor
432.\".El
433.\".It bit 6 (QUIET_BELL)
434.\"This option suppresses the bell, whether audible or visual,
435.\"if it is rung in a background virtual terminal.
436.It 0x0080 (VESAMODE)
437This option puts the video card in the VESA mode specified by
438.Pa /boot/device.hints
439variable
440.Va vesa_mode
441during kernel initialization.
442Note that in order for this flag to work, the kernel must be
443compiled with the
444.Dv SC_PIXEL_MODE
445option explained above.
446A list of the available mode can be obtained via
447.Xr vidcontrol 1 .
448.\"Note also that the ``copy-and-paste'' function is not currently supported
449.\"in this mode and the mouse pointer will not be displayed.
450.It 0x0100 (AUTODETECT_KBD)
451This option instructs the syscons driver to periodically scan
452for a keyboard device if it is not currently attached to one.
453Otherwise, the driver only probes for a keyboard once during bootup.
454.El
455.Ss Loader Tunables
456These settings can be entered at the
457.Xr loader 8
458prompt or in
459.Xr loader.conf 5 .
460.Bl -tag -width indent
461.It Va kern.vty
462When both
463.Nm
464and
465.Xr vt 4
466have been compiled into the kernel, the one to use for the system console can
467be selected by setting this variable to
468.Ql sc
469or
470.Ql vt .
471The
472.Pa GENERIC
473kernel uses
474.Xr vt 4
475when this value is not set.
476.El
477.Sh FILES
478.Bl -tag -width /usr/share/syscons/xxxxyyyyzzz -compact
479.It Pa /dev/console
480.It Pa /dev/consolectl
481.It Pa /dev/ttyv?
482virtual terminals
483.It Pa /etc/ttys
484terminal initialization information
485.It Pa /usr/share/syscons/fonts/*
486font files
487.It Pa /usr/share/syscons/keymaps/*
488key map files
489.It Pa /usr/share/syscons/scrmaps/*
490screen map files
491.El
492.Sh EXAMPLES
493As the
494.Nm
495driver requires the keyboard driver and the video card driver,
496the kernel configuration file should contain the following lines.
497.Bd -literal -offset indent
498device atkbdc
499device atkbd
500device vga
501device sc
502device splash
503.Ed
504.Pp
505You also need the following lines in
506.Pa /boot/device.hints
507for these drivers.
508.Bd -literal -offset indent
509hint.atkbdc.0.at="isa"
510hint.atkbdc.0.port="0x060"
511hint.atkbd.0.at="atkbdc"
512hint.atkbd.0.irq="1"
513hint.vga.0.at="isa"
514hint.sc.0.at="isa"
515.Ed
516.Pp
517If you do not intend to load the splash image or use the screen saver,
518the last line is not necessary, and can be omitted.
519.Pp
520Note that the keyboard controller driver
521.Nm atkbdc
522is required by the keyboard driver
523.Nm atkbd .
524.Pp
525The following lines will set the default colors.
526The normal text will be green on black background.
527The reversed text will be yellow on green background.
528Note that you cannot put any white space inside the quoted string,
529because of the current implementation of
530.Xr config 8 .
531.Pp
532.Dl "options SC_NORM_ATTR=(FG_GREEN|BG_BLACK)"
533.Dl "options SC_NORM_REV_ATTR=(FG_YELLOW|BG_GREEN)"
534.Pp
535The following lines will set the default colors of the kernel message.
536The kernel message will be printed bright red on black background.
537The reversed message will be black on red background.
538.Pp
539.Dl "options SC_KERNEL_CONS_ATTR=(FG_LIGHTRED|BG_BLACK)"
540.Dl "options SC_KERNEL_CONS_REV_ATTR=(FG_BLACK|BG_RED)"
541.Pp
542The following example adds the font files
543.Pa cp850-8x16.fnt ,
544.Pa cp850-8x14.font
545and
546.Pa cp850-8x8.font
547to the kernel.
548.Pp
549.Dl "options SC_DFLT_FONT"
550.Dl "makeoptions SC_DFLT_FONT=cp850"
551.Dl "device sc"
552.\".Sh DIAGNOSTICS
553.Sh SEE ALSO
554.Xr kbdcontrol 1 ,
555.Xr login 1 ,
556.Xr vidcontrol 1 ,
557.Xr atkbd 4 ,
558.Xr atkbdc 4 ,
559.Xr keyboard 4 ,
560.Xr screen 4 ,
561.Xr splash 4 ,
562.Xr ukbd 4 ,
563.Xr vga 4 ,
564.Xr vt 4 ,
565.Xr kbdmap 5 ,
566.Xr rc.conf 5 ,
567.Xr ttys 5 ,
568.Xr config 8 ,
569.Xr getty 8 ,
570.Xr kldload 8 ,
571.Xr moused 8
572.Sh HISTORY
573The
574.Nm
575driver first appeared in
576.Fx 1.0 .
577.Sh AUTHORS
578.An -nosplit
579The
580.Nm
581driver was written by
582.An S\(/oren Schmidt Aq Mt sos@FreeBSD.org .
583This manual page was written by
584.An Kazutaka Yokota Aq Mt yokota@FreeBSD.org .
585.Sh CAVEATS
586The amount of data that is possible to insert from the cut buffer is limited
587by the
588.Brq Dv MAX_INPUT ,
589a system limit on the number of bytes that may be stored in the terminal
590input queue - usually 1024 bytes
591(see
592.Xr termios 4 ) .
593.Sh BUGS
594This manual page is incomplete and urgently needs revision.
595