1 .\" Copyright (c) 1995 James R. Van Zandt <jrv@vanzandt.mv.com>
2 .\" Sat Feb 18 09:11:07 EST 1995
4 .\" %%%LICENSE_START(GPLv2+_DOC_FULL)
5 .\" This is free documentation; you can redistribute it and/or
6 .\" modify it under the terms of the GNU General Public License as
7 .\" published by the Free Software Foundation; either version 2 of
8 .\" the License, or (at your option) any later version.
10 .\" The GNU General Public License's references to "object code"
11 .\" and "executables" are to be interpreted as the output of any
12 .\" document formatting or typesetting system, including
13 .\" intermediate and printed output.
15 .\" This manual is distributed in the hope that it will be useful,
16 .\" but WITHOUT ANY WARRANTY; without even the implied warranty of
17 .\" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 .\" GNU General Public License for more details.
20 .\" You should have received a copy of the GNU General Public
21 .\" License along with this manual; if not, see
22 .\" <http://www.gnu.org/licenses/>.
25 .\" Modified, Sun Feb 26 15:08:05 1995, faith@cs.unc.edu
26 .\" 2007-12-17, Samuel Thibault <samuel.thibault@ens-lyon.org>:
27 .\" document the VT_GETHIFONTMASK ioctl
29 .TH VCS 4 2007-12-17 "Linux" "Linux Programmer's Manual"
31 vcs, vcsa \- virtual console memory
34 is a character device with major number 7 and minor number
35 0, usually of mode 0644 and owner root.tty.
36 It refers to the memory of the currently
37 displayed virtual console terminal.
40 are character devices for virtual console
41 terminals, they have major number 7 and minor number 1 to 63, usually
42 mode 0644 and owner root.tty.
46 .IR "unsigned short" s
47 (in host byte order) that include attributes,
48 and prefixed with four bytes giving the screen
49 dimensions and cursor position:
57 = 0 at the top left corner of the screen.)
59 When a 512-character font is loaded,
60 the 9th bit position can be fetched by applying the
64 (available in Linux kernels 2.6.18 and above)
67 the value is returned in the
69 pointed to by the third
73 These devices replace the screendump
78 administrator can control access using filesystem permissions.
80 The devices for the first eight virtual consoles may be created by:
83 for x in 0 1 2 3 4 5 6 7 8; do
84 mknod \-m 644 /dev/vcs$x c 7 $x;
85 mknod \-m 644 /dev/vcsa$x c 7 $[$x+128];
87 chown root:tty /dev/vcs*
92 requests are supported.
98 .\" Andries Brouwer <aeb@cwi.nl>
100 Introduced with version 1.1.92 of the Linux kernel.
102 You may do a screendump on vt3 by switching to vt1 and typing
106 Note that the output does not contain
107 newline characters, so some processing may be required, like
110 old \-w 81 /dev/vcs3 | lpr
114 xetterm \-dump 3 \-file /proc/self/fd/1
119 device is used for Braille support.
121 This program displays the character and screen attributes under the
122 cursor of the second virtual console, then changes the background color
130 #include <sys/ioctl.h>
131 #include <linux/vt.h>
137 char *device = "/dev/vcsa2";
138 char *console = "/dev/tty2";
139 struct {unsigned char lines, cols, x, y;} scrn;
142 unsigned char ch, attrib;
144 fd = open(console, O_RDWR);
149 if (ioctl(fd, VT_GETHIFONTMASK, &mask) < 0) {
150 perror("VT_GETHIFONTMASK");
154 fd = open(device, O_RDWR);
159 (void) read(fd, &scrn, 4);
160 (void) lseek(fd, 4 + 2*(scrn.y*scrn.cols + scrn.x), 0);
161 (void) read(fd, &s, 2);
165 attrib = ((s & ~mask) >> 8);
166 printf("ch=\(aq%c\(aq attrib=0x%02x\\n", ch, attrib);
168 (void) lseek(fd, \-1, 1);
169 (void) write(fd, &attrib, 1);