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