debian-bugs-dist.lists.debian.org
[Top] [All Lists]

Bug#263580: loadkeys: partial fix for Caps Lock (Unicode)

Subject: Bug#263580: loadkeys: partial fix for Caps Lock Unicode
From: Denis Barbier
Date: Thu, 30 Sep 2004 23:18:35 +0200
On Wed, Sep 29, 2004 at 11:12:11PM +0100, Darren Salt wrote:
> tag 263580 patch
> thanks
> 
> The "bug" is in lib/ksyms.c.
> 
> In /usr/bin/unicode_start, there's a line
>   dumpkeys | loadkeys --unicode > /dev/null
> 
> dumpkeys correctly outputs the line, but loadkeys isn't adding the Caps Lock
> modifier (KT_LETTER) when the keyboard is in Unicode mode (set by kbd_mode)
> because it's interpreting 'e' as 0xF065 rather than 0x0065, i.e. as a 12-bit
> character code in the kernel keymap Unicode space rather than as an 8-bit
> character, possibly with a modifier.

Absolutely.

> This can be fixed for ASCII characters only by patching console-tools (patch
> attached); anything more requires a kernel patch.

> --- console-tools-0.2.3.old/lib/ksyms.c       2004-09-29 22:49:15.000000000 
> +0100
> +++ console-tools-0.2.3/lib/ksyms.c   2004-09-29 22:48:19.000000000 +0100
> @@ -1824,6 +1824,8 @@
>               else
>                       return code;
>       }
> +     if (kbd_mode == K_UNICODE && KTYP(code) < syms_size && KVAL(code) < 
> 0x80)
> +             return code;

Hmmm, not sure if this change should be applied, it seems to be only an
optimization.

>       if (kbd_mode != K_UNICODE && KTYP(code) < syms_size)
>               return code;
>       return ksymtocode(codetoksym(code));
> @@ -1832,7 +1834,7 @@
>  int
>  add_capslock(int code)
>  {
> -     if (KTYP(code) == KT_LATIN)
> +     if (KTYP(code) == KT_LATIN || (code ^ 0xF000) < 0x80)
>               code = K(KT_LETTER, KVAL(code));
>       return add_number(code);
>  }

I am going to commit a similar fix for kbd:
  if (KTYP(code) == KT_LATIN)
        code = K(KT_LETTER, KVAL(code));
  else if (KTYP(code) >= syms_size && (code ^ 0xf000) < 0x80)
        code = K(KT_LETTER, code ^ 0xf000);
It does the exact same job, and I hope it is more readable.

Denis


-- 
To UNSUBSCRIBE, email to debian-bugs-dist-REQUEST@xxxxxxxxxxxxxxxx
with a subject of "unsubscribe". Trouble? Contact listmaster@xxxxxxxxxxxxxxxx

<Prev in Thread] Current Thread [Next in Thread>
Privacy Policy