Re: [PATCH] console keyboard mapping broken by 04c71976

From: Jiri Bohac
Date: Wed Jun 11 2008 - 11:10:40 EST


On Wed, Jun 11, 2008 at 03:03:04PM +0100, Samuel Thibault wrote:
> Err, at quick look it looks to me rather like a bug kbd, which doesn't
> cope with the console being in unicode mode. Which distribution are you
> using?
>
> In unicode mode, k_self is really meant to hold unicode values (there is
> no other way to provide an arbitrary unicode value in keyboard maps),
> and thus kbd should translate KT_LETTER's value from the map file's
> encoding (set by the charset directive) to unicode.

I am actually hunting down a bug this causes in openSUSE. We use
kbd-1.12. kbd does not translate anything to unicode - there is
no space for that in the 8 bits the keycode uses for the value.
The kernel needs to take care for the conversion.

I'll demonstrate the problem on tracing kbd_keycode() in
drivers/char/keyboard.c when the key "2" (keycode 3) is pressed.
The expected result is the letter letter "e" with a caron [CARON]
accent, code 0xec in iso-8859-2 [88592].

The keysym for this key in the Czech keyboard is set to 0xbec
by a call to KDSKBENT, which stores it as 0xfbec in the map.

...
type = KTYP(keysym); // 0xfb
...
type -= 0xf0; // 0xb
if (type == KT_LETTER) { // true
type = KT_LATIN; // 0

...
(*k_handler[type])(vc, keysym & 0xff, !down);
// calls k_self, note there is really no space for a
// full unicode representation ;-)

So, we need to perform the conversion in k_self (or later). Your
patch removed it from k_unicode, but only does it in k_self when
the keyboard mode is not VC_UNICODE.

[CARON]: http://en.wikipedia.org/wiki/Caron
[88592]: http://en.wikipedia.org/wiki/Iso-8859-2

Regards,

--
Jiri Bohac <jbohac@xxxxxxx>
SUSE Labs, SUSE CZ

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/