Skip to contentSkip to conversation

Escape sequences & console

DISCUSSION Simon Richter 2 participants 2 messages Mar 2, 2001 – Mar 5, 2001 1 message not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): "[email protected]

#1 lore raw
Quoted 6 lines · Sébastien HINDERER

According to linux/drivers/console.c, function setterm_commands, case 12, one can change the virtual console by sending an escape sequence to /dev/cnsole (what I want to do), hower, this is not documented in man pages.

From the source of the chvt program:

    if (ioctl(fd,VT_ACTIVATE,num)) {
        perror("chvt: VT_ACTIVATE");
        exit(1);
    }
    if (ioctl(fd,VT_WAITACTIVE,num)) {
        perror("VT_WAITACTIVE");
        exit(1);
    }

Where fd is /dev/tty, /dev/tty0, /dev/console or std{in,out,err} (From the source, I doubt this ioctl works on all of those).

Simon

Signature · 4 lines
GPG public key available from http://phobos.fs.tum.de/pgp/Simon.Richter.asc
 Fingerprint: DC26 EB8D 1F35 4F44 2934  7583 DBB6 F98D 9198 3292
Hi! I'm a .signature virus! Copy me into your ~/.signature to help me spread!
UP:  10:29pm  up 7 days,  3:40,  8 users,  load average: 3.67, 4.43, 4.69
#2 lore raw
In reply to a message not in the archive
Followup to:  <Pine.LNX.4.31.0103022208050.30419-100000@phobos.fachschaften.tu-muenchen.de>
By author:    Simon Richter <[email protected]>
In newsgroup: linux.dev.kernel
Quoted 12 lines

From the source of the chvt program:

    if (ioctl(fd,VT_ACTIVATE,num)) {
        perror("chvt: VT_ACTIVATE");
        exit(1);
    }
    if (ioctl(fd,VT_WAITACTIVE,num)) {
        perror("VT_WAITACTIVE");
        exit(1);
    }
Quoted 3 lines

Where fd is /dev/tty, /dev/tty0, /dev/console or std{in,out,err} (From the source, I doubt this ioctl works on all of those).

/dev/tty0 would be the correct device (tty0 = current virtual console.)

-hpa

Signature · 3 lines
<[email protected]> at work, <[email protected]> in private!
"Unix gives you enough rope to shoot yourself in the foot."
http://www.zytor.com/~hpa/puzzle.txt