small addition to keyboard driver propose with patch

Stanislav V. Voronyi (stas@cnti.uanet.kharkov.ua)
Thu, 10 Dec 1998 00:34:51 +0200


This is a small, but as for me useful patch for
drivers/char/keyboard.c. The main idea is using console
unicode table to translate unicode keysyms to ascii symbols
when in keymap defined some U+xxxx chars, but keyboard in
in XLATE mode. For example I do

setfont koi8-8x16 -u koi8.uni
loadkeys koi8-utf

and if I type 'kbd_mode -u' my keyboard generate UTF-8 2-bytes
sequences for each russian letter, but if I set 'kbd_mode -a'
keyboard generate koi-8 codes for russian letters except of
UTF without reloading keymap by loadkeys.

Is this usefull enough to be included to official
kernel ?

Stanislav Voronyi.

-----------------------------------------------------------

--- keyboard.c.old Wed Dec 9 23:37:06 1998
+++ keyboard.c Thu Dec 10 00:00:50 1998
@@ -41,6 +41,17 @@
#include <linux/kbd_ll.h>
#include <linux/sysrq.h>

+/*
+ * Four lines bellow added for support translation unicode
+ * symbols to ASCII through console unicode table when
+ * keyboard in XLATE mode, but in keymap U+xxxx symbols
+ * persent
+ */
+#include <linux/console_struct.h>
+extern int fg_console;
+extern struct vc vc_cons[];
+extern conv_uni_to_pc(struct vc_data *conp, long ucs);
+
#define SIZE(x) (sizeof(x)/sizeof((x)[0]))

#ifndef KBD_DEFMODE
@@ -296,7 +307,13 @@
} else {
/* maybe only if (kbd->kbdmode == VC_UNICODE) ? */
if (!up_flag && !raw_mode)
- to_utf8(keysym);
+ if (kbd->kbdmode == VC_UNICODE)
+ to_utf8(keysym);
+ else if (kbd->kbdmode == VC_XLATE) { /* translate unicode to ASCII */
+ int c = conv_uni_to_pc(vc_cons[fg_console].d, keysym);
+ if (c > 0)
+ put_queue(c);
+ }
}
} else {
/* maybe beep? */

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/