1.\" 2.\" vidcontrol - a utility for manipulating the syscons or vt video driver 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.\" @(#)vidcontrol.1 14.\" $FreeBSD$ 15.\" 16.Dd January 19, 2016 17.Dt VIDCONTROL 1 18.Os 19.Sh NAME 20.Nm vidcontrol 21.Nd system console control and configuration utility 22.Sh SYNOPSIS 23.Nm 24.Op Fl CdLHPpx 25.Op Fl b Ar color 26.Op Fl c Ar appearance 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.Cm setting Ns s . 132Each 133.Cm setting 134overrides or modifies previous ones in left to right order. 135.Pp 136The following override 137.Cm 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.Cm 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.Cm 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 166didn't support it, 167and this version doesn't 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.Cm 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.Cm 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 Xo 286.Fl f 287.Oo 288.Op Ar size 289.Ar file 290.Oc 291.Xc 292Load font 293.Ar file 294for 295.Ar size 296(currently, only 297.Cm 8x8 , 298.Cm 8x14 299or 300.Cm 8x16 ) . 301The font file can be either uuencoded or in raw binary format. 302You can also use the menu-driven 303.Xr vidfont 1 304command to load the font of your choice. 305.Pp 306.Ar Size 307may be omitted, in this case 308.Nm 309will try to guess it from the size of font file. 310.Pp 311When using 312.Xr vt 4 313both 314.Ar size 315and 316.Ar font 317can be omitted, and the default font will be loaded. 318.Pp 319Note that older video cards, such as MDA and CGA, do not support 320software font. 321See also 322.Sx Video Mode Support 323and 324.Sx EXAMPLES 325below and the man page for either 326.Xr syscons 4 327or 328.Xr vt 4 329(depending on which driver you use). 330.It Fl g Ar geometry 331Set the 332.Ar geometry 333of the text mode for the modes with selectable 334geometry. 335Currently only raster modes, such as 336.Ar VESA_800x600 , 337support this option. 338See also 339.Sx Video Mode Support 340and 341.Sx EXAMPLES 342below. 343.It Fl h Ar size 344Set the size of the history (scrollback) buffer to 345.Ar size 346lines. 347.It Fl i Cm active 348Shows the active vty number. 349.It Fl i Cm adapter 350Shows info about the current video adapter. 351.It Fl i Cm mode 352Shows the possible video modes with the current video hardware. 353.It Fl l Ar screen_map 354Install screen output map file from 355.Ar screen_map . 356See also 357.Xr syscons 4 358or 359.Xr vt 4 360(depending on which driver you use). 361.It Fl L 362Install default screen output map. 363.It Fl M Ar char 364Sets the base character used to render the mouse pointer to 365.Ar char . 366.It Fl m Cm on | off 367Switch the mouse pointer 368.Cm on 369or 370.Cm off . 371Used together with the 372.Xr moused 8 373daemon for text mode cut & paste functionality. 374.It Fl p 375Capture the current contents of the video buffer corresponding 376to the terminal device referred to by standard input. 377The 378.Nm 379utility writes contents of the video buffer to the standard 380output in a raw binary format. 381For details about that 382format see 383.Sx Format of Video Buffer Dump 384below. 385.It Fl P 386Same as 387.Fl p , 388but dump contents of the video buffer in a plain text format 389ignoring nonprintable characters and information about text 390attributes. 391.It Fl H 392When used with 393.Fl p 394or 395.Fl P , 396it instructs 397.Nm 398to dump full history buffer instead of visible portion of 399the video buffer only. 400.It Fl r Ar foreground background 401Change reverse mode colors to 402.Ar foreground 403and 404.Ar background . 405.It Fl S Cm on | off 406Turn vty switching on or off. 407When vty switching is off, 408attempts to switch to a different virtual terminal will fail. 409(The default is to permit vty switching.) 410This protection can be easily bypassed when the kernel is compiled with 411the 412.Dv DDB 413option. 414However, you probably should not compile the kernel debugger on a box which 415is supposed to be physically secure. 416.It Fl s Ar number 417Set the active vty to 418.Ar number . 419.It Fl T Cm xterm | cons25 420Switch between xterm and cons25 style terminal emulation. 421.It Fl t Ar N | Cm off 422Set the screensaver timeout to 423.Ar N 424seconds, or turns it 425.Cm off . 426.It Fl x 427Use hexadecimal digits for output. 428.El 429.Ss Video Mode Support 430Note that not all modes listed above may be supported by the video 431hardware. 432You can verify which mode is supported by the video hardware, using the 433.Fl i Cm mode 434option. 435.Pp 436The VESA BIOS support must be linked to the kernel 437or loaded as a KLD module if you wish to use VESA video modes 438or 132 column modes 439(see 440.Xr vga 4 ) . 441.Pp 442You need to compile your kernel with the 443.Ar VGA_WIDTH90 444option if you wish to use VGA 90 column modes 445(see 446.Xr vga 4 ) . 447.Pp 448Video modes other than 25 and 30 line modes may require specific size of font. 449Use 450.Fl f 451option above to load a font file to the kernel. 452If the required size of font has not been loaded to the kernel, 453.Nm 454will fail if the user attempts to set a new video mode. 455.Pp 456.Bl -column "25 line modes" "8x16 (VGA), 8x14 (EGA)" -compact 457.Sy Modes Ta Sy Font size 458.No 25 line modes Ta 8x16 (VGA), 8x14 (EGA) 459.No 30 line modes Ta 8x16 460.No 43 line modes Ta 8x8 461.No 50 line modes Ta 8x8 462.No 60 line modes Ta 8x8 463.El 464.Pp 465It is better to always load all three sizes (8x8, 8x14 and 8x16) 466of the same font. 467.Pp 468You may set variables in 469.Pa /etc/rc.conf 470or 471.Pa /etc/rc.conf.local 472so that desired font files will be automatically loaded 473when the system starts up. 474See below. 475.Pp 476If you want to use any of the raster text modes you need to recompile your 477kernel with the 478.Dv SC_PIXEL_MODE 479option. 480See 481.Xr syscons 4 482or 483.Xr vt 4 484(depending on which driver you use) 485for more details on this kernel option. 486.Ss Format of Video Buffer Dump 487The 488.Nm 489utility uses the 490.Xr syscons 4 491.\" is it supported on vt(4)??? 492or 493.Xr vt 4 494.Dv CONS_SCRSHOT 495.Xr ioctl 2 496to capture the current contents of the video buffer. 497The 498.Nm 499utility writes version and additional information to the standard 500output, followed by the contents of the video buffer. 501.Pp 502VGA video memory is typically arranged in two byte tuples, 503one per character position. 504In each tuple, the first byte will be the character code, 505and the second byte is the character's color attribute. 506.Pp 507The VGA color attribute byte looks like this: 508.Bl -column "X:X" "<00000000>" "width" "bright foreground color" 509.Sy "bits# width meaning" 510.Li "7 <X0000000> 1 character blinking" 511.Li "6:4 <0XXX0000> 3 background color" 512.Li "3 <0000X000> 1 bright foreground color" 513.Li "2:0 <00000XXX> 3 foreground color" 514.El 515.Pp 516Here is a list of the three bit wide base colors: 517.Pp 518.Bl -hang -offset indent -compact 519.It 0 520Black 521.It 1 522Blue 523.It 2 524Green 525.It 3 526Cyan 527.It 4 528Red 529.It 5 530Magenta 531.It 6 532Brown 533.It 7 534Light Grey 535.El 536.Pp 537Base colors with bit 3 (the bright foreground flag) set: 538.Pp 539.Bl -hang -offset indent -compact 540.It 0 541Dark Grey 542.It 1 543Light Blue 544.It 2 545Light Green 546.It 3 547Light Cyan 548.It 4 549Light Red 550.It 5 551Light Magenta 552.It 6 553Yellow 554.It 7 555White 556.El 557.Pp 558For example, the two bytes 559.Pp 560.Dl "65 158" 561.Pp 562specify an uppercase A (character code 65), blinking 563(bit 7 set) in yellow (bits 3:0) on a blue background 564(bits 6:4). 565.Pp 566The 567.Nm 568output contains a small header which includes additional 569information which may be useful to utilities processing 570the output. 571.Pp 572The first 10 bytes are always arranged as follows: 573.Bl -column "Byte range" "Contents" -offset indent 574.It Sy "Byte Range Contents" 575.It "1 thru 8 Literal text" Dq Li SCRSHOT_ 576.It "9 File format version number" 577.It "10 Remaining number of bytes in the header" 578.El 579.Pp 580Subsequent bytes depend on the version number. 581.Bl -column "Version" "13 and up" -offset indent 582.It Sy "Version Byte Meaning" 583.It "1 11 Terminal width, in characters" 584.It " 12 Terminal depth, in characters" 585.It " 13 and up The snapshot data" 586.El 587.Pp 588So a dump of an 80x25 screen would start (in hex) 589.Bd -literal -offset indent 59053 43 52 53 48 4f 54 5f 01 02 50 19 591----------------------- -- -- -- -- 592 | | | | ` 25 decimal 593 | | | `--- 80 decimal 594 | | `------ 2 remaining bytes of header data 595 | `--------- File format version 1 596 `------------------------ Literal "SCRSHOT_" 597.Ed 598.Sh VIDEO OUTPUT CONFIGURATION 599.Ss Boot Time Configuration 600You may set the following variables in 601.Pa /etc/rc.conf 602or 603.Pa /etc/rc.conf.local 604in order to configure the video output at boot time. 605.Pp 606.Bl -tag -width foo_bar_var -compact 607.It Ar blanktime 608Sets the timeout value for the 609.Fl t 610option. 611.It Ar font8x16 , font8x14 , font8x8 612Specifies font files for the 613.Fl f 614option. 615.It Ar scrnmap 616Specifies a screen output map file for the 617.Fl l 618option. 619.El 620.Pp 621See 622.Xr rc.conf 5 623for more details. 624.Ss Driver Configuration 625The video card driver may let you change default configuration 626options, such as the default font, so that you do not need to set up 627the options at boot time. 628See video card driver manuals, (e.g.\& 629.Xr vga 4 ) 630for details. 631.Sh FILES 632.Bl -tag -width /usr/share/syscons/scrnmaps/foo-bar -compact 633.It Pa /usr/share/syscons/fonts/* 634.It Pa /usr/share/vt/fonts/* 635font files. 636.It Pa /usr/share/syscons/scrnmaps/* 637screen output map files (relevant for 638.Xr syscons 4 639only). 640.El 641.Sh EXAMPLES 642If you want to load 643.Pa /usr/share/syscons/fonts/iso-8x16.fnt 644to the kernel, run 645.Nm 646as: 647.Pp 648.Dl vidcontrol -f 8x16 /usr/share/syscons/fonts/iso-8x16.fnt 649.Pp 650So long as the font file is in 651.Pa /usr/share/syscons/fonts 652(if using syscons) or 653.Pa /usr/share/vt/fonts 654(if using vt), 655you may abbreviate the file name as 656.Pa iso-8x16 : 657.Pp 658.Dl vidcontrol -f 8x16 iso-8x16 659.Pp 660Furthermore, you can also omit font size 661.Dq Li 8x16 : 662.Pp 663.Dl vidcontrol -f iso-8x16 664.Pp 665Moreover, the suffix specifying the font size can be also omitted; in 666this case, 667.Nm 668will use the size of the currently displayed font to construct the 669suffix: 670.Pp 671.Dl vidcontrol -f iso 672.Pp 673Likewise, you can also abbreviate the screen output map file name for 674the 675.Fl l 676option if the file is found in 677.Pa /usr/share/syscons/scrnmaps . 678.Pp 679.Dl vidcontrol -l iso-8859-1_to_cp437 680.Pp 681The above command will load 682.Pa /usr/share/syscons/scrnmaps/iso-8859-1_to_cp437.scm . 683.Pp 684The following command will set-up a 100x37 raster text mode (useful for 685some LCD models): 686.Pp 687.Dl vidcontrol -g 100x37 VESA_800x600 688.Pp 689The following command will capture the contents of the first virtual 690terminal video buffer, and redirect the output to the 691.Pa shot.scr 692file: 693.Pp 694.Dl vidcontrol -p < /dev/ttyv0 > shot.scr 695.Pp 696The following command will dump contents of the fourth virtual terminal 697video buffer 698to the standard output in the human readable format: 699.Pp 700.Dl vidcontrol -P < /dev/ttyv3 701.Sh SEE ALSO 702.Xr kbdcontrol 1 , 703.Xr vidfont 1 , 704.Xr keyboard 4 , 705.Xr screen 4 , 706.Xr syscons 4 , 707.Xr vga 4 , 708.Xr vt 4 , 709.Xr rc.conf 5 , 710.Xr kldload 8 , 711.Xr moused 8 , 712.Xr watch 8 713.Pp 714The various 715.Pa scr2* 716utilities in the 717.Pa graphics 718and 719.Pa textproc 720categories of the 721.Em "Ports Collection" . 722.Sh AUTHORS 723.An S\(/oren Schmidt Aq Mt sos@FreeBSD.org 724.An Sascha Wildner Aq Mt saw@online.de 725.Sh CONTRIBUTORS 726.An -split 727.An Maxim Sobolev Aq Mt sobomax@FreeBSD.org 728.An Nik Clayton Aq Mt nik@FreeBSD.org 729