4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
22 * Copyright 2007 Sun Microsystems, Inc. All rights reserved.
23 * Use is subject to license terms.
26 #pragma ident "%Z%%M% %I% %E% SMI"
29 * This module contains the translation tables for PS/2 style keyboards.
31 #define KEYMAP_SIZE_VARIABLE
33 #include <sys/param.h>
36 /* handy way to define control characters in the tables */
37 #define c(ch) (ch&0x1F)
41 #define KEYMAP_SIZE_PC 160
43 /* ***************************** */
44 /* PC-101 keyboard definitions */
45 /* ***************************** */
46 /* Unshifted keyboard table for PC keyboard */
49 static keymap_entry_t keytab_pc_lc
[KEYMAP_SIZE_PC
] = {
50 /* 0 */ HOLE
, '`', '1', '2', '3', '4', '5', '6',
51 /* 8 */ '7', '8', '9', '0', '-', '=', HOLE
, '\b',
52 /* 16 */ '\t', 'q', 'w', 'e', 'r', 't', 'y', 'u',
53 /* 24 */ 'i', 'o', 'p', '[', ']', '\\',
56 /* 32 */ 's', 'd', 'f', 'g', 'h', 'j', 'k', 'l',
57 /* 40 */ ';', '\'', '\\', '\r',
60 /* 48 */ 'c', 'v', 'b', 'n', 'm', ',', '.', '/',
61 /* 56 */ NOP
, SHIFTKEYS
+RIGHTSHIFT
,
63 HOLE
, SHIFTKEYS
+LEFTALT
,
67 /* 64 */ SHIFTKEYS
+RIGHTCTRL
,
68 HOLE
, HOLE
, HOLE
, HOLE
, HOLE
, HOLE
, HOLE
,
69 /* 72 */ HOLE
, HOLE
, HOLE
, BF(8), DEL
,
72 /* 80 */ RF(7), RF(13), HOLE
,
79 RF(7), STRING
+LEFTARROW
,
82 /* 96 */ STRING
+UPARROW
,
83 RF(11), STRING
+DOWNARROW
,
88 /*104 */ DEL
, PADMINUS
,
92 /*112 */ TF(1), TF(2), TF(3), TF(4), TF(5), TF(6), TF(7), TF(8),
93 /*120 */ TF(9), TF(10), TF(11), TF(12), NOP
, NOP
, NOP
, HOLE
,
94 /*128 */ HOLE
, HOLE
, HOLE
, HOLE
, HOLE
, HOLE
, HOLE
, HOLE
,
95 /*136 */ HOLE
, HOLE
, HOLE
, HOLE
, HOLE
, HOLE
, HOLE
, HOLE
,
96 /*144 */ HOLE
, HOLE
, HOLE
, HOLE
, HOLE
, HOLE
, HOLE
, HOLE
,
97 /*152 */ HOLE
, HOLE
, HOLE
, HOLE
, HOLE
, HOLE
, HOLE
, HOLE
,
101 /* Shifted keyboard table for PC keyboard */
103 static keymap_entry_t keytab_pc_uc
[KEYMAP_SIZE_PC
] = {
104 /* 0 */ HOLE
, '~', '!', '@', '#', '$', '%', '^',
105 /* 8 */ '&', '*', '(', ')', '_', '+', HOLE
, '\b',
106 /* 16 */ '\t', 'Q', 'W', 'E', 'R', 'T', 'Y', 'U',
107 /* 24 */ 'I', 'O', 'P', '{', '}', '|',
110 /* 32 */ 'S', 'D', 'F', 'G', 'H', 'J', 'K', 'L',
111 /* 40 */ ':', '"', '|', '\r',
114 /* 48 */ 'C', 'V', 'B', 'N', 'M', '<', '>', '?',
115 /* 56 */ NOP
, SHIFTKEYS
+RIGHTSHIFT
,
122 /* 64 */ SHIFTKEYS
+RIGHTCTRL
,
123 HOLE
, HOLE
, HOLE
, HOLE
, HOLE
, HOLE
, HOLE
,
124 /* 72 */ HOLE
, HOLE
, HOLE
, BF(8), DEL
, NOP
, HOLE
,
126 /* 80 */ RF(7), RF(13), HOLE
, STRING
+UPARROW
,
132 '7', '4', '1', HOLE
, '/',
133 /* 96 */ '8', '5', '2', '0', '*', '9', '6', '3',
134 /*104 */ '.', '-', '+', HOLE
, '\n', HOLE
, ESC
, HOLE
,
135 /*112 */ TF(1), TF(2), TF(3), TF(4), TF(5), TF(6), TF(7), TF(8),
136 /*120 */ TF(9), TF(10), TF(11), TF(12), NOP
, NOP
, NOP
, HOLE
,
137 /*128 */ HOLE
, HOLE
, HOLE
, HOLE
, HOLE
, HOLE
, HOLE
, HOLE
,
138 /*136 */ HOLE
, HOLE
, HOLE
, HOLE
, HOLE
, HOLE
, HOLE
, HOLE
,
139 /*144 */ HOLE
, HOLE
, HOLE
, HOLE
, HOLE
, HOLE
, HOLE
, HOLE
,
140 /*152 */ HOLE
, HOLE
, HOLE
, HOLE
, HOLE
, HOLE
, HOLE
, HOLE
,
144 /* Caps Locked keyboard table for PC keyboard */
146 static keymap_entry_t keytab_pc_cl
[KEYMAP_SIZE_PC
] = {
147 /* 0 */ HOLE
, '`', '1', '2', '3', '4', '5', '6',
148 /* 8 */ '7', '8', '9', '0', '-', '=', HOLE
, '\b',
149 /* 16 */ '\t', 'Q', 'W', 'E', 'R', 'T', 'Y', 'U',
150 /* 24 */ 'I', 'O', 'P', '[', ']', '\\',
153 /* 32 */ 'S', 'D', 'F', 'G', 'H', 'J', 'K', 'L',
154 /* 40 */ ';', '\'', '\\', '\r',
157 /* 48 */ 'C', 'V', 'B', 'N', 'M', ',', '.', '/',
158 /* 56 */ NOP
, SHIFTKEYS
+RIGHTSHIFT
,
165 /* 64 */ SHIFTKEYS
+RIGHTCTRL
,
166 HOLE
, HOLE
, HOLE
, HOLE
, HOLE
, HOLE
, HOLE
,
167 /* 72 */ HOLE
, HOLE
, HOLE
, BF(8), DEL
, NOP
, HOLE
,
177 RF(7), STRING
+LEFTARROW
,
178 RF(13), HOLE
, PADSLASH
,
179 /* 96 */ STRING
+UPARROW
,
180 RF(11), STRING
+DOWNARROW
,
185 /*104 */ DEL
, PADMINUS
,
189 /*112 */ TF(1), TF(2), TF(3), TF(4), TF(5), TF(6), TF(7), TF(8),
190 /*120 */ TF(9), TF(10), TF(11), TF(12), NOP
, NOP
, NOP
, HOLE
,
191 /*128 */ HOLE
, HOLE
, HOLE
, HOLE
, HOLE
, HOLE
, HOLE
, HOLE
,
192 /*136 */ HOLE
, HOLE
, HOLE
, HOLE
, HOLE
, HOLE
, HOLE
, HOLE
,
193 /*144 */ HOLE
, HOLE
, HOLE
, HOLE
, HOLE
, HOLE
, HOLE
, HOLE
,
194 /*152 */ HOLE
, HOLE
, HOLE
, HOLE
, HOLE
, HOLE
, HOLE
, HOLE
,
198 /* Alt Graph keyboard table for PC keyboard */
200 static keymap_entry_t keytab_pc_ag
[KEYMAP_SIZE_PC
] = {
201 /* 0 */ HOLE
, NOP
, NOP
, NOP
, NOP
, NOP
, NOP
, NOP
,
202 /* 8 */ NOP
, NOP
, NOP
, NOP
, NOP
, NOP
, HOLE
, NOP
,
203 /* 16 */ NOP
, NOP
, NOP
, NOP
, NOP
, NOP
, NOP
, NOP
,
204 /* 24 */ NOP
, NOP
, NOP
, NOP
, NOP
, NOP
,
207 /* 32 */ NOP
, NOP
, NOP
, NOP
, NOP
, NOP
, NOP
, NOP
,
208 /* 40 */ NOP
, NOP
, NOP
, NOP
,
211 /* 48 */ NOP
, NOP
, NOP
, NOP
, NOP
, NOP
, NOP
, NOP
,
212 /* 56 */ NOP
, SHIFTKEYS
+RIGHTSHIFT
,
219 /* 64 */ SHIFTKEYS
+RIGHTCTRL
,
220 HOLE
, HOLE
, HOLE
, HOLE
, HOLE
, HOLE
, HOLE
,
221 /* 72 */ HOLE
, HOLE
, HOLE
, BF(8), DEL
, NOP
, HOLE
,
224 /* 80 */ RF(7), RF(13), HOLE
, STRING
+
226 DOWNARROW
,RF(9), RF(15), HOLE
,
227 /* 88 */ HOLE
, STRING
+
230 NOP
, NOP
, NOP
, HOLE
, NOP
,
231 /* 96 */ NOP
, NOP
, NOP
, NOP
, NOP
, NOP
, NOP
, NOP
,
232 /*104 */ NOP
, NOP
, NOP
, HOLE
, NOP
, HOLE
, ESC
, HOLE
,
233 /*112 */ TF(1), TF(2), TF(3), TF(4), TF(5), TF(6), TF(7), TF(8),
234 /*120 */ TF(9), TF(10), TF(11), TF(12), NOP
, NOP
, NOP
, HOLE
,
235 /*128 */ HOLE
, HOLE
, HOLE
, HOLE
, HOLE
, HOLE
, HOLE
, HOLE
,
236 /*136 */ HOLE
, HOLE
, HOLE
, HOLE
, HOLE
, HOLE
, HOLE
, HOLE
,
237 /*144 */ HOLE
, HOLE
, HOLE
, HOLE
, HOLE
, HOLE
, HOLE
, HOLE
,
238 /*152 */ HOLE
, HOLE
, HOLE
, HOLE
, HOLE
, HOLE
, HOLE
, HOLE
,
242 /* Num Locked keyboard table for PC keyboard */
244 static keymap_entry_t keytab_pc_nl
[KEYMAP_SIZE_PC
] = {
245 /* 0 */ HOLE
, NONL
, NONL
, NONL
, NONL
, NONL
, NONL
, NONL
,
246 /* 8 */ NONL
, NONL
, NONL
, NONL
, NONL
, NONL
, HOLE
, NONL
,
247 /* 16 */ NONL
, NONL
, NONL
, NONL
, NONL
, NONL
, NONL
, NONL
,
248 /* 24 */ NONL
, NONL
, NONL
, NONL
, NONL
, NONL
, NONL
, NONL
,
249 /* 32 */ NONL
, NONL
, NONL
, NONL
, NONL
, NONL
, NONL
, NONL
,
250 /* 40 */ NONL
, NONL
, NONL
, NONL
, NONL
, HOLE
, NONL
, NONL
,
251 /* 48 */ NONL
, NONL
, NONL
, NONL
, NONL
, NONL
, NONL
, NONL
,
252 /* 56 */ NONL
, NONL
, NONL
, HOLE
, NONL
, NONL
, NONL
, HOLE
,
253 /* 64 */ NONL
, HOLE
, HOLE
, HOLE
, HOLE
, HOLE
, HOLE
, HOLE
,
254 /* 72 */ HOLE
, HOLE
, HOLE
, NONL
, NONL
, NONL
, HOLE
, NONL
,
255 /* 80 */ NONL
, NONL
, HOLE
, NONL
, NONL
, NONL
, NONL
, HOLE
,
256 /* 88 */ HOLE
, NONL
, NONL
, PAD7
, PAD4
, PAD1
, HOLE
, NONL
,
257 /* 96 */ PAD8
, PAD5
, PAD2
, PAD0
, NONL
, PAD9
, PAD6
, PAD3
,
258 /*104 */ PADDOT
, NONL
, NONL
, HOLE
, NONL
, HOLE
, NONL
, HOLE
,
259 /*112 */ NONL
, NONL
, NONL
, NONL
, NONL
, NONL
, NONL
, NONL
,
260 /*120 */ NONL
, NONL
, NONL
, NONL
, NONL
, NONL
, NONL
, HOLE
,
261 /*128 */ HOLE
, HOLE
, HOLE
, HOLE
, HOLE
, HOLE
, HOLE
, HOLE
,
262 /*136 */ HOLE
, HOLE
, HOLE
, HOLE
, HOLE
, HOLE
, HOLE
, HOLE
,
263 /*144 */ HOLE
, HOLE
, HOLE
, HOLE
, HOLE
, HOLE
, HOLE
, HOLE
,
264 /*152 */ HOLE
, HOLE
, HOLE
, HOLE
, HOLE
, HOLE
, HOLE
, HOLE
,
268 /* Controlled keyboard table for PC keyboard */
270 static keymap_entry_t keytab_pc_ct
[KEYMAP_SIZE_PC
] = {
271 /* 0 */ HOLE
, c('^'), '1', c('@'), '3', '4', '5', c('^'),
272 /* 8 */ '7', '8', '9', '0', c('_'), '=', HOLE
, '\b',
273 /* 16 */ '\t', c('q'), c('w'), c('e'), c('r'), c('t'), c('y'), c('u'),
274 /* 24 */ c('i'), c('o'), c('p'), c('['), c(']'), c('\\'),
277 /* 32 */ c('s'), c('d'), c('f'), c('g'), c('h'), c('j'), c('k'), c('l'),
278 /* 40 */ ';', '\'', '\\', '\r',
280 HOLE
, c('z'), c('x'),
281 /* 48 */ c('c'), c('v'), c('b'), c('n'), c('m'), ',', '.', c('_'),
282 /* 56 */ NOP
, SHIFTKEYS
+RIGHTSHIFT
,
289 /* 64 */ SHIFTKEYS
+RIGHTCTRL
,
290 HOLE
, HOLE
, HOLE
, HOLE
, HOLE
, HOLE
, HOLE
,
291 /* 72 */ HOLE
, HOLE
, HOLE
, BF(8), DEL
, NOP
, HOLE
,
293 /* 80 */ RF(7), RF(13), HOLE
,
300 PAD7
, PAD4
, PAD1
, HOLE
,
302 /* 96 */ PAD8
, PAD5
, PAD2
, PAD0
, PADSTAR
,
304 /*104 */ PADDOT
, PADMINUS
,
308 /*112 */ TF(1), TF(2), TF(3), TF(4), TF(5), TF(6), TF(7), TF(8),
309 /*120 */ TF(9), TF(10), TF(11), TF(12), NOP
, NOP
, NOP
, HOLE
,
310 /*128 */ HOLE
, HOLE
, HOLE
, HOLE
, HOLE
, HOLE
, HOLE
, HOLE
,
311 /*136 */ HOLE
, HOLE
, HOLE
, HOLE
, HOLE
, HOLE
, HOLE
, HOLE
,
312 /*144 */ HOLE
, HOLE
, HOLE
, HOLE
, HOLE
, HOLE
, HOLE
, HOLE
,
313 /*152 */ HOLE
, HOLE
, HOLE
, HOLE
, HOLE
, HOLE
, HOLE
, HOLE
,
317 /* "Key Up" keyboard table for PC keyboard */
320 static keymap_entry_t keytab_pc_up
[KEYMAP_SIZE_PC
] = {
321 /* 0 */ HOLE
, NOP
, NOP
, NOP
, NOP
, NOP
, NOP
, NOP
,
322 /* 8 */ NOP
, NOP
, NOP
, NOP
, NOP
, NOP
, HOLE
, NOP
,
323 /* 16 */ NOP
, NOP
, NOP
, NOP
, NOP
, NOP
, NOP
, NOP
,
324 /* 24 */ NOP
, NOP
, NOP
, NOP
, NOP
, NOP
, NOP
, NOP
,
325 /* 32 */ NOP
, NOP
, NOP
, NOP
, NOP
, NOP
, NOP
, NOP
,
326 /* 40 */ NOP
, NOP
, NOP
, NOP
,
329 /* 48 */ NOP
, NOP
, NOP
, NOP
, NOP
, NOP
, NOP
, NOP
,
330 /* 56 */ NOP
, SHIFTKEYS
+RIGHTSHIFT
,
332 HOLE
, SHIFTKEYS
+LEFTALT
,
336 /* 64 */ SHIFTKEYS
+RIGHTCTRL
,
337 HOLE
, HOLE
, HOLE
, HOLE
, HOLE
, HOLE
, HOLE
,
338 /* 72 */ HOLE
, HOLE
, HOLE
, NOP
, NOP
, NOP
, HOLE
, NOP
,
339 /* 80 */ NOP
, NOP
, HOLE
, NOP
, NOP
, NOP
, NOP
, HOLE
,
340 /* 88 */ HOLE
, NOP
, NOP
, NOP
, NOP
, NOP
, HOLE
, NOP
,
341 /* 96 */ NOP
, NOP
, NOP
, NOP
, NOP
, NOP
, NOP
, NOP
,
342 /*104 */ NOP
, NOP
, NOP
, HOLE
, NOP
, HOLE
, NOP
, HOLE
,
343 /*112 */ NOP
, NOP
, NOP
, NOP
, NOP
, NOP
, NOP
, NOP
,
344 /*120 */ NOP
, NOP
, NOP
, NOP
, NOP
, NOP
, NOP
, HOLE
,
345 /*128 */ HOLE
, HOLE
, HOLE
, HOLE
, HOLE
, HOLE
, HOLE
, HOLE
,
346 /*136 */ HOLE
, HOLE
, HOLE
, HOLE
, HOLE
, HOLE
, HOLE
, HOLE
,
347 /*144 */ HOLE
, HOLE
, HOLE
, HOLE
, HOLE
, HOLE
, HOLE
, HOLE
,
348 /*152 */ HOLE
, HOLE
, HOLE
, HOLE
, HOLE
, HOLE
, HOLE
, HOLE
,
354 #define M(x) (1 << (x))
355 #define MASK_ALL (M(LEFTSHIFT) | \
362 * Make Ctrl+Shift+F1 be Compose. This is SOOOO hokey.
364 static struct exception_map exceptions_pc
[] = {
365 { MASK_ALL
, M(LEFTSHIFT
)|M(LEFTCTRL
), 112, COMPOSE
, },
366 { MASK_ALL
, M(LEFTSHIFT
)|M(RIGHTCTRL
), 112, COMPOSE
, },
367 { MASK_ALL
, M(RIGHTSHIFT
)|M(LEFTCTRL
), 112, COMPOSE
, },
368 { MASK_ALL
, M(RIGHTSHIFT
)|M(RIGHTCTRL
), 112, COMPOSE
, },
372 /* Index to keymaps for PC keyboard */
373 struct keyboard keyindex_pc
= {
382 0x0000, /* Shift bits which stay on with idle keyboard */
383 0x0000, /* Bucky bits which stay on with idle keyboard */
384 112, 0, 31, /* abort keys: F1+A */
385 CAPSMASK
|NUMLOCKMASK
, /* Shift bits which toggle on down event */
386 exceptions_pc
, /* Exceptions */
387 44, 57, 126, /* new abort keys: Shift+Pause */