1.\"- 2.\" SPDX-License-Identifier: BSD-2-Clause 3.\" 4.\" vidcontrol - a utility for manipulating the syscons or vt video driver 5.\" 6.\" Redistribution and use in source and binary forms, with or without 7.\" modification, are permitted provided that the following conditions 8.\" are met: 9.\" 1. Redistributions of source code must retain the above copyright 10.\" notice, this list of conditions and the following disclaimer. 11.\" 2. Redistributions in binary form must reproduce the above copyright 12.\" notice, this list of conditions and the following disclaimer in the 13.\" documentation and/or other materials provided with the distribution. 14.\" 15.Dd July 7, 2024 16.Dt VIDCONTROL 1 17.Os 18.Sh NAME 19.Nm vidcontrol 20.Nd system video console control and configuration utility 21.Sh SYNOPSIS 22.Nm 23.Op Fl CdHLPpx 24.Op Fl b Ar color 25.Op Fl c Ar appearance 26.Op Fl E Ar emulator 27.Oo 28.Fl f 29.Oo 30.Op Ar size 31.Ar file 32.Oc 33.Oc 34.Op Fl g Ar geometry 35.Op Fl h Ar size 36.Op Fl i Cm active | adapter | mode 37.Op Fl l Ar screen_map 38.Op Fl M Ar char 39.Op Fl m Cm on | off 40.Op Fl r Ar foreground Ar background 41.Op Fl S Cm on | off 42.Op Fl s Ar number 43.Op Fl T Cm xterm | cons25 44.Op Fl t Ar N | Cm off 45.Op Ar mode 46.Op Ar foreground Op Ar background 47.Op Cm show 48.Sh DESCRIPTION 49The 50.Nm 51utility is used to set various options for the 52.Xr syscons 4 53or 54.Xr vt 4 55console driver, 56such as video mode, colors, cursor shape, screen output map, font, and screen 57saver timeout. 58Only a small subset of options is supported by 59.Xr vt 4 . 60Unsupported options lead to error messages, typically including 61the text "Inappropriate ioctl for device". 62.Pp 63The following command line options are supported: 64.Bl -tag -width indent 65.It Ar mode 66Select a new video mode. 67The modes currently recognized are: 68.Ar 80x25 , 69.Ar 80x30 , 70.Ar 80x43 , 71.Ar 80x50 , 72.Ar 80x60 , 73.Ar 132x25 , 74.Ar 132x30 , 75.Ar 132x43 , 76.Ar 132x50 , 77.Ar 132x60 , 78.Ar VGA_40x25 , 79.Ar VGA_80x25 , 80.Ar VGA_80x30 , 81.Ar VGA_80x50 , 82.Ar VGA_80x60 , 83.Ar VGA_90x25 , 84.Ar VGA_90x30 , 85.Ar VGA_90x43 , 86.Ar VGA_90x50 , 87.Ar VGA_90x60 , 88.Ar EGA_80x25 , 89.Ar EGA_80x43 , 90.Ar VESA_132x25 , 91.Ar VESA_132x43 , 92.Ar VESA_132x50 , 93.Ar VESA_132x60 . 94.\"The graphic mode 95.\".Ar VGA_320x200 96.\"and 97The raster text mode 98.Ar VESA_800x600 99can also be chosen. 100Alternatively, a mode can be specified with its number by using a mode name of 101the form 102.Li MODE_ Ns Aq Ar NUMBER . 103A list of valid mode numbers can be obtained with the 104.Fl i Cm mode 105option. 106See 107.Sx Video Mode Support 108below. 109.It Ar foreground Op Ar background 110Change colors when displaying text. 111Specify the foreground color 112(e.g., 113.Dq vidcontrol white ) , 114or both a foreground and background colors 115(e.g., 116.Dq vidcontrol yellow blue ) . 117Use the 118.Cm show 119command below to see available colors. 120.It Cm show 121See the supported colors on a given platform. 122.It Fl b Ar color 123Set border color to 124.Ar color . 125This option may not be always supported by the video driver. 126.It Fl C 127Clear the history buffer. 128.It Fl c Ar setting Ns Op , Ns Ar setting ... 129Change the cursor appearance. 130The change is specified by a non-empty comma-separated list of 131.Ar setting Ns s . 132Each 133.Ar setting 134overrides or modifies previous ones in left to right order. 135.Pp 136The following override 137.Ar setting Ns s 138are available: 139.Bl -tag -width indent 140.It Cm normal 141Set to a block covering 1 character cell, 142with a configuration-dependent coloring 143that should be at worst inverse video. 144.It Cm destructive 145Set to a blinking sub-block with 146.Cm height 147scanlines starting at 148.Cm base . 149The name 150.Dq destructive 151is bad for backwards compatibility. 152This 153.Ar setting 154should not force destructiveness, 155and it now only gives destructiveness in some 156configurations (typically for hardware cursors 157in text mode). 158Blinking limits destructiveness. 159This 160.Ar setting 161should now be spelled 162.Cm normal , Ns Cm blink , Ns Cm noblock . 163A non-blinking destructive cursor would be unusable, 164so old versions of 165.Nm 166did not support it, 167and this version does not have an override for it. 168.It Cm base Ns = Ns Ar value , Cm height Ns = Ns Ar value 169Set the specified scanline parameters. 170These parameters are only active in 171.Cm noblock 172mode. 173.Cm value 174is an integer in any base supported by 175.Xr strtol 3 . 176Setting 177.Cm height 178to 0 turns off the cursor in 179.Cm noblock 180mode. 181Negative 182.Ar value Ns s 183are silently ignored. 184Positive 185.Ar value Ns s 186are clamped to fit in the character cell when the cursor is drawn. 187.El 188.Pp 189The following modifier 190.Ar setting Ns s 191are available: 192.Bl -tag -width indent 193.It Cm blink , noblink 194Set or clear the blinking attribute. 195This is not quite backwards compatible. 196In old versions of 197.Nm , Cm blink 198was an override to a blinking block. 199.It Cm block , noblock 200Set or clear the 201.Cm block 202attribute. 203This attribute is the inverse of the flag 204.Dv CONS_CHAR_CURSOR 205in the implementation. 206It deactivates the scanline parameters, 207and expresses a preference for using a 208simpler method of implementation. 209Its inverse does the opposite. 210When the scanline parameters give a full block, 211this attribute reduces to a method selection bit. 212The 213.Cm block 214method tends to give better coloring. 215.It Cm hidden , nohidden 216Set or clear the hidden attribute. 217.El 218.Pp 219The following (non-sticky) flags control application of the 220.Ar setting Ns s : 221.Bl -tag -width indent 222.It Cm charcolors 223Apply 224.Cm base 225and 226.Cm height 227to the (character) cursor's list of preferred colors instead of its shape. 228Beware that the color numbers are raw VGA palette indexes, 229not ANSI color numbers. 230The indexes are reduced mod 8, 16 or 256, 231or ignored, 232depending on the video mode and renderer. 233.It Cm mousecolors 234Colors for the mouse cursor in graphics mode. 235Like 236.Cm charcolors , 237except there is no preference or sequence; 238.Cm base 239gives the mouse border color and 240.Cm height 241gives the mouse interior color. 242Together with 243.Cm charcolors , 244this gives 2 selection bits which select between 245only 3 of 4 sub-destinations of the 4 destinations selected by 246.Cm default 247and 248.Cm local 249(by ignoring 250.Cm mousecolors 251if 252.Cm charcolors 253is also set). 254.It Cm default 255Apply the changes to the default settings and then to the active settings, 256instead of only to the active settings. 257Together with 258.Cm local , 259this gives 2 selection bits which select between 4 destinations. 260.It Cm shapeonly 261Ignore any changes to the 262.Cm block 263and 264.Cm hidden 265attributes. 266.It Cm local 267Apply the changes to the current vty. 268The default is to apply them to a global place 269and copy from there to all vtys. 270.It Cm reset 271Reset everything. 272The default is to not reset. 273When the 274.Cm local 275parameter is specified, the current local settings are reset 276to default local settings. 277Otherwise, the current global settings are reset to default 278global settings and then copied to the current and default 279settings for all vtys. 280.It Cm show 281Show the current changes. 282.El 283.It Fl d 284Print out current output screen map. 285.It Fl E Ar emulator 286Set the terminal emulator to 287.Ar emulator . 288.It Fl e 289Show the active and available terminal emulators. 290.It Xo 291.Fl f 292.Oo 293.Op Ar size 294.Ar file 295.Oc 296.Xc 297Load font 298.Ar file 299for 300.Ar size 301(currently, only 302.Cm 8x8 , 303.Cm 8x14 304or 305.Cm 8x16 ) . 306The font file can be either uuencoded or in raw binary format. 307You can also use the menu-driven 308.Xr vidfont 1 309command to load the font of your choice. 310.Pp 311.Ar Size 312may be omitted, in this case 313.Nm 314will try to guess it from the size of font file. 315.Pp 316When using 317.Xr vt 4 318both 319.Ar size 320and 321.Ar file 322can be omitted, and the default font will be loaded. 323.Pp 324Note that older video cards, such as MDA and CGA, do not support 325software font. 326See also 327.Sx Video Mode Support 328and 329.Sx EXAMPLES 330below and the man page for either 331.Xr syscons 4 332or 333.Xr vt 4 334(depending on which driver you use). 335.It Fl g Ar geometry 336Set the 337.Ar geometry 338of the text mode for the modes with selectable 339geometry. 340Currently only raster modes, such as 341.Ar VESA_800x600 , 342support this option. 343See also 344.Sx Video Mode Support 345and 346.Sx EXAMPLES 347below. 348.It Fl h Ar size 349Set the size of the history (scrollback) buffer to 350.Ar size 351lines. 352.It Fl i Cm active 353Shows the active vty number. 354.It Fl i Cm adapter 355Shows info about the current video adapter. 356.It Fl i Cm mode 357Shows the possible video modes with the current video hardware. 358.It Fl l Ar screen_map 359Install screen output map file from 360.Ar screen_map . 361See also 362.Xr syscons 4 363or 364.Xr vt 4 365(depending on which driver you use). 366.It Fl L 367Install default screen output map. 368.It Fl M Ar char 369Sets the base character used to render the mouse pointer to 370.Ar char . 371.It Fl m Cm on | off 372Switch the mouse pointer 373.Cm on 374or 375.Cm off . 376Used together with the 377.Xr moused 8 378daemon for text mode cut & paste functionality. 379.It Fl p 380Capture the current contents of the video buffer corresponding 381to the terminal device referred to by standard input. 382The 383.Nm 384utility writes contents of the video buffer to the standard 385output in a raw binary format. 386For details about that 387format see 388.Sx Format of Video Buffer Dump 389below. 390Supported only with 391.Xr syscons 4 . 392.It Fl P 393Same as 394.Fl p , 395but dump contents of the video buffer in a plain text format 396ignoring nonprintable characters and information about text 397attributes. 398Supported only with 399.Xr syscons 4 . 400.It Fl H 401When used with 402.Fl p 403or 404.Fl P , 405it instructs 406.Nm 407to dump full history buffer instead of visible portion of 408the video buffer only. 409.It Fl r Ar foreground background 410Change reverse mode colors to 411.Ar foreground 412and 413.Ar background . 414.It Fl S Cm on | off 415Turn vty switching on or off. 416When vty switching is off, 417attempts to switch to a different virtual terminal will fail. 418(The default is to permit vty switching.) 419This protection can be easily bypassed when the kernel is compiled with 420the 421.Dv DDB 422option. 423However, you probably should not compile the kernel debugger on a box which 424is supposed to be physically secure. 425.It Fl s Ar number 426Set the active vty to 427.Ar number . 428.It Fl T Cm xterm | cons25 429Switch between xterm and cons25 style terminal emulation. 430.It Fl t Ar N | Cm off 431Set the screensaver timeout to 432.Ar N 433seconds, or turns it 434.Cm off . 435.It Fl x 436Use hexadecimal digits for output. 437.El 438.Ss Video Mode Support 439Note that not all modes listed above may be supported by the video 440hardware. 441You can verify which mode is supported by the video hardware, using the 442.Fl i Cm mode 443option. 444.Pp 445The VESA BIOS support must be linked to the kernel 446or loaded as a KLD module if you wish to use VESA video modes 447or 132 column modes 448(see 449.Xr vga 4 ) . 450.Pp 451You need to compile your kernel with the 452.Ar VGA_WIDTH90 453option if you wish to use VGA 90 column modes 454(see 455.Xr vga 4 ) . 456.Pp 457Video modes other than 25 and 30 line modes may require specific size of font. 458Use 459.Fl f 460option above to load a font file to the kernel. 461If the required size of font has not been loaded to the kernel, 462.Nm 463will fail if the user attempts to set a new video mode. 464.Pp 465.Bl -column "25 line modes" "8x16 (VGA), 8x14 (EGA)" -compact 466.Sy Modes Ta Sy Font size 467.No 25 line modes Ta 8x16 (VGA), 8x14 (EGA) 468.No 30 line modes Ta 8x16 469.No 43 line modes Ta 8x8 470.No 50 line modes Ta 8x8 471.No 60 line modes Ta 8x8 472.El 473.Pp 474It is better to always load all three sizes (8x8, 8x14 and 8x16) 475of the same font. 476.Pp 477You may set variables in 478.Pa /etc/rc.conf 479or 480.Pa /etc/rc.conf.local 481so that desired font files will be automatically loaded 482when the system starts up. 483See below. 484.Pp 485If you want to use any of the raster text modes you need to recompile your 486kernel with the 487.Dv SC_PIXEL_MODE 488option. 489See 490.Xr syscons 4 491or 492.Xr vt 4 493(depending on which driver you use) 494for more details on this kernel option. 495.Ss Format of Video Buffer Dump 496The 497.Nm 498utility uses the 499.Xr syscons 4 500.\" is it supported on vt(4)??? 501or 502.Xr vt 4 503.Dv CONS_SCRSHOT 504.Xr ioctl 2 505to capture the current contents of the video buffer. 506The 507.Nm 508utility writes version and additional information to the standard 509output, followed by the contents of the video buffer. 510.Pp 511VGA video memory is typically arranged in two byte tuples, 512one per character position. 513In each tuple, the first byte will be the character code, 514and the second byte is the character's color attribute. 515.Pp 516The VGA color attribute byte looks like this: 517.Bl -column "X:X" "<00000000>" "width" "bright foreground color" 518.Sy "bits# width meaning" 519.Li "7 <X0000000> 1 character blinking" 520.Li "6:4 <0XXX0000> 3 background color" 521.Li "3 <0000X000> 1 bright foreground color" 522.Li "2:0 <00000XXX> 3 foreground color" 523.El 524.Pp 525Here is a list of the three bit wide base colors: 526.Pp 527.Bl -hang -offset indent -compact 528.It 0 529Black 530.It 1 531Blue 532.It 2 533Green 534.It 3 535Cyan 536.It 4 537Red 538.It 5 539Magenta 540.It 6 541Brown 542.It 7 543Light Grey 544.El 545.Pp 546Base colors with bit 3 (the bright foreground flag) set: 547.Pp 548.Bl -hang -offset indent -compact 549.It 0 550Dark Grey 551.It 1 552Light Blue 553.It 2 554Light Green 555.It 3 556Light Cyan 557.It 4 558Light Red 559.It 5 560Light Magenta 561.It 6 562Yellow 563.It 7 564White 565.El 566.Pp 567For example, the two bytes 568.Pp 569.Dl "65 158" 570.Pp 571specify an uppercase A (character code 65), blinking 572(bit 7 set) in yellow (bits 3:0) on a blue background 573(bits 6:4). 574.Pp 575The 576.Nm 577output contains a small header which includes additional 578information which may be useful to utilities processing 579the output. 580.Pp 581The first 10 bytes are always arranged as follows: 582.Bl -column "Byte range" "Contents" -offset indent 583.It Sy "Byte Range Contents" 584.It "1 - 8 Literal text" Dq Li SCRSHOT_ 585.It "9 File format version number" 586.It "10 Remaining number of bytes in the header" 587.El 588.Pp 589Subsequent bytes depend on the version number. 590.Bl -column "Version" "13 and up" -offset indent 591.It Sy "Version Byte Meaning" 592.It "1 11 Terminal width, in characters" 593.It " 12 Terminal depth, in characters" 594.It " 13 and up The snapshot data" 595.El 596.Pp 597So a dump of an 80x25 screen would start (in hex) 598.Bd -literal -offset indent 59953 43 52 53 48 4f 54 5f 01 02 50 19 600----------------------- -- -- -- -- 601 | | | | ` 25 decimal 602 | | | `--- 80 decimal 603 | | `------ 2 remaining bytes of header data 604 | `--------- File format version 1 605 `------------------------ Literal "SCRSHOT_" 606.Ed 607.Sh VIDEO OUTPUT CONFIGURATION 608.Ss Boot Time Configuration 609You may set the following variables in 610.Pa /etc/rc.conf 611or 612.Pa /etc/rc.conf.local 613in order to configure the video output at boot time. 614.Pp 615.Bl -tag -width foo_bar_var -compact 616.It Ar blanktime 617Sets the timeout value for the 618.Fl t 619option. 620.It Ar font8x16 , font8x14 , font8x8 621Specifies font files for the 622.Fl f 623option. 624.It Ar scrnmap 625Specifies a screen output map file for the 626.Fl l 627option. 628.El 629.Pp 630See 631.Xr rc.conf 5 632for more details. 633.Ss Driver Configuration 634The video card driver may let you change default configuration 635options, such as the default font, so that you do not need to set up 636the options at boot time. 637See video card driver manuals, (e.g., 638.Xr vga 4 ) 639for details. 640.Sh FILES 641.Bl -tag -width /usr/share/syscons/scrnmaps/foo-bar -compact 642.It Pa /usr/share/syscons/fonts/* 643.It Pa /usr/share/vt/fonts/* 644font files. 645.It Pa /usr/share/syscons/scrnmaps/* 646screen output map files (relevant for 647.Xr syscons 4 648only). 649.El 650.Sh EXAMPLES 651If you want to load 652.Pa /usr/share/syscons/fonts/iso-8x16.fnt 653to the kernel, run 654.Nm 655as: 656.Pp 657.Dl vidcontrol -f 8x16 /usr/share/syscons/fonts/iso-8x16.fnt 658.Pp 659So long as the font file is in 660.Pa /usr/share/syscons/fonts 661(if using syscons) or 662.Pa /usr/share/vt/fonts 663(if using vt), 664you may abbreviate the file name as 665.Pa iso-8x16 : 666.Pp 667.Dl vidcontrol -f 8x16 iso-8x16 668.Pp 669Furthermore, you can also omit font size 670.Dq Li 8x16 : 671.Pp 672.Dl vidcontrol -f iso-8x16 673.Pp 674Moreover, the suffix specifying the font size can also be omitted; in 675this case, 676.Nm 677will use the size of the currently displayed font to construct the 678suffix: 679.Pp 680.Dl vidcontrol -f iso 681.Pp 682Likewise, you can also abbreviate the screen output map file name for 683the 684.Fl l 685option if the file is found in 686.Pa /usr/share/syscons/scrnmaps . 687.Pp 688.Dl vidcontrol -l iso-8859-1_to_cp437 689.Pp 690The above command will load 691.Pa /usr/share/syscons/scrnmaps/iso-8859-1_to_cp437.scm . 692.Pp 693The following command will set-up a 100x37 raster text mode (useful for 694some LCD models): 695.Pp 696.Dl vidcontrol -g 100x37 VESA_800x600 697.Pp 698The following command will capture the contents of the first virtual 699terminal video buffer, and redirect the output to the 700.Pa shot.scr 701file: 702.Pp 703.Dl vidcontrol -p < /dev/ttyv0 > shot.scr 704.Pp 705The following command will dump contents of the fourth virtual terminal 706video buffer 707to the standard output in the human readable format: 708.Pp 709.Dl vidcontrol -P < /dev/ttyv3 710.Sh SEE ALSO 711.Xr kbdcontrol 1 , 712.Xr vidfont 1 , 713.Xr keyboard 4 , 714.Xr screen 4 , 715.Xr syscons 4 , 716.Xr vga 4 , 717.Xr vt 4 , 718.Xr rc.conf 5 , 719.Xr kldload 8 , 720.Xr moused 8 , 721.Xr watch 8 722.Pp 723The various 724.Pa scr2* 725utilities in the 726.Pa graphics 727and 728.Pa textproc 729categories of the 730.Em "Ports Collection" . 731.Sh AUTHORS 732.An S\(/oren Schmidt Aq Mt sos@FreeBSD.org 733.An Sascha Wildner Aq Mt saw@online.de 734.Sh CONTRIBUTORS 735.An -split 736.An Maxim Sobolev Aq Mt sobomax@FreeBSD.org 737.An Nik Clayton Aq Mt nik@FreeBSD.org 738