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