1 /* $NetBSD: wskbdmap_sun.c,v 1.15 2008/05/25 15:51:44 ghen Exp $ */
2 /* $OpenBSD: sunkbd.c,v 1.9 2002/09/08 23:22:00 miod Exp $ */
5 * Copyright (c) 2002 Jason L. Wright (jason@thought.net)
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions
11 * 1. Redistributions of source code must retain the above copyright
12 * notice, this list of conditions and the following disclaimer.
13 * 2. Redistributions in binary form must reproduce the above copyright
14 * notice, this list of conditions and the following disclaimer in the
15 * documentation and/or other materials provided with the distribution.
16 * 3. All advertising materials mentioning features or use of this software
17 * must display the following acknowledgement:
18 * This product includes software developed by Jason L. Wright
19 * 4. The name of the author may not be used to endorse or promote products
20 * derived from this software without specific prior written permission.
22 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
23 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
24 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
25 * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
26 * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
27 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
28 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
29 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
30 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
31 * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
32 * POSSIBILITY OF SUCH DAMAGE.
34 * Effort sponsored in part by the Defense Advanced Research Projects
35 * Agency (DARPA) and Air Force Research Laboratory, Air Force
36 * Materiel Command, USAF, under agreement number F30602-01-2-0537.
40 #include <sys/cdefs.h>
41 __KERNEL_RCSID(0, "$NetBSD: wskbdmap_sun.c,v 1.15 2008/05/25 15:51:44 ghen Exp $");
43 #include <sys/types.h>
44 #include <dev/wscons/wsksymdef.h>
45 #include <dev/wscons/wsksymvar.h>
47 #include "opt_sunkbd.h"
49 #define KC(n) KS_KEYCODE(n)
51 static const keysym_t wssun_keydesctab_us
[] = {
52 /* pos command normal shifted */
54 KC(0x02), KS_Cmd_BrightnessDown
,
56 KC(0x04), KS_Cmd_BrightnessUp
,
57 KC(0x05), KS_Cmd_Screen0
, KS_f1
,
58 KC(0x06), KS_Cmd_Screen1
, KS_f2
,
59 KC(0x07), KS_Cmd_Screen9
, KS_f10
,
60 KC(0x08), KS_Cmd_Screen2
, KS_f3
,
62 KC(0x0a), KS_Cmd_Screen3
, KS_f4
,
64 KC(0x0c), KS_Cmd_Screen4
, KS_f5
,
66 KC(0x0e), KS_Cmd_Screen5
, KS_f6
,
67 KC(0x10), KS_Cmd_Screen6
, KS_f7
,
68 KC(0x11), KS_Cmd_Screen7
, KS_f8
,
69 KC(0x12), KS_Cmd_Screen8
, KS_f9
,
71 KC(0x13), KS_Cmd
, KS_Alt_L
,
75 KC(0x14), KS_Cmd_ScrollSlowUp
, KS_Up
,
77 KC(0x16), KS_Print_Screen
,
78 KC(0x17), KS_Hold_Screen
,
82 KC(0x1b), KS_Cmd_ScrollSlowDown
, KS_Down
,
85 KC(0x1e), KS_1
, KS_exclam
,
86 KC(0x1f), KS_2
, KS_at
,
87 KC(0x20), KS_3
, KS_numbersign
,
88 KC(0x21), KS_4
, KS_dollar
,
89 KC(0x22), KS_5
, KS_percent
,
90 KC(0x23), KS_6
, KS_asciicircum
,
91 KC(0x24), KS_7
, KS_ampersand
,
92 KC(0x25), KS_8
, KS_asterisk
,
93 KC(0x26), KS_9
, KS_parenleft
,
94 KC(0x27), KS_0
, KS_parenright
,
95 KC(0x28), KS_minus
, KS_underscore
,
96 KC(0x29), KS_equal
, KS_plus
,
97 KC(0x2a), KS_grave
, KS_asciitilde
,
100 KC(0x2d), KS_KP_Equal
,
101 KC(0x2e), KS_KP_Divide
,
102 KC(0x2f), KS_KP_Multiply
,
105 KC(0x32), KS_KP_Delete
, KS_KP_Decimal
,
119 KC(0x40), KS_bracketleft
, KS_braceleft
,
120 KC(0x41), KS_bracketright
,KS_braceright
,
122 KC(0x43), KS_Multi_key
,
123 KC(0x44), KS_KP_Home
, KS_KP_7
,
124 KC(0x45), KS_Cmd_ScrollSlowUp
, KS_KP_Up
, KS_KP_8
,
125 KC(0x46), KS_Cmd_ScrollFastUp
, KS_KP_Prior
, KS_KP_9
,
126 KC(0x47), KS_KP_Subtract
,
130 KC(0x4c), KS_Control_L
,
131 KC(0x4d), KS_Cmd_Debugger
, KS_a
,
140 KC(0x56), KS_semicolon
, KS_colon
,
141 KC(0x57), KS_apostrophe
, KS_quotedbl
,
142 KC(0x58), KS_backslash
, KS_bar
,
144 KC(0x5a), KS_KP_Enter
,
145 KC(0x5b), KS_KP_Left
, KS_KP_4
,
146 KC(0x5c), KS_KP_Begin
, KS_KP_5
,
147 KC(0x5d), KS_KP_Right
, KS_KP_6
,
148 KC(0x5e), KS_KP_Insert
, KS_KP_0
,
150 KC(0x60), KS_Cmd_ScrollFastUp
, KS_Prior
,
152 KC(0x62), KS_Num_Lock
,
153 KC(0x63), KS_Shift_L
,
161 KC(0x6b), KS_comma
, KS_less
,
162 KC(0x6c), KS_period
, KS_greater
,
163 KC(0x6d), KS_slash
, KS_question
,
164 KC(0x6e), KS_Shift_R
,
165 KC(0x6f), KS_Linefeed
,
166 KC(0x70), KS_KP_End
, KS_KP_1
,
167 KC(0x71), KS_Cmd_ScrollSlowDown
, KS_KP_Down
, KS_KP_2
,
168 KC(0x72), KS_Cmd_ScrollFastDown
, KS_KP_Next
, KS_KP_3
,
170 KC(0x77), KS_Caps_Lock
,
174 KC(0x7b), KS_Cmd_ScrollFastDown
, KS_Next
,
178 const keysym_t wssun_keydesctab_sv
[] = {
179 KC(0x0d), KS_Multi_key
,
180 KC(0x0f), KS_asciitilde
, KS_asciicircum
,
181 KC(0x1f), KS_2
, KS_quotedbl
, KS_at
,
182 KC(0x20), KS_3
, KS_numbersign
, KS_sterling
,
183 KC(0x21), KS_4
, KS_currency
, KS_dollar
,
184 KC(0x23), KS_6
, KS_ampersand
,
185 KC(0x24), KS_7
, KS_slash
, KS_braceleft
,
186 KC(0x25), KS_8
, KS_parenleft
, KS_bracketleft
,
187 KC(0x26), KS_9
, KS_parenright
, KS_bracketright
,
188 KC(0x27), KS_0
, KS_equal
, KS_braceright
,
189 KC(0x28), KS_plus
, KS_question
, KS_backslash
,
190 KC(0x29), KS_dead_acute
, KS_dead_grave
,
191 KC(0x2a), KS_apostrophe
, KS_asterisk
, KS_grave
,
193 KC(0x41), KS_dead_diaeresis
,KS_dead_circumflex
,KS_dead_tilde
,
194 KC(0x43), KS_Mode_switch
,
195 KC(0x4c), KS_Caps_Lock
,
196 KC(0x56), KS_odiaeresis
,
197 KC(0x57), KS_adiaeresis
,
198 KC(0x58), KS_paragraph
, KS_onehalf
,
199 KC(0x6b), KS_comma
, KS_semicolon
,
200 KC(0x6c), KS_period
, KS_colon
,
201 KC(0x6d), KS_minus
, KS_underscore
,
202 KC(0x77), KS_Control_L
,
203 KC(0x7c), KS_less
, KS_greater
, KS_bar
,
206 const keysym_t wssun_keydesctab_sv_nodead
[] = {
207 KC(0x29), KS_apostrophe
, KS_grave
,
208 KC(0x41), KS_diaeresis
, KS_asciicircum
, KS_asciitilde
,
211 const keysym_t wssun_keydesctab_de
[] = {
212 KC(0x0d), KS_Mode_switch
, /* Alt Graph (Alt R code) */
213 KC(0x1f), KS_2
, KS_quotedbl
, KS_twosuperior
,
214 KC(0x20), KS_3
, KS_paragraph
, KS_threesuperior
,
215 KC(0x21), KS_4
, KS_dollar
,
216 KC(0x22), KS_5
, KS_percent
,
217 KC(0x23), KS_6
, KS_ampersand
,
218 KC(0x24), KS_7
, KS_slash
, KS_braceleft
,
219 KC(0x25), KS_8
, KS_parenleft
, KS_bracketleft
,
220 KC(0x26), KS_9
, KS_parenright
, KS_bracketright
,
221 KC(0x27), KS_0
, KS_equal
, KS_braceright
,
222 KC(0x28), KS_ssharp
, KS_question
, KS_backslash
,
223 KC(0x29), KS_dead_acute
, KS_dead_grave
,
224 KC(0x2a), KS_dead_circumflex
, KS_dead_abovering
,
225 KC(0x36), KS_q
, KS_Q
, KS_at
,
227 KC(0x40), KS_udiaeresis
,
228 /* KC(0x43) - Compose - could be used for mode switch too */
229 KC(0x41), KS_plus
, KS_asterisk
, KS_dead_tilde
,
230 KC(0x56), KS_odiaeresis
,
231 KC(0x57), KS_adiaeresis
,
232 KC(0x58), KS_numbersign
, KS_apostrophe
, KS_acute
,
234 KC(0x6a), KS_m
, KS_M
, KS_mu
,
235 KC(0x6b), KS_comma
, KS_semicolon
,
236 KC(0x6c), KS_period
, KS_colon
,
237 KC(0x6d), KS_minus
, KS_underscore
,
238 KC(0x7c), KS_less
, KS_greater
, KS_bar
,
241 const keysym_t wssun_keydesctab_de_nodead
[] = {
242 KC(0x29), KS_apostrophe
, KS_grave
,
243 KC(0x2a), KS_asciicircum
, KS_degree
,
244 KC(0x41), KS_plus
, KS_asterisk
, KS_asciitilde
,
247 const keysym_t wssun_keydesctab_uk
[] = {
248 KC(0x1f), KS_2
, KS_quotedbl
,
249 KC(0x20), KS_3
, KS_sterling
,
250 KC(0x21), KS_4
, KS_dollar
, KS_currency
,
251 KC(0x2a), KS_grave
, KS_notsign
,
252 KC(0x57), KS_apostrophe
, KS_at
,
253 KC(0x58), KS_numbersign
, KS_asciitilde
,
254 KC(0x7c), KS_backslash
, KS_bar
,
257 static const keysym_t wssun_keydesctab_us_dvorak
[] = {
258 /* pos command normal shifted */
259 KC(0x28), KS_bracketleft
, KS_braceleft
,
260 KC(0x29), KS_bracketright
,KS_braceright
,
261 KC(0x36), KS_apostrophe
, KS_quotedbl
,
262 KC(0x37), KS_comma
, KS_less
,
263 KC(0x38), KS_period
, KS_greater
,
271 KC(0x40), KS_slash
, KS_question
,
272 KC(0x41), KS_equal
, KS_plus
,
273 KC(0x4d), KS_Cmd_Debugger
, KS_a
,
283 KC(0x57), KS_minus
, KS_underscore
,
284 KC(0x64), KS_semicolon
, KS_colon
,
296 static const keysym_t wssun_keydesctab_us_colemak
[] = {
297 /* pos command normal shifted */
307 KC(0x3f), KS_semicolon
, KS_colon
,
308 KC(0x4d), KS_Cmd_Debugger
, KS_a
,
328 #define KBD_MAP(name, base, map) \
329 { name, base, sizeof(map)/sizeof(keysym_t), map }
330 /* KBD_NULLMAP generates a entry for machine native variant.
331 the entry will be modified by machine dependent keyboard driver. */
332 #define KBD_NULLMAP(name, base) { name, base, 0, 0 }
334 const struct wscons_keydesc wssun_keydesctab
[] = {
335 KBD_MAP(KB_US
, 0, wssun_keydesctab_us
),
336 KBD_MAP(KB_SV
, KB_US
, wssun_keydesctab_sv
),
337 KBD_MAP(KB_SV
| KB_NODEAD
, KB_SV
, wssun_keydesctab_sv_nodead
),
338 KBD_MAP(KB_DE
, KB_US
, wssun_keydesctab_de
),
339 KBD_MAP(KB_DE
| KB_NODEAD
, KB_DE
, wssun_keydesctab_de_nodead
),
340 KBD_MAP(KB_UK
, KB_US
, wssun_keydesctab_uk
),
341 KBD_MAP(KB_US
| KB_DVORAK
, KB_US
, wssun_keydesctab_us_dvorak
),
342 KBD_MAP(KB_US
| KB_COLEMAK
, KB_US
, wssun_keydesctab_us_colemak
),