xref: /netbsd-src/sys/dev/hil/hilkbdmap.c (revision 82d56013d7b633d116a93943de88e08335357a7c)
1 /*	$OpenBSD: hilkbdmap.c,v 1.7 2005/05/07 22:42:30 miod Exp $	*/
2 /*
3  * Copyright (c) 2003, Miodrag Vallat.
4  * All rights reserved.
5  *
6  * Redistribution and use in source and binary forms, with or without
7  * modification, are permitted provided that the following conditions
8  * are met:
9  * 1. Redistributions of source code must retain the above copyright
10  *    notice, this list of conditions and the following disclaimer.
11  * 2. Redistributions in binary form must reproduce the above copyright
12  *    notice, this list of conditions and the following disclaimer in the
13  *    documentation and/or other materials provided with the distribution.
14  *
15  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
16  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
17  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
18  * DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
19  * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
20  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
21  * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
22  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
23  * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
24  * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
25  * POSSIBILITY OF SUCH DAMAGE.
26  *
27  */
28 
29 #include "opt_wsdisplay_compat.h"
30 
31 #include <sys/types.h>
32 #include <dev/wscons/wsksymdef.h>
33 #include <dev/wscons/wsksymvar.h>
34 #include <dev/hil/hilkbdmap.h>
35 
36 #ifdef WSDISPLAY_COMPAT_RAWKBD
37 
38 /*
39  * Translate HIL keycodes to US keyboard XT scancodes, for proper
40  * X11-over-wsmux operation.
41  *
42  * XXX: Needs re-think how we should treat RAWKBD code on NetBSD.
43  */
44 const uint8_t hilkbd_raw[0x80] = {
45 	0x9d, 0x00, 0xb8, 0x38, 0x36, 0x2a, 0x1d, 0x6a,
46 	0x4b, 0x48, 0x4c, 0x49, 0x4d, 0x47, 0x53, 0x9c,
47 	0x4f, 0xb5, 0x50, 0x4e, 0x51, 0x37, 0x52, 0x4a,
48 	0x30, 0x2f, 0x2e, 0x2d, 0x2c, 0x00, 0x00, 0x01,
49 	0x00, 0x44, 0x00, 0x57, 0x53, 0x43, 0x0f, 0x58,
50 	0x23, 0x22, 0x21, 0x20, 0x1f, 0x1e, 0x00, 0x3a,
51 	0x16, 0x15, 0x14, 0x13, 0x12, 0x11, 0x10, 0x0f,
52 	0x08, 0x07, 0x06, 0x05, 0x04, 0x03, 0x02, 0x29,
53 	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
54 	0x67, 0x3e, 0x3d, 0x3c, 0x3b, 0x00, 0x46, 0x1c,
55 	0x45, 0x3f, 0x40, 0x41, 0x42, 0x00, 0x00, 0x00,
56 	0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x00, 0x00,
57 	0x17, 0x18, 0x19, 0x1a, 0x1b, 0x2b, 0xd2, 0xd3,
58 	0x24, 0x25, 0x26, 0x27, 0x28, 0x1c, 0xc7, 0xc9,
59 	0x32, 0x33, 0x34, 0x35, 0x00, 0xcf, 0x00, 0xd1,
60 	0x31, 0x39, 0x00, 0x00, 0xcb, 0xd0, 0xc8, 0xcd
61 };
62 #endif
63 
64 #define KC(n) KS_KEYCODE(n)
65 
66 /*
67  * 1f. US ASCII
68  *
69  * We use the same table for PS/2 and old HIL keyboards, as the only
70  * differences are a few keys which are only present in one of both layouts,
71  * and the one-function-only keypad in the old HIL flavour (hilkbd.c knows
72  * about this and does The Right Thing).
73  */
74 
75 static const keysym_t hilkbd_keydesc_us[] = {
76 /*  pos      command		normal		shifted */
77     KC(0),   KS_Cmd1,		KS_Control_R,
78     KC(2),   KS_Cmd2,		KS_Mode_switch,	KS_Multi_key,
79     KC(3),   KS_Cmd2,		KS_Alt_L,
80     KC(4),   KS_Cmd,		KS_Shift_R,
81     KC(5),   KS_Cmd,		KS_Shift_L,
82     KC(6),   KS_Cmd1,		KS_Control_L,
83     KC(7),   KS_Cmd_Debugger,			/* Break/Reset */
84     KC(8),			KS_KP_Left,	KS_KP_4,
85     KC(9),			KS_KP_Up,	KS_KP_8,
86     KC(10),			KS_KP_Begin,	KS_KP_5,
87     KC(11),			KS_KP_Prior,	KS_KP_9,
88     KC(12),			KS_KP_Right,	KS_KP_6,
89     KC(13),			KS_KP_Home,	KS_KP_7,
90     KC(14),			KS_KP_Separator,
91     KC(15),			KS_KP_Enter,
92     KC(16),			KS_KP_End,	KS_KP_1,
93     KC(17),			KS_KP_Divide,
94     KC(18),			KS_KP_Down,	KS_KP_2,
95     KC(19),			KS_KP_Add,
96     KC(20),			KS_KP_Next,	KS_KP_3,
97     KC(21),			KS_KP_Multiply,
98     KC(22),			KS_KP_Insert,	KS_KP_0,
99     KC(23),			KS_KP_Subtract,
100     KC(24),			KS_b,
101     KC(25),			KS_v,		KS_V,		KS_section,
102     KC(26),			KS_c,		KS_C,		KS_ccedilla,
103     KC(27),			KS_x,		KS_X,
104     KC(28),			KS_z,		KS_Z,		KS_paragraph,
105     /* 29 Kanji Left */
106 
107     KC(31), KS_Cmd_Debugger,	KS_Escape,	KS_Delete,
108     KC(33), KS_Cmd_Screen9,	KS_f10,		/* also KS_KP_F2 */
109     KC(35),			KS_f11,		/* also KS_KP_F3 */
110     KC(36),			KS_KP_Delete,	KS_KP_Decimal,
111     KC(37), KS_Cmd_Screen8,	KS_f9,		/* also KS_KP_F1 */
112     KC(38),			KS_Tab,		/* numeric pad */
113     KC(39),			KS_f12,		/* also KS_KP_F4 */
114     KC(40),			KS_h,		KS_H,		KS_yen,
115     KC(41),			KS_g,		KS_G,		KS_currency,
116     KC(42),			KS_f,
117     KC(43),			KS_d,		KS_D,		KS_eth,
118     KC(44),			KS_s,		KS_S,		KS_ssharp,
119     KC(45),			KS_a,		KS_A,		KS_aring,
120     /* 46 Mode_Switch ??? */
121     KC(47),			KS_Caps_Lock,
122     KC(48),			KS_u,		KS_U,		KS_dead_diaeresis,
123     KC(49),			KS_y,		KS_Y,		KS_dead_circumflex,
124     KC(50),			KS_t,		KS_T,		KS_dead_grave,
125     KC(51),			KS_r,		KS_R,		KS_dead_acute,
126     KC(52),			KS_e,		KS_E,		KS_ae,
127     KC(53),			KS_w,		KS_W,		KS_asciitilde,
128     KC(54),			KS_q,		KS_Q,		KS_periodcentered,
129     KC(55),			KS_Tab,
130     KC(56),			KS_7,		KS_ampersand,	KS_backslash,
131     KC(57),			KS_6,		KS_asciicircum,	KS_asciicircum,
132     KC(58),			KS_5,		KS_percent,	KS_onehalf,
133     KC(59),			KS_4,		KS_dollar,
134 				KS_onequarter,	KS_threequarters,
135     KC(60),			KS_3,		KS_numbersign,	KS_numbersign,
136     KC(61),			KS_2,		KS_at,		KS_at,
137     KC(62),			KS_1,		KS_exclam,	KS_exclamdown,
138     KC(63),			KS_grave,	KS_asciitilde,
139 				KS_guillemotleft,KS_guillemotright,
140 
141     KC(72),			KS_Print_Screen, /* Menu */
142     KC(73),  KS_Cmd_Screen3,	KS_f4,
143     KC(74),  KS_Cmd_Screen2,	KS_f3,
144     KC(75),  KS_Cmd_Screen1,	KS_f2,
145     KC(76),  KS_Cmd_Screen0,	KS_f1,
146 
147     KC(78),			KS_Hold_Screen,
148     KC(79),			KS_Return,	KS_Print_Screen,
149     KC(80),			KS_Num_Lock,	/* System/User */
150     KC(81),  KS_Cmd_Screen4,	KS_f5,
151     KC(82),  KS_Cmd_Screen5,	KS_f6,
152     KC(83),  KS_Cmd_Screen6,	KS_f7,
153     KC(84),  KS_Cmd_Screen7,	KS_f8,
154 
155     /* 86 Clear line */
156     KC(87),			KS_Clear,
157     KC(88),			KS_8,		KS_asterisk,
158 				KS_bracketleft,	KS_braceleft,
159     KC(89),			KS_9,		KS_parenleft,
160 				KS_bracketright,KS_braceright,
161     KC(90),			KS_0,		KS_parenright,	KS_questiondown,
162     KC(91),			KS_minus,	KS_underscore,	KS_macron,
163     KC(92),			KS_equal,	KS_plus,	KS_plusminus,
164     KC(93),  KS_Cmd_ResetEmul,	KS_Delete,	/* Backspace */
165     /* 94 Insert line */
166     /* 95 Delete line */
167     KC(96),			KS_i,		KS_I,		KS_dead_tilde,
168     KC(97),			KS_o,		KS_O,		KS_oslash,
169     KC(98),			KS_p,		KS_P,		KS_thorn,
170     KC(99),			KS_bracketleft,	KS_braceleft,	KS_degree,
171     KC(100),			KS_bracketright,KS_braceright,
172 				KS_bar,		KS_brokenbar,
173     KC(101),			KS_backslash,	KS_bar,		KS_mu,
174     KC(102),			KS_Insert,
175     KC(103),			KS_Delete,
176     KC(104),			KS_j,		KS_J,		KS_dollar,
177     KC(105),			KS_k,		KS_K,		KS_cent,
178     KC(106),			KS_l,		KS_L,		KS_sterling,
179     KC(107),			KS_semicolon,	KS_colon,
180     KC(108),			KS_apostrophe,	KS_quotedbl,
181 				KS_grave,	KS_apostrophe,
182     KC(109),			KS_Return,
183     KC(110),			KS_Home,
184     KC(111),			KS_Prior,
185     KC(112),			KS_m,		KS_M,		KS_masculine,
186     KC(113),			KS_comma,	KS_less,	KS_less,
187     KC(114),			KS_period,	KS_greater,	KS_greater,
188     KC(115),			KS_slash,	KS_question,	KS_underscore,
189 
190     KC(117),			KS_End,		/* Select */
191 
192     KC(119),			KS_Next,
193     KC(120),			KS_n,		KS_N,		KS_ordfeminine,
194     KC(121),			KS_space,
195 
196     /* 123 Kanji Right */
197     KC(124),			KS_Left,
198     KC(125),			KS_Down,
199     KC(126),			KS_Up,
200     KC(127),			KS_Right,
201 };
202 
203 /*
204  * 0e. Swedish
205  */
206 
207 static const keysym_t hilkbd_keydesc_sv[] = {
208     KC(56),	KS_7,		KS_slash,	KS_backslash,
209     KC(57),	KS_6,		KS_ampersand,	KS_asciicircum,
210     KC(61),	KS_2,		KS_quotedbl,	KS_at,
211     KC(63),	KS_less,	KS_greater,
212 		KS_guillemotleft,KS_guillemotright,
213     KC(88),	KS_8,		KS_parenleft,	KS_bracketleft,	KS_braceleft,
214     KC(89),	KS_9,		KS_parenright,	KS_bracketright,KS_braceright,
215     KC(90),	KS_0,		KS_equal,	KS_exclamdown,
216     KC(91),	KS_plus,	KS_question,	KS_macron,
217     KC(92),	KS_eacute,	KS_Eacute,	KS_plusminus,
218     KC(97),	KS_aring,	KS_Aring,	KS_degree,
219     KC(98),	KS_udiaeresis,	KS_Udiaeresis,	KS_bar,		KS_brokenbar,
220     KC(99),	KS_apostrophe,	KS_asterisk,	KS_mu,
221     KC(107),	KS_odiaeresis,
222     KC(108),	KS_adiaeresis,	KS_Adiaeresis,	KS_grave,	KS_apostrophe,
223     KC(113),	KS_comma,	KS_semicolon,	KS_less,
224     KC(114),	KS_period,	KS_colon,	KS_greater,
225     KC(115),	KS_minus,	KS_underscore,	KS_underscore
226 };
227 
228 static const keysym_t hilkbd_keydesc_sv_nodead[] = {
229     KC(48),	KS_u,		KS_U,		KS_diaeresis,
230     KC(49),	KS_y,		KS_Y,		KS_asciicircum,
231     KC(50),	KS_t,		KS_T,		KS_grave,
232     KC(51),	KS_r,		KS_R,		KS_apostrophe,
233     KC(96),	KS_i,		KS_I,		KS_asciitilde,
234 };
235 
236 static const keysym_t hilkbd_keydesc_sv_ps2[] = {
237     KC(24),	KS_b,
238     KC(25),	KS_v,
239     KC(26),	KS_c,
240     KC(27),	KS_x,
241     KC(28),	KS_z,
242     KC(36),	KS_KP_Separator,KS_KP_Delete,
243     KC(40),	KS_h,
244     KC(41),	KS_g,
245     KC(42),	KS_f,
246     KC(43),	KS_d,
247     KC(44),	KS_s,
248     KC(45),	KS_a,
249     KC(48),	KS_u,
250     KC(49),	KS_y,
251     KC(50),	KS_t,
252     KC(51),	KS_r,
253     KC(52),	KS_e,
254     KC(53),	KS_w,
255     KC(54),	KS_q,
256     KC(56),	KS_7,		KS_slash,	KS_braceleft,
257     KC(57),	KS_6,		KS_ampersand,
258     KC(58),	KS_5,		KS_percent,
259     KC(59),	KS_4,		KS_currency,	KS_dollar,
260     KC(60),	KS_3,		KS_numbersign,	KS_sterling,
261     KC(61),	KS_2,		KS_quotedbl,	KS_at,
262     KC(62),	KS_1,		KS_exclam,
263     KC(63),	KS_section,	KS_onehalf,
264     KC(88),	KS_8,		KS_parenleft,	KS_bracketleft,
265     KC(89),	KS_9,		KS_parenright,	KS_bracketright,
266     KC(90),	KS_0,		KS_equal,	KS_braceright,
267     KC(91),	KS_minus,	KS_question,	KS_backslash,
268     KC(92),	KS_dead_acute,	KS_dead_grave,
269     KC(96),	KS_i,
270     KC(97),	KS_o,
271     KC(98),	KS_p,
272     KC(99),	KS_aring,
273     KC(100),	KS_dead_diaeresis,KS_dead_circumflex,KS_dead_tilde,
274     KC(104),	KS_j,
275     KC(105),	KS_k,
276     KC(106),	KS_l,
277     KC(107),	KS_odiaeresis,
278     KC(108),	KS_adiaeresis,
279     KC(112),	KS_m,
280     KC(113),	KS_comma,	KS_semicolon,
281     KC(114),	KS_period,	KS_colon,
282     KC(115),	KS_minus,	KS_underscore,
283     KC(116),	KS_apostrophe,	KS_asterisk,
284     KC(118),	KS_less,	KS_greater,	KS_bar,
285     KC(120),	KS_n
286 };
287 
288 static const keysym_t hilkbd_keydesc_sv_ps2_nodead[] = {
289     KC(92),	KS_apostrophe,	KS_grave,
290     KC(100),	KS_diaeresis,	KS_asciicircum,	KS_asciitilde,
291 };
292 
293 /*
294  * 0f. German
295  */
296 
297 static const keysym_t hilkbd_keydesc_de[] = {
298     KC(28),	KS_y,		KS_Y,		KS_paragraph,
299     KC(49),	KS_z,		KS_Z,		KS_dead_circumflex,
300     KC(56),	KS_7,		KS_slash,	KS_backslash,
301     KC(57),	KS_6,		KS_ampersand,	KS_asciicircum,
302     KC(60),	KS_3,		KS_section,	KS_numbersign,
303     KC(61),	KS_2,		KS_quotedbl,	KS_at,
304     KC(63),	KS_less,	KS_greater,
305 		KS_guillemotleft,KS_guillemotright,
306     KC(88),	KS_8,		KS_parenleft,
307 		KS_bracketleft,	KS_braceleft,
308     KC(89),	KS_9,		KS_parenright,
309 		KS_bracketright,KS_braceright,
310     KC(90),	KS_0,		KS_equal,	KS_exclamdown,
311     KC(91),	KS_ssharp,	KS_question,	KS_macron,
312     KC(92),	KS_dead_acute,	KS_dead_grave,	KS_plusminus,
313     KC(99),	KS_udiaeresis,	KS_Udiaeresis,	KS_dead_abovering,
314     KC(100),	KS_plus,	KS_asterisk,	KS_bar,		KS_brokenbar,
315     KC(101),	KS_sterling,	KS_dead_circumflex,KS_mu,
316     KC(107),	KS_odiaeresis,
317     KC(108),	KS_adiaeresis,	KS_Adiaeresis,	KS_grave,	KS_apostrophe,
318     KC(113),	KS_comma,	KS_semicolon,	KS_less,
319     KC(114),	KS_period,	KS_colon,	KS_greater,
320     KC(115),	KS_minus,	KS_underscore,	KS_underscore
321 };
322 
323 static const keysym_t hilkbd_keydesc_de_nodead[] = {
324     KC(48),	KS_u,		KS_U,		KS_diaeresis,
325     KC(49),	KS_z,		KS_Z,		KS_asciicircum,
326     KC(50),	KS_t,		KS_T,		KS_grave,
327     KC(51),	KS_r,		KS_R,		KS_apostrophe,
328     KC(92),	KS_apostrophe,	KS_grave,	KS_plusminus,
329     KC(99),	KS_udiaeresis,	KS_Udiaeresis,	KS_degree,
330     KC(101),	KS_sterling,	KS_asciicircum,	KS_mu,
331     KC(96),	KS_i,		KS_I,		KS_asciitilde
332 };
333 
334 static const keysym_t hilkbd_keydesc_de_ps2[] = {
335     KC(24),	KS_b,
336     KC(25),	KS_v,
337     KC(26),	KS_c,
338     KC(27),	KS_x,
339     KC(28),	KS_y,
340     KC(36),	KS_KP_Separator,KS_KP_Delete,
341     KC(40),	KS_h,
342     KC(41),	KS_g,
343     KC(42),	KS_f,
344     KC(43),	KS_d,
345     KC(44),	KS_s,
346     KC(45),	KS_a,
347     KC(48),	KS_u,
348     KC(49),	KS_z,		KS_Z,		KS_dead_circumflex,
349     KC(50),	KS_t,
350     KC(51),	KS_r,
351     KC(52),	KS_e,
352     KC(53),	KS_w,
353     KC(54),	KS_q,		KS_Q,		KS_at,
354     KC(56),	KS_7,		KS_slash,	KS_braceleft,
355     KC(57),	KS_6,		KS_ampersand,
356     KC(58),	KS_5,		KS_percent,
357     KC(59),	KS_4,		KS_dollar,
358     KC(60),	KS_3,		KS_section,	KS_threesuperior,
359     KC(61),	KS_2,		KS_quotedbl,	KS_twosuperior,
360     KC(62),	KS_1,		KS_exclam,
361     KC(63),	KS_dead_circumflex,	KS_dead_abovering,
362     KC(88),	KS_8,		KS_parenleft,	KS_bracketleft,
363     KC(89),	KS_9,		KS_parenright,	KS_bracketright,
364     KC(90),	KS_0,		KS_equal,	KS_braceright,
365     KC(91),	KS_ssharp,	KS_question,	KS_backslash,
366     KC(92),	KS_dead_acute,	KS_dead_grave,
367     KC(96),	KS_i,
368     KC(97),	KS_o,
369     KC(98),	KS_p,
370     KC(99),	KS_udiaeresis,
371     KC(100),	KS_plus,	KS_asterisk,	KS_dead_tilde,
372     KC(104),	KS_j,
373     KC(105),	KS_k,
374     KC(106),	KS_l,
375     KC(107),	KS_odiaeresis,
376     KC(108),	KS_adiaeresis,
377     KC(112),	KS_m,		KS_M,		KS_mu,
378     KC(113),	KS_comma,	KS_semicolon,
379     KC(114),	KS_period,	KS_colon,
380     KC(115),	KS_minus,	KS_underscore,
381     KC(116),	KS_numbersign,	KS_apostrophe,
382     KC(118),	KS_less,	KS_greater, 	KS_bar,
383     KC(120),	KS_n
384 };
385 
386 static const keysym_t hilkbd_keydesc_de_ps2_nodead[] = {
387     KC(49),	KS_z,		KS_Z,		KS_asciicircum,
388     KC(63),	KS_asciicircum,	KS_degree,
389     KC(92),	KS_apostrophe,	KS_grave,
390     KC(100),	KS_plus,	KS_asterisk,	KS_asciitilde
391 };
392 
393 /*
394  * 17. English
395  */
396 
397 static const keysym_t hilkbd_keydesc_uk[] = {
398     KC(56),	KS_7,		KS_asciicircum,	KS_backslash,
399     KC(57),	KS_6,		KS_ampersand,	KS_asciicircum,
400     KC(60),	KS_3,		KS_sterling,	KS_numbersign,
401     KC(61),	KS_2,		KS_quotedbl,	KS_at,
402     KC(88),	KS_8,		KS_parenleft,	KS_bracketleft,	KS_braceleft,
403     KC(89),	KS_9,		KS_parenright,	KS_bracketright,KS_braceright,
404     KC(90),	KS_0,		KS_equal,	KS_questiondown,
405     KC(91),	KS_plus,	KS_question,	KS_macron,
406     KC(92),	KS_apostrophe,	KS_slash,	KS_plusminus,
407     KC(101),	KS_less,	KS_greater,	KS_mu,
408     KC(107),	KS_asterisk,	KS_at,
409     KC(108),	KS_backslash,	KS_bar,		KS_grave,	KS_apostrophe,
410     KC(113),	KS_comma,	KS_semicolon,	KS_less,
411     KC(114),	KS_period,	KS_colon,	KS_greater,
412     KC(115),	KS_minus,	KS_underscore,	KS_underscore
413 };
414 
415 static const keysym_t hilkbd_keydesc_uk_ps2[] = {
416     KC(24),	KS_b,
417     KC(25),	KS_v,
418     KC(26),	KS_c,
419     KC(27),	KS_x,
420     KC(28),	KS_z,
421     KC(40),	KS_h,
422     KC(41),	KS_g,
423     KC(42),	KS_f,
424     KC(43),	KS_d,
425     KC(44),	KS_s,
426     KC(45),	KS_a,
427     KC(48),	KS_u,
428     KC(49),	KS_y,
429     KC(50),	KS_t,
430     KC(51),	KS_r,
431     KC(52),	KS_e,
432     KC(53),	KS_w,
433     KC(54),	KS_q,
434     KC(56),	KS_7,		KS_ampersand,
435     KC(57),	KS_6,		KS_asciicircum,
436     KC(58),	KS_5,		KS_percent,
437     KC(59),	KS_4,		KS_dollar,
438     KC(60),	KS_3,		KS_sterling,
439     KC(61),	KS_2,		KS_quotedbl,
440     KC(62),	KS_1,		KS_exclam,
441     KC(63),	KS_grave,	KS_notsign,	KS_bar,
442     KC(88),	KS_8,		KS_asterisk,
443     KC(89),	KS_9,		KS_parenleft,
444     KC(90),	KS_0,		KS_parenright,
445     KC(91),	KS_minus,	KS_underscore,
446     KC(92),	KS_equal,	KS_plus,
447     KC(96),	KS_i,
448     KC(97),	KS_o,
449     KC(98),	KS_p,
450     KC(99),	KS_bracketleft,	KS_braceleft,
451     KC(100),	KS_bracketright,KS_braceright,
452     KC(104),	KS_j,
453     KC(105),	KS_k,
454     KC(106),	KS_l,
455     KC(107),	KS_semicolon,	KS_colon,
456     KC(108),	KS_apostrophe,	KS_at,
457     KC(112),	KS_m,
458     KC(113),	KS_comma,	KS_less,
459     KC(114),	KS_period,	KS_greater,
460     KC(115),	KS_slash,	KS_question,
461     KC(116),	KS_numbersign,	KS_asciitilde,
462     KC(118),	KS_backslash,	KS_brokenbar,
463     KC(120),	KS_n
464 };
465 
466 /*
467  * 1b. French
468  */
469 
470 static const keysym_t hilkbd_keydesc_fr[] = {
471     KC(28),	KS_w,		KS_W,		KS_paragraph,
472     KC(45),	KS_q,		KS_Q,		KS_aring,
473     KC(53),	KS_z,		KS_Z,		KS_asciitilde,
474     KC(54),	KS_a,		KS_A,		KS_periodcentered,
475     KC(56),	KS_egrave,	KS_7,		KS_backslash,
476     KC(57),	KS_section,	KS_6,		KS_asciicircum,
477     KC(58),	KS_parenleft,	KS_5,		KS_onehalf,
478     KC(59),	KS_apostrophe,	KS_4,		KS_onequarter,	KS_threequarters,
479     KC(60),	KS_quotedbl,	KS_3,		KS_numbersign,
480     KC(61),	KS_eacute,	KS_2,		KS_at,
481     KC(62),	KS_ampersand,	KS_1,		KS_exclamdown,
482     KC(63),	KS_dollar,	KS_sterling,
483 		KS_guillemotleft,KS_guillemotright,
484     KC(88),	KS_exclam,	KS_8,		KS_bracketleft,	KS_braceleft,
485     KC(89),	KS_ccedilla,	KS_9,		KS_bracketright,KS_braceright,
486     KC(90),	KS_agrave,	KS_0,		KS_questiondown,
487     KC(91),	KS_parenright,	KS_degree,	KS_macron,
488     KC(92),	KS_minus,	KS_underscore,	KS_plusminus,
489     KC(99),	KS_dead_circumflex, KS_dead_diaeresis,	KS_dead_abovering,
490     KC(100),	KS_grave,	KS_asterisk,	KS_bar,		KS_brokenbar,
491     KC(101),	KS_less,	KS_greater,	KS_mu,
492     KC(107),	KS_m,
493     KC(108),	KS_ugrave,	KS_percent,	KS_grave,	KS_apostrophe,
494     KC(112),	KS_comma,	KS_question,	KS_masculine,
495     KC(113),	KS_semicolon,	KS_period,	KS_less,
496     KC(114),	KS_colon,	KS_slash,	KS_greater,
497     KC(115),	KS_equal,	KS_plus,	KS_underscore
498 };
499 
500 static const keysym_t hilkbd_keydesc_fr_ps2[] = {
501     KC(24),	KS_b,
502     KC(25),	KS_v,
503     KC(26),	KS_c,
504     KC(27),	KS_x,
505     KC(28),	KS_w,
506     KC(40),	KS_h,
507     KC(41),	KS_g,
508     KC(42),	KS_f,
509     KC(43),	KS_d,
510     KC(44),	KS_s,
511     KC(45),	KS_q,
512     KC(48),	KS_u,
513     KC(49),	KS_y,
514     KC(50),	KS_t,
515     KC(51),	KS_r,
516     KC(52),	KS_e,
517     KC(53),	KS_z,
518     KC(54),	KS_a,
519     KC(56),	KS_egrave,	KS_7,		KS_grave,
520     KC(57),	KS_minus,	KS_6,		KS_bar,
521     KC(58),	KS_parenleft,	KS_5,		KS_bracketleft,
522     KC(59),	KS_apostrophe,	KS_4,		KS_braceleft,
523     KC(60),	KS_quotedbl,	KS_3,		KS_numbersign,
524     KC(61),	KS_eacute,	KS_2,		KS_asciitilde,
525     KC(62),	KS_ampersand,	KS_1,
526     KC(63),	KS_twosuperior,
527     KC(88),	KS_underscore,	KS_8,		KS_backslash,
528     KC(89),	KS_ccedilla,	KS_9,		KS_asciicircum,
529     KC(90),	KS_agrave,	KS_0,		KS_at,
530     KC(91),	KS_parenright,	KS_degree,	KS_bracketright,
531     KC(92),	KS_equal,	KS_plus,	KS_braceright,
532     KC(96),	KS_i,
533     KC(97),	KS_o,
534     KC(98),	KS_p,
535     KC(99),	KS_dead_circumflex,KS_dead_diaeresis,
536     KC(100),	KS_dollar,	KS_sterling,	KS_currency,
537     KC(104),	KS_j,
538     KC(105),	KS_k,
539     KC(106),	KS_l,
540     KC(107),	KS_m,
541     KC(108),	KS_ugrave,	KS_percent,
542     KC(112),	KS_comma,	KS_question,
543     KC(113),	KS_semicolon,	KS_period,
544     KC(114),	KS_colon,	KS_slash,
545     KC(115),	KS_exclam,	KS_section,
546     KC(116),	KS_asterisk,	KS_mu,
547     KC(118),	KS_less,	KS_greater,
548 		KS_guillemotleft,KS_guillemotright,
549     KC(120),	KS_n
550 };
551 
552 #define KBD_MAP(name, base, map) \
553 			{ name, base, sizeof(map)/sizeof(keysym_t), map }
554 
555 const struct wscons_keydesc hilkbd_keydesctab[] = {
556 	KBD_MAP(KB_US,			0,	hilkbd_keydesc_us),
557 	KBD_MAP(KB_DE,			KB_US,	hilkbd_keydesc_de),
558 	KBD_MAP(KB_DE | KB_NODEAD,	KB_DE,	hilkbd_keydesc_de_nodead),
559 	KBD_MAP(KB_FR,			KB_US,	hilkbd_keydesc_fr),
560 	KBD_MAP(KB_UK,			KB_US,	hilkbd_keydesc_uk),
561 	KBD_MAP(KB_SV,			KB_US,	hilkbd_keydesc_sv),
562 	KBD_MAP(KB_SV | KB_NODEAD,	KB_SV,	hilkbd_keydesc_sv_nodead),
563 	{0, 0, 0, 0},
564 };
565 
566 const struct wscons_keydesc hilkbd_keydesctab_ps2[] = {
567 	KBD_MAP(KB_US,			0,	hilkbd_keydesc_us),
568 	KBD_MAP(KB_DE,			KB_US,	hilkbd_keydesc_de_ps2),
569 	KBD_MAP(KB_DE | KB_NODEAD,	KB_DE,	hilkbd_keydesc_de_ps2_nodead),
570 	KBD_MAP(KB_FR,			KB_US,	hilkbd_keydesc_fr_ps2),
571 	KBD_MAP(KB_UK,			KB_US,	hilkbd_keydesc_uk_ps2),
572 	KBD_MAP(KB_SV,			KB_US,	hilkbd_keydesc_sv_ps2),
573 	KBD_MAP(KB_SV | KB_NODEAD,	KB_SV,	hilkbd_keydesc_sv_ps2_nodead),
574 	{0, 0, 0, 0},
575 };
576 
577 /*
578  * Keyboard ID to layout table
579  */
580 const kbd_t hilkbd_layouts[MAXHILKBDLAYOUT] = {
581 	-1,	/* 00 Undefined or custom layout */
582 	-1,	/* 01 Undefined */
583 	-1,	/* 02 Japanese */
584 	-1,	/* 03 Swiss french */
585 	-1,	/* 04 Portuguese */
586 	-1,	/* 05 Arabic */
587 	-1,	/* 06 Hebrew */
588 	-1,	/* 07 Canadian English */
589 	-1,	/* 08 Turkish */
590 	-1,	/* 09 Greek */
591 	-1,	/* 0a Thai */
592 	-1,	/* 0b Italian */
593 	-1,	/* 0c Korean */
594 	-1,	/* 0d Dutch */
595 	KB_SV,	/* 0e Swedish */
596 	KB_DE,	/* 0f German */
597 	-1,	/* 10 Simplified Chinese */
598 	-1,	/* 11 Traditional Chinese */
599 	-1,	/* 12 Swiss French 2 */
600 	-1,	/* 13 Euro Spanish */
601 	-1,	/* 14 Swiss German 2 */
602 	-1,	/* 15 Belgian */
603 	-1,	/* 16 Finnish */
604 	KB_UK,	/* 17 UK English */
605 	-1,	/* 18 Canadian French */
606 	-1,	/* 19 Swiss German */
607 	-1,	/* 1a Norwegian */
608 	KB_FR,	/* 1b French */
609 	-1,	/* 1c Danish */
610 	-1,	/* 1d Katakana */
611 	-1,	/* 1e Latin Spanish */
612 	KB_US,	/* 1f US ASCII */
613 };
614