[PLUG] remapping keys in VGA console

Carlos Konstanski ckonstanski at pippiandcarlos.com
Sun Aug 21 19:20:13 UTC 2011


On 08/21/2011 12:33 PM, Carlos Konstanski wrote:
> On 08/21/2011 11:57 AM, Martin A. Brown wrote:
>>
>> Greetings,
>>
>>  : I just used xmodmap to remap a key. It works great in X. But not 
>>  : in the VGA console.
>>
>> That is true.  X and the console use two different mechanism for 
>> remapping keys.  It can be wonderfully annoying if you find yourself 
>> switching layouts from the default.
>>
>>  : I tried editing the file in /usr/share/keymaps (Gentoo system) to 
>>  : no avail. Is this the right place, but maybe I just wasn't doing 
>>  : it right?
>>
>> I suspect that /usr/share/keymaps on your Gentoo system is the 
>> location of the console keymap files read by the loadkeys utility 
>> ('man 1 loadkeys').  You can switch layouts using loadkeys.  I use 
>> the dvorak layout and switch this way:
>>
>>   zcat /usr/share/kbd/keymaps/i386/dvorak/dvorak.map.gz | loadkeys -
>>
>>  : Is there a tool similar to xev that works in non-X shells? Are 
>>  : the kexcodes identical in X and non-X environments?
>>
>> I do not think that they keycodes are identical; in fact, they seem 
>> to be two very different worlds.  Also, I have never found something 
>> similar to 'xev', which I admit is remarkably convenient when you 
>> find yourself messing with this sort of remapping.
>>
>> Good luck,
>>
>> -Martin
> 
> Thanks, very helpful. The keycodes do not match between X and non-X. I found
> that my key mapping did work, but affected the wrong key. It's down to
> figuring out the keymaps in VGA mode. I'll look at the kernel source. I
> remembering seeing a header file with a keymap in there somewhere.
> 
> Carlos

Here's how I got 'er done:

I went the directory /usr/share/keymaps/i386/qwertz/ and made a file
de-latin1-nodeadkeys-101key-custom.map.gz. Its contents:

include "de-latin1-nodeadkeys.map"
keycode  13 = less greater bar brokenbar

This is the key that has = and + on it (in the us layout). In X, the keycode
is 21.

2 line fix! And it won't get overwritten at the next sys-apps/kbd upgrade.

Carlos



More information about the PLUG mailing list