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