xref: /freebsd/share/man/man4/vt.4 (revision b17b639832e707aab0e9514cf94727498e2d67bd)
1.\" Copyright (c) 2014 Warren Block
2.\" All rights reserved.
3.\"
4.\" Redistribution and use in source and binary forms, with or without
5.\" modification, are permitted provided that the following conditions
6.\" are met:
7.\" 1. Redistributions of source code must retain the above copyright
8.\"    notice, this list of conditions and the following disclaimer.
9.\" 2. Redistributions in binary form must reproduce the above copyright
10.\"    notice, this list of conditions and the following disclaimer in the
11.\"    documentation and/or other materials provided with the distribution.
12.\"
13.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``AS IS'' AND
14.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
15.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
16.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE
17.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
18.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
19.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
20.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
21.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
22.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
23.\" SUCH DAMAGE.
24.\"
25.\" $FreeBSD$
26.\"
27.Dd May 8, 2023
28.Dt "VT" 4
29.Os
30.Sh NAME
31.Nm vt
32.Nd virtual terminal console driver
33.Sh SYNOPSIS
34.Cd "options TERMINAL_KERN_ATTR=_attribute_"
35.Cd "options TERMINAL_NORM_ATTR=_attribute_"
36.Cd "options VT_MAXWINDOWS=N"
37.Cd "options VT_ALT_TO_ESC_HACK=1"
38.Cd "options VT_TWOBUTTON_MOUSE"
39.Cd "options VT_FB_MAX_WIDTH=X"
40.Cd "options VT_FB_MAX_HEIGHT=Y"
41.Cd "options SC_NO_CUTPASTE"
42.Cd "device vt"
43.Pp
44In
45.Xr loader.conf 5 :
46.Cd hw.vga.textmode=1
47.Cd hw.vga.acpi_ignore_no_vga=1
48.Cd kern.vty=vt
49.Cd kern.vt.color.<colornum>.rgb="<colorspec>"
50.Cd kern.vt.fb.default_mode="<X>x<Y>"
51.Cd kern.vt.fb.modes.<connector>="<X>x<Y>"
52.Pp
53In
54.Xr loader.conf 5 or
55.Xr sysctl.conf 5 :
56.Cd kern.vt.kbd_halt=1
57.Cd kern.vt.kbd_poweroff=1
58.Cd kern.vt.kbd_reboot=1
59.Cd kern.vt.kbd_debug=1
60.Cd kern.vt.kbd_panic=0
61.Cd kern.vt.enable_altgr=0
62.Cd kern.vt.enable_bell=1
63.Sh DESCRIPTION
64The
65.Nm
66device provides multiple virtual terminals with an extensive feature
67set:
68.Bl -item -offset indent
69.It
70Unicode UTF-8 text with double-width characters.
71.It
72Large font maps in graphics mode, including support for Asian
73character sets.
74.It
75Graphics-mode consoles.
76.It
77Integration with
78KMS
79.Pq Kernel Mode Setting
80video drivers for switching between the
81.Em X Window System
82and virtual terminals.
83.El
84.Ss Virtual Terminals
85Multiple virtual terminals are provided on a single computer.
86Up to sixteen virtual terminals can be defined.
87A single virtual terminal is connected to the screen and keyboard
88at a time.
89Key combinations are used to select a virtual terminal.
90Alt-F1 through Alt-F12 correspond to the first twelve virtual terminals.
91If more than twelve virtual terminals are created, Shift-Alt-F1 through
92Shift-Alt-F4 are used to switch to the additional terminals.
93.Ss Copying and Pasting Text with a Mouse
94Copying and pasting text from the screen with a mouse is supported.
95Press and hold down mouse button 1, usually the left button, while
96moving the mouse to select text.
97Selected text is highlighted with reversed foreground and background
98colors.
99To select more text after releasing mouse button 1, press mouse button
1003, usually the right button.
101To paste text that has been selected, press mouse button 2, usually the
102middle button.
103The text is entered as if it were typed at the keyboard.
104The
105.Dv VT_TWOBUTTON_MOUSE
106kernel option can be used with mice that only have two buttons.
107Setting this option makes the second mouse button into the
108paste button.
109See
110.Xr moused 8
111for more information.
112.Ss Scrolling Back
113Output that has scrolled off the screen can be reviewed by pressing the
114Scroll Lock key, then scrolling up and down with the arrow keys.
115The Page Up and Page Down keys scroll up or down a full screen at a
116time.
117The Home and End keys jump to the beginning or end of the scrollback
118buffer.
119When finished reviewing, press the Scroll Lock key again to return to
120normal use.
121Some laptop keyboards lack a Scroll Lock key, and use a special function key
122sequence (such as Fn + K) to access Scroll Lock.
123.Sh DRIVER CONFIGURATION
124.Ss Kernel Configuration Options
125These kernel options control the
126.Nm
127driver.
128.Bl -tag -width MAXCONS
129.It Dv TERMINAL_NORM_ATTR= Ns Pa attribute
130.It Dv TERMINAL_KERN_ATTR= Ns Pa attribute
131These options change the default colors used for normal and kernel
132text.
133Available colors are defined in
134.In sys/terminal.h .
135See
136.Sx EXAMPLES
137below.
138.It Dv VT_MAXWINDOWS=N
139Set the number of virtual terminals to be created to
140.Fa N .
141The value defaults to 12.
142.It Dv VT_ALT_TO_ESC_HACK=1
143When the Alt key is held down while pressing another key, send an ESC
144sequence instead of the Alt key.
145.It Dv VT_TWOBUTTON_MOUSE
146If defined, swap the functions of mouse buttons 2 and 3.
147In effect, this makes the right-hand mouse button perform a paste.
148These options are checked in the order shown.
149.It Dv SC_NO_CUTPASTE
150Disable mouse support.
151.It VT_FB_MAX_WIDTH=X
152Set the maximum width to
153.Fa X .
154.It VT_FB_MAX_HEIGHT=Y
155Set the maximum height to
156.Fa Y .
157.El
158.Sh BACKWARDS COMPATIBILITY
159Several options are provided for compatibility with the previous
160console device,
161.Xr sc 4 .
162These options will be removed in a future
163.Fx
164version.
165.Bl -column -offset indent ".Sy vt VT_TWOBUTTON_MOUSE" ".Sy SC_TWOBUTTON_MOUSE"
166.It Sy vt Option Name Ta Sy sc Option Name
167.It Dv TERMINAL_KERN_ATTR Ta Dv SC_KERNEL_CONS_ATTR
168.It Dv TERMINAL_NORM_ATTR Ta Dv SC_NORM_ATTR
169.It Dv VT_TWOBUTTON_MOUSE Ta Dv SC_TWOBUTTON_MOUSE
170.It Dv VT_MAXWINDOWS Ta Dv MAXCONS
171.It none Ta Dv SC_NO_CUTPASTE
172.El
173.Sh START-UP OPERATION WITH X86 BIOS SYSTEMS
174The computer BIOS starts in text mode, and
175the
176.Fx
177.Xr loader 8
178runs, loading the kernel.
179If
180.Va hw.vga.textmode
181is set, the system remains in text mode.
182Otherwise,
183.Nm
184switches to 640x480x16 VGA mode using
185.Cm vt_vga .
186If a KMS
187.Pq Kernel Mode Setting
188video driver is available, the display is switched to high resolution
189and the KMS driver takes over.
190When a KMS driver is not available,
191.Cm vt_vga
192remains active.
193.Sh LOADER TUNABLES
194These settings can be entered at the
195.Xr loader 8
196prompt or in
197.Xr loader.conf 5 .
198.Bl -tag -width indent
199.It Va hw.vga.textmode
200Set to 1 to use virtual terminals in text mode instead of graphics mode.
201Features that require graphics mode, like loadable fonts, will be
202disabled.
203.Pp
204If a KMS driver is loaded the console will switch to (and remain in)
205graphics mode.
206.It Va hw.vga.acpi_ignore_no_vga
207Set to 1 to force the usage of the VGA driver regardless of whether
208ACPI IAPC_BOOT_ARCH signals no VGA support.
209Can be used to workaround firmware bugs in the ACPI tables.
210Note no VGA support is only acknowledged when running virtualized.
211There is too many broken firmware that wrongly reports no VGA support on
212physical hardware.
213.It Va kern.vty
214Set this value to
215.Ql vt
216or
217.Ql sc
218to choose a specific system console, overriding the default.
219The
220.Pa GENERIC
221kernel uses
222.Nm
223when this value is not set.
224.It Va kern.vt.color. Ns Ar colornum Ns Va .rgb
225Set this value to override default palette entry for color
226.Pa colornum
227which should be in a range from 0 to 15 inclusive.
228The value should be either a comma-separated triplet of
229red, green, and blue values in a range from 0 to 255 or
230HTML-like hex triplet.
231See
232.Sx EXAMPLES
233below.
234.Pp
235Note: The
236.Nm
237VGA hardware driver does not support palette configuration.
238.It Va kern.vt.fb.default_mode
239Set this value to a graphic mode to override the default mode picked by the
240.Nm
241backend.
242The mode is applied to all output connectors.
243This is currently only supported by the
244.Cm vt_fb
245backend when it is paired with a KMS video driver.
246.It Va kern.vt.fb.modes. Ns Pa connector_name
247Set this value to a graphic mode to override the default mode picked by the
248.Nm
249backend.
250This mode is applied to the output connector
251.Pa connector_name
252only.
253It has precedence over
254.Va kern.vt.fb.default_mode .
255The names of available connector names can be found in
256.Xr dmesg 8
257after loading the KMS driver.
258It will contain a list of connectors and their associated tunables.
259This is currently only supported by the
260.Cm vt_fb
261backend when it is paired with a KMS video driver.
262.El
263.Sh KEYBOARD SYSCTL TUNABLES
264These settings control whether certain special key combinations are enabled or
265ignored.
266The specific key combinations can be configured by using a
267.Xr keymap 5
268file.
269.Pp
270These settings can be entered at the
271.Xr loader 8
272prompt or in
273.Xr loader.conf 5
274and can also be changed at runtime with the
275.Xr sysctl 8
276command.
277.Bl -tag -width indent
278.It Va kern.vt.enable_altgr
279Enable AltGr key (do not assume right Alt key as Alt).
280.It Va kern.vt.kbd_halt
281Enable halt keyboard combination.
282.It Va kern.vt.kbd_poweroff
283Enable power off key combination.
284.It Va kern.vt.kbd_reboot
285Enable reboot key combination, usually Ctrl+Alt+Del.
286.It Va kern.vt.kbd_debug
287Enable debug request key combination, usually Ctrl+Alt+Esc.
288.It Va kern.vt.kbd_panic
289Enable panic key combination.
290.El
291.Sh OTHER SYSCTL TUNABLES
292These settings can be entered at the
293.Xr loader 8
294prompt, set in
295.Xr loader.conf 5 ,
296or changed at runtime with
297.Xr sysctl 8 .
298.Bl -tag -width indent
299.It Va kern.vt.enable_bell
300Enable the terminal bell.
301.El
302.Sh FILES
303.Bl -tag -width /usr/share/vt/keymaps/* -compact
304.It Pa /dev/console
305.It Pa /dev/consolectl
306.It Pa /dev/ttyv*
307virtual terminals
308.It Pa /etc/ttys
309terminal initialization information
310.It Pa /usr/share/vt/fonts/*.fnt
311console fonts
312.It Pa /usr/share/vt/keymaps/*.kbd
313keyboard layouts
314.El
315.Sh DEVCTL MESSAGES
316.Bl -column "System" "Subsystem" "1234567" -compact
317.Sy "System" Ta Sy "Subsystem" Ta Sy "Type" Ta Sy "Description"
318.It Li VT Ta BELL Ta RING Ta
319Notification that the console bell has rung.
320.El
321.Pp
322.Bl -column "Variable" "Meaning" -compact
323.Sy "Variable" Ta Sy "Meaning"
324.It Li duration_ms Ta Length of time the bell was requested to ring in milliseconds.
325.It Li enabled Ta true or false indicating whether or not the bell was administratively enabled when rung.
326.It Li hushed Ta true or false indicating whether or not the bell was quieted by the user when rung.
327.It Li hz Ta Tone that was requested in Hz.
328.El
329.Sh EXAMPLES
330This example changes the default color of normal text to green on a
331black background, or black on a green background when reversed.
332Note that white space cannot be used inside the attribute string
333because of the current implementation of
334.Xr config 8 .
335.Pp
336.Dl "options TERMINAL_NORM_ATTR=(FG_GREEN|BG_BLACK)"
337.Pp
338This line changes the default color of kernel messages to be bright red
339on a black background, or black on a bright red background when reversed.
340.Pp
341.Dl "options TERMINAL_KERN_ATTR=(FG_LIGHTRED|BG_BLACK)"
342.Pp
343To set a 1024x768 mode on all output connectors, put the following line in
344.Pa /boot/loader.conf :
345.Pp
346.Dl kern.vt.fb.default_mode="1024x768"
347.Pp
348To set a 800x600 only on a laptop builtin screen, use the following line instead:
349.Pp
350.Dl kern.vt.fb.modes.LVDS-1="800x600"
351.Pp
352The connector name was found in
353.Xr dmesg 8 :
354.Pp
355.Dl info: [drm] Connector LVDS-1: get mode from tunables:
356.Dl info: [drm]   - kern.vt.fb.modes.LVDS-1
357.Dl info: [drm]   - kern.vt.fb.default_mode
358.Pp
359To set black and white colors of console palette
360.Pp
361.Dl kern.vt.color.0.rgb="10,10,10"
362.Dl kern.vt.color.15.rgb="#f0f0f0"
363.Sh SEE ALSO
364.Xr kbdcontrol 1 ,
365.Xr login 1 ,
366.Xr vidcontrol 1 ,
367.Xr atkbd 4 ,
368.Xr atkbdc 4 ,
369.Xr kbdmux 4 ,
370.Xr keyboard 4 ,
371.Xr screen 4 ,
372.Xr splash 4 ,
373.Xr syscons 4 ,
374.Xr ukbd 4 ,
375.Xr kbdmap 5 ,
376.Xr rc.conf 5 ,
377.Xr ttys 5 ,
378.Xr config 8 ,
379.Xr getty 8 ,
380.Xr kldload 8 ,
381.Xr moused 8 ,
382.Xr vtfontcvt 8
383.Sh HISTORY
384The
385.Nm
386driver first appeared in
387.Fx 9.3 .
388.Sh AUTHORS
389.An -nosplit
390The
391.Nm
392device driver was developed by
393.An \&Ed Schouten Aq Mt ed@FreeBSD.org ,
394.An \&Ed Maste Aq Mt emaste@FreeBSD.org ,
395and
396.An Aleksandr Rybalko Aq Mt ray@FreeBSD.org ,
397with sponsorship provided by the
398.Fx
399Foundation.
400This manual page was written by
401.An Warren Block Aq Mt wblock@FreeBSD.org .
402.Sh CAVEATS
403Paste buffer size is limited by the system value
404.Brq Dv MAX_INPUT ,
405the number of bytes that can be stored in the terminal
406input queue, usually 1024 bytes
407(see
408.Xr termios 4 ) .
409