This patch fix the bug of keyboard driver in 2.6.x kernels: input of non-latin (cyrillic for ex.) letters in utf-mode don't sense the state of CapsLock because procedures for ASCII and UNICODE chars are branch out _before_ the checking of CapsLock state --- linux-2.6.17.14.orig/drivers/char/keyboard.c 2008-02-06 11:53:35 +0200 +++ linux-2.6.17.14/drivers/char/keyboard.c 2008-02-12 10:30:32 +0200 @@ -1151,8 +1151,15 @@ unsigned char type, raw_mode; struct tty_struct *tty; int shift_final; +#define NONLATIN_LETTER_LOCK ((1 << VC_ALTGRLOCK) | (1 << VC_CTRLLLOCK) | (1 << VC_CTRLRLOCK)) +#define APPLY_CAPSLOCK if (vc_kbd_led(kbd, VC_CAPSLOCK)) { \ + key_map = key_maps[shift_final ^ (1 << KG_SHIFT)]; \ + if (key_map) \ + keysym = key_map[keycode]; \ + } + tty = vc->vc_tty; if (tty && (!tty->driver_data)) { /* No driver data? Strange. Okay we fix it then. */ @@ -1252,10 +1259,15 @@ type = KTYP(keysym); if (type < 0xf0) { - if (down && !raw_mode) + if (down && !raw_mode) { + // Assume that all input unicode chars are + // CAPSLOCK-sensitive letters + if ((shift_final & NONLATIN_LETTER_LOCK)) APPLY_CAPSLOCK; + to_utf8(vc, keysym); + } return; } type -= 0xf0; @@ -1264,13 +1276,9 @@ return; if (type == KT_LETTER) { type = KT_LATIN; - if (vc_kbd_led(kbd, VC_CAPSLOCK)) { - key_map = key_maps[shift_final ^ (1 << KG_SHIFT)]; - if (key_map) - keysym = key_map[keycode]; - } + APPLY_CAPSLOCK; } (*k_handler[type])(vc, keysym & 0xff, !down, regs);