wskbdmap_next.c revision 1.4
1/*	$NetBSD: wskbdmap_next.c,v 1.4 2005/12/11 12:18:25 christos Exp $	*/
2
3/*-
4 * Copyright (c) 1997 The NetBSD Foundation, Inc.
5 * All rights reserved.
6 *
7 * This code is derived from software contributed to The NetBSD Foundation
8 * by Juergen Hannken-Illjes.
9 *
10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions
12 * are met:
13 * 1. Redistributions of source code must retain the above copyright
14 *    notice, this list of conditions and the following disclaimer.
15 * 2. Redistributions in binary form must reproduce the above copyright
16 *    notice, this list of conditions and the following disclaimer in the
17 *    documentation and/or other materials provided with the distribution.
18 * 3. All advertising materials mentioning features or use of this software
19 *    must display the following acknowledgement:
20 *	This product includes software developed by the NetBSD
21 *	Foundation, Inc. and its contributors.
22 * 4. Neither the name of The NetBSD Foundation nor the names of its
23 *    contributors may be used to endorse or promote products derived
24 *    from this software without specific prior written permission.
25 *
26 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
27 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
28 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
29 * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
30 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
31 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
32 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
33 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
34 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
35 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
36 * POSSIBILITY OF SUCH DAMAGE.
37 */
38
39#include <sys/cdefs.h>
40__KERNEL_RCSID(0, "$NetBSD: wskbdmap_next.c,v 1.4 2005/12/11 12:18:25 christos Exp $");
41
42#include <sys/types.h>
43#include <dev/wscons/wsksymdef.h>
44#include <dev/wscons/wsksymvar.h>
45#include <arch/next68k/dev/wskbdmap_next.h>
46
47#define KC(n)		(0xe000 | (n))  /* see wsksymvar.h */
48
49static const keysym_t nextkbd_keydesc_us[] = {
50/*  pos      command		normal		shifted */
51    KC(3), 			KS_backslash,	KS_bar,
52    KC(4), 			KS_bracketright, KS_braceright,
53    KC(5), 			KS_bracketleft,	KS_braceleft,
54    KC(6),                      KS_i,
55    KC(7),                      KS_o,
56    KC(8),                      KS_p,
57    KC(9),			KS_Left,
58    KC(11), 			KS_KP_0,
59    KC(12), 			KS_KP_Decimal,
60    KC(13),			KS_KP_Enter,
61    KC(15),			KS_Down,
62    KC(16),			KS_Right,
63    KC(17), 			KS_KP_1,
64    KC(18), 			KS_KP_4,
65    KC(19), 			KS_KP_6,
66    KC(20), 			KS_KP_3,
67    KC(21), 			KS_KP_Add,
68    KC(22),			KS_Up,
69    KC(23), 			KS_KP_2,
70    KC(24), 			KS_KP_5,
71    KC(27), 			KS_Delete,
72    KC(28), 			KS_equal,	KS_plus,
73    KC(29), 			KS_minus,	KS_underscore,
74    KC(30),  			KS_8,		KS_asterisk,
75    KC(31), 			KS_9,		KS_parenleft,
76    KC(32), 			KS_0,		KS_parenright,
77    KC(33), 			KS_KP_7,
78    KC(34), 			KS_KP_8,
79    KC(35), 			KS_KP_9,
80    KC(36), 			KS_KP_Subtract,
81    KC(37), 			KS_KP_Multiply,
82    KC(38), 			KS_grave,	KS_asciitilde,
83    KC(39), 			KS_KP_Equal, KS_bar,
84    KC(40),			  KS_KP_Divide, KS_backslash,
85    KC(42), 			KS_Return,
86    KC(43), 			KS_apostrophe,	KS_quotedbl,
87    KC(44), 			KS_semicolon,	KS_colon,
88    KC(45), 			KS_l,
89    KC(46), 			KS_comma,	KS_less,
90    KC(47), 			KS_period,	KS_greater,
91    KC(48), 			KS_slash,	KS_question,
92    KC(49),                     KS_z,
93    KC(50),                     KS_x,
94    KC(51),                     KS_c,
95    KC(52),                     KS_v,
96    KC(53),                     KS_b,
97    KC(54),                     KS_m,
98    KC(55),                     KS_n,
99    KC(56), 			KS_space,
100    KC(57),                     KS_a,
101    KC(58),                     KS_s,
102    KC(59),                     KS_d,
103    KC(60),                     KS_f,
104    KC(61),                     KS_g,
105    KC(62),                     KS_k,
106    KC(63),                     KS_j,
107    KC(64),                     KS_h,
108    KC(65), 			KS_Tab,
109    KC(66),                     KS_q,
110    KC(67),                     KS_w,
111    KC(68),                     KS_e,
112    KC(69),                     KS_r,
113    KC(70),                     KS_u,
114    KC(71),                     KS_y,
115    KC(72),                     KS_t,
116    KC(73),   KS_Cmd_Debugger,	KS_Escape,
117    KC(74),  			KS_1,		KS_exclam,
118    KC(75),  			KS_2,		KS_at,
119    KC(76),  			KS_3,		KS_numbersign,
120    KC(77),  			KS_4,		KS_dollar,
121    KC(78),  			KS_7,		KS_ampersand,
122    KC(79),  			KS_6,		KS_asciicircum,
123    KC(80),  			KS_5,		KS_percent,
124
125    KC(90), 			KS_Shift_L,
126    KC(91), 			KS_Shift_R,
127    KC(92),   			KS_Alt_L,
128    KC(93),  			KS_Alt_R,
129    KC(94),			KS_Control_L,
130    KC(95), 			KS_Cmd1,
131    KC(96), 			KS_Cmd2,
132#if 0
133    //KC(58), 			KS_Caps_Lock,
134    //KC(59),  KS_Cmd_Screen0,	KS_f1,
135    //KC(60),  KS_Cmd_Screen1,	KS_f2,
136    //KC(61),  KS_Cmd_Screen2,	KS_f3,
137    //KC(62),  KS_Cmd_Screen3,	KS_f4,
138    //KC(63),  KS_Cmd_Screen4,	KS_f5,
139    //KC(64),  KS_Cmd_Screen5,	KS_f6,
140    //KC(65),  KS_Cmd_Screen6,	KS_f7,
141    //KC(66),  KS_Cmd_Screen7,	KS_f8,
142    //KC(67),  KS_Cmd_Screen8,	KS_f9,
143    //KC(68),  KS_Cmd_Screen9,	KS_f10,
144    //KC(69), 			KS_Num_Lock,
145    //KC(70), 			KS_Hold_Screen,
146    //KC(87), 			KS_f11,
147    //KC(88), 			KS_f12,
148    /*  127, break, */
149    /*  170, print screen, */
150    /*  183, print screen, */
151    //KC(184),			KS_Alt_R,	KS_Multi_key,
152    //KC(199),			KS_Home,
153    //KC(201),			KS_Prior,
154    //K/C(207),			KS_End,
155    //K/C(209),			KS_Next,
156    ///KC(210),			KS_Insert,
157    //KC(211),			KS_KP_Delete,
158    /*  219, left win, */
159    /*  220, right win, */
160    /*  221, menu, */
161#endif
162};
163
164#if 0
165static const keysym_t nextkbd_keydesc_de[] = {
166/*  pos      normal		shifted		altgr		shift-altgr */
167    KC(3),   KS_2,		KS_quotedbl,	KS_twosuperior,
168    KC(4),   KS_3,		KS_section,	KS_threesuperior,
169    KC(7),   KS_6,		KS_ampersand,
170    KC(8),   KS_7,		KS_slash,	KS_braceleft,
171    KC(9),   KS_8,		KS_parenleft,	KS_bracketleft,
172    KC(10),  KS_9,		KS_parenright,	KS_bracketright,
173    KC(11),  KS_0,		KS_equal,	KS_braceright,
174    KC(12),  KS_ssharp,		KS_question,	KS_backslash,
175    KC(13),  KS_dead_acute,	KS_dead_grave,
176    KC(16),  KS_q,		KS_Q,		KS_at,
177    KC(21),  KS_z,
178    KC(26),  KS_udiaeresis,
179    KC(27),  KS_plus,		KS_asterisk,	KS_dead_tilde,
180    KC(39),  KS_odiaeresis,
181    KC(40),  KS_adiaeresis,
182    KC(41),  KS_dead_circumflex,KS_dead_abovering,
183    KC(43),  KS_numbersign,	KS_apostrophe,
184    KC(44),  KS_y,
185    KC(50),  KS_m,		KS_M,		KS_mu,
186    KC(51),  KS_comma,		KS_semicolon,
187    KC(52),  KS_period,		KS_colon,
188    KC(53),  KS_minus,		KS_underscore,
189    KC(86),  KS_less,		KS_greater,	KS_bar,		KS_brokenbar,
190    KC(184), KS_Mode_switch,	KS_Multi_key,
191};
192
193static const keysym_t nextkbd_keydesc_de_nodead[] = {
194/*  pos      normal		shifted		altgr		shift-altgr */
195    KC(13),  KS_apostrophe,	KS_grave,
196    KC(27),  KS_plus,		KS_asterisk,	KS_asciitilde,
197    KC(41),  KS_asciicircum,	KS_degree,
198};
199
200static const keysym_t nextkbd_keydesc_dk[] = {
201/*  pos      normal		shifted		altgr		shift-altgr */
202    KC(3),   KS_2,		KS_quotedbl,	KS_at,
203    KC(4),   KS_3,		KS_numbersign,	KS_sterling,
204    KC(5),   KS_4,		KS_currency,	KS_dollar,
205    KC(7),   KS_6,		KS_ampersand,
206    KC(8),   KS_7,		KS_slash,	KS_braceleft,
207    KC(9),   KS_8,		KS_parenleft,	KS_bracketleft,
208    KC(10),  KS_9,		KS_parenright,	KS_bracketright,
209    KC(11),  KS_0,		KS_equal,	KS_braceright,
210    KC(12),  KS_plus,		KS_question,
211    KC(13),  KS_dead_acute,	KS_dead_grave,	KS_bar,
212    KC(26),  KS_aring,
213    KC(27),  KS_dead_diaeresis,	KS_dead_circumflex, KS_dead_tilde,
214    KC(39),  KS_ae,
215    KC(40),  KS_oslash,
216    KC(41),  KS_onehalf,	KS_paragraph,
217    KC(43),  KS_apostrophe,	KS_asterisk,
218    KC(51),  KS_comma,		KS_semicolon,
219    KC(52),  KS_period,		KS_colon,
220    KC(53),  KS_minus,		KS_underscore,
221    KC(86),  KS_less,		KS_greater,	KS_backslash,
222    KC(184), KS_Mode_switch,	KS_Multi_key,
223};
224
225static const keysym_t nextkbd_keydesc_dk_nodead[] = {
226/*  pos      normal		shifted		altgr		shift-altgr */
227    KC(13),  KS_apostrophe,	KS_grave,	KS_bar,
228    KC(27),  KS_diaeresis,	KS_asciicircum,	KS_asciitilde,
229};
230
231static const keysym_t nextkbd_keydesc_fr[] = {
232/*  pos	     normal		shifted		altgr		shift-altgr */
233    KC(2),   KS_ampersand,	KS_1,
234    KC(3),   KS_eacute,		KS_2,		KS_asciitilde,
235    KC(4),   KS_quotedbl,	KS_3,		KS_numbersign,
236    KC(5),   KS_apostrophe,	KS_4,		KS_braceleft,
237    KC(6),   KS_parenleft,	KS_5,		KS_bracketleft,
238    KC(7),   KS_minus,		KS_6,		KS_bar,
239    KC(8),   KS_egrave,		KS_7,		KS_grave,
240    KC(9),   KS_underscore,	KS_8,		KS_backslash,
241    KC(10),  KS_ccedilla,	KS_9,		KS_asciicircum,
242    KC(11),  KS_agrave,		KS_0,		KS_at,
243    KC(12),  KS_parenright,	KS_degree,	KS_bracketright,
244    KC(13),  KS_equal,		KS_plus,	KS_braceright,
245    KC(16),  KS_a,
246    KC(17),  KS_z,
247    KC(26),  KS_dead_circumflex, KS_dead_diaeresis,
248    KC(27),  KS_dollar,		KS_sterling,	KS_currency,
249    KC(30),  KS_q,
250    KC(39),  KS_m,
251    KC(40),  KS_ugrave,		KS_percent,
252    KC(41),  KS_twosuperior,
253    KC(43),  KS_asterisk,	KS_mu,
254    KC(44),  KS_w,
255    KC(50),  KS_comma,		KS_question,
256    KC(51),  KS_semicolon,	KS_period,
257    KC(52),  KS_colon,		KS_slash,
258    KC(53),  KS_exclam,		KS_section,
259    KC(86),  KS_less,		KS_greater,
260    KC(184), KS_Mode_switch,	KS_Multi_key,
261};
262
263static const keysym_t nextkbd_keydesc_it[] = {
264/*  pos      normal		shifted		altgr		shift-altgr */
265    KC(3),   KS_2,	    	KS_quotedbl,	KS_twosuperior,
266    KC(4),   KS_3,	    	KS_sterling,	KS_threesuperior,
267    KC(5),   KS_4,	    	KS_dollar,
268    KC(6),   KS_5,	    	KS_percent,
269    KC(7),   KS_6,	    	KS_ampersand,
270    KC(8),   KS_7,	    	KS_slash,
271    KC(9),   KS_8,	    	KS_parenleft,
272    KC(10),  KS_9,	    	KS_parenright,
273    KC(11),  KS_0,	    	KS_equal,
274    KC(12),  KS_apostrophe,	KS_question,
275    KC(13),  KS_igrave,	    	KS_asciicircum,
276    KC(26),  KS_egrave,		KS_eacute,	KS_braceleft,	KS_bracketleft,
277    KC(27),  KS_plus,		KS_asterisk,	KS_braceright,	KS_bracketright,
278    KC(39),  KS_ograve,		KS_Ccedilla,	KS_at,
279    KC(40),  KS_agrave,		KS_degree,	KS_numbersign,
280    KC(41),  KS_backslash,	KS_bar,
281    KC(43),  KS_ugrave,		KS_section,
282    KC(51),  KS_comma,		KS_semicolon,
283    KC(52),  KS_period,		KS_colon,
284    KC(53),  KS_minus,		KS_underscore,
285    KC(86),  KS_less,		KS_greater,
286    KC(184), KS_Mode_switch,	KS_Multi_key,
287};
288
289static const keysym_t nextkbd_keydesc_us_declk[] = {
290/*  pos      normal		shifted		altgr		shift-altgr */
291    KC(1),	KS_grave,	KS_asciitilde, /* replace escape */
292    KC(41),	KS_less,	KS_greater, /* replace grave/tilde */
293    KC(143),	KS_Multi_key, /* left compose */
294    KC(157),	KS_Multi_key, /* right compose, replace right control */
295    KC(87),	KS_Cmd_Debugger,	KS_Escape, /* replace F11 */
296    KC(189),	KS_f13,
297    KC(190),	KS_f14,
298    KC(191),	KS_Help,
299    KC(192),	KS_Execute,
300    KC(193),	KS_f17,
301    KC(183),	KS_f18,
302    KC(70),	KS_f19, /* replace scroll lock */
303    KC(127),	KS_f20, /* replace break */
304    KC(69),	KS_KP_F1, /* replace num lock */
305    KC(181),	KS_KP_F2, /* replace divide */
306    KC(55),	KS_KP_F3, /* replace multiply */
307    KC(74),	KS_KP_F4, /* replace subtract */
308
309    /* keypad is numbers only - no num lock */
310    KC(71), 	KS_KP_7,
311    KC(72), 	KS_KP_8,
312    KC(73), 	KS_KP_9,
313    KC(75), 	KS_KP_4,
314    KC(76), 	KS_KP_5,
315    KC(77), 	KS_KP_6,
316    KC(79), 	KS_KP_1,
317    KC(80), 	KS_KP_2,
318    KC(81), 	KS_KP_3,
319    KC(82), 	KS_KP_0,
320    KC(83), 	KS_KP_Decimal,
321
322    KC(206),	KS_KP_Subtract,
323    KC(78),	KS_KP_Separator, /* replace add */
324    KC(199),	KS_Find, /* replace home */
325    KC(207),	KS_Select, /* replace end */
326};
327#endif
328
329#define KBD_MAP(name, base, map) \
330			{ name, base, sizeof(map)/sizeof(keysym_t), map }
331
332const struct wscons_keydesc nextkbd_keydesctab[] = {
333	KBD_MAP(KB_US,			0,	nextkbd_keydesc_us),
334#if 0
335	KBD_MAP(KB_DE,			KB_US,	nextkbd_keydesc_de),
336	KBD_MAP(KB_DE | KB_NODEAD,	KB_DE,	nextkbd_keydesc_de_nodead),
337	KBD_MAP(KB_FR,                  KB_US,  nextkbd_keydesc_fr),
338	KBD_MAP(KB_DK,			KB_US,	nextkbd_keydesc_dk),
339	KBD_MAP(KB_DK | KB_NODEAD,	KB_DK,	nextkbd_keydesc_dk_nodead),
340	KBD_MAP(KB_IT,			KB_US,	nextkbd_keydesc_it),
341	KBD_MAP(KB_US | KB_DECLK,	KB_US,	nextkbd_keydesc_us_declk),
342#endif
343	{0, 0, 0, 0}
344};
345
346#undef KBD_MAP
347#undef KC
348