From: Gary McTaggart (gmt@beach.cis.ufl.edu)
Date: 06/07/93


From: gmt@beach.cis.ufl.edu (Gary McTaggart)
Subject: Re: [Q]: Swapping control and caps lock
Date: 7 Jun 1993 23:54:53

In article <GOWEN.93Jun6203927@apex.cs.tufts.edu> gowen@apex.cs.tufts.edu (Gregory Owen) writes:

> I apologize because I know this was a topic some 2 months ago,
> but I didn't have Linux running back then so I didn't make notes. How
> does one remap the left-control and the caps-lock keys on the standard
> 101-key keyboard?

If you are only interested in doing it within X, you can use xmodmap as per
the man page. (There is an example of exactly what you want to do in the
man page.) Otherwise, if you want the change to take affect everywhere,
modify /linux/kernel/chr_drv/keyboard.c as follow. I turned my left
caps-lock into a control and left the other control alone. You can
probably do what you would like by example. The GARY_WAS_HERE parts are
the original code, and the rest is my replacement to fix the keys.

Good luck!! (If you have any questions or problems, gimme a holler.)

--Gary

======================================================================
static void caps(int sc)
{
        if (kbd_dead(KGD_E0))
                set_kbd_flag(KG_RCTRL);
        else
                set_kbd_flag(KG_LCTRL);
#ifdef GARY_WAS_HERE
        if (kbd_flag(KG_CAPSLOCK))
                return; /* key already pressed: defeat repeat */
        set_kbd_flag(KG_CAPSLOCK);
        chg_vc_kbd_flag(kbd,VC_CAPSLOCK);
#endif
}

static void uncaps(int sc)
{
        if (kbd_dead(KGD_E0))
                clr_kbd_flag(KG_RCTRL);
        else
                clr_kbd_flag(KG_LCTRL);
#ifdef GARY_WAS_HERE
        clr_kbd_flag(KG_CAPSLOCK);
#endif
}