aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/char/keyboard.c
diff options
context:
space:
mode:
authorSamuel Thibault <samuel.thibault@ens-lyon.org>2007-10-17 02:27:04 -0400
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-10-17 11:42:52 -0400
commit04c71976500352d02f60616d2b960267d8c5fe24 (patch)
treeed0d84a533e26a2c9f18d53413d183252e1d925f /drivers/char/keyboard.c
parentabdbf94d7c6f1fcb2931d5cb7562a6159323b704 (diff)
unicode diacritics support
There have been issues with non-latin1 diacritics and unicode. http://bugzilla.kernel.org/show_bug.cgi?id=7746 Git 759448f459234bfcf34b82471f0dba77a9aca498 `Kernel utf-8 handling' partly resolved it by adding conversion between diacritics and unicode. The patch below goes further by just turning diacritics into unicode, hence providing better future support. The kbd support can be fetched from http://bugzilla.kernel.org/attachment.cgi?id=12313 This was tested in all of latin1, latin9, latin2 and unicode with french and czech dead keys. Turn the kernel accent_table into unicode, and extend ioctls KDGKBDIACR and KDSKBDIACR into their equivalents KDGKBDIACRUC and KDSKBDIACR. New function int conv_uni_to_8bit(u32 uni) for converting unicode into 8bit _input_. No, we don't want to store the translation, as it is potentially sparse and large. Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org> Cc: Jan Engelhardt <jengelh@gmx.de> Cc: "Antonino A. Daplas" <adaplas@pol.net> Cc: David Woodhouse <dwmw2@infradead.org> Cc: Martin Schwidefsky <schwidefsky@de.ibm.com> Cc: Heiko Carstens <heiko.carstens@de.ibm.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/char/keyboard.c')
-rw-r--r--drivers/char/keyboard.c35
1 files changed, 25 insertions, 10 deletions
diff --git a/drivers/char/keyboard.c b/drivers/char/keyboard.c
index d95f316afb5a..5ae2a3250c50 100644
--- a/drivers/char/keyboard.c
+++ b/drivers/char/keyboard.c
@@ -38,6 +38,7 @@
38#include <linux/kbd_kern.h> 38#include <linux/kbd_kern.h>
39#include <linux/kbd_diacr.h> 39#include <linux/kbd_diacr.h>
40#include <linux/vt_kern.h> 40#include <linux/vt_kern.h>
41#include <linux/consolemap.h>
41#include <linux/sysrq.h> 42#include <linux/sysrq.h>
42#include <linux/input.h> 43#include <linux/input.h>
43#include <linux/reboot.h> 44#include <linux/reboot.h>
@@ -403,9 +404,12 @@ static unsigned int handle_diacr(struct vc_data *vc, unsigned int ch)
403 return d; 404 return d;
404 405
405 if (kbd->kbdmode == VC_UNICODE) 406 if (kbd->kbdmode == VC_UNICODE)
406 to_utf8(vc, conv_8bit_to_uni(d)); 407 to_utf8(vc, d);
407 else if (d < 0x100) 408 else {
408 put_queue(vc, d); 409 int c = conv_uni_to_8bit(d);
410 if (c != -1)
411 put_queue(vc, c);
412 }
409 413
410 return ch; 414 return ch;
411} 415}
@@ -417,9 +421,12 @@ static void fn_enter(struct vc_data *vc)
417{ 421{
418 if (diacr) { 422 if (diacr) {
419 if (kbd->kbdmode == VC_UNICODE) 423 if (kbd->kbdmode == VC_UNICODE)
420 to_utf8(vc, conv_8bit_to_uni(diacr)); 424 to_utf8(vc, diacr);
421 else if (diacr < 0x100) 425 else {
422 put_queue(vc, diacr); 426 int c = conv_uni_to_8bit(diacr);
427 if (c != -1)
428 put_queue(vc, c);
429 }
423 diacr = 0; 430 diacr = 0;
424 } 431 }
425 put_queue(vc, 13); 432 put_queue(vc, 13);
@@ -627,9 +634,12 @@ static void k_unicode(struct vc_data *vc, unsigned int value, char up_flag)
627 return; 634 return;
628 } 635 }
629 if (kbd->kbdmode == VC_UNICODE) 636 if (kbd->kbdmode == VC_UNICODE)
630 to_utf8(vc, conv_8bit_to_uni(value)); 637 to_utf8(vc, value);
631 else if (value < 0x100) 638 else {
632 put_queue(vc, value); 639 int c = conv_uni_to_8bit(value);
640 if (c != -1)
641 put_queue(vc, c);
642 }
633} 643}
634 644
635/* 645/*
@@ -646,7 +656,12 @@ static void k_deadunicode(struct vc_data *vc, unsigned int value, char up_flag)
646 656
647static void k_self(struct vc_data *vc, unsigned char value, char up_flag) 657static void k_self(struct vc_data *vc, unsigned char value, char up_flag)
648{ 658{
649 k_unicode(vc, value, up_flag); 659 unsigned int uni;
660 if (kbd->kbdmode == VC_UNICODE)
661 uni = value;
662 else
663 uni = conv_8bit_to_uni(value);
664 k_unicode(vc, uni, up_flag);
650} 665}
651 666
652static void k_dead2(struct vc_data *vc, unsigned char value, char up_flag) 667static void k_dead2(struct vc_data *vc, unsigned char value, char up_flag)