[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

more convenient way to change keymap



Hello,

attached is a tar file that contains a modified version of Marks keymap
change tool and a perl script to use it.

The modified version is called set_key and does not contain any keymap
information. It is used this way:

./set_key STATE SCANCODE VALUE [VALUE [VALUE]]

STATE: 0: key pressed without modifiers.
       1: key pressed with shift.
       2:        ...  with ctrl.
       3:        ...  with alt.
       4:        ...  with shift and alt together.

SCANCODE: A byte determining the scan code of the key.
          Not all values are used. The scan codes start roughly in the upper
          left corner of thekeyboard and end on the lower right.

VALUE ...: Up to three bytes which determine which ascii sequence should be
   send to the console when the key SCANCODE is pressed with modifier STATE.

All numbers can be decimal, hex (0x...) or octal (0...).

To use this tool conveniently, I wrote loadkeys.pl, a simple perl script
which maps symbolic names and ascii characters to SCANCODE and VALUE.
The input format for loadkeys.pl is as follows:

SCANCODE STATE0 [STATE1 [STATE2 [STATE3 [STATE4]]]]

SCANCODE: Is a symbolic name or a number specifying the scan code. See the
perl source code for a list of symbolic names. The symbolic names correspond
to a qwert* keyboard, mainly us and de. So, for example, there is a symbolic
name x for the x key, but no symbolic name y, only us_y and de_z (and vice
versa us_z == de_y).

STATE0-4: Is a list of symbolic names corresponding to the above states of
the key with scancode SCANCODE. If you want to leave out certain states (not
set them at all), use "skip". If you want to clear a certain key, use "nc".
Other symbolic names are again listed in the perl code (%value_map). Note
that I have not found good names for the delete/backspace key. Use "del" for
the "bs" scancode and "delete" for the "del" scan code (at least on a german
keyboard...).

You should be able to avoid specifying concrete numbers in the keymap
completely. If there are symbols missing, we can add them. There is a whole
range of characters above 127 that do not have a symbolic name yet because I
am lazy.

Included are two example maps (de.map for german layout, tested, en.map for
us layout, untested). I would be happy to get more layout files from other
countries.

To see 8-bit characters, I had to add "set convert-meta off" in
/etc/inputrc (and press CTRL-X CTRL-R to refresh readline).

I hope this is useful for some people. Please feel free to use the code as a
base for a more sophisticated tool. For example, move the parser into the C
code and loop over device_set_status for speed increase. Although the whole
mach terminal situation is hopefully temporary, european fellow developers
will probably feel a bit more comfortable using a native keyboard layout.

As a temporary solution we will probably want to add Kalle's AltGR patch to
GNU Mach and make my tool a bit faster and flesh out the problem (choosing
consistent symbols, providing more default maps). Then we can include the
code in some of the Debian packages.

(I considered porting console-tools package by Debian developer Yann Dirson.
This contains so many features that it would be a lot of work to peel out the 
few features that would work under Mach, so I want to delay this until we
have either the linux terminal or some cool native Hurd terminal available).

Thanks,
Marcus

-- 
`Rhubarb is no Egyptian god.' Debian http://www.debian.org   finger brinkmd@ 
Marcus Brinkmann              GNU    http://www.gnu.org     master.debian.org
Marcus.Brinkmann@ruhr-uni-bochum.de                        for public  PGP Key
http://homepage.ruhr-uni-bochum.de/Marcus.Brinkmann/       PGP Key ID 36E7CD09
y

Attachment: keymap.tar.gz
Description: Binary data


Reply to: