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