DECstation keyboard mappings and XFree
Hallo everybody,
I have modified the keycode remapping table in drivers/tc/lk201-remap.c to deliver PC compatible keycodes. Aim of this modification is easier use of XFree86 on DECstations (with the standard PC-keyboard map) and the possibility to use existing loadable national keymaps for i386. In theory, this should work, in practice, it does not :-(.
I have encountered several problems when running the new remapping table with a standard i386 us.kmap.gz:
- the "Alt Function" keys on an LK401 seem to deliver no keypress event (same behaviour with the original DECstation mapping, so this seems to be a generic problem. Does the LK401 need a particular initialization to use these keys (which do not exist on an LK201)?
- When running in console mode, everything besides console switching (because of the missing ALT-keycode) and activating NumLock (keypad is always in cursor mode) works. In XFree86 the normal character keys and the main keyboard number keys work fine, but cursor keys, the Del/Insert/Pos1/End/etc. block and the numeric keyblock do not work at all or deliver wrong keycodes.
I would be very grateful if somebody could give me a hint about the reason for this behaviour, the modified lk201-remap.c is attached to this mail.
Regards,
Karsten
Signature · 4 lines
#include <standard_disclaimer> Nach Paragraph 28 Abs. 3 Bundesdatenschutzgesetz widerspreche ich der Nutzung oder Uebermittlung meiner Daten fuer Werbezwecke oder fuer die Markt- oder Meinungsforschung.
/*
* PC-compatible keyboard mappings for DEC LK201/401/501 keyboards
* 2002/02/09 by Karsten Merker <[email protected]>,
* based on the layout of the original lk201-remap.c written
* 17.05.99 by Michael Engel ([email protected]).
* This file is subject to the terms and conditions of the GNU General
* Public License, version 2. See the file "COPYING" in the main
* directory of this archive for more details.
*
* Rationale:
*
* DEC US keyboards generate keycodes in the range 0x55 - 0xfb *
* The (historically PC-centric) Linux keycodes have to be in the
* range 0x00-0x7f, so the raw keycodes from the keyboard have to
* be remapped appropriately.
*
* This remapping table in contrast to the original lk201-remap.c (which
* numbered the keys by their position from top left to lower right)
* delivers PC-compatible keycodes.
*
* Relocated keys (from a PC-keyboard point of view):
* SysReq/ScrollLock/Pause are on F13/F14/Help
* Pos1/End are on Find/Select
* ESC is on Do
* LeftPenguin/RightPenguin are on LeftCompose/RightCompose
* Menu/RightControl are on F17/F18
* The numeric keypad has PC-like layout
*/
unsigned char scancodeRemap[256] = {
/* ----- */
/* 0 */ 0, 0, 0, 0,
/* ----- */
/* 4 */ 0, 0, 0, 0,
/* ----- */
/* 8 */ 0, 0, 0, 0,
/* ----- */
/* c */ 0, 0, 0, 0,
/* ----- */
/* 10 */ 0, 0, 0, 0,
/* ----- */
/* 14 */ 0, 0, 0, 0,
/* ----- */
/* 18 */ 0, 0, 0, 0,
/* ----- */
/* 1c */ 0, 0, 0, 0,
/* ----- */
/* 20 */ 0, 0, 0, 0,
/* ----- */
/* 24 */ 0, 0, 0, 0,
/* ----- */
/* 28 */ 0, 0, 0, 0,
/* ----- */
/* 2c */ 0, 0, 0, 0,
/* ----- */
/* 30 */ 0, 0, 0, 0,
/* ----- */
/* 34 */ 0, 0, 0, 0,
/* ----- */
/* 38 */ 0, 0, 0, 0,
/* ----- */
/* 3c */ 0, 0, 0, 0,
/* ----- */
/* 40 */ 0, 0, 0, 0,
/* ----- */
/* 44 */ 0, 0, 0, 0,
/* ----- */
/* 48 */ 0, 0, 0, 0,
/* ----- */
/* 4c */ 0, 0, 0, 0,
/* ----- */
/* 50 */ 0, 0, 0, 0,
/* ----- F1 F2 */
/* 54 */ 0, 0, 59, 60,
/* ----- F3 F4 F5 */
/* 58 */ 61, 62, 63, 0,
/* ----- */
/* 5c */ 0, 0, 0, 0,
/* ----- */
/* 60 */ 0, 0, 0, 0,
/* ----- F6 F7 F8 F9 */
/* 64 */ 64, 65, 66, 67,
/* ----- F10 */
/* 68 */ 68, 0, 0, 0,
/* ----- */
/* 6c */ 0, 0, 0, 0,
/* ----- F11 F12 F13/SYSREQ */
/* 70 */ 0, 87, 88, 99,
/* ----- F14/SCR.LOCK */
/* 74 */ 70, 0, 0, 0,
/* ----- */
/* 78 */ 0, 0, 0, 0,
/* ----- HELP/PAUSE DO/ESC */
/* 7c */ 119, 1, 0, 0,
/* ----- F17/MENU F18/R.CTRL F19 F20 */
/* 80 */ 127, 97, 0, 0,
/* ----- */
/* 84 */ 0, 0, 0, 0,
/* ----- FIND/POS1 INSERT */
/* 88 */ 0, 0, 102, 110,
/* ----- REMOVE SELECT/END PREV/PAGEUP NEXT/PAGEDOWN */
/* 8c */ 111, 107, 104, 109,
/* ----- KP 0 */
/* 90 */ 0, 0, 82, 0,
/* ----- KP . KP ENTER KP 1 KP 2 */
/* 94 */ 83, 96, 79, 80,
/* ----- KP 3 KP 4 KP 5 KP 6 */
/* 98 */ 81, 75, 76, 77,
/* ----- KP ,/KP + KP 7 KP 8 KP 9 */
/* 9c */ 78, 71, 72, 73,
/* ----- KP -/KP+ KP F1/NUM LCK KP F2/KP / KP F3/KP * */
/* a0 */ 78, 69, 98, 55,
/* ----- KP F4/KP - LEFT */
/* a4 */ 74, 0, 0, 105,
/* ----- RIGHT DOWN UP SHIFT Rt */
/* a8 */ 106, 108, 103, 54,
/* ----- ALT R.COMP/R.TUX SHIFT CONTROL */
/* ac */ 56, 126, 42, 29,
/* ----- CAPS L.COMP/L.TUX ALT Rt */
/* b0 */ 58, 125, 100, 0,
/* ----- */
/* b4 */ 0, 0, 0, 0,
/* ----- */
/* b8 */ 0, 0, 0, 0,
/* ----- BKSP RET TAB ` */
/* bc */ 14, 28, 15, 0x15,
/* ----- 1 q a z */
/* c0 */ 2, 16, 30, 44,
/* ----- 2 w s */
/* c4 */ 0, 3, 17, 31,
/* ----- x </\\ 3 */
/* c8 */ 45, 86, 0, 4,
/* ----- e d c */
/* cc */ 18, 32, 46, 0,
/* ----- 4 r f v */
/* d0 */ 5, 19, 33, 47,
/* ----- SPACE 5 t */
/* d4 */ 57, 0, 6, 20,
/* ----- g b 6 */
/* d8 */ 34, 48, 0, 7,
/* ----- y h n */
/* dc */ 21, 35, 49, 0,
/* ----- 7 u j m */
/* e0 */ 8, 22, 36, 50,
/* ----- 8 i k */
/* e4 */ 0, 9, 23, 37,
/* ----- , 9 o */
/* e8 */ 51, 0, 10, 24,
/* ----- l . 0 */
/* ec */ 38, 52, 0, 11,
/* ----- p ; / */
/* f0 */ 25, 0, 39, 53,
/* ----- = ] \\/\' */
/* f4 */ 0, 13, 27, 43,
/* ----- - [ \' */
/* f8 */ 0, 12, 26, 40,
/* ----- */
/* fc */ 0, 0, 0, 0,
};
Quoted 5 lines · Karsten Merker
I have modified the keycode remapping table in
drivers/tc/lk201-remap.cto deliver PC compatible keycodes. Aim of this modification is easier use of XFree86 on DECstations (with the standard PC-keyboard map) and the possibility to use existing loadable national keymaps for i386. In theory, this should work, in practice, it does not :-(.
Hmm, why do you need (sh*tty) PC-compatible keycodes for a keaboard that
barely resembles a PC keyboard? AFAIK, XFree86 has appropriate LK201 keymaps -- see "/usr/X11R6/lib/X11/xkb/*/digital/*".
Just set up your "Keyboard" section of XF86Config correctly. E.g.
(completely untested):
Section "Keyboard"
XkbKeycodes "digital/lk(lk201)"
XkbSymbols "digital/us(us)"
XkbGeometry "digital/lk(lk201)"
EndSection
It might be nice to add these values to Xkb rules somewhere ("/usr/X11R6/lib/X11/xkb/rules/digital"?) one day, so you don't need to specify components separately for default values, but I'm not sure our XFree86 support is stable enough to consider it now.
Maciej
Signature · 3 lines
+ Maciej W. Rozycki, Technical University of Gdansk, Poland + +--------------------------------------------------------------+ + e-mail: [email protected], PGP key available +
Quoted 11 lines · Maciej W. Rozycki
Quoted 5 lines · Karsten Merker
I have modified the keycode remapping table in
drivers/tc/lk201-remap.cto deliver PC compatible keycodes. Aim of this modification is easier use of XFree86 on DECstations (with the standard PC-keyboard map) and the possibility to use existing loadable national keymaps for i386. In theory, this should work, in practice, it does not :-(.Hmm, why do you need (sh*tty) PC-compatible keycodes for a keaboard that
barely resembles a PC keyboard? AFAIK, XFree86 has appropriate LK201 keymaps -- see "/usr/X11R6/lib/X11/xkb/*/digital/*".
Because the original code does not deliver LK201 keycodes - LK201 keycodes are in the range 0x55 - 0xfb, but the kernel to my knowledge accepts only keycodes in the range 0x01 - 0x7f, so the original code already did a remapping of the LK201 raw codes (it delivered the key numbers from the top left to the downmost right keys, i.e. F1=1, F2=2, F3=3 etc.). This means that the XFree LK201 mapping did not work, and if we have to remap keycodes anyway into the range 0x01-0x7f, using a PC-compatible keymap seemed the best solution to me.
Regards,
Karsten
Signature · 4 lines
#include <standard_disclaimer> Nach Paragraph 28 Abs. 3 Bundesdatenschutzgesetz widerspreche ich der Nutzung oder Uebermittlung meiner Daten fuer Werbezwecke oder fuer die Markt- oder Meinungsforschung.
Quoted 9 lines · Karsten Merker
Quoted 3 lines
Hmm, why do you need (sh*tty) PC-compatible keycodes for a keaboard that
barely resembles a PC keyboard? AFAIK, XFree86 has appropriate LK201 keymaps -- see "/usr/X11R6/lib/X11/xkb/*/digital/*".Because the original code does not deliver LK201 keycodes - LK201 keycodes are in the range
0x55-0xfb, but the kernel to my knowledge accepts only keycodes in the range0x01-0x7f, so the original code already did a remapping of the LK201 raw codes (it delivered the key numbers from the top left to the downmost right keys, i.e. F1=1, F2=2, F3=3 etc.).
This may be reasonable for the pc_keyb.c driver, but we don't use it, do
we?
Quoted 3 lines
This means that the XFree LK201 mapping did not work, and if we have to remap keycodes anyway into the range 0x01-0x7f, using a PC-compatible keymap seemed the best solution to me.
Then the kernel needs to be fixed -- raw scancodes should be passed as is
and the translation should be done in kbd_translate(). I'm adding it to my to-do list (to be resolved soon, hopefully, together with the annoying indefinite timeout when no keyboard is attached).
Signature · 3 lines
+ Maciej W. Rozycki, Technical University of Gdansk, Poland + +--------------------------------------------------------------+ + e-mail: [email protected], PGP key available +
Hi,
Quoted 6 lines · Maciej W. Rozycki
Quoted 4 lines · Karsten Merker
Quoted 3 lines
Hmm, why do you need (sh*tty) PC-compatible keycodes for a keaboard that
barely resembles a PC keyboard? AFAIK, XFree86 has appropriate LK201 keymaps -- see "/usr/X11R6/lib/X11/xkb/*/digital/*".
Quoted 8 lines
Quoted 5 lines
Because the original code does not deliver LK201 keycodes - LK201 keycodes are in the range
0x55-0xfb, but the kernel to my knowledge accepts only keycodes in the range0x01-0x7f, so the original code already did a remapping of the LK201 raw codes (it delivered the key numbers from the top left to the downmost right keys, i.e. F1=1, F2=2, F3=3 etc.).This may be reasonable for the
pc_keyb.cdriver, but we don't use it, do
we?
Unfortunately, handle_scancode still uses the 0x80 bit internally to indicate key up transisitions (see drivers/char/keyboard.c). So IMHO only keycodes <= 0x7f are usable. Same problem with Access.Bus LK501 keyboards, btw.
Quoted 8 lines
Quoted 3 lines
This means that the XFree LK201 mapping did not work, and if we have to remap keycodes anyway into the range 0x01-0x7f, using a PC-compatible keymap seemed the best solution to me.
Then the kernel needs to be fixed -- raw scancodes should be passed as is
and the translation should be done inkbd_translate(). I'm adding it to my to-do list (to be resolved soon, hopefully, together with the annoying indefinite timeout when no keyboard is attached).
Hmmm, this change would probably affect a lot of the console infrastructure. I'm still waiting for the promised rewritten console code in 2.5 ;-).
regards,
Michael
Quoted 8 lines · Michael Engel
Quoted 4 lines
Then the kernel needs to be fixed -- raw scancodes should be passed as is
and the translation should be done inkbd_translate(). I'm adding it to my to-do list (to be resolved soon, hopefully, together with the annoying indefinite timeout when no keyboard is attached).Hmmm, this change would probably affect a lot of the console infrastructure. I'm still waiting for the promised rewritten console code in 2.5 ;-).
Not at all. There is only a small bug that needs to be fixed indrivers/char/keyboard.c.
Signature · 3 lines
+ Maciej W. Rozycki, Technical University of Gdansk, Poland + +--------------------------------------------------------------+ + e-mail: [email protected], PGP key available +
Quoted 14 lines · Maciej W. Rozycki
Quoted 9 lines · Karsten Merker
Quoted 3 lines
Hmm, why do you need (sh*tty) PC-compatible keycodes for a keaboard that
barely resembles a PC keyboard? AFAIK, XFree86 has appropriate LK201 keymaps -- see "/usr/X11R6/lib/X11/xkb/*/digital/*".Because the original code does not deliver LK201 keycodes - LK201 keycodes are in the range
0x55-0xfb, but the kernel to my knowledge accepts only keycodes in the range0x01-0x7f, so the original code already did a remapping of the LK201 raw codes (it delivered the key numbers from the top left to the downmost right keys, i.e. F1=1, F2=2, F3=3 etc.).This may be reasonable for the
pc_keyb.cdriver, but we don't use it, do
we?
Quoted 8 lines
Quoted 3 lines
This means that the XFree LK201 mapping did not work, and if we have to remap keycodes anyway into the range 0x01-0x7f, using a PC-compatible keymap seemed the best solution to me.
Then the kernel needs to be fixed -- raw scancodes should be passed as is
and the translation should be done inkbd_translate(). I'm adding it to my to-do list (to be resolved soon, hopefully, together with the annoying indefinite timeout when no keyboard is attached).
The keyboard mid-layer assumes keycodes are in the range 1-127 (with some minor hack 0 can be made to work, cfr. Amiga keboards). Bit 7 is used to differentiate between up and down events. This means you cannot get keyboards with more than 128 keys to work (e.g. some specialized keyboards for old workstations).
Perhaps it's different in the new input layer. I don't know.
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]
In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
Quoted 5 lines · Geert Uytterhoeven
The keyboard mid-layer assumes keycodes are in the range 1-127 (with some minor hack 0 can be made to work, cfr. Amiga keboards). Bit 7 is used to differentiate between up and down events. This means you cannot get keyboards with more than 128 keys to work (e.g. some specialized keyboards for old workstations).
But the raw scancode should be passed as is. A brief look atdrivers/char/keyboard.c suggests it's doable without breaking anything.
Keycodes seem to be limited to 1 - 127, but it's not a problem -- LK
keyboards do not have that many keys.
Signature · 3 lines
+ Maciej W. Rozycki, Technical University of Gdansk, Poland + +--------------------------------------------------------------+ + e-mail: [email protected], PGP key available +
Quoted 6 lines
Quoted 5 lines
Then the kernel needs to be fixed -- raw scancodes should be passed as is
and the translation should be done inkbd_translate(). I'm adding it to my to-do list (to be resolved soon, hopefully, together with the annoying indefinite timeout when no keyboard is attached).
Quoted 7 lines
The keyboard mid-layer assumes keycodes are in the range 1-127 (with some minor hack 0 can be made to work, cfr. Amiga keboards). Bit 7 is used to differentiate between up and down events. This means you cannot get keyboards with more than 128 keys to work (e.g. some specialized keyboards for old workstations).
Perhaps it's different in the new input layer. I don't know.
With the input layer the below is translated to what the console system wants.
struct input_event {
struct timeval time;
unsigned short type;
unsigned short code;
unsigned int value;
};The type field tells us if it is a key or mouse movement etc.
The code field is the value of the key. For example if you press the A key you would get KEY_A. Now buttons and keys are considered the same thing. Because of this their is a range for keys and a range for buttons. At present you can have up to 255 types of keys. For buttons and keys you can have 0x1ff buttons.
Here the value field represents the states the key press can be in:
0: The key has been released.
1: The key has been pressed.
2: The key has been pressed again.