Subject: Greek support for Console (Alpha Patch Included)
To: None <tech-kern@netbsd.org>
From: Eye of the Beholder <eye.of.the.8eholder@gmail.com>
List: tech-kern
Date: 04/02/2006 01:34:28
This is a multi-part message in MIME format.

--Multipart=_Sun__2_Apr_2006_01_34_28_+0300_jjh.57j2e_hFneWI
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: 7bit

Hello.

I saw "# see dev/pckbc/wskbdmap_mfii.c for implemented layouts" in the kernel config
file and i tried to see if the format of it was simple enough for me to write a greek
keymap. I have attached a patch file. It works ok with the following features/bugs:

1) I tried to use the unicode values but it didn't work so i used the simple ISO8859-7
values. It would be better if it were unicode but the console doesn't understand it.

2) You can input greek characters by pressing the AltGr but i don't know how to lock
the mode, so that you need only to press AltGr once instead of needing to keep it
pressed.

I have done the locking by changing the line "update_modifier(id, type, 0,
MOD_MODESHIFT);" to "update_modifier(id, type, 1, MOD_MODESHIFT);" so that the locking
is permanent. Now, it is needed to only press AltGr once to change the mode. I don't
know though if it is the right way to do it or it will break something.

3) Accents (Tonoi with ; and Dialutika with : dead keys) work fine. I haven't done
the Tonoi+Dialutika case since the compose implementation needs only two keys and
the default mapping is (; + : + key), although i can use another dead key for the keys.

I use it for two days now and it didn't result to any crash or other ill efect.
Typing a Greek key and then pressing tab results to successful autocompletion of a
Greek filename in a mounted Windows partition. Also typing a message in vi and then
opening it from X or from Windows works fine so i guess the keymap works.

If there are any other Greek users, try it and tell me your opinion.
Surely it could be better but i don't have much experience with NetBSD so don't be
harsh on me.




--Multipart=_Sun__2_Apr_2006_01_34_28_+0300_jjh.57j2e_hFneWI
Content-Type: text/plain;
 name="patch.txt"
Content-Disposition: attachment;
 filename="patch.txt"
Content-Transfer-Encoding: 7bit

--- sys/dev/pckbport/wskbdmap_mfii.c-orig	2006-04-01 17:36:35.000000000 +0300
+++ sys/dev/pckbport/wskbdmap_mfii.c	2006-04-02 00:56:59.000000000 +0300
@@ -159,6 +159,39 @@
 };
 
 #ifndef WSKBD_USONLY
+static const keysym_t pckbd_keydesc_gr[] = {
+/*  pos      normal		shifted		altgr		shift-altgr */
+    KC(14),  KS_Delete,		KS_BackSpace,
+    KC(16),  KS_q,		KS_Q,		KS_semicolon,	KS_colon,
+    KC(17),  KS_w,		KS_W,		KS_gr_teliko_s,	KS_gr_S,
+    KC(18),  KS_e,		KS_E,		KS_gr_e,	KS_gr_E,
+    KC(19),  KS_r,		KS_R,		KS_gr_r,	KS_gr_R,
+    KC(20),  KS_t,		KS_T,		KS_gr_t,	KS_gr_T,
+    KC(21),  KS_y,		KS_Y,		KS_gr_y,	KS_gr_Y,
+    KC(22),  KS_u,		KS_U,		KS_gr_u,	KS_gr_U,
+    KC(23),  KS_i,		KS_I,		KS_gr_i,	KS_gr_I,
+    KC(24),  KS_o,		KS_O,		KS_gr_o,	KS_gr_O,
+    KC(25),  KS_p,		KS_P,		KS_gr_p,	KS_gr_P,
+    KC(30),  KS_a,		KS_A,		KS_gr_a,	KS_gr_A,
+    KC(31),  KS_s,		KS_S,		KS_gr_s,	KS_gr_S,
+    KC(32),  KS_d,		KS_D,		KS_gr_d,	KS_gr_D,
+    KC(33),  KS_f,		KS_F,		KS_gr_f,	KS_gr_F,
+    KC(34),  KS_g,		KS_G,		KS_gr_g,	KS_gr_G,
+    KC(35),  KS_h,		KS_H,		KS_gr_h,	KS_gr_H,
+    KC(36),  KS_j,		KS_J,		KS_gr_j,	KS_gr_J,
+    KC(37),  KS_k,		KS_K,		KS_gr_k,	KS_gr_K,
+    KC(38),  KS_l,		KS_L,		KS_gr_l,	KS_gr_L,
+    KC(39),  KS_semicolon,	KS_colon,	KS_dead_semi,	KS_dead_colon,
+    KC(44),  KS_z,		KS_Z,		KS_gr_z,	KS_gr_Z,
+    KC(45),  KS_x,		KS_X,		KS_gr_x,	KS_gr_X,
+    KC(46),  KS_c,		KS_C,		KS_gr_c,	KS_gr_C,
+    KC(47),  KS_v,		KS_V,		KS_gr_v,	KS_gr_V,
+    KC(48),  KS_b,		KS_B,		KS_gr_b,	KS_gr_B,
+    KC(49),  KS_n,		KS_N,		KS_gr_n,	KS_gr_N,
+    KC(50),  KS_m,		KS_M,		KS_gr_m,	KS_gr_M,
+    KC(184), KS_Mode_switch,	KS_Multi_key,
+};
+
 static const keysym_t pckbd_keydesc_de[] = {
 /*  pos      normal		shifted		altgr		shift-altgr */
     KC(3),   KS_2,		KS_quotedbl,	KS_twosuperior,
@@ -545,6 +578,7 @@
 		pckbd_keydesc_swapctrlcaps),
 	KBD_MAP(KB_ES ,			KB_US,	pckbd_keydesc_es),
 	KBD_MAP(KB_PT,			KB_US,	pckbd_keydesc_pt),
