12880SN/A/*	$OpenBSD: sunkbdmap.c,v 1.7 2023/01/23 09:36:40 nicm Exp $	*/
22880SN/A
32880SN/A/*
42880SN/A * Copyright (c) 2002, 2003 Miodrag Vallat.
52880SN/A * Copyright (c) 2002 Jason L. Wright (jason@thought.net)
62880SN/A * All rights reserved.
72880SN/A *
82880SN/A * Redistribution and use in source and binary forms, with or without
92880SN/A * modification, are permitted provided that the following conditions
102880SN/A * are met:
112880SN/A * 1. Redistributions of source code must retain the above copyright
122880SN/A *    notice, this list of conditions and the following disclaimer.
132880SN/A * 2. Redistributions in binary form must reproduce the above copyright
142880SN/A *    notice, this list of conditions and the following disclaimer in the
152880SN/A *    documentation and/or other materials provided with the distribution.
162880SN/A *
172880SN/A * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
182880SN/A * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
192880SN/A * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
202880SN/A * DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
212880SN/A * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
222880SN/A * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
232880SN/A * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
242880SN/A * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
252880SN/A * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
262880SN/A * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
272880SN/A * POSSIBILITY OF SUCH DAMAGE.
282880SN/A *
292880SN/A * Effort sponsored in part by the Defense Advanced Research Projects
302880SN/A * Agency (DARPA) and Air Force Research Laboratory, Air Force
312880SN/A * Materiel Command, USAF, under agreement number F30602-01-2-0537.
322880SN/A *
332880SN/A */
342880SN/A
352880SN/A#include <sys/param.h>
36#include <sys/systm.h>
37#include <sys/device.h>
38#include <sys/kernel.h>
39#include <sys/timeout.h>
40
41#include <dev/wscons/wsconsio.h>
42#include <dev/wscons/wskbdvar.h>
43#include <dev/wscons/wsksymdef.h>
44#include <dev/wscons/wsksymvar.h>
45
46#include <dev/sun/sunkbdreg.h>
47#include <dev/sun/sunkbdvar.h>
48
49#ifdef WSDISPLAY_COMPAT_RAWKBD
50#include <dev/wscons/wskbdraw.h>
51
52/*
53 * Translate Sun keycodes to US keyboard XT scancodes, for proper
54 * X11-over-wsmux operation.
55 */
56const u_int8_t sunkbd_rawmap[0x80] = {
57	RAWKEY_Null,
58	RAWKEY_L1,
59	RAWKEY_AudioLower,
60	RAWKEY_L2,
61	RAWKEY_AudioRaise,
62	RAWKEY_f1,
63	RAWKEY_f2,
64	RAWKEY_f10,
65	RAWKEY_f3,
66	RAWKEY_f11,
67	RAWKEY_f4,
68	RAWKEY_f12,
69	RAWKEY_f5,
70	RAWKEY_Alt_R,
71	RAWKEY_f6,
72	RAWKEY_Null,
73	RAWKEY_f7,
74	RAWKEY_f8,
75	RAWKEY_f9,
76	RAWKEY_Alt_L,
77	RAWKEY_Up,
78	RAWKEY_Pause,
79	RAWKEY_Print_Screen,
80	RAWKEY_Hold_Screen,
81	RAWKEY_Left,
82	RAWKEY_L3,
83	RAWKEY_L4,
84	RAWKEY_Down,
85	RAWKEY_Right,
86	RAWKEY_Escape,
87	RAWKEY_1,
88	RAWKEY_2,
89	RAWKEY_3,
90	RAWKEY_4,
91	RAWKEY_5,
92	RAWKEY_6,
93	RAWKEY_7,
94	RAWKEY_8,
95	RAWKEY_9,
96	RAWKEY_0,
97	RAWKEY_minus,
98	RAWKEY_equal,
99	RAWKEY_grave,
100	RAWKEY_BackSpace,
101	RAWKEY_Insert,
102	RAWKEY_KP_Equal,	/* type 4 only */
103	RAWKEY_KP_Divide,
104	RAWKEY_KP_Multiply,
105	RAWKEY_Null,
106	RAWKEY_L5,
107	RAWKEY_KP_Delete,
108	RAWKEY_L6,
109	RAWKEY_Home,
110	RAWKEY_Tab,
111	RAWKEY_q,
112	RAWKEY_w,
113	RAWKEY_e,
114	RAWKEY_r,
115	RAWKEY_t,
116	RAWKEY_y,
117	RAWKEY_u,
118	RAWKEY_i,
119	RAWKEY_o,
120	RAWKEY_p,
121	RAWKEY_bracketleft,
122	RAWKEY_bracketright,
123	RAWKEY_Delete,
124	RAWKEY_Compose,
125	RAWKEY_KP_Home,
126	RAWKEY_KP_Up,
127	RAWKEY_KP_Prior,
128	RAWKEY_KP_Subtract,
129	RAWKEY_L7,
130	RAWKEY_L8,
131	RAWKEY_End,
132	RAWKEY_Null,
133	RAWKEY_Control_L,
134	RAWKEY_a,
135	RAWKEY_s,
136	RAWKEY_d,
137	RAWKEY_f,
138	RAWKEY_g,
139	RAWKEY_h,
140	RAWKEY_j,
141	RAWKEY_k,
142	RAWKEY_l,
143	RAWKEY_semicolon,
144	RAWKEY_apostrophe,
145	RAWKEY_backslash,
146	RAWKEY_Return,
147	RAWKEY_KP_Enter,
148	RAWKEY_KP_Left,
149	RAWKEY_KP_Begin,
150	RAWKEY_KP_Right,
151	RAWKEY_KP_Insert,
152	RAWKEY_L9,
153	RAWKEY_Prior,
154	RAWKEY_L10,
155	RAWKEY_Num_Lock,
156	RAWKEY_Shift_L,
157	RAWKEY_z,
158	RAWKEY_x,
159	RAWKEY_c,
160	RAWKEY_v,
161	RAWKEY_b,
162	RAWKEY_n,
163	RAWKEY_m,
164	RAWKEY_comma,
165	RAWKEY_period,
166	RAWKEY_slash,
167	RAWKEY_Shift_R,
168	RAWKEY_Null,		/* KS_Linefeed on type 3/4 */
169	RAWKEY_KP_End,
170	RAWKEY_KP_Down,
171	RAWKEY_KP_Next,
172	RAWKEY_Null,
173	RAWKEY_Null,
174	RAWKEY_Null,
175	RAWKEY_Help,
176	RAWKEY_Caps_Lock,
177	RAWKEY_Meta_L,
178	RAWKEY_space,
179	RAWKEY_Meta_R,
180	RAWKEY_Next,
181	RAWKEY_Null,
182	RAWKEY_KP_Add,
183	RAWKEY_Null,
184	RAWKEY_AudioMute	/* type 5 remapped 0x2d */
185};
186#endif
187
188#define	KC(n)	KS_KEYCODE(n)
189
190/* 000/021/022 US English type 4/5 keyboard */
191const keysym_t sunkbd_keydesc_us[] = {
192    KC(0x01), KS_Cmd,
193    KC(0x02), KS_Cmd_BrightnessDown,
194    KC(0x03),				KS_Again,
195    KC(0x04), KS_Cmd_BrightnessUp,
196    KC(0x05),				KS_f1,
197    KC(0x06),				KS_f2,
198    KC(0x07),				KS_f10,
199    KC(0x08),				KS_f3,
200    KC(0x09),				KS_f11,
201    KC(0x0a),				KS_f4,
202    KC(0x0b),				KS_f12,
203    KC(0x0c),				KS_f5,
204    KC(0x0d),				KS_Alt_R,
205    KC(0x0e),				KS_f6,
206    KC(0x10),				KS_f7,
207    KC(0x11),				KS_f8,
208    KC(0x12),				KS_f9,
209    KC(0x13),				KS_Alt_L,
210    KC(0x14),				KS_Up,
211    KC(0x15),				KS_Pause,
212    KC(0x16),				KS_Print_Screen,
213    KC(0x17),				KS_Hold_Screen,
214    KC(0x18),				KS_Left,
215    KC(0x19),				KS_Props,
216    KC(0x1a),				KS_Undo,
217    KC(0x1b),				KS_Down,
218    KC(0x1c),				KS_Right,
219    KC(0x1d),				KS_Escape,
220    KC(0x1e),				KS_1,		KS_exclam,
221    KC(0x1f),				KS_2,		KS_at,
222    KC(0x20),				KS_3,		KS_numbersign,
223    KC(0x21),				KS_4,		KS_dollar,
224    KC(0x22),				KS_5,		KS_percent,
225    KC(0x23),				KS_6,		KS_asciicircum,
226    KC(0x24),				KS_7,		KS_ampersand,
227    KC(0x25),				KS_8,		KS_asterisk,
228    KC(0x26),				KS_9,		KS_parenleft,
229    KC(0x27),				KS_0,		KS_parenright,
230    KC(0x28),				KS_minus,	KS_underscore,
231    KC(0x29),				KS_equal,	KS_plus,
232    KC(0x2a),				KS_grave,	KS_asciitilde,
233    KC(0x2b),				KS_Delete,
234    KC(0x2c),				KS_Insert,
235    KC(0x2d),				KS_KP_Equal,	/* type 4 */
236    KC(0x2e),				KS_KP_Divide,
237    KC(0x2f),				KS_KP_Multiply,
238    KC(0x31),				KS_Front,
239    KC(0x32),				KS_KP_Delete,	KS_KP_Decimal,
240    KC(0x33),				KS_Copy,
241    KC(0x34),				KS_Home,
242    KC(0x35),				KS_Tab,		KS_Backtab,
243    KC(0x36),				KS_q,
244    KC(0x37),				KS_w,
245    KC(0x38),				KS_e,
246    KC(0x39),				KS_r,
247    KC(0x3a),				KS_t,
248    KC(0x3b),				KS_y,
249    KC(0x3c),				KS_u,
250    KC(0x3d),				KS_i,
251    KC(0x3e),				KS_o,
252    KC(0x3f),				KS_p,
253    KC(0x40),				KS_bracketleft,	KS_braceleft,
254    KC(0x41),				KS_bracketright,KS_braceright,
255    KC(0x42),				KS_Delete,
256    KC(0x43),				KS_Multi_key,
257    KC(0x44),				KS_KP_Home,	KS_KP_7,
258    KC(0x45),				KS_KP_Up,	KS_KP_8,
259    KC(0x46),				KS_KP_Prior,	KS_KP_9,
260    KC(0x47),				KS_KP_Subtract,
261    KC(0x48),				KS_Open,
262    KC(0x49),				KS_Paste,
263    KC(0x4a),				KS_End,
264    KC(0x4c),				KS_Control_L,
265    KC(0x4d), KS_Cmd_Debugger,		KS_a,
266    KC(0x4e),				KS_s,
267    KC(0x4f),				KS_d,
268    KC(0x50),				KS_f,
269    KC(0x51),				KS_g,
270    KC(0x52),				KS_h,
271    KC(0x53),				KS_j,
272    KC(0x54),				KS_k,
273    KC(0x55),				KS_l,
274    KC(0x56),				KS_semicolon,	KS_colon,
275    KC(0x57),				KS_apostrophe,	KS_quotedbl,
276    KC(0x58),				KS_backslash,	KS_bar,
277    KC(0x59),				KS_Return,
278    KC(0x5a),				KS_KP_Enter,
279    KC(0x5b),				KS_KP_Left,	KS_KP_4,
280    KC(0x5c),				KS_KP_Begin,	KS_KP_5,
281    KC(0x5d),				KS_KP_Right,	KS_KP_6,
282    KC(0x5e),				KS_KP_Insert,	KS_KP_0,
283    KC(0x5f),				KS_Find,
284    KC(0x60),				KS_Prior,
285    KC(0x61),				KS_Cut,
286    KC(0x62),				KS_Num_Lock,
287    KC(0x63),				KS_Shift_L,
288    KC(0x64),				KS_z,
289    KC(0x65),				KS_x,
290    KC(0x66),				KS_c,
291    KC(0x67),				KS_v,
292    KC(0x68),				KS_b,
293    KC(0x69),				KS_n,
294    KC(0x6a),				KS_m,
295    KC(0x6b),				KS_comma,	KS_less,
296    KC(0x6c),				KS_period,	KS_greater,
297    KC(0x6d),				KS_slash,	KS_question,
298    KC(0x6e),				KS_Shift_R,
299    KC(0x6f),				KS_Linefeed,
300    KC(0x70),				KS_KP_End,	KS_KP_1,
301    KC(0x71),				KS_KP_Down,	KS_KP_2,
302    KC(0x72),				KS_KP_Next,	KS_KP_3,
303    KC(0x76),				KS_Help,
304    KC(0x77),				KS_Caps_Lock,
305    KC(0x78),				KS_Meta_L,
306    KC(0x79),				KS_space,
307    KC(0x7a),				KS_Meta_R,
308    KC(0x7b),				KS_Next,
309    KC(0x7d),				KS_KP_Add,
310    KC(0x7f),				KS_AudioMute,	/* type 5 KC(0x2d) */
311};
312
313/* 002 French/Belgian type 4 keyboard */
314const keysym_t sunkbd_keydesc_befr[] = {
315    KC(0x0d),		KS_Caps_Lock,
316    KC(0x0f),		KS_bracketright,KS_braceright,	KS_guillemotright,
317    KC(0x1e),		KS_ampersand,	KS_1,
318    KC(0x1f),		KS_eacute,	KS_2,		KS_twosuperior,
319    KC(0x20),		KS_quotedbl,	KS_3,		KS_threesuperior,
320    KC(0x21),		KS_apostrophe,	KS_4,
321    KC(0x22),		KS_parenleft,	KS_5,
322    KC(0x23),		KS_section,	KS_6,
323    KC(0x24),		KS_egrave,	KS_7,
324    KC(0x25),		KS_exclam,	KS_8,		KS_sterling,
325    KC(0x26),		KS_ccedilla,	KS_9,		KS_backslash,
326    KC(0x27),		KS_agrave,	KS_0,
327    KC(0x28),		KS_parenright,	KS_degree,	KS_asciitilde,
328    KC(0x29),		KS_minus,	KS_underscore,	KS_numbersign,
329    KC(0x2a),		KS_asterisk,	KS_bar,		KS_currency,
330    KC(0x36),		KS_a,
331    KC(0x37),		KS_z,
332    KC(0x40),		KS_dead_circumflex,KS_dead_diaeresis,
333    KC(0x41),		KS_grave,	KS_dollar,	KS_at,
334    KC(0x4d), KS_Cmd_Debugger,	KS_q,
335    KC(0x56),		KS_m,		KS_M,		KS_mu,
336    KC(0x57),		KS_ugrave,	KS_percent,
337    KC(0x58),		KS_bracketleft,	KS_braceleft,	KS_guillemotleft,
338    KC(0x64),		KS_w,
339    KC(0x6a),		KS_comma,	KS_question,
340    KC(0x6b),		KS_semicolon,	KS_period,
341    KC(0x6c),		KS_colon,	KS_slash,
342    KC(0x6d),		KS_equal,	KS_plus,
343    KC(0x77),		KS_Mode_switch,
344    KC(0x7c),		KS_less,	KS_greater,
345};
346
347/* 023 French type 5 keyboard */
348const keysym_t sunkbd5_keydesc_fr[] = {
349    KC(0x0d),		KS_Mode_switch,
350    KC(0x1e),		KS_ampersand,	KS_1,
351    KC(0x1f),		KS_eacute,	KS_2,		KS_asciitilde,
352    KC(0x20),		KS_quotedbl,	KS_3,		KS_numbersign,
353    KC(0x21),		KS_apostrophe,	KS_4,		KS_braceleft,
354    KC(0x22),		KS_parenleft,	KS_5,		KS_bracketleft,
355    KC(0x23),		KS_minus,	KS_6,		KS_bar,
356    KC(0x24),		KS_egrave,	KS_7,		KS_grave,
357    KC(0x25),		KS_underscore,	KS_8,		KS_backslash,
358    KC(0x26),		KS_ccedilla,	KS_9,		KS_asciicircum,
359    KC(0x27),		KS_agrave,	KS_0,		KS_at,
360    KC(0x28),		KS_parenright,	KS_degree,	KS_bracketright,
361    KC(0x29),		KS_equal,	KS_plus,	KS_braceright,
362    KC(0x2a),		KS_twosuperior,
363    KC(0x36),		KS_a,
364    KC(0x37),		KS_z,
365    KC(0x40),		KS_dead_circumflex,KS_dead_diaeresis,
366    KC(0x41),		KS_dollar,	KS_sterling,	KS_currency,
367    KC(0x4d), KS_Cmd_Debugger,	KS_q,
368    KC(0x56),		KS_m,
369    KC(0x57),		KS_ugrave,	KS_percent,
370    KC(0x58),		KS_asterisk,	KS_mu,
371    KC(0x64),		KS_w,
372    KC(0x6a),		KS_comma,	KS_question,
373    KC(0x6b),		KS_semicolon,	KS_period,
374    KC(0x6c),		KS_colon,	KS_slash,
375    KC(0x6d),		KS_exclam,	KS_section,
376    KC(0x7c),		KS_less,	KS_greater,
377};
378
379/* 004 Danish type 4 keyboard */
380const keysym_t sunkbd_keydesc_dk[] = {
381    KC(0x0d),		KS_Multi_key,
382    KC(0x0f),		KS_asciitilde,	KS_asciicircum,
383    KC(0x1f),		KS_2,		KS_quotedbl,	KS_at,
384    KC(0x20),		KS_3,		KS_numbersign,	KS_sterling,
385    KC(0x21),		KS_4,		KS_currency,	KS_dollar,
386    KC(0x23),		KS_6,		KS_ampersand,
387    KC(0x24),		KS_7,		KS_slash,	KS_braceleft,
388    KC(0x25),		KS_8,		KS_parenleft,	KS_bracketleft,
389    KC(0x26),		KS_9,		KS_parenright,	KS_bracketright,
390    KC(0x27),		KS_0,		KS_equal,	KS_braceright,
391    KC(0x28),		KS_plus,	KS_question,
392    KC(0x29),		KS_dead_acute,	KS_dead_grave,	KS_bar,
393    KC(0x2a),		KS_apostrophe,	KS_asterisk,	KS_grave,
394    KC(0x40),		KS_aring,
395    KC(0x41),		KS_dead_diaeresis,KS_dead_circumflex,KS_dead_tilde,
396    KC(0x43),		KS_Mode_switch,
397    KC(0x4c),		KS_Caps_Lock,
398    KC(0x56),		KS_ae,
399    KC(0x57),		KS_oslash,
400    KC(0x58),		KS_onehalf,	KS_section,
401    KC(0x6b),		KS_comma,	KS_semicolon,
402    KC(0x6c),		KS_period,	KS_colon,
403    KC(0x6d),		KS_minus,	KS_underscore,
404    KC(0x77),		KS_Control_L,
405    KC(0x7c),		KS_less,	KS_greater,	KS_backslash,
406};
407
408/* 024 Danish type 5 keyboard */
409const keysym_t sunkbd5_keydesc_dk[] = {
410    KC(0x0d),		KS_Mode_switch,
411    KC(0x1f),		KS_2,		KS_quotedbl,	KS_at,
412    KC(0x20),		KS_3,		KS_numbersign,	KS_sterling,
413    KC(0x21),		KS_4,		KS_currency,	KS_dollar,
414    KC(0x22),		KS_5,		KS_percent,	KS_asciitilde,
415    KC(0x23),		KS_6,		KS_ampersand,	KS_asciicircum,
416    KC(0x24),		KS_7,		KS_slash,	KS_braceleft,
417    KC(0x25),		KS_8,		KS_parenleft,	KS_bracketleft,
418    KC(0x26),		KS_9,		KS_parenright,	KS_bracketright,
419    KC(0x27),		KS_0,		KS_equal,	KS_braceright,
420    KC(0x28),		KS_plus,	KS_question,
421    KC(0x29),		KS_dead_acute,	KS_dead_grave,	KS_bar,
422    KC(0x2a),		KS_onehalf,	KS_asterisk,	KS_grave,
423    KC(0x40),		KS_aring,
424    KC(0x41),		KS_dead_diaeresis,KS_dead_circumflex,KS_dead_tilde,
425    KC(0x56),		KS_ae,
426    KC(0x57),		KS_oslash,
427    KC(0x58),		KS_backslash,	KS_asterisk,	KS_grave,
428    KC(0x6b),		KS_comma,	KS_semicolon,
429    KC(0x6c),		KS_period,	KS_colon,
430    KC(0x6d),		KS_minus,	KS_underscore,
431    KC(0x7c),		KS_less,	KS_greater,	KS_backslash,
432};
433
434/* 005 German type 4 keyboard */
435const keysym_t sunkbd_keydesc_de[] = {
436    KC(0x0d),		KS_Alt_L,
437    KC(0x0f),		KS_bracketright,KS_braceright,	KS_guillemotright,
438    KC(0x13),		KS_Mode_switch,
439    KC(0x1f),		KS_2,		KS_quotedbl,	KS_twosuperior,
440    KC(0x20),		KS_3,		KS_section,	KS_threesuperior,
441    KC(0x23),		KS_6,		KS_ampersand,
442    KC(0x24),		KS_7,		KS_slash,	KS_degree,
443    KC(0x25),		KS_8,		KS_parenleft,	KS_grave,
444    KC(0x26),		KS_9,		KS_parenright,	KS_apostrophe,
445    KC(0x27),		KS_0,		KS_equal,	KS_bar,
446    KC(0x28),		KS_ssharp,	KS_question,	KS_backslash,
447    KC(0x29),		KS_dead_acute,	KS_dead_grave,
448    KC(0x2a),		KS_numbersign,	KS_asciicircum,	KS_at,
449    KC(0x3b),		KS_z,
450    KC(0x40),		KS_udiaeresis,
451    KC(0x41),		KS_plus,	KS_asterisk,	KS_asciitilde,
452    KC(0x4c),		KS_Caps_Lock,
453    KC(0x56),		KS_odiaeresis,
454    KC(0x57),		KS_adiaeresis,
455    KC(0x58),		KS_bracketleft,	KS_braceleft,	KS_guillemotleft,
456    KC(0x64),		KS_y,
457    KC(0x6a),		KS_m,		KS_M,		KS_mu,
458    KC(0x6b),		KS_comma,	KS_semicolon,
459    KC(0x6c),		KS_period,	KS_colon,
460    KC(0x6d),		KS_minus,	KS_underscore,
461    KC(0x77),		KS_Control_L,
462    KC(0x7c),		KS_less,	KS_greater,
463};
464
465/* 025 German type 5 keyboard */
466const keysym_t sunkbd5_keydesc_de[] = {
467    KC(0x0d),		KS_Mode_switch,
468    KC(0x1f),		KS_2,		KS_quotedbl,	KS_twosuperior,
469    KC(0x20),		KS_3,		KS_section,	KS_threesuperior,
470    KC(0x23),		KS_6,		KS_ampersand,
471    KC(0x24),		KS_7,		KS_slash,	KS_braceleft,
472    KC(0x25),		KS_8,		KS_parenleft,	KS_bracketleft,
473    KC(0x26),		KS_9,		KS_parenright,	KS_bracketright,
474    KC(0x27),		KS_0,		KS_equal,	KS_braceright,
475    KC(0x28),		KS_ssharp,	KS_question,	KS_backslash,
476    KC(0x29),		KS_dead_acute,	KS_dead_grave,
477    KC(0x2a),		KS_asciicircum,	KS_degree,
478    KC(0x36),		KS_q,		KS_Q,		KS_at,
479    KC(0x3b),		KS_z,
480    KC(0x40),		KS_udiaeresis,
481    KC(0x41),		KS_plus,	KS_asterisk,	KS_asciitilde,
482    KC(0x56),		KS_odiaeresis,
483    KC(0x57),		KS_adiaeresis,
484    KC(0x58),		KS_numbersign,	KS_apostrophe,	KS_grave,
485    KC(0x64),		KS_y,
486    KC(0x6a),		KS_m,		KS_M,		KS_mu,
487    KC(0x6b),		KS_comma,	KS_semicolon,
488    KC(0x6c),		KS_period,	KS_colon,
489    KC(0x6d),		KS_minus,	KS_underscore,
490    KC(0x7c),		KS_less,	KS_greater,	KS_bar,
491};
492
493/* 006 Italian type 4 keyboard */
494const keysym_t sunkbd_keydesc_it[] = {
495    KC(0x0d),		KS_Mode_switch,
496    KC(0x0f),		KS_bracketright,KS_braceright,	KS_guillemotright,
497    KC(0x1f),		KS_2,		KS_quotedbl,	KS_twosuperior,
498    KC(0x20),		KS_3,		KS_sterling,	KS_threesuperior,
499    KC(0x23),		KS_6,		KS_ampersand,	KS_notsign,
500    KC(0x24),		KS_7,		KS_slash,
501    KC(0x25),		KS_8,		KS_parenleft,
502    KC(0x26),		KS_9,		KS_parenright,	KS_backslash,
503    KC(0x27),		KS_0,		KS_equal,	KS_bar,
504    KC(0x28),		KS_apostrophe,	KS_question,	KS_grave,
505    KC(0x29),		KS_igrave,	KS_asciicircum,
506    KC(0x2a),		KS_ugrave,	KS_section,
507    KC(0x40),		KS_egrave,	KS_eacute,
508    KC(0x41),		KS_plus,	KS_asterisk,	KS_asciitilde,
509    KC(0x4c),		KS_Caps_Lock,
510    KC(0x56),		KS_ograve,	KS_ccedilla,	KS_at,
511    KC(0x57),		KS_agrave,	KS_degree,	KS_numbersign,
512    KC(0x58),		KS_bracketleft,	KS_braceleft,	KS_guillemotleft,
513    KC(0x6b),		KS_comma,	KS_semicolon,
514    KC(0x6c),		KS_period,	KS_colon,
515    KC(0x6d),		KS_minus,	KS_underscore,
516    KC(0x77),		KS_Control_L,
517    KC(0x7c),		KS_less,	KS_greater,
518};
519
520/* 026 Italian type 5 keyboard */
521const keysym_t sunkbd5_keydesc_it[] = {
522    KC(0x0d),		KS_Mode_switch,
523    KC(0x1f),		KS_2,		KS_quotedbl,
524    KC(0x20),		KS_3,		KS_sterling,
525    KC(0x23),		KS_6,		KS_ampersand,
526    KC(0x24),		KS_7,		KS_slash,
527    KC(0x25),		KS_8,		KS_parenleft,	KS_braceleft,
528    KC(0x26),		KS_9,		KS_parenright,	KS_braceright,
529    KC(0x27),		KS_0,		KS_equal,
530    KC(0x28),		KS_apostrophe,	KS_question,	KS_grave,
531    KC(0x29),		KS_igrave,	KS_asciicircum,
532    KC(0x2a),		KS_backslash,	KS_bar,
533    KC(0x40),		KS_egrave,	KS_eacute,	KS_bracketleft,
534    KC(0x41),		KS_plus,	KS_asterisk,	KS_bracketright,
535    KC(0x56),		KS_ograve,	KS_ccedilla,	KS_at,
536    KC(0x57),		KS_agrave,	KS_degree,	KS_numbersign,
537    KC(0x58),		KS_ugrave,	KS_section,	KS_asciitilde,
538    KC(0x6b),		KS_comma,	KS_semicolon,
539    KC(0x6c),		KS_period,	KS_colon,
540    KC(0x6d),		KS_minus,	KS_underscore,
541    KC(0x7c),		KS_less,	KS_greater,
542};
543
544/* 007 Dutch type 4 keyboard */
545const keysym_t sunkbd_keydesc_nl[] = {
546    KC(0x0d),		KS_Caps_Lock,
547    KC(0x0f),		KS_backslash,	KS_bar,
548    KC(0x1e),		KS_1,		KS_exclam,	KS_onesuperior,
549    KC(0x1f),		KS_2,		KS_quotedbl,	KS_twosuperior,
550    KC(0x20),		KS_3,		KS_numbersign,	KS_threesuperior,
551    KC(0x21),		KS_4,		KS_dollar,	KS_onequarter,
552    KC(0x22),		KS_5,		KS_percent,	KS_onehalf,
553    KC(0x23),		KS_6,		KS_ampersand,	KS_threequarters,
554    KC(0x24),		KS_7,		KS_underscore,	KS_sterling,
555    KC(0x25),		KS_8,		KS_parenleft,	KS_braceleft,
556    KC(0x26),		KS_9,		KS_parenright,	KS_braceright,
557    KC(0x27),		KS_0,		KS_apostrophe,	KS_grave,
558    KC(0x28),		KS_slash,	KS_question,
559    KC(0x29),		KS_degree,	KS_dead_tilde,	KS_dead_abovering,
560    KC(0x2a),		KS_less,	KS_greater,
561    KC(0x40),		KS_dead_diaeresis,KS_dead_circumflex,
562    KC(0x41),		KS_asterisk,	KS_brokenbar,	KS_asciitilde,
563    KC(0x4e),		KS_s,		KS_S,		KS_ssharp,
564    KC(0x56),		KS_plus,	KS_plusminus,
565    KC(0x57),		KS_dead_acute,	KS_dead_grave,
566    KC(0x58),		KS_at,		KS_section,	KS_notsign,
567    KC(0x64),		KS_z,		KS_Z,		KS_guillemotleft,
568    KC(0x65),		KS_x,		KS_X,		KS_guillemotright,
569    KC(0x66),		KS_c,		KS_C,		KS_cent,
570    KC(0x6a),		KS_m,		KS_M,		KS_mu,
571    KC(0x6b),		KS_comma,	KS_semicolon,
572    KC(0x6c),		KS_period,	KS_colon,
573    KC(0x6d),		KS_minus,	KS_equal,
574    KC(0x77),		KS_Mode_switch,
575    KC(0x7d),		KS_bracketright,KS_bracketleft,
576};
577
578/* 027 Dutch type 5 keyboard */
579const keysym_t sunkbd5_keydesc_nl[] = {
580    KC(0x0d),		KS_Mode_switch,
581    KC(0x1e),		KS_1,		KS_exclam,	KS_onesuperior,
582    KC(0x1f),		KS_2,		KS_quotedbl,	KS_twosuperior,
583    KC(0x20),		KS_3,		KS_numbersign,	KS_threesuperior,
584    KC(0x21),		KS_4,		KS_dollar,	KS_onequarter,
585    KC(0x22),		KS_5,		KS_percent,	KS_onehalf,
586    KC(0x23),		KS_6,		KS_ampersand,	KS_threequarters,
587    KC(0x24),		KS_7,		KS_underscore,	KS_sterling,
588    KC(0x25),		KS_8,		KS_parenleft,	KS_braceleft,
589    KC(0x26),		KS_9,		KS_parenright,	KS_braceright,
590    KC(0x27),		KS_0,		KS_apostrophe,	KS_grave,
591    KC(0x28),		KS_slash,	KS_question,	KS_backslash,
592    KC(0x29),		KS_degree,	KS_dead_tilde,	KS_dead_abovering,
593    KC(0x2a),		KS_at,		KS_section,	KS_notsign,
594    KC(0x40),		KS_dead_diaeresis,KS_dead_circumflex,
595    KC(0x41),		KS_asterisk,	KS_bar,		KS_asciitilde,
596    KC(0x4e),		KS_s,		KS_S,		KS_ssharp,
597    KC(0x56),		KS_plus,	KS_plusminus,
598    KC(0x57),		KS_dead_acute,	KS_dead_grave,
599    KC(0x58),		KS_less,	KS_greater,	KS_asciicircum,
600    KC(0x64),		KS_z,		KS_Z,		KS_guillemotleft,
601    KC(0x65),		KS_x,		KS_X,		KS_guillemotright,
602    KC(0x66),		KS_c,		KS_C,		KS_cent,
603    KC(0x6a),		KS_m,		KS_M,		KS_mu,
604    KC(0x6b),		KS_comma,	KS_semicolon,
605    KC(0x6c),		KS_period,	KS_colon,	KS_hyphen,
606    KC(0x6d),		KS_minus,	KS_equal,
607    KC(0x7d),		KS_bracketright,KS_bracketleft,	KS_brokenbar,
608};
609
610/* 008 Norwegian type 4 keyboard */
611const keysym_t sunkbd_keydesc_no[] = {
612    KC(0x0d),		KS_Mode_switch,
613    KC(0x0f),		KS_asciitilde,	KS_asciicircum,
614    KC(0x1f),		KS_2,		KS_quotedbl,	KS_at,
615    KC(0x20),		KS_3,		KS_numbersign,	KS_sterling,
616    KC(0x21),		KS_4,		KS_currency,	KS_dollar,
617    KC(0x23),		KS_6,		KS_ampersand,
618    KC(0x24),		KS_7,		KS_slash,	KS_braceleft,
619    KC(0x25),		KS_8,		KS_parenleft,	KS_bracketleft,
620    KC(0x26),		KS_9,		KS_parenright,	KS_bracketright,
621    KC(0x27),		KS_0,		KS_equal,	KS_braceright,
622    KC(0x28),		KS_plus,	KS_question,
623    KC(0x29),		KS_backslash,	KS_dead_grave,	KS_dead_acute,
624    KC(0x2a),		KS_apostrophe,	KS_asterisk,	KS_grave,
625    KC(0x40),		KS_aring,
626    KC(0x41),		KS_dead_diaeresis,KS_dead_circumflex,KS_dead_tilde,
627    KC(0x4c),		KS_Caps_Lock,
628    KC(0x56),		KS_oslash,
629    KC(0x57),		KS_ae,
630    KC(0x58),		KS_bar,		KS_section,
631    KC(0x6b),		KS_comma,	KS_semicolon,
632    KC(0x6c),		KS_period,	KS_colon,
633    KC(0x6d),		KS_minus,	KS_underscore,
634    KC(0x77),		KS_Control_L,
635    KC(0x7d),		KS_less,	KS_greater,
636};
637
638/* 028 Norwegian type 5 keyboard */
639const keysym_t sunkbd5_keydesc_no[] = {
640    KC(0x0d),		KS_Mode_switch,
641    KC(0x1f),		KS_2,		KS_quotedbl,	KS_at,
642    KC(0x20),		KS_3,		KS_numbersign,	KS_sterling,
643    KC(0x21),		KS_4,		KS_currency,	KS_dollar,
644    KC(0x22),		KS_5,		KS_percent,	KS_asciitilde,
645    KC(0x23),		KS_6,		KS_ampersand,	KS_asciicircum,
646    KC(0x24),		KS_7,		KS_slash,	KS_braceleft,
647    KC(0x25),		KS_8,		KS_parenleft,	KS_bracketleft,
648    KC(0x26),		KS_9,		KS_parenright,	KS_bracketright,
649    KC(0x27),		KS_0,		KS_equal,	KS_braceright,
650    KC(0x28),		KS_plus,	KS_question,
651    KC(0x29),		KS_backslash,	KS_dead_grave,	KS_dead_acute,
652    KC(0x2a),		KS_bar,		KS_section,
653    KC(0x40),		KS_aring,
654    KC(0x41),		KS_dead_diaeresis,KS_dead_circumflex,KS_dead_tilde,
655    KC(0x56),		KS_oslash,
656    KC(0x57),		KS_ae,
657    KC(0x58),		KS_apostrophe,	KS_asterisk,	KS_grave,
658    KC(0x6b),		KS_comma,	KS_semicolon,
659    KC(0x6c),		KS_period,	KS_colon,
660    KC(0x6d),		KS_minus,	KS_underscore,
661    KC(0x7d),		KS_less,	KS_greater,
662};
663
664/* 009 Portuguese type 4 keyboard */
665const keysym_t sunkbd_keydesc_pt[] = {
666    KC(0x0d),		KS_Mode_switch,
667    KC(0x0f),		KS_bracketright,KS_braceright,	KS_guillemotright,
668    KC(0x1f),		KS_2,		KS_quotedbl,	KS_at,
669    KC(0x20),		KS_3,		KS_numbersign,	KS_sterling,
670    KC(0x21),		KS_4,		KS_dollar,	KS_section,
671    KC(0x23),		KS_6,		KS_ampersand,	KS_notsign,
672    KC(0x24),		KS_7,		KS_slash,
673    KC(0x25),		KS_8,		KS_parenleft,
674    KC(0x26),		KS_9,		KS_parenright,	KS_backslash,
675    KC(0x27),		KS_0,		KS_equal,	KS_bar,
676    KC(0x28),		KS_apostrophe,	KS_question,	KS_grave,
677    KC(0x29),		KS_exclamdown,	KS_questiondown,
678    KC(0x2a),		KS_dead_tilde,	KS_dead_circumflex,KS_asciicircum,
679    KC(0x40),		KS_dead_diaeresis,KS_asterisk,	KS_plus,
680    KC(0x41),		KS_dead_acute,	KS_dead_grave,	KS_asciitilde,
681    KC(0x4c),		KS_Caps_Lock,
682    KC(0x56),		KS_ccedilla,
683    KC(0x57),		KS_masculine,	KS_ordfeminine,
684    KC(0x58),		KS_bracketleft,	KS_braceleft,	KS_guillemotleft,
685    KC(0x6b),		KS_comma,	KS_semicolon,
686    KC(0x6c),		KS_period,	KS_colon,
687    KC(0x6d),		KS_minus,	KS_underscore,
688    KC(0x77),		KS_Control_L,
689    KC(0x7d),		KS_less,	KS_greater,
690};
691
692/* 029 Portuguese type 4 keyboard */
693const keysym_t sunkbd5_keydesc_pt[] = {
694    KC(0x0d),		KS_Mode_switch,
695    KC(0x1f),		KS_2,		KS_quotedbl,	KS_at,
696    KC(0x20),		KS_3,		KS_numbersign,	KS_sterling,
697    KC(0x21),		KS_4,		KS_dollar,	KS_section,
698    KC(0x22),		KS_5,		KS_percent,	KS_asciitilde,
699    KC(0x23),		KS_6,		KS_ampersand,	KS_asciicircum,
700    KC(0x24),		KS_7,		KS_slash,	KS_braceleft,
701    KC(0x25),		KS_8,		KS_parenleft,	KS_bracketleft,
702    KC(0x26),		KS_9,		KS_parenright,	KS_bracketright,
703    KC(0x27),		KS_0,		KS_equal,	KS_braceright,
704    KC(0x28),		KS_apostrophe,	KS_question,	KS_grave,
705    KC(0x29),		KS_guillemotleft,KS_guillemotright,
706    KC(0x2a),		KS_backslash,	KS_bar,
707    KC(0x40),		KS_plus,	KS_asterisk,	KS_dead_diaeresis,
708    KC(0x41),		KS_dead_acute,	KS_dead_grave,
709    KC(0x56),		KS_ccedilla,
710    KC(0x57),		KS_masculine,	KS_ordfeminine,
711    KC(0x58),		KS_dead_tilde,	KS_dead_circumflex,
712    KC(0x6b),		KS_comma,	KS_semicolon,
713    KC(0x6c),		KS_period,	KS_colon,
714    KC(0x6d),		KS_minus,	KS_underscore,
715    KC(0x7d),		KS_less,	KS_greater,
716};
717
718/* 00a Spanish type 4 keyboard */
719const keysym_t sunkbd_keydesc_es[] = {
720    KC(0x0d),		KS_Mode_switch,
721    KC(0x0f),		KS_bracketright,KS_braceright,	KS_guillemotright,
722    KC(0x1f),		KS_2,		KS_quotedbl,	KS_at,
723    KC(0x20),		KS_3,		KS_hyphen,	KS_numbersign,
724    KC(0x22),		KS_5,		KS_percent,	KS_degree,
725    KC(0x23),		KS_6,		KS_ampersand,	KS_notsign,
726    KC(0x24),		KS_7,		KS_slash,
727    KC(0x25),		KS_8,		KS_parenleft,
728    KC(0x26),		KS_9,		KS_parenright,	KS_backslash,
729    KC(0x27),		KS_0,		KS_equal,	KS_bar,
730    KC(0x28),		KS_apostrophe,	KS_question,	KS_grave,
731    KC(0x29),		KS_exclamdown,	KS_questiondown,
732    KC(0x2a),		KS_ccedilla,
733    KC(0x3e),		KS_o,		KS_O,		KS_masculine,
734    KC(0x40),		KS_dead_grave,	KS_dead_circumflex,KS_asciicircum,
735    KC(0x41),		KS_plus,	KS_asterisk,	KS_asciitilde,
736    KC(0x4c),		KS_Caps_Lock,
737    KC(0x4d),		KS_a,		KS_A,		KS_ordfeminine,
738    KC(0x56),		KS_ntilde,
739    KC(0x57),		KS_dead_acute,	KS_dead_diaeresis,
740    KC(0x58),		KS_bracketleft,	KS_braceleft,	KS_guillemotleft,
741    KC(0x6b),		KS_comma,	KS_semicolon,
742    KC(0x6c),		KS_period,	KS_colon,
743    KC(0x6d),		KS_minus,	KS_underscore,
744    KC(0x77),		KS_Control_L,
745    KC(0x7d),		KS_less,	KS_greater,
746};
747
748/* 02a Spanish type 5 keyboard */
749const keysym_t sunkbd5_keydesc_es[] = {
750    KC(0x0d),		KS_Mode_switch,
751    KC(0x1e),		KS_1,		KS_exclam,	KS_bar,
752    KC(0x1f),		KS_2,		KS_quotedbl,	KS_at,
753    KC(0x20),		KS_3,		KS_hyphen,	KS_numbersign,
754    KC(0x21),		KS_4,		KS_dollar,	KS_asciicircum,
755    KC(0x22),		KS_5,		KS_percent,	KS_asciitilde,
756    KC(0x23),		KS_6,		KS_ampersand,	KS_notsign,
757    KC(0x24),		KS_7,		KS_slash,
758    KC(0x25),		KS_8,		KS_parenleft,
759    KC(0x26),		KS_9,		KS_parenright,
760    KC(0x27),		KS_0,		KS_equal,
761    KC(0x28),		KS_apostrophe,	KS_question,	KS_grave,
762    KC(0x29),		KS_exclamdown,	KS_questiondown,
763    KC(0x2a),		KS_masculine,	KS_ordfeminine,	KS_backslash,
764    KC(0x40),		KS_dead_grave,	KS_dead_circumflex,KS_bracketleft,
765    KC(0x41),		KS_plus,	KS_asterisk,	KS_bracketright,
766    KC(0x56),		KS_ntilde,
767    KC(0x57),		KS_dead_acute,	KS_dead_diaeresis,KS_braceleft,
768    KC(0x58),		KS_ccedilla,	KS_Ccedilla,	KS_braceright,
769    KC(0x6b),		KS_comma,	KS_semicolon,
770    KC(0x6c),		KS_period,	KS_colon,
771    KC(0x6d),		KS_minus,	KS_underscore,
772    KC(0x7d),		KS_less,	KS_greater,
773};
774
775/* 00b Swedish/Finnish type 4 keyboard */
776const keysym_t sunkbd_keydesc_sv[] = {
777    KC(0x0d),		KS_Multi_key,
778    KC(0x0f),		KS_asciitilde,	KS_asciicircum,
779    KC(0x1f),		KS_2,		KS_quotedbl,	KS_at,
780    KC(0x20),		KS_3,		KS_numbersign,	KS_sterling,
781    KC(0x21),		KS_4,		KS_currency,	KS_dollar,
782    KC(0x23),		KS_6,		KS_ampersand,
783    KC(0x24),		KS_7,		KS_slash,	KS_braceleft,
784    KC(0x25),		KS_8,		KS_parenleft,	KS_bracketleft,
785    KC(0x26),		KS_9,		KS_parenright,	KS_bracketright,
786    KC(0x27),		KS_0,		KS_equal,	KS_braceright,
787    KC(0x28),		KS_plus,	KS_question,	KS_backslash,
788    KC(0x29),		KS_dead_acute,	KS_dead_grave,
789    KC(0x2a),		KS_apostrophe,	KS_asterisk,	KS_grave,
790    KC(0x40),		KS_aring,
791    KC(0x41),		KS_dead_diaeresis,KS_dead_circumflex,KS_dead_tilde,
792    KC(0x43),		KS_Mode_switch,
793    KC(0x4c),		KS_Caps_Lock,
794    KC(0x56),		KS_odiaeresis,
795    KC(0x57),		KS_adiaeresis,
796    KC(0x58),		KS_section,	KS_onehalf,
797    KC(0x6b),		KS_comma,	KS_semicolon,
798    KC(0x6c),		KS_period,	KS_colon,
799    KC(0x6d),		KS_minus,	KS_underscore,
800    KC(0x77),		KS_Control_L,
801    KC(0x7c),		KS_less,	KS_greater,	KS_bar,
802};
803
804const keysym_t sunkbd_keydesc_sv_nodead[] = {
805    KC(0x29),		KS_apostrophe,	KS_grave,
806    KC(0x41),		KS_diaeresis,	KS_asciicircum,	KS_asciitilde,
807};
808
809/* 02b Swedish type 5 keyboard */
810const keysym_t sunkbd5_keydesc_sv[] = {
811    KC(0x0d),		KS_Mode_switch,
812    KC(0x0f),		KS_asciitilde,	KS_asciicircum,
813    KC(0x1f),		KS_2,		KS_quotedbl,	KS_at,
814    KC(0x20),		KS_3,		KS_numbersign,	KS_sterling,
815    KC(0x21),		KS_4,		KS_currency,	KS_dollar,
816    KC(0x23),		KS_6,		KS_ampersand,
817    KC(0x24),		KS_7,		KS_slash,	KS_braceleft,
818    KC(0x25),		KS_8,		KS_parenleft,	KS_bracketleft,
819    KC(0x26),		KS_9,		KS_parenright,	KS_bracketright,
820    KC(0x27),		KS_0,		KS_equal,	KS_braceright,
821    KC(0x28),		KS_plus,	KS_question,	KS_backslash,
822    KC(0x29),		KS_dead_acute,	KS_dead_grave,
823    KC(0x2a),		KS_section,	KS_onehalf,
824    KC(0x40),		KS_aring,
825    KC(0x41),		KS_dead_diaeresis,KS_dead_circumflex,KS_dead_tilde,
826    KC(0x43),		KS_Multi_key,
827    KC(0x4c),		KS_Control_L,
828    KC(0x56),		KS_odiaeresis,
829    KC(0x57),		KS_adiaeresis,
830    KC(0x58),		KS_apostrophe,	KS_asterisk,	KS_grave,
831    KC(0x6b),		KS_comma,	KS_semicolon,
832    KC(0x6c),		KS_period,	KS_colon,
833    KC(0x6d),		KS_minus,	KS_underscore,
834    KC(0x77),		KS_Caps_Lock,
835    KC(0x7c),		KS_less,	KS_greater,	KS_bar,
836};
837
838/* 00c Swiss-French type 4 keyboard */
839const keysym_t sunkbd_keydesc_sf[] = {
840    KC(0x0d),		KS_Multi_key,
841    KC(0x0f),		KS_greater,	KS_braceright,
842    KC(0x1e),		KS_1,		KS_plus,	KS_exclam,
843    KC(0x1f),		KS_2,		KS_quotedbl,	KS_at,
844    KC(0x20),		KS_3,		KS_asterisk,	KS_numbersign,
845    KC(0x21),		KS_4,		KS_ccedilla,	KS_cent,
846    KC(0x22),		KS_5,		KS_percent,	KS_asciitilde,
847    KC(0x23),		KS_6,		KS_ampersand,	KS_section,
848    KC(0x24),		KS_7,		KS_slash,	KS_bar,
849    KC(0x25),		KS_8,		KS_parenleft,	KS_degree,
850    KC(0x26),		KS_9,		KS_parenright,	KS_backslash,
851    KC(0x27),		KS_0,		KS_equal,	KS_asciicircum,
852    KC(0x28),		KS_apostrophe,	KS_question,	KS_grave,
853    KC(0x29),		KS_dead_circumflex,KS_dead_grave,
854    KC(0x2a),		KS_dollar,	KS_dead_tilde,	KS_sterling,
855    KC(0x3b),		KS_z,
856    KC(0x40),		KS_egrave,	KS_udiaeresis,
857    KC(0x41),		KS_dead_diaeresis,KS_dead_acute,
858    KC(0x43),		KS_Mode_switch,
859    KC(0x4c),		KS_Caps_Lock,
860    KC(0x56),		KS_eacute,	KS_odiaeresis,
861    KC(0x57),		KS_agrave,	KS_adiaeresis,
862    KC(0x58),		KS_less,	KS_braceleft,
863    KC(0x64),		KS_y,
864    KC(0x6a),		KS_m,		KS_M,		KS_mu,
865    KC(0x6b),		KS_comma,	KS_semicolon,
866    KC(0x6c),		KS_period,	KS_colon,
867    KC(0x6d),		KS_minus,	KS_underscore,
868    KC(0x77),		KS_Control_L,
869    KC(0x7c),		KS_bracketright,KS_bracketleft,	KS_backslash,
870};
871
872/* 02c Swiss-French type 5 keyboard */
873const keysym_t sunkbd5_keydesc_sf[] = {
874    KC(0x0d),		KS_Mode_switch,
875    KC(0x1e),		KS_1,		KS_plus,	KS_bar,
876    KC(0x1f),		KS_2,		KS_quotedbl,	KS_at,
877    KC(0x20),		KS_3,		KS_asterisk,	KS_numbersign,
878    KC(0x21),		KS_4,		KS_ccedilla,	KS_asciicircum,
879    KC(0x22),		KS_5,		KS_percent,	KS_asciitilde,
880    KC(0x23),		KS_6,		KS_ampersand,
881    KC(0x24),		KS_7,		KS_slash,
882    KC(0x25),		KS_8,		KS_parenleft,
883    KC(0x26),		KS_9,		KS_parenright,
884    KC(0x27),		KS_0,		KS_equal,	KS_grave,
885    KC(0x28),		KS_apostrophe,	KS_question,	KS_dead_acute,
886    KC(0x29),		KS_dead_circumflex,KS_dead_grave,KS_dead_tilde,
887    KC(0x2a),		KS_dollar,	KS_degree,
888    KC(0x3b),		KS_z,
889    KC(0x40),		KS_egrave,	KS_udiaeresis,	KS_bracketleft,
890    KC(0x41),		KS_dead_diaeresis,KS_exclam,	KS_bracketright,
891    KC(0x56),		KS_eacute,	KS_odiaeresis,
892    KC(0x57),		KS_agrave,	KS_adiaeresis,	KS_braceleft,
893    KC(0x58),		KS_dollar,	KS_sterling,	KS_braceright,
894    KC(0x64),		KS_y,
895    KC(0x6b),		KS_comma,	KS_semicolon,
896    KC(0x6c),		KS_period,	KS_colon,
897    KC(0x6d),		KS_minus,	KS_underscore,
898    KC(0x7c),		KS_less,	KS_greater,	KS_backslash,
899};
900
901/* 00d Swiss-German type 4 keyboard */
902const keysym_t sunkbd_keydesc_sg[] = {
903    KC(0x0d),		KS_Multi_key,
904    KC(0x0f),		KS_greater,	KS_braceright,
905    KC(0x1e),		KS_1,		KS_plus,	KS_exclam,
906    KC(0x1f),		KS_2,		KS_quotedbl,	KS_at,
907    KC(0x20),		KS_3,		KS_asterisk,	KS_numbersign,
908    KC(0x21),		KS_4,		KS_ccedilla,	KS_cent,
909    KC(0x22),		KS_5,		KS_percent,	KS_asciitilde,
910    KC(0x23),		KS_6,		KS_ampersand,	KS_section,
911    KC(0x24),		KS_7,		KS_slash,	KS_bar,
912    KC(0x25),		KS_8,		KS_parenleft,	KS_degree,
913    KC(0x26),		KS_9,		KS_parenright,	KS_backslash,
914    KC(0x27),		KS_0,		KS_equal,	KS_asciicircum,
915    KC(0x28),		KS_apostrophe,	KS_question,	KS_grave,
916    KC(0x29),		KS_dead_circumflex,KS_dead_grave,
917    KC(0x2a),		KS_dollar,	KS_dead_tilde,	KS_sterling,
918    KC(0x3b),		KS_z,
919    KC(0x40),		KS_udiaeresis,	KS_egrave,
920    KC(0x41),		KS_dead_diaeresis,KS_dead_acute,
921    KC(0x43),		KS_Mode_switch,
922    KC(0x4c),		KS_Caps_Lock,
923    KC(0x56),		KS_odiaeresis,	KS_eacute,
924    KC(0x57),		KS_adiaeresis,	KS_agrave,
925    KC(0x58),		KS_less,	KS_braceleft,
926    KC(0x64),		KS_y,
927    KC(0x6a),		KS_m,		KS_M,		KS_mu,
928    KC(0x6b),		KS_comma,	KS_semicolon,
929    KC(0x6c),		KS_period,	KS_colon,
930    KC(0x6d),		KS_minus,	KS_underscore,
931    KC(0x77),		KS_Control_L,
932    KC(0x7c),		KS_bracketright,KS_bracketleft,	KS_backslash,
933};
934
935/* 02d Swiss-German type 5 keyboard */
936const keysym_t sunkbd5_keydesc_sg[] = {
937    KC(0x0d),		KS_Mode_switch,
938    KC(0x1e),		KS_1,		KS_plus,	KS_bar,
939    KC(0x1f),		KS_2,		KS_quotedbl,	KS_at,
940    KC(0x20),		KS_3,		KS_asterisk,	KS_numbersign,
941    KC(0x21),		KS_4,		KS_ccedilla,	KS_asciicircum,
942    KC(0x22),		KS_5,		KS_percent,	KS_asciitilde,
943    KC(0x23),		KS_6,		KS_ampersand,
944    KC(0x24),		KS_7,		KS_slash,
945    KC(0x25),		KS_8,		KS_parenleft,
946    KC(0x26),		KS_9,		KS_parenright,
947    KC(0x27),		KS_0,		KS_equal,	KS_grave,
948    KC(0x28),		KS_apostrophe,	KS_question,	KS_dead_acute,
949    KC(0x29),		KS_dead_circumflex,KS_dead_grave,KS_dead_tilde,
950    KC(0x2a),		KS_dollar,	KS_degree,
951    KC(0x3b),		KS_z,
952    KC(0x40),		KS_udiaeresis,	KS_egrave,	KS_bracketleft,
953    KC(0x41),		KS_dead_diaeresis,KS_exclam,	KS_bracketright,
954    KC(0x56),		KS_odiaeresis,	KS_eacute,
955    KC(0x57),		KS_adiaeresis,	KS_agrave,	KS_braceleft,
956    KC(0x58),		KS_dollar,	KS_sterling,	KS_braceright,
957    KC(0x64),		KS_y,
958    KC(0x6b),		KS_comma,	KS_semicolon,
959    KC(0x6c),		KS_period,	KS_colon,
960    KC(0x6d),		KS_minus,	KS_underscore,
961    KC(0x7c),		KS_less,	KS_greater,	KS_backslash,
962};
963
964/* 00e UK English type 4 keyboard */
965const keysym_t sunkbd_keydesc_uk[] = {
966    KC(0x1e),		KS_1,		KS_exclam,	KS_bar,
967    KC(0x21),		KS_3,		KS_sterling,	KS_numbersign,
968    KC(0x28),		KS_minus,	KS_underscore,	KS_notsign,
969    KC(0x43),		KS_Mode_switch,
970};
971
972/* 02e UK English type 5 keyboard */
973const keysym_t sunkbd5_keydesc_uk[] = {
974    KC(0x0d),		KS_Mode_switch,
975    KC(0x1f),		KS_2,		KS_quotedbl,
976    KC(0x20),		KS_3,		KS_sterling,
977    KC(0x2a),		KS_grave,	KS_notsign,	KS_brokenbar,
978    KC(0x57),		KS_apostrophe,	KS_at,
979    KC(0x58),		KS_numbersign,	KS_asciitilde,
980    KC(0x7c),		KS_backslash,	KS_bar,
981};
982
983/* 031 Japan type 5 keyboard */
984const keysym_t sunkbd5_keydesc_jp[] = {
985    KC(0x1f),		KS_2,		KS_quotedbl,
986    KC(0x23),		KS_6,		KS_ampersand,
987    KC(0x24),		KS_7,		KS_apostrophe,
988    KC(0x25),		KS_8,		KS_parenleft,
989    KC(0x26),		KS_9,		KS_parenright,
990    KC(0x27),		KS_0,
991    KC(0x28),		KS_minus,	KS_equal,
992    KC(0x29),		KS_asciicircum,	KS_asciitilde,
993    KC(0x2a),		KS_yen,		KS_bar,
994    KC(0x40),		KS_at,		KS_grave,
995    KC(0x41),		KS_bracketleft,	KS_braceleft,
996    KC(0x56),		KS_semicolon,	KS_plus,
997    KC(0x57),		KS_colon,	KS_asterisk,
998    KC(0x58),		KS_bracketright,KS_braceright,
999    KC(0x7c),		KS_backslash,	KS_underscore,
1000};
1001
1002#define KBD_MAP(name, base, map) \
1003    { name, base, sizeof(map)/sizeof(keysym_t), map }
1004
1005/* Supported type 4 keyboard layouts */
1006const struct wscons_keydesc sunkbd_keydesctab[] = {
1007	KBD_MAP(KB_US,			0,	sunkbd_keydesc_us),
1008	KBD_MAP(KB_BE,			KB_US,	sunkbd_keydesc_befr),
1009	KBD_MAP(KB_DE,			KB_US,	sunkbd_keydesc_de),
1010	KBD_MAP(KB_DK,			KB_US,	sunkbd_keydesc_dk),
1011	KBD_MAP(KB_ES,			KB_US,	sunkbd_keydesc_es),
1012	KBD_MAP(KB_FR,			KB_US,	sunkbd_keydesc_befr),
1013	KBD_MAP(KB_IT,			KB_US,	sunkbd_keydesc_it),
1014	KBD_MAP(KB_NL,			KB_US,	sunkbd_keydesc_nl),
1015	KBD_MAP(KB_NO,			KB_US,	sunkbd_keydesc_no),
1016	KBD_MAP(KB_PT,			KB_US,	sunkbd_keydesc_pt),
1017	KBD_MAP(KB_SF,			KB_US,	sunkbd_keydesc_sf),
1018	KBD_MAP(KB_SG,			KB_US,	sunkbd_keydesc_sg),
1019	KBD_MAP(KB_SV,			KB_US,	sunkbd_keydesc_sv),
1020	KBD_MAP(KB_SV | KB_NODEAD,	KB_SV,	sunkbd_keydesc_sv_nodead),
1021	KBD_MAP(KB_UK,			KB_US,	sunkbd_keydesc_uk),
1022	{0, 0, 0, 0},
1023};
1024
1025/* Supported type 5 keyboard layouts */
1026const struct wscons_keydesc sunkbd5_keydesctab[] = {
1027	KBD_MAP(KB_US,			0,	sunkbd_keydesc_us),
1028	KBD_MAP(KB_DE,			KB_US,	sunkbd5_keydesc_de),
1029	KBD_MAP(KB_DK,			KB_US,	sunkbd5_keydesc_dk),
1030	KBD_MAP(KB_ES,			KB_US,	sunkbd5_keydesc_es),
1031	KBD_MAP(KB_FR,			KB_US,	sunkbd5_keydesc_fr),
1032	KBD_MAP(KB_IT,			KB_US,	sunkbd5_keydesc_it),
1033	KBD_MAP(KB_JP,			KB_US,	sunkbd5_keydesc_jp),
1034	KBD_MAP(KB_NL,			KB_US,	sunkbd5_keydesc_nl),
1035	KBD_MAP(KB_NO,			KB_US,	sunkbd5_keydesc_no),
1036	KBD_MAP(KB_PT,			KB_US,	sunkbd5_keydesc_pt),
1037	KBD_MAP(KB_SF,			KB_US,	sunkbd5_keydesc_sf),
1038	KBD_MAP(KB_SG,			KB_US,	sunkbd5_keydesc_sg),
1039	KBD_MAP(KB_SV,			KB_US,	sunkbd5_keydesc_sv),
1040	KBD_MAP(KB_SV | KB_NODEAD,	KB_SV,	sunkbd_keydesc_sv_nodead),
1041	KBD_MAP(KB_UK,			KB_US,	sunkbd5_keydesc_uk),
1042	{0, 0, 0, 0},
1043};
1044
1045/*
1046 * Keyboard layout to ID table
1047 * References:
1048 *	Sun Type 5 Keyboard Supplement Installation Guide, May 1992
1049 *	http://docs.sun.com/db/doc/806-6642/6jfipqu57?a=view
1050 *	http://jp.sunsolve.sun.com/handbook_pub/Systems/SSVygr/INPUT_Compact1_Keyboard.html
1051 */
1052const int sunkbd_layouts[MAXSUNLAYOUT] = {
1053	/* Type 4 layouts */
1054	KB_US,	/* 000 USA */
1055	KB_US,	/* 001 same as 000 */
1056	KB_BE,	/* 002 Belgium/French */
1057	-1,	/* 003 Canada */
1058	KB_DK,	/* 004 Denmark */
1059	KB_DE,	/* 005 Germany */
1060	KB_IT,	/* 006 Italy */
1061	KB_NL,	/* 007 The Netherlands */
1062	KB_NO,	/* 008 Norway */
1063	KB_PT,	/* 009 Portugal */
1064	KB_ES,	/* 00a Latin America/Spanish */
1065	KB_SV,	/* 00b Sweden */
1066	KB_SF,	/* 00c Switzerland/French */
1067	KB_SG,	/* 00d Switzerland/German */
1068	KB_UK,	/* 00e Great Britain */
1069	-1,	/* 00f unaffected */
1070	-1,	/* 010 Korea */
1071	-1,	/* 011 Taiwan */
1072	-1,	/* 012 unaffected */
1073	-1,	/* 013 unaffected */
1074	-1,	/* 014 VT220 */
1075	-1,	/* 015 VT220 Switzerland/French */
1076	-1,	/* 016 VT220 Switzerland/German */
1077	-1,	/* 017 VT220 Switzerland/Italian */
1078	-1,	/* 018 unaffected */
1079	-1,	/* 019 Belgium */
1080	-1,	/* 01a unaffected */
1081	-1,	/* 01b unaffected */
1082	-1,	/* 01c unaffected */
1083	-1,	/* 01d unaffected */
1084	-1,	/* 01e unaffected */
1085	-1,	/* 01f unaffected */
1086	-1,	/* 020 Japan */
1087
1088	/* Type 5 layouts */
1089	KB_US,	/* 021 USA */
1090	KB_US,	/* 022 UNIX */
1091	KB_FR,	/* 023 France */
1092	KB_DK,	/* 024 Denmark */
1093	KB_DE,	/* 025 Germany */
1094	KB_IT,	/* 026 Italy */
1095	KB_NL,	/* 027 The Netherlands */
1096	KB_NO,	/* 028 Norway */
1097	KB_PT,	/* 029 Portugal */
1098	KB_ES,	/* 02a Spain */
1099	KB_SV,	/* 02b Sweden */
1100	KB_SF,	/* 02c Switzerland/French */
1101	KB_SG,	/* 02d Switzerland/German */
1102	KB_UK,	/* 02e Great Britain */
1103	-1,	/* 02f Korea */
1104	-1,	/* 030 Taiwan */
1105	KB_JP,	/* 031 Japan */
1106	-1,	/* 032 Canada/French */
1107	-1,	/* 033 Hungary */
1108	-1,	/* 034 Poland */
1109	-1,	/* 035 Czech */
1110	-1,	/* 036 Russia */
1111	-1,	/* 037 Latvia */
1112	-1,	/* 038 Turkey-Q5 */
1113	-1,	/* 039 Greece */
1114	-1,	/* 03a Arabic */
1115	-1,	/* 03b Lithuania */
1116	-1,	/* 03c Belgium */
1117	-1,	/* 03d unaffected */
1118	-1,	/* 03e Turkey-F5 */
1119	-1,	/* 03f Canada/French */
1120
1121	/* Not affected range */
1122	-1,	/* 040 */
1123	-1,	/* 041 */
1124	-1,	/* 042 */
1125	-1,	/* 043 */
1126	-1,	/* 044 */
1127	-1,	/* 045 */
1128	-1,	/* 046 */
1129	-1,	/* 047 */
1130	-1,	/* 048 */
1131	-1,	/* 049 */
1132	-1,	/* 04a */
1133	-1,	/* 04b */
1134	-1,	/* 04c */
1135	-1,	/* 04d */
1136	-1,	/* 04e */
1137	-1,	/* 04f */
1138
1139	/* ``Compact-1'' layouts */
1140	KB_US,	/* 050 USA */
1141	KB_US,	/* 051 UNIX */
1142	KB_FR,	/* 052 France */
1143	KB_DK,	/* 053 Denmark */
1144	KB_DE,	/* 054 Germany */
1145	KB_IT,	/* 055 Italy */
1146	KB_NL,	/* 056 The Netherlands */
1147	KB_NO,	/* 057 Norway */
1148	KB_PT,	/* 058 Portugal */
1149	KB_ES,	/* 059 Spain */
1150	KB_SV,	/* 05a Sweden */
1151	KB_SF,	/* 05b Switzerland/French */
1152	KB_SG,	/* 05c Switzerland/German */
1153	KB_UK,	/* 05d Great Britain */
1154	-1,	/* 05e Korea */
1155	-1,	/* 05f Taiwan */
1156	KB_JP,	/* 060 Japan */
1157	-1,	/* 061 Canada/French */
1158};
1159
1160struct wskbd_mapdata sunkbd_keymapdata = {
1161	sunkbd_keydesctab,
1162#ifdef SUNKBD_LAYOUT
1163	SUNKBD_LAYOUT,
1164#else
1165	KB_US | KB_DEFAULT,
1166#endif
1167};
1168
1169struct wskbd_mapdata sunkbd5_keymapdata = {
1170	sunkbd5_keydesctab,
1171#ifdef SUNKBD5_LAYOUT
1172	SUNKBD5_LAYOUT,
1173#else
1174	KB_US | KB_DEFAULT,
1175#endif
1176};
1177