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