You are not logged in.
Hi,
I'm working on an Asus zenbook UX301L, with the 4.1.2-2-ARCH kernel.
Sometime fairly recently (weeks ago) I noticed that virtual consoles 2-6 were not working properly for me.
However, I'm not sure exactly what version I was at when the change occurred, as I use the VCs infrequently.
Virtual console 1 works, but virtual consoles 2-6 are illegible, with what look like wierd graphics characters replacing the textual characters. However, something else may be going on.
Reading the first two bytes of /dev/vcsa1 shows a virtual console text screen resolution of 65 rows and 213 columns. On the other hand, reading from /dev/vcsa2 through /dev/vcsa6 shows a virtual console text screen resolution of 90 rows and 64 columns.
$ sudo ./vcs 1 1 0
mask = 0x0000
lines=65, cols=213, x=14, y=3
ch='A' (0x041) attrib=0x07
$ sudo ./vcs 2 1 0
mask = 0x0000
lines=90, cols=64, x=14, y=3
ch=' ' (0x020) attrib=0x07
$ sudo ./vcs 3 1 0
mask = 0x0000
lines=90, cols=64, x=14, y=3
ch=' ' (0x020) attrib=0x07
$ sudo ./vcs 4 1 0
mask = 0x0000
lines=90, cols=64, x=14, y=3
ch=' ' (0x020) attrib=0x07
$ sudo ./vcs 5 1 0
mask = 0x0000
lines=90, cols=64, x=14, y=3
ch=' ' (0x020) attrib=0x07
$ sudo ./vcs 6 1 0
mask = 0x0000
lines=90, cols=64, x=14, y=3
ch=' ' (0x020) attrib=0x07where the 'vcs' program is compiled from vcs.c below.
Any idea what might be going on, or how to fix it? My knowledge of virtual consoles is limited to 'man vcs'...
Thanks,
- Dan
vcs.c
-------
#include <unistd.h>
#include <stdlib.h>
#include <stdio.h>
#include <fcntl.h>
#include <sys/ioctl.h>
#include <linux/vt.h>
void usage (char *prog)
{
fprintf(stderr, "Usage: %s DEVNUM ROW COL\n"
" where DEVNUM is in the range 1 .. 6\n", prog);
exit(1);
}
int
main(int argc, char **argv)
{
int fd;
char device[32];
char console[32];
struct {unsigned char lines, cols, x, y;} scrn;
unsigned short s;
unsigned short mask;
unsigned char ch, attrib;
int devnum;
int row, col;
if (argc != 4)
usage(argv[0]);
devnum = atoi(argv[1]);
if (devnum < 1 || devnum > 6)
{
fprintf(stderr, "Device number out of range [1..6]\n");
exit(1);
}
row = atoi(argv[2]);
col = atoi(argv[3]);
snprintf (device, sizeof(device), "/dev/vcsa%d", devnum);
snprintf (console, sizeof(console), "/dev/tty%d", devnum);
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);
}
printf("mask = 0x%04x\n", mask);
(void) close(fd);
fd = open(device, O_RDWR);
if (fd < 0) {
perror(device);
exit(EXIT_FAILURE);
}
(void) read(fd, &scrn, 4);
printf ("lines=%u, cols=%u, x=%u, y=%u\n",
scrn.lines, scrn.cols, scrn.x, scrn.y);
if (row < 0 || col < 0 || row >= scrn.lines || col >= scrn.cols)
{
fprintf(stderr, "ROW or COL was out of range\n");
exit(1);
}
(void) lseek(fd, 4 + 2*(row*scrn.cols + col), 0);
(void) read(fd, &s, 2);
ch = s & 0xff;
if (s & mask)
ch |= 0x100;
attrib = ((s & ~mask) >> 8);
printf("ch='%c' (0x%03x) attrib=0x%02x\n", ch, ch, attrib);
exit(EXIT_SUCCESS);
}Last edited by dank (2015-09-04 01:35:13)
Offline
Hi Dan, welcome to the Arch Linux forums.
Please edit your post to add code tags around your terminal output and code. It makes it much easier to read.
Sakura:-
Mobo: MSI MAG X570S TORPEDO MAX // Processor: AMD Ryzen 9 5950X @4.9GHz // GFX: AMD Radeon RX 5700 XT // RAM: 32GB (4x 8GB) Corsair DDR4 (@ 3000MHz) // Storage: 1x 3TB HDD, 6x 1TB SSD, 2x 120GB SSD, 1x 275GB M2 SSD
Making lemonade from lemons since 2015.
Offline
Done.
Offline
Now on kernel 4.1.6-1-ARCH. The problem seems to have been fixed at some point.
Offline
Please remember to mark your thread as [Solved] by editing your first post and prepending it to the title.
Offline