[kbd] [PATCH] loadkeys: Auto-convert “traditional”/Unicode keysyms

Michael Schutte michi at uiae.at
Sat Apr 18 00:01:40 MSD 2009


On Fri, Apr 17, 2009 at 03:01:09AM +0400, Alexey Gladkov wrote:
> I tested exactly like that:
> 
> <user>$ src/unicode_stop
> <user>$ export LANG=ru_RU.koi8r
> <user>$ setfont data/consolefonts/koi8r-8x16
> 
> <root># loadkeys data/keymaps/i386/qwerty/ruwin_cplk-KOI8-R.map
> 
> <user>$ < I getting correct chars when I typing a russian text >
> <user>$ dumpkeys -n > dump-loadkeys.old
> 
> <root># src/loadkeys data/keymaps/i386/qwerty/ruwin_cplk-KOI8-R.map
> 
> <user>$ < I getting wrong chars when I typing a russian text >
> <user>$ dumpkeys -n > dump-loadkeys.new
> 
> <root># loadkeys data/keymaps/i386/qwerty/ruwin_cplk-KOI8-R.map
> 
> <user>$ < correct chars again >

This is just weird :-(

Here’s what I get:

	$ src/unicode_stop
	$ export LANG=ru_RU.koi8r
	$ setfont data/consolefonts/koi8r-8x16
	# loadkeys data/keymaps/i386/qwerty/ruwin_cplk-KOI8-R.map
	# [some chars]
	# dumpkeys -n >dumpkeys.old
	# src/loadkeys data/keymaps/i386/qwerty/ruwin_cplk-KOI8-R.map
	# [the same chars]
	# dumpkeys -n >dumpkeys.new
	$ diff dumpkeys.*
	$

No differences at all.  I fail to see what is going on here.

loadkeys is from master (86d0ca1) and src/loadkeys from master plus my
patch, right?  Just so we don’t talk about different codebases here.

> >> How do you test this patch?
> > Pretty much the way you do: loadkeys, typing some things,
> 
> 
> Hmmm ... you typing in what language?

I tried it some with some Latin alphabets (the German, French, and
Turkish keymaps), Cyrillic and Greek.

> Your patch will change the behaviour. At least for the russian keymaps
> will need to add "charset" directive. We have 4 charsets (koi8-r,
> cp1251, cp855, iso8859-5 and utf8). Without "charset" you do not know
> what encoding is used in keymap.

The point is, my patch should not change the behaviour of loadkeys when
it is called in the “traditional” way.  If the console is in Unicode
mode and the user loads a Unicode keymap, or if the console is in XLATE
mode and the user loads a non-Unicode keymap, everything should work as
before: In these cases, loadkeys should perform no conversion at all.
So there’s no problem if a file is missing a “charset” line as long as
the user doesn’t change the way they use loadkeys – hence, no
regression.  And indeed, that’s exactly what the patch does on my
system.  I have yet to figure out why you are getting entirely different
results.

> > The true reason why I want to push this, though, is that Debian’s
> > version of kbd has had a similar patch since 2004. 
> 
> I want to be completely sure it's working with old keymaps.

That is a top priority for me as well, of course.  I would hate to break
everyone’s systems in fancy unexpected ways.

> > I’d like to get rid of this divergence without losing its useful features.
> 
> This is a good reason. :)
> 
> > This is why I’ve cleaned it up and why I’m discussing it with you now.
> 
> I am concerned keymaps legacy. We have a lot of keymaps that are not
> added to the kbd package. Your patch should support the old behaviour
> for them. Probably would be better to implement a new option to
> enable/disable autodetection.

I’m completely with you on the legacy part.  Whether to make the
auto-detection an opt-in feature, I leave for you to decide.  First of
all, I think that the bloody thing should work on every machine :-)

On Fri, Apr 17, 2009 at 05:44:17PM +0400, Alexey Gladkov wrote:
> 17.04.2009 03:01, Alexey Gladkov wrote:
> > <root># loadkeys data/keymaps/i386/qwerty/ruwin_cplk-KOI8-R.map
> > <user>$ < I getting correct chars when I typing a russian text >
> > <user>$ dumpkeys -n > dump-loadkeys.old
> > <root># src/loadkeys data/keymaps/i386/qwerty/ruwin_cplk-KOI8-R.map
> > 
> > <user>$ < I getting wrong chars when I typing a russian text >
> 
> I see a strange thing. Characters on the console in unicode mode,
> after the src/loadkeys has been executed.

This is very strange indeed.  Firstly, this is not reflected in the
dumps you sent me.  And second, the KDSKBENT ioctls should fail if
loadkeys even tries to assign Unicode keysyms in XLATE mode.

I’ll try to come up with an idea for what I am missing during this
weekend.  If you have got any thoughts as to what is going wrong, I
would be glad to hear them.

Cheers,
-- 
Michael Schutte <michi at uiae.at>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 489 bytes
Desc: Digital signature
URL: <http://lists.altlinux.org/pipermail/kbd/attachments/20090417/908ec540/attachment.bin>


More information about the kbd mailing list