1 .\" Copyright (c) 1995 James R. Van Zandt <jrv@vanzandt.mv.com>
2 .\" Sat Feb 18 09:11:07 EST 1995
4 .\" This is free documentation; you can redistribute it and/or
5 .\" modify it under the terms of the GNU General Public License as
6 .\" published by the Free Software Foundation; either version 2 of
7 .\" the License, or (at your option) any later version.
9 .\" The GNU General Public License's references to "object code"
10 .\" and "executables" are to be interpreted as the output of any
11 .\" document formatting or typesetting system, including
12 .\" intermediate and printed output.
14 .\" This manual is distributed in the hope that it will be useful,
15 .\" but WITHOUT ANY WARRANTY; without even the implied warranty of
16 .\" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 .\" GNU General Public License for more details.
19 .\" You should have received a copy of the GNU General Public
20 .\" License along with this manual; if not, write to the Free
21 .\" Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111,
24 .\" Modified, Sun Feb 26 15:08:05 1995, faith@cs.unc.edu
25 .\" 2007-12-17, Samuel Thibault <samuel.thibault@ens-lyon.org>:
26 .\" document the VT_GETHIFONTMASK ioctl
28 .TH VCS 4 2007-12-17 "Linux" "Linux Programmer's Manual"
30 vcs, vcsa \- virtual console memory
32 \fI/dev/vcs0\fP is a character device with major number 7 and minor number
33 0, usually of mode 0644 and owner root.tty.
34 It refers to the memory of the currently
35 displayed virtual console terminal.
37 \fI/dev/vcs[1\-63]\fP are character devices for virtual console
38 terminals, they have major number 7 and minor number 1 to 63, usually
39 mode 0644 and owner root.tty.
40 \fI/dev/vcsa[0\-63]\fP are the same, but
42 .IR "unsigned short" s
43 (in host byte order) that include attributes,
44 and prefixed with four bytes giving the screen
45 dimensions and cursor position: \fIlines\fP, \fIcolumns\fP, \fIx\fP, \fIy\fP.
46 (\fIx\fP = \fIy\fP = 0 at the top left corner of the screen.)
48 When a 512-character font is loaded,
49 the 9th bit position can be fetched by applying the
51 \fBVT_GETHIFONTMASK\fP operation
52 (available in Linux kernels 2.6.18 and above)
53 on \fI/dev/tty[1\-63]\fP;
54 the value is returned in the
56 pointed to by the third
60 These devices replace the screendump
65 administrator can control access using file system permissions.
67 The devices for the first eight virtual consoles may be created by:
70 for x in 0 1 2 3 4 5 6 7 8; do
71 mknod \-m 644 /dev/vcs$x c 7 $x;
72 mknod \-m 644 /dev/vcsa$x c 7 $[$x+128];
74 chown root:tty /dev/vcs*
79 requests are supported.
85 .\" Andries Brouwer <aeb@cwi.nl>
87 Introduced with version 1.1.92 of the Linux kernel.
89 You may do a screendump on vt3 by switching to vt1 and typing
90 \fIcat /dev/vcs3 >foo\fP.
91 Note that the output does not contain
92 newline characters, so some processing may be required, like
93 in \fIfold \-w 81 /dev/vcs3 | lpr\fP or (horrors)
94 \fIsetterm \-dump 3 \-file /proc/self/fd/1\fP.
96 The \fI/dev/vcsa0\fP device is used for Braille support.
98 This program displays the character and screen attributes under the
99 cursor of the second virtual console, then changes the background color
107 #include <sys/ioctl.h>
108 #include <linux/vt.h>
114 char *device = "/dev/vcsa2";
115 char *console = "/dev/tty2";
116 struct {unsigned char lines, cols, x, y;} scrn;
119 unsigned char ch, attrib;
121 fd = open(console, O_RDWR);
126 if (ioctl(fd, VT_GETHIFONTMASK, &mask) < 0) {
127 perror("VT_GETHIFONTMASK");
131 fd = open(device, O_RDWR);
136 (void) read(fd, &scrn, 4);
137 (void) lseek(fd, 4 + 2*(scrn.y*scrn.cols + scrn.x), 0);
138 (void) read(fd, &s, 2);
142 attrib = ((s & ~mask) >> 8);
143 printf("ch=\(aq%c\(aq attrib=0x%02x\\n", ch, attrib);
145 (void) lseek(fd, \-1, 1);
146 (void) write(fd, &attrib, 1);