Skip to Content.
Sympa Menu

baslinux - [BL] BL2 remapping console (XT) keyboard with loadkeys

baslinux AT lists.ibiblio.org

Subject: Baslinux mailing list

List archive

Chronological Thread  
  • From: Sindi Keesan <keesan AT iamjlamb.com>
  • To: baslinux AT lists.ibiblio.org
  • Subject: [BL] BL2 remapping console (XT) keyboard with loadkeys
  • Date: Wed, 24 Mar 2004 23:27:31 -0500 (EST)

Loadkeys is the console equivalent of xmodmap.
Like xmodmap, you can use it to load a complete file of keycode maps, or
just change a few mappings in the default file.

loadkeys filename - it loads a file from /usr/lib/kbd/i386/qwerty

There are keyboard mappings for many languages including Russian,
Bulgarian, Czech, Slovak and Japanese.


If you want to change only a few keycode mappings, first determine
what the keycodes are by typing
showkey

then pressing the key you are interested in and you will get the number.

To see what all the keycodes are currently mapped to, type
dumpkeys|less

I was trying to remap the number pad PgUp and PgDn to act like the PageUp
and PageDn keys on the newer AT keyboard, because I use an XT keyboard
without the later keys and I want to be able to type Shift-PgUp and
Shift-PgDn and scroll backware or forward using the scroll buffer (like
you can do with an xterm if your keys are properly mapped).

There is a default mapping in /qwerty/ called defkeymap.map.gz. To load
the default type loadkeys defkeymap. (It also works if the file is not
gzipped). This is similar to setfont (omit the gz and it still works).
Or type loadkeys -d to reset to default. (If things get really screwed up
and you cannot type half the keys at all, type reset to fix this).

I used showkey on both Page Up/Page Down (keycodes 104 and 109) and PgUp
and PgDn (keycodes 73 and 81). I noticed that 104 and 109 (in the file
produced by dumpkeys when the default defkeymap is loaded) have as part of
the definition
shift keycode 104 = Scroll-Backward
shift keycode 109 = Scroll-Forward

Keys 73 and 81 did not have this line. Shift-PgUp produced a tilde.

I added the above lines after the lines
keycode 73 = KP_9
keycode 81 = KP_3

in a copy of the default map which I called 84key.map.
I then gzipped the file and typed
loadkeys 84key
and now I can type
shift-PgUp and scroll backward just like Shift-Page Up
shift-PgDn and scroll forward just like Shift-Page Down


THERE ARE TWO WAYS (at least) TO USE LOADKEYS TO PERMANENTLY REMAP:
1. Put 'loadkeys 84key' into rc (or rc.d or whatever you prefer) after
remapping the default file. Or loadkeys ru to type in Russian.

2. Put just a definition for the two remapped keys in rc, like
someone did in .xinitrc for the Backspace and Del keys:

loadkeys << EOF
shift keycode 73 = Scroll_Backward
shift keycode 81 = Scroll_Forward
EOF

The instructions were in the keyboard and console HOWTO and in the man
page for loadkeys (which also discussed showkey and dumpkeys).
The HOWTO appears to have a mistake in one section <<-EOF not << EOF.

Is this how our Czech list member Christof handles keyboard mapping in
BL2?


This means I can now run Kermit in console mode, and other programs in
console mode, with my 84-key XT keyboard (that lets me find the F keys
without taking my hands off the letter keys), rather than needing to
either use an AT keyboard or use an xterm (with the keys also
appropriately mapped, I presume). Since I can also, with the appropriate
video card, resizecons (resize console) to 132x25 or maybe 100x40 columns
by rows, and use setfont to load Cyrillic or other fonts of various sizes
(8x8 8x14 8x16 and sometimes others) I no longer have any reason to run
console programs in X, except if I want to use xli or xv as the viewer for
things like links text-mode or lynx, rather than installing zgv and a
bunch of related libraries.

Links2 also obviates most of the need to use X for a graphical browser in
BL2, but a version specially compiled for BL3 with support for X but not
for SVGAlib or framebuffer would be nice.

I don't know if showkey and dumpkeys would work in X, did not try them.
This seems simpler than running xev to determine keycodes.

My next challenge is how to type the extended ASCII characters with the
keyboard. In DOS you type Alt plus the number of that character but that
does not seem to work in linux. I can do it while telnetted and using
Pine (Alt-2,4,1 gives me the plus or minus character) but not at the
console prompt, where nothing at all appears when I type that. Why?

Some things are a lot easier in DOS - printing being one.





Archive powered by MHonArc 2.6.24.

Top of Page