lkml.org 
[lkml]   [1999]   [Jan]   [30]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Date
SubjectRe: Unicode console patch
In message <199901291018.KAA00693@grumpy.vocalis.com>
edmund@rano.demon.co.uk writes:

>I have a patch

> http://www.rano.demon.co.uk/kernel_patch/003

>which extends Unicode support to include mouse selection and keyboard
>mapping, so I'm inviting anyone who is interested in consolemap.c,
>selection.c or keyboard.c in drivers/char to take a look please and
>send comments.

Good job. I have made similar patch, but your method of translation
is better than mine. But I afraid that Linus refuse this patch until
2.3 will start. At the end of this letter I attach patch relative to your
code which fix error with pseudographic drawing and also add one useful
feature from my patch - get/set all variables concerning to traslations
(translate,charset,G0_charset,G1_charset,utf) with help of two additional
TIOCLINUX ioctls. The patch relative to original 2.2.1 with both your
and my code is laid here:
ftp://linux.esc.kharkov.com/pub/linux/myown/uni.patch

Also you can get my version of kbd which support all unicode
possibilities in kernel:
ftp://linux.esc.kharkov.com/pub/linux/myown/kbd-0.97vsv.tgz

SY, Stanislav Voronyi.
------------------------------------------------------------------------

diff -u --recursive linux/drivers/char/console.c linux-2.2.1/drivers/char/console.c
--- linux/drivers/char/console.c Sat Jan 30 15:41:12 1999
+++ linux-2.2.1/drivers/char/console.c Sat Jan 30 15:44:32 1999
@@ -66,6 +66,9 @@
*
* Resurrected character buffers in videoram plus lots of other trickery
* by Martin Mares <mj@atrey.karlin.mff.cuni.cz>, July 1998
+ *
+ * Adding two new TIOCLINUX ioctl-s for get/set all variables concerning to translation
+ * by Stanislav Voronyi <stas@esc.kharkov.com>
*/

#include <linux/module.h>
@@ -168,6 +171,11 @@
int kmsg_redirect = 0;

/*
+ * current translation table
+ */
+unsigned short *translation;
+
+/*
* For each existing display, we have a pointer to console currently visible
* on that display, allowing consoles other than fg_console to be refreshed
* appropriately. Unless the low-level driver supplies its own display_fg
@@ -1022,14 +1030,21 @@
case 7:
reverse = 1;
break;
+ /* stas@esc.kharkov.com:
+ * 10,11,12 is temporary translation switching
+ * usualy used for drawing pseudographics,
+ * so it must change translation here,
+ * but not in vc_cons[currcons] because
+ * if key on keboard will be pressed during
+ * drawing of pseudographics (possible thing)
+ * this keypress will be processed uncorectly.
+ */
case 10: /* ANSI X3.64-1979 (SCO-ish?)
* Select primary font, don't display
* control chars if defined, don't set
* bit 8 on output.
*/
- set_translate(vc_cons[currcons].d, charset == 0
- ? G0_charset
- : G1_charset);
+ translation=get_acm(charset == 0 ? G0_charset : G1_charset);
disp_ctrl = 0;
toggle_meta = 0;
break;
@@ -1037,7 +1052,7 @@
* Select first alternate font, lets
* chars < 32 be displayed as ROM chars.
*/
- set_translate(vc_cons[currcons].d, IBMPC_MAP);
+ translation=get_acm(IBMPC_MAP);
disp_ctrl = 1;
toggle_meta = 0;
break;
@@ -1045,7 +1060,7 @@
* Select second alternate font, toggle
* high bit before displaying as ROM char.
*/
- set_translate(vc_cons[currcons].d, IBMPC_MAP);
+ translation=get_acm(IBMPC_MAP);
disp_ctrl = 1;
toggle_meta = 1;
break;
@@ -1330,7 +1345,7 @@
color = s_color;
G0_charset = saved_G0;
G1_charset = saved_G1;
- set_translate(vc_cons[currcons].d, charset ? G1_charset : G0_charset);
+ translation=set_translate(vc_cons[currcons].d, charset ? G1_charset : G0_charset);
update_attr(currcons);
need_wrap = 0;
}
@@ -1345,7 +1360,7 @@
bottom = video_num_lines;
vc_state = ESnormal;
ques = 0;
- set_translate(vc_cons[currcons].d, LAT1_MAP);
+ translation=set_translate(vc_cons[currcons].d, LAT1_MAP);
G0_charset = LAT1_MAP;
G1_charset = GRAF_MAP;
charset = 0;
@@ -1428,12 +1443,12 @@
return;
case 14:
charset = 1;
- set_translate(vc_cons[currcons].d, G1_charset);
+ translation=set_translate(vc_cons[currcons].d, G1_charset);
disp_ctrl = 1;
return;
case 15:
charset = 0;
- set_translate(vc_cons[currcons].d, G0_charset);
+ translation=set_translate(vc_cons[currcons].d, G0_charset);
disp_ctrl = 0;
return;
case 24: case 26:
@@ -1740,7 +1755,7 @@
else if (c == 'K')
G0_charset = USER_MAP;
if (charset == 0)
- set_translate(vc_cons[currcons].d, G0_charset);
+ translation=set_translate(vc_cons[currcons].d, G0_charset);
vc_state = ESnormal;
return;
case ESsetG1:
@@ -1753,7 +1768,7 @@
else if (c == 'K')
G1_charset = USER_MAP;
if (charset == 1)
- set_translate(vc_cons[currcons].d, G1_charset);
+ translation=set_translate(vc_cons[currcons].d, G1_charset);
vc_state = ESnormal;
return;
default:
@@ -1778,10 +1793,8 @@
unsigned long draw_from = 0, draw_to = 0;
struct vt_struct *vt = (struct vt_struct *)tty->driver_data;
u16 himask, charmask;
- unsigned short *translation;

