[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Linux console: unicode_start corrupts keymap
barbier@xxxxxxxxxxx (Denis Barbier) writes:
> On Wed, Sep 29, 2004 at 10:08:34PM +0100, Roger Leigh wrote:
>> Bruno Haible <bruno@xxxxxxxxx> writes:
>>
>> > Roger Leigh wrote:
>> >> I'm using:
>> >> Linux 2.6.[6-8] and current 2.4 kernels
>> >> console-tools 0.2.3
>> >
>> > Have you tried to use kbd-1.12 instead of console-tools?
>>
>> I have now. It didn't change the behaviour of unicode_start: the
>> keymap was still corrupted.
>
> Roger, this is a Debian specific bug, I am pretty sure that pristine
> kbd-1.12 does not exhibit this bug.
There's a patch for console-tools ksyms.c here, which does appear to
correct the problem:
http://bugs.debian.org/cgi-bin/bugreport.cgi/unicode_ascii_capslock.patch?bug=263580&msg=9&att=1
--- 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;
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);
}
It may well be useful for kbd ksyms.c also, though the implementations
are sufficiently different that I wasn't sure exactly how to implement
it for kbd. The patched console-tools source looks like this:
int
add_number(int code)
{
int kbd_mode;
static int fd = -1;
if (fd < 0)
fd = get_console_fd(NULL);
if (KTYP(code) == KT_META)
return code;
ioctl(fd, KDGKBMODE, &kbd_mode);
if (kbd_mode == K_UNICODE && KTYP(code) >= syms_size) {
if ((code ^ 0xf000) < 0x80)
return K(KT_LATIN, code ^ 0xf000);
else
return code;
}
if (kbd_mode == K_UNICODE && KTYP(code) < syms_size && KVAL(code) < 0x80)
return code;
if (kbd_mode != K_UNICODE && KTYP(code) < syms_size)
return code;
return ksymtocode(codetoksym(code));
}
int
add_capslock(int code)
{
if (KTYP(code) == KT_LATIN || (code ^ 0xF000) < 0x80)
code = K(KT_LETTER, KVAL(code));
return add_number(code);
}
Regards,
Roger
--
Roger Leigh
Printing on GNU/Linux? http://gimp-print.sourceforge.net/
GPG Public Key: 0x25BFB848. Please sign and encrypt your mail.
--
Linux-UTF8: i18n of Linux on all levels
Archive: http://mail.nl.linux.org/linux-utf8/