mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Jiri Bohac <jbohac@suse.cz>
To: samuel.thibault@ens-lyon.org, Andrew Morton <akpm@linux-foundation.org>
Cc: lkml <linux-kernel@vger.kernel.org>
Subject: [PATCH] console keyboard mapping broken by 04c71976
Date: Wed, 11 Jun 2008 15:48:37 +0200	[thread overview]
Message-ID: <20080611134837.GA11462@midget.suse.cz> (raw)

Hi,

the Czech (and I believe many other) console keyboard maps are
broken since 04c71976. 

To make old (non-unicode - the majority distributed with the kbd
package) keymaps work, the keyboard mapping in the kernel uses a
trick. It uses the translation tables loaded with the console
font to translate the 8-bit values to unicode values.

So with the currently available keymaps when using unicode in
the console you end up with:

- kbd->kbdmode set to VC_UNICODE, to send UTF-8 sequences to the
  terminal
- most letters, icluding non-latin1, defined as type=KT_LETTER in the
  keymap, with an 8-bit value, which only has its correct meaning
  when translated using conv_8bit_to_uni().

04c71976 changes k_self() to:
static void k_self(struct vc_data *vc, unsigned char value, char up_flag)
{
	unsigned int uni;
	if (kbd->kbdmode == VC_UNICODE)
		uni = value;
	else
		uni = conv_8bit_to_uni(value);
	k_unicode(vc, uni, up_flag);
}

It wrongly assumes, that when the keyboard is in the VC_UNICODE
mode, value is already the correct unicode value. This is only
true for latin1.

I think we need to always convert the value with
conv_8bit_to_uni(), as we did before 04c71976.

The following patch fixes the problem for me: 

diff --git a/drivers/char/keyboard.c b/drivers/char/keyboard.c
index 7f7e798..16492b7 100644
--- a/drivers/char/keyboard.c
+++ b/drivers/char/keyboard.c
@@ -678,10 +678,7 @@ static void k_deadunicode(struct vc_data *vc, unsigned int value, char up_flag)
 static void k_self(struct vc_data *vc, unsigned char value, char up_flag)
 {
 	unsigned int uni;
-	if (kbd->kbdmode == VC_UNICODE)
-		uni = value;
-	else
-		uni = conv_8bit_to_uni(value);
+	uni = conv_8bit_to_uni(value);
 	k_unicode(vc, uni, up_flag);
 }

As far as I can see, it will affect latin1 users that now get
their keymaps working even without loading the "trivial" console
map (so the conversion will not do anything) but I think they
needed to do that before 04c71976, so they probably still do
without even knowing, right?

Samuel, any comments?

-- 
Jiri Bohac <jbohac@suse.cz>
SUSE Labs, SUSE CZ


             reply	other threads:[~2008-06-11 13:48 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-06-11 13:48 Jiri Bohac [this message]
2008-06-11 14:03 ` Samuel Thibault
2008-06-11 15:10   ` Jiri Bohac
2008-06-11 15:23     ` Samuel Thibault
2008-06-12  1:18 ` Samuel Thibault
2008-06-12  1:27   ` Andrew Morton
2008-06-12  1:36     ` Samuel Thibault

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20080611134837.GA11462@midget.suse.cz \
    --to=jbohac@suse.cz \
    --cc=akpm@linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=samuel.thibault@ens-lyon.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome