[comp.unix.i386] 6386 V.3.2 virtual terminal switch remapping?

jr@oglvee.UUCP (Jim Rosenberg) (06/15/89)

I have a feeling this question has come up before, so pardon if this is one of
those constantly asked things.  I'm not too crazy about having the virtual
terminal switch require a lead-in.  I've used virtual terminals on 3 other
operating systems and none of them required this.  In reading the man page for
keyboard(7) it's not clear to me whether this can be reprogrammed or not.  It
seems clear that the lead-in can be reprogrammed from ALT-Sysreq if you like,
and that following that lead-in you can map whatever you'd like to select a
given virtual terminal.  But what I'd like is to be able to have, say,
CTRL-ALT-1 give me vt00, CTRL-ALT-2 give me vt01, etc -- with *no* lead-in.
(We use QNX around here a lot, which uses those for switching virtual
terminals, so it sure would simplify things to have the same keystrokes!!!)  If
anybody knows how to do this I'd appreciate a tip.
-- 
Jim Rosenberg                        pitt
Oglevee Computer Systems                 >--!amanue!oglvee!jr
151 Oglevee Lane                      cgh
Connellsville, PA 15425                                #include <disclaimer.h>

campbell@redsox.bsw.com (Larry Campbell) (07/22/89)

The manual entry is incomplete;  you have to scrutinize kd.h carefully.
I'm glad Jim's posting (Hi, Jim!) prompted me to look this up and write
the following program (which I call kset, but you can call Nancy if you
like).

This program lets you switch consoles with Alt-F1 through Alt-F8 (instead
of the irritating Alt-Sysreq F1 through Alt-Sysreq F8);  modify to taste.
I wrote and tested it on Interactive 386/ix v2.0.1, but I assume it will
also work on the AT&T SVR3.2 release.

-----------------------------------cut here-----------------------------------
#include <stdio.h>
#include <sys/types.h>
#include <sys/at_ansi.h>
#include <sys/kd.h>

extern void exit();
extern void perror();

struct kbentry
    kbetab[] =
	{
	    { K_ALTTAB,	59, SPECIALKEY | (K_VTF + 1) },
	    { K_ALTTAB,	60, SPECIALKEY | (K_VTF + 2) },
	    { K_ALTTAB,	61, SPECIALKEY | (K_VTF + 3) },
	    { K_ALTTAB,	62, SPECIALKEY | (K_VTF + 4) },
	    { K_ALTTAB,	63, SPECIALKEY | (K_VTF + 5) },
	    { K_ALTTAB,	64, SPECIALKEY | (K_VTF + 6) },
	    { K_ALTTAB,	65, SPECIALKEY | (K_VTF + 7) },
	    { K_ALTTAB,	66, SPECIALKEY | (K_VTF + 0) },
	    { 0,         0,                        0 }
	};

main()
{
int i;

for (i = 0; kbetab[i].kb_index; i++)
    {
    if (ioctl(0, KDSKBENT, &kbetab[i]) == -1)
	{
	perror("kset: KDGKBENT ioctl failed");
	exit(1);
	}
    }
return 0;
}

-- 
Larry Campbell                          The Boston Software Works, Inc.
campbell@bsw.com                        120 Fulton Street
wjh12!redsox!campbell                   Boston, MA 02146