Samuel Thibault wrote:
> Package: manpages
> Version: 2.67-1
> Severity: normal
> Tags: patch
> 
> Hello,
> 
> Here is a documentation fix for vcsa(4): attribute/text characters are
> in the host endianness.  Also, document the VT_GETHIFONTMASK ioctl.

I edited and your patch somewhat, and fixed some other places on the page
that are affected by these changes, and applied for upstream 2.74.

Does the following look okay?

Cheers,

Michael

===================================================================
--- vcs.4       (revision 2338)
+++ vcs.4       (working copy)
@@ -22,8 +22,10 @@
 .\" USA.
 .\"
 .\" Modified, Sun Feb 26 15:08:05 1995, [EMAIL PROTECTED]
+.\" 2007-12-17, Samuel Thibault <[EMAIL PROTECTED]>:
+.\"     document the VT_GETHIFONTMASK ioctl
 .\" "
-.TH VCS 4 1995-02-19 "Linux" "Linux Programmer's Manual"
+.TH VCS 4 2007-12-17 "Linux" "Linux Programmer's Manual"
 .SH NAME
 vcs, vcsa \- virtual console memory
 .SH DESCRIPTION
@@ -36,13 +38,26 @@
 terminals, they have major number 7 and minor number 1 to 63, usually
 mode 0644 and owner root.tty.
 \fI/dev/vcsa[0\-63]\fP are the same, but
-including attributes, and prefixed with four bytes giving the screen
+using unsigned shorts (in host byte order) that include attributes,
+and prefixed with four bytes giving the screen
 dimensions and cursor position: \fIlines\fP, \fIcolumns\fP, \fIx\fP, \fIy\fP.
 (\fIx\fP = \fIy\fP = 0 at the top left corner of the screen.)
+
+When a 512-character font is loaded,
+the 9th bit position can be fetched by applying the
+.BR ioctl (2)
+\fBVT_GETHIFONTMASK\fP operation
+(available in Linux kernels 2.6.18 and above)
+on \fI/dev/tty[1\-63]\fP;
+the value is returned in the
+.I "unsigned short"
+pointed to by the third
+.BR ioctl (2)
+argument.
 .PP
-These replace the screendump
-.IR ioctl s
-of
+These devices replace the screendump
+.BR ioctl (2)
+operations of
 .BR console (4),
 so the system
 administrator can control access using file system permissions.
@@ -56,10 +71,6 @@
     done
     chown root:tty /dev/vcs*
 .fi
-
-No
-.BR ioctl (2)
-requests are supported.
 .SH FILES
 /dev/vcs[0\-63]
 .br
@@ -87,15 +98,30 @@
 #include <stdlib.h>
 #include <stdio.h>
 #include <fcntl.h>
+#include <sys/ioctl.h>
+#include <linux/vt.h>

 int
 main(void)
 {
     int fd;
     char *device = "/dev/vcsa2";
+    char *console = "/dev/tty2";
     struct {unsigned char lines, cols, x, y;} scrn;
-    char ch, attrib;
+    unsigned short s;
+    unsigned short mask;
+    unsigned char ch, attrib;

+    fd = open(console, O_RDWR);
+    if (fd < 0) {
+        perror(console);
+        exit(EXIT_FAILURE);
+    }
+    if (ioctl(fd, VT_GETHIFONTMASK, &mask) < 0) {
+        perror("VT_GETHIFONTMASK");
+        exit(EXIT_FAILURE);
+    }
+    (void) close(fd);
     fd = open(device, O_RDWR);
     if (fd < 0) {
         perror(device);
@@ -103,8 +129,11 @@
     }
     (void) read(fd, &scrn, 4);
     (void) lseek(fd, 4 + 2*(scrn.y*scrn.cols + scrn.x), 0);
-    (void) read(fd, &ch, 1);
-    (void) read(fd, &attrib, 1);
+    (void) read(fd, &s, 2);
+    ch = s & 0xff;
+    if (attrib & mask)
+        ch |= 0x100;
+    attrib = ((s & ~mask) >> 8);
     printf("ch='%c' attrib=0x%02x\\n", ch, attrib);
     attrib ^= 0x10;
     (void) lseek(fd, \-1, 1);




-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to