currcons = vt->vc_num;
- translation = get_acm(translate);
if (!vc_cons_allocated(currcons)) {
/* could this happen? */
static int error = 0;
@@ -2079,6 +2092,7 @@
int tioclinux(struct tty_struct *tty, unsigned long arg)
{
char type, data;
+ int currcons;

if (tty->driver.type != TTY_DRIVER_TYPE_CONSOLE)
return -EINVAL;
@@ -2122,6 +2136,41 @@
return 0;
case 12: /* get fg_console */
return fg_console;
+ /* get/set ACM & charset #
+ * its allow save/restore translation state
+ * through ioctl in programs line showfont
+ */
+ case 13: /* get ACM & charset */
+ /* bit format ucg1g0tt
+ * where tt - current translation;
+ * g0,g1 - value of G[01]_charset
+ * c - charset
+ * u - utf mode
+ * so we are able now to save/restore all
+ * variables concerning to translation
+ * VSV <stas@esc.kharkov.cov>
+ */
+ currcons=((struct vt_struct *)tty->driver_data)->vc_num;
+ data=translate;
+ data|=G0_charset<<2;
+ data|=G1_charset<<4;
+ data|=charset<<6;
+ data|=utf<<7;
+ return __put_user(data, (char *) arg+1);
+ case 14: /* set ACM & charset */
+ if (!suser())
+ return -EPERM;
+ if (get_user(data, (char *)arg+1))
+ return -EFAULT;
+ currcons=((struct vt_struct *)tty->driver_data)->vc_num;
+ utf = (data>>7)&0x01;
+ charset = (data>>6)&0x01;
+ G1_charset = (data>>4)&0x03;
+ G0_charset = (data>>2)&0x03;
+ translate = data&0x03;
+ translation = get_acm(translate);
+ return 0;
+
}
return -EINVAL;
}
diff -u --recursive linux/drivers/char/consolemap.c linux-2.2.1/drivers/char/consolemap.c
--- linux/drivers/char/consolemap.c Sat Jan 30 15:41:12 1999
+++ linux-2.2.1/drivers/char/consolemap.c Sat Jan 30 15:41:50 1999
@@ -324,9 +324,10 @@
}
}

-void set_translate(struct vc_data *conp, int m)
+unsigned short * set_translate(struct vc_data *conp, int m)
{
conp->vc_translate = m;
+ return translations[m];
}

unsigned short *get_acm(int m)
diff -u --recursive linux/drivers/char/selection.c linux-2.2.1/drivers/char/selection.c
--- linux/drivers/char/selection.c Sat Jan 30 15:41:12 1999
+++ linux-2.2.1/drivers/char/selection.c Sat Jan 30 15:41:50 1999
@@ -265,7 +265,7 @@
sel_end = new_sel_end;

/* Allocate a new buffer before freeing the old one ... */
- bp = kmalloc(((sel_end-sel_start)/2+1)*sizeof(u16), GFP_KERNEL);
+ bp = kmalloc(sel_end-sel_start, GFP_KERNEL); /* since both 16bit calculation is simple VSV */
if (!bp) {
printk(KERN_WARNING "selection: kmalloc() failed\n");
clear_selection();
diff -u --recursive linux/include/linux/consolemap.h linux-2.2.1/include/linux/consolemap.h
--- linux/include/linux/consolemap.h Sat Jan 30 15:41:12 1999
+++ linux-2.2.1/include/linux/consolemap.h Sat Jan 30 15:41:50 1999
@@ -13,5 +13,5 @@
extern unsigned short *get_acm(int m);
extern unsigned char inverse_translate(int m, int ucs);
extern u16 inverse_convert(struct vc_data *conp, int glyph);
-extern void set_translate(struct vc_data *conp, int m);
+extern unsigned short * set_translate(struct vc_data *conp, int m);
extern int conv_uni_to_pc(struct vc_data *conp, long ucs);

-
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/

\
 
 \ /
  Last update: 2005-03-22 13:50    [W:0.075 / U:0.360 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site