xref: /freebsd/share/man/man4/vt.4 (revision e87ec409fa9b21abf79895837fe375ab3d7e408a)
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 March 17, 2022
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_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.
120.Sh DRIVER CONFIGURATION
121.Ss Kernel Configuration Options
122These kernel options control the
123.Nm
124driver.
125.Bl -tag -width MAXCONS
126.It Dv TERMINAL_NORM_ATTR= Ns Pa attribute
127.It Dv TERMINAL_KERN_ATTR= Ns Pa attribute
128These options change the default colors used for normal and kernel
129text.
130Available colors are defined in
131.In sys/terminal.h .
132See
133.Sx EXAMPLES
134below.
135.It Dv VT_MAXWINDOWS=N
136Set the number of virtual terminals to be created to
137.Fa N .
138The value defaults to 12.
139.It Dv VT_ALT_TO_ESC_HACK=1
140When the Alt key is held down while pressing another key, send an ESC
141sequence instead of the Alt key.
142.It Dv VT_TWOBUTTON_MOUSE
143If defined, swap the functions of mouse buttons 2 and 3.
144In effect, this makes the right-hand mouse button perform a paste.
145These options are checked in the order shown.
146.It Dv SC_NO_CUTPASTE
147Disable mouse support.
148.It VT_FB_MAX_WIDTH=X
149Set the maximum width to
150.Fa X .
151.It VT_FB_MAX_HEIGHT=Y
152Set the maximum height to
153.Fa Y .
154.El
155.Sh BACKWARDS COMPATIBILITY
156Several options are provided for compatibility with the previous
157console device,
158.Xr sc 4 .
159These options will be removed in a future
160.Fx
161version.
162.Bl -column -offset indent ".Sy vt VT_TWOBUTTON_MOUSE" ".Sy SC_TWOBUTTON_MOUSE"
163.It Sy vt Option Name Ta Sy sc Option Name
164.It Dv TERMINAL_KERN_ATTR Ta Dv SC_KERNEL_CONS_ATTR
165.It Dv TERMINAL_NORM_ATTR Ta Dv SC_NORM_ATTR
166.It Dv VT_TWOBUTTON_MOUSE Ta Dv SC_TWOBUTTON_MOUSE
167.It Dv VT_MAXWINDOWS Ta Dv MAXCONS
168.It none Ta Dv SC_NO_CUTPASTE
169.El
170.Sh START-UP OPERATION WITH X86 BIOS SYSTEMS
171The computer BIOS starts in text mode, and
172the
173.Fx
174.Xr loader 8
175runs, loading the kernel.
176If
177.Va hw.vga.textmode
178is set, the system remains in text mode.
179Otherwise,
180.Nm
181switches to 640x480x16 VGA mode using
182.Cm vt_vga .
183If a KMS
184.Pq Kernel Mode Setting
185video driver is available, the display is switched to high resolution
186and the KMS driver takes over.
187When a KMS driver is not available,
188.Cm vt_vga
189remains active.
190.Sh LOADER TUNABLES
191These settings can be entered at the
192.Xr loader 8
193prompt or in
194.Xr loader.conf 5 .
195.Bl -tag -width indent
196.It Va hw.vga.textmode
197Set to 1 to use virtual terminals in text mode instead of graphics mode.
198Features that require graphics mode, like loadable fonts, will be
199disabled.
200.Pp
201If a KMS driver is loaded the console will switch to (and remain in)
202graphics mode.
203.It Va hw.vga.acpi_ignore_no_vga
204Set to 1 to force the usage of the VGA driver regardless of whether
205ACPI IAPC_BOOT_ARCH signals no VGA support.
206Can be used to workaround firmware bugs in the ACPI tables.
207Note no VGA support is only acknowledged when running virtualized.
208There is too many broken firmware that wrongly reports no VGA support on
209physical hardware.
210.It Va kern.vty
211Set this value to
212.Ql vt
213or
214.Ql sc
215to choose a specific system console, overriding the default.
216The
217.Pa GENERIC
218kernel uses
219.Nm
220when this value is not set.
221.It Va kern.vt.color. Ns Ar colornum Ns Va .rgb
222Set this value to override default palette entry for color
223.Pa colornum
224which should be in a range from 0 to 15 inclusive.
225The value should be either a comma-separated triplet of
226red, green, and blue values in a range from 0 to 255 or
227HTML-like hex triplet.
228See
229.Sx EXAMPLES
230below.
231.Pp
232Note: The
233.Nm
234VGA hardware driver does not support palette configuration.
235.It Va kern.vt.fb.default_mode
236Set this value to a graphic mode to override the default mode picked by the
237.Nm
238backend.
239The mode is applied to all output connectors.
240This is currently only supported by the
241.Cm vt_fb
242backend when it is paired with a KMS video driver.
243.It Va kern.vt.fb.modes. Ns Pa connector_name
244Set this value to a graphic mode to override the default mode picked by the
245.Nm
246backend.
247This mode is applied to the output connector
248.Pa connector_name
249only.
250It has precedence over
251.Va kern.vt.fb.default_mode .
252The names of available connector names can be found in
253.Xr dmesg 8
254after loading the KMS driver.
255It will contain a list of connectors and their associated tunables.
256This is currently only supported by the
257.Cm vt_fb
258backend when it is paired with a KMS video driver.
259.El
260.Sh KEYBOARD SYSCTL TUNABLES
261These settings control whether certain special key combinations are enabled or
262ignored.
263The specific key combinations can be configured by using a
264.Xr keymap 5
265file.
266.Pp
267These settings can be entered at the
268.Xr loader 8
269prompt or in
270.Xr loader.conf 5
271and can also be changed at runtime with the
272.Xr sysctl 8
273command.
274.Bl -tag -width indent
275.It Va kern.vt.kbd_halt
276Enable halt keyboard combination.
277.It Va kern.vt.kbd_poweroff
278Enable power off key combination.
279.It Va kern.vt.kbd_reboot
280Enable reboot key combination, usually Ctrl+Alt+Del.
281.It Va kern.vt.kbd_debug
282Enable debug request key combination, usually Ctrl+Alt+Esc.
283.It Va kern.vt.kbd_panic
284Enable panic key combination.
285.El
286.Sh OTHER SYSCTL TUNABLES
287These settings can be entered at the
288.Xr loader 8
289prompt, set in
290.Xr loader.conf 5 ,
291or changed at runtime with
292.Xr sysctl 8 .
293.Bl -tag -width indent
294.It Va kern.vt.enable_bell
295Enable the terminal bell.
296.El
297.Sh FILES
298.Bl -tag -width /usr/share/vt/keymaps/* -compact
299.It Pa /dev/console
300.It Pa /dev/consolectl
301.It Pa /dev/ttyv*
302virtual terminals
303.It Pa /etc/ttys
304terminal initialization information
305.It Pa /usr/share/vt/fonts/*.fnt
306console fonts
307.It Pa /usr/share/vt/keymaps/*.kbd
308keyboard layouts
309.El
310.Sh DEVCTL MESSAGES
311.Bl -column "System" "Subsystem" "1234567" -compact
312.Sy "System" Ta Sy "Subsystem" Ta Sy "Type" Ta Sy "Description"
313.It Li VT Ta BELL Ta RING Ta
314Notification that the console bell has rung.
315.El
316.Pp
317.Bl -column "Variable" "Meaning" -compact
318.Sy "Variable" Ta Sy "Meaning"
319.It Li duration_ms Ta Length of time the bell was requested to ring in milliseconds.
320.It Li enabled Ta true or false indicating whether or not the bell was administratively enabled when rung.
321.It Li hushed Ta true or false indicating whether or not the bell was quieted by the user when rung.
322.It Li hz Ta Tone that was requested in Hz.
323.El
324.Sh EXAMPLES
325This example changes the default color of normal text to green on a
326black background, or black on a green background when reversed.
327Note that white space cannot be used inside the attribute string
328because of the current implementation of
329.Xr config 8 .
330.Pp
331.Dl "options TERMINAL_NORM_ATTR=(FG_GREEN|BG_BLACK)"
332.Pp
333This line changes the default color of kernel messages to be bright red
334on a black background, or black on a bright red background when reversed.
335.Pp
336.Dl "options TERMINAL_KERN_ATTR=(FG_LIGHTRED|BG_BLACK)"
337.Pp
338To set a 1024x768 mode on all output connectors, put the following line in
339.Pa /boot/loader.conf :
340.Pp
341.Dl kern.vt.fb.default_mode="1024x768"
342.Pp
343To set a 800x600 only on a laptop builtin screen, use the following line instead:
344.Pp
345.Dl kern.vt.fb.modes.LVDS-1="800x600"
346.Pp
347The connector name was found in
348.Xr dmesg 8 :
349.Pp
350.Dl info: [drm] Connector LVDS-1: get mode from tunables:
351.Dl info: [drm]   - kern.vt.fb.modes.LVDS-1
352.Dl info: [drm]   - kern.vt.fb.default_mode
353.Pp
354To set black and white colors of console palette
355.Pp
356.Dl kern.vt.color.0.rgb="10,10,10"
357.Dl kern.vt.color.15.rgb="#f0f0f0"
358.Sh SEE ALSO
359.Xr kbdcontrol 1 ,
360.Xr login 1 ,
361.Xr vidcontrol 1 ,
362.Xr atkbd 4 ,
363.Xr atkbdc 4 ,
364.Xr kbdmux 4 ,
365.Xr keyboard 4 ,
366.Xr screen 4 ,
367.Xr splash 4 ,
368.Xr syscons 4 ,
369.Xr ukbd 4 ,
370.Xr kbdmap 5 ,
371.Xr rc.conf 5 ,
372.Xr ttys 5 ,
373.Xr config 8 ,
374.Xr getty 8 ,
375.Xr kldload 8 ,
376.Xr moused 8 ,
377.Xr vtfontcvt 8
378.Sh HISTORY
379The
380.Nm
381driver first appeared in
382.Fx 9.3 .
383.Sh AUTHORS
384.An -nosplit
385The
386.Nm
387device driver was developed by
388.An \&Ed Schouten Aq Mt ed@FreeBSD.org ,
389.An \&Ed Maste Aq Mt emaste@FreeBSD.org ,
390and
391.An Aleksandr Rybalko Aq Mt ray@FreeBSD.org ,
392with sponsorship provided by the
393.Fx
394Foundation.
395This manual page was written by
396.An Warren Block Aq Mt wblock@FreeBSD.org .
397.Sh CAVEATS
398Paste buffer size is limited by the system value
399.Brq Dv MAX_INPUT ,
400the number of bytes that can be stored in the terminal
401input queue, usually 1024 bytes
402(see
403.Xr termios 4 ) .
404