+	KBD_MAP(KB_GR,			KB_US,	pckbd_keydesc_gr),
 #endif /* WSKBD_USONLY */
 
 	/* placeholders */
--- sys/dev/wscons/wsksymdef.h-orig	2006-04-01 17:51:22.000000000 +0300
+++ sys/dev/wscons/wsksymdef.h	2006-04-02 00:53:21.000000000 +0300
@@ -274,6 +274,82 @@
 #define	KS_dead_diaeresis 	0x0308
 #define	KS_dead_abovering 	0x030a
 #define	KS_dead_cedilla 	0x0327
+#define        KS_dead_semi		0x0328
+#define        KS_dead_colon		0x0329
+
+/*
+ * Group Greek
+ */
+
+#define KS_gr_At		0xb6
+#define KS_gr_Et		0xb8
+#define KS_gr_Ht		0xb9
+#define KS_gr_It		0xba
+#define KS_gr_Ot		0xbc
+#define KS_gr_Yt		0xbe
+#define KS_gr_Vt		0xbf
+#define KS_gr_itd		0xc0
+#define KS_gr_A		0xc1
+#define KS_gr_B		0xc2
+#define KS_gr_G		0xc3
+#define KS_gr_D		0xc4
+#define KS_gr_E		0xc5
+#define KS_gr_Z		0xc6
+#define KS_gr_H		0xc7
+#define KS_gr_U		0xc8
+#define KS_gr_I		0xc9
+#define KS_gr_K		0xca
+#define KS_gr_L		0xcb
+#define KS_gr_M		0xcc
+#define KS_gr_N		0xcd
+#define KS_gr_J		0xce
+#define KS_gr_O		0xcf
+#define KS_gr_P		0xd0
+#define KS_gr_R		0xd1
+#define KS_gr_S		0xd3
+#define KS_gr_T		0xd4
+#define KS_gr_Y		0xd5
+#define KS_gr_F		0xd6
+#define KS_gr_X		0xd7
+#define KS_gr_C		0xd8
+#define KS_gr_V		0xd9
+#define KS_gr_Id		0xda
+#define KS_gr_Yd		0xdb
+#define KS_gr_at		0xdc
+#define KS_gr_et		0xdd
+#define KS_gr_ht		0xde
+#define KS_gr_it		0xdf
+#define KS_gr_ytd		0xe0
+#define KS_gr_a		0xe1
+#define KS_gr_b		0xe2
+#define KS_gr_g		0xe3
+#define KS_gr_d		0xe4
+#define KS_gr_e		0xe5
+#define KS_gr_z		0xe6
+#define KS_gr_h		0xe7
+#define KS_gr_u		0xe8
+#define KS_gr_i		0xe9
+#define KS_gr_k		0xea
+#define KS_gr_l		0xeb
+#define KS_gr_m		0xec
+#define KS_gr_n		0xed
+#define KS_gr_j		0xee
+#define KS_gr_o		0xef
+#define KS_gr_p		0xf0
+#define KS_gr_r		0xf1
+#define KS_gr_teliko_s		0xf2
+#define KS_gr_s		0xf3
+#define KS_gr_t		0xf4
+#define KS_gr_y		0xf5
+#define KS_gr_f		0xf6
+#define KS_gr_x		0xf7
+#define KS_gr_c		0xf8
+#define KS_gr_v		0xf9
+#define KS_gr_id		0xfa
+#define KS_gr_yd		0xfb
+#define KS_gr_ot		0xfc
+#define KS_gr_yt		0xfd
+#define KS_gr_vt		0xfe
 
 /*
  * Group 1 (modifiers)
@@ -511,6 +587,7 @@
 action(KB_FI,	0,	0x0900,	"fi",	,	"Finnish")	\
 action(KB_FR,	0,	0x0600,	"fr",	,	"French")	\
 action(KB_DE, KB_NODEAD,0x0300,	"de",".nodead",	"German")	\
+action(KB_GR,	0,	0x1400,	"gr",	,	"Greek")	\
 action(KB_HU,	0,	0x0c00,	"hu",	,	"Hungarian")	\
 action(KB_IT,	0,	0x0500,	"it",	,	"Italian")	\
 action(KB_JP,	0,	0x0800,	"jp",	,	"Japanese")	\
@@ -527,7 +604,7 @@
 
 /* Define all the KB_xx numeric values using above table */
 #define KBF_ENUM(tag, tagf, value, cc, ccf, country) tag=value,
-enum { KB_ENC_FUN(KBF_ENUM) KB_NEXT=0x1400 };
+enum { KB_ENC_FUN(KBF_ENUM) KB_NEXT=0x1500 };
 
 /* Define list of KB_xxx and country codes for array initialisation */
 #define KBF_ENCTAB(tag, tagf, value, cc, ccf, country) { tag, cc },
--- sys/dev/wscons/wskbdutil.c-orig	2006-04-02 00:36:14.000000000 +0300
+++ sys/dev/wscons/wskbdutil.c	2006-04-02 00:51:16.000000000 +0300
@@ -177,7 +177,25 @@
 	{ { KS_acute,			KS_u },			KS_uacute },
 	{ { KS_asciicircum,		KS_u },			KS_ucircumflex },
 	{ { KS_grave,			KS_u },			KS_ugrave },
-	{ { KS_acute,			KS_y },			KS_yacute }
+	{ { KS_acute,			KS_y },			KS_yacute },
+	{ { KS_dead_semi,		KS_gr_A },		KS_gr_At  },
+	{ { KS_dead_semi,		KS_gr_E },		KS_gr_Et  },
+	{ { KS_dead_semi,		KS_gr_H },		KS_gr_Ht  },
+	{ { KS_dead_semi,		KS_gr_I },		KS_gr_It  },
+	{ { KS_dead_semi,		KS_gr_O },		KS_gr_Ot  },
+	{ { KS_dead_semi,		KS_gr_Y },		KS_gr_Yt  },
+	{ { KS_dead_semi,		KS_gr_V },		KS_gr_Vt  },
+	{ { KS_dead_colon,		KS_gr_I },		KS_gr_Id  },
+	{ { KS_dead_colon,		KS_gr_Y },		KS_gr_Yd  },
+	{ { KS_dead_semi,		KS_gr_a },		KS_gr_at  },
+	{ { KS_dead_semi,		KS_gr_e },		KS_gr_et  },
+	{ { KS_dead_semi,		KS_gr_h },		KS_gr_ht  },
+	{ { KS_dead_semi,		KS_gr_i },		KS_gr_it  },
+	{ { KS_dead_semi,		KS_gr_o },		KS_gr_ot  },
+	{ { KS_dead_semi,		KS_gr_y },		KS_gr_yt  },
+	{ { KS_dead_semi,		KS_gr_v },		KS_gr_vt  },
+	{ { KS_dead_colon,		KS_gr_i },		KS_gr_id  },
+	{ { KS_dead_colon,		KS_gr_y },		KS_gr_yd  }
 };
 
 #define COMPOSE_SIZE	sizeof(compose_tab)/sizeof(compose_tab[0])
--- sys/dev/wscons/wskbd.c-orig	2006-04-02 01:14:17.000000000 +0300
+++ sys/dev/wscons/wskbd.c	2006-04-02 01:14:36.000000000 +0300
@@ -1632,7 +1632,7 @@
 		break;
 
 	case KS_Mode_switch:
-		update_modifier(id, type, 0, MOD_MODESHIFT);
+		update_modifier(id, type, 1, MOD_MODESHIFT);
 		break;
 
 	case KS_Num_Lock:


--Multipart=_Sun__2_Apr_2006_01_34_28_+0300_jjh.57j2e_hFneWI--