xref: /netbsd/sys/dev/sun/wskbdmap_sun.c (revision c4a72b64)
1 /*	$NetBSD: wskbdmap_sun.c,v 1.2 2002/10/25 21:50:10 martin Exp $	*/
2 /*	$OpenBSD: sunkbd.c,v 1.9 2002/09/08 23:22:00 miod Exp $	*/
3 
4 /*
5  * Copyright (c) 2002 Jason L. Wright (jason@thought.net)
6  * All rights reserved.
7  *
8  * Redistribution and use in source and binary forms, with or without
9  * modification, are permitted provided that the following conditions
10  * are met:
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.
21  *
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.
33  *
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.
37  *
38  */
39 
40 #include <sys/types.h>
41 #include <dev/wscons/wsksymdef.h>
42 #include <dev/wscons/wsksymvar.h>
43 
44 #define KC(n) KS_KEYCODE(n)
45 
46 static const keysym_t wssun_keydesctab_us [] = {
47 /*  pos      command			normal		shifted */
48     KC(0x01), KS_Cmd,
49     KC(0x02), KS_Cmd_BrightnessDown,
50     KC(0x03),				KS_Again,
51     KC(0x04), KS_Cmd_BrightnessUp,
52     KC(0x05),				KS_f1,
53     KC(0x06),				KS_f2,
54     KC(0x07),				KS_f10,
55     KC(0x08),				KS_f3,
56     KC(0x09),				KS_f11,
57     KC(0x0a),				KS_f4,
58     KC(0x0b),				KS_f12,
59     KC(0x0c),				KS_f5,
60     KC(0x0d),				KS_Alt_R,
61     KC(0x0e),				KS_f6,
62     KC(0x10),				KS_f7,
63     KC(0x11),				KS_f8,
64     KC(0x12),				KS_f9,
65     KC(0x13),				KS_Alt_L,
66     KC(0x14),				KS_Up,
67     KC(0x15),				KS_Pause,
68     KC(0x16),				KS_Print_Screen,
69     KC(0x17),				KS_Hold_Screen,
70     KC(0x18),				KS_Left,
71     KC(0x19),				KS_Props,
72     KC(0x1a),				KS_Undo,
73     KC(0x1b),				KS_Down,
74     KC(0x1c),				KS_Right,
75     KC(0x1d),				KS_Escape,
76     KC(0x1e),				KS_1,		KS_exclam,
77     KC(0x1f),				KS_2,		KS_at,
78     KC(0x20),				KS_3,		KS_numbersign,
79     KC(0x21),				KS_4,		KS_dollar,
80     KC(0x22),				KS_5,		KS_percent,
81     KC(0x23),				KS_6,		KS_asciicircum,
82     KC(0x24),				KS_7,		KS_ampersand,
83     KC(0x25),				KS_8,		KS_asterisk,
84     KC(0x26),				KS_9,		KS_parenleft,
85     KC(0x27),				KS_0,		KS_parenright,
86     KC(0x28),				KS_minus,	KS_underscore,
87     KC(0x29),				KS_equal,	KS_plus,
88     KC(0x2a),				KS_grave,	KS_asciitilde,
89     KC(0x2b),				KS_Delete,
90     KC(0x2c),				KS_Insert,
91     KC(0x2d),				KS_KP_Equal,
92     KC(0x2e),				KS_KP_Divide,
93     KC(0x2f),				KS_KP_Multiply,
94     KC(0x31),				KS_Front,
95     KC(0x32),				KS_KP_Delete,	KS_KP_Decimal,
96     KC(0x33),				KS_Copy,
97     KC(0x34),				KS_Home,
98     KC(0x35),				KS_Tab,
99     KC(0x36),				KS_q,
100     KC(0x37),				KS_w,
101     KC(0x38),				KS_e,
102     KC(0x39),				KS_r,
103     KC(0x3a),				KS_t,
104     KC(0x3b),				KS_y,
105     KC(0x3c),				KS_u,
106     KC(0x3d),				KS_i,
107     KC(0x3e),				KS_o,
108     KC(0x3f),				KS_p,
109     KC(0x40),				KS_bracketleft,	KS_braceleft,
110     KC(0x41),				KS_bracketright,KS_braceright,
111     KC(0x42),				KS_Delete,
112     KC(0x43),				KS_Multi_key,
113     KC(0x44),				KS_KP_Home,	KS_KP_7,
114     KC(0x45),				KS_KP_Up,	KS_KP_8,
115     KC(0x46),				KS_KP_Prior,	KS_KP_9,
116     KC(0x47),				KS_KP_Subtract,
117     KC(0x48),				KS_Open,
118     KC(0x49),				KS_Paste,
119     KC(0x4a),				KS_End,
120     KC(0x4c),				KS_Control_L,
121     KC(0x4d), KS_Cmd_Debugger,		KS_a,
122     KC(0x4e),				KS_s,
123     KC(0x4f),				KS_d,
124     KC(0x50),				KS_f,
125     KC(0x51),				KS_g,
126     KC(0x52),				KS_h,
127     KC(0x53),				KS_j,
128     KC(0x54),				KS_k,
129     KC(0x55),				KS_l,
130     KC(0x56),				KS_semicolon,	KS_colon,
131     KC(0x57),				KS_apostrophe,	KS_quotedbl,
132     KC(0x58),				KS_backslash,	KS_bar,
133     KC(0x59),				KS_Return,
134     KC(0x5a),				KS_KP_Enter,
135     KC(0x5b),				KS_KP_Left,	KS_KP_4,
136     KC(0x5c),				KS_KP_Begin,	KS_KP_5,
137     KC(0x5d),				KS_KP_Right,	KS_KP_6,
138     KC(0x5e),				KS_KP_Insert,	KS_KP_0,
139     KC(0x5f),				KS_Find,
140     KC(0x60),				KS_Prior,
141     KC(0x61),				KS_Cut,
142     KC(0x62),				KS_Num_Lock,
143     KC(0x63),				KS_Shift_L,
144     KC(0x64),				KS_z,
145     KC(0x65),				KS_x,
146     KC(0x66),				KS_c,
147     KC(0x67),				KS_v,
148     KC(0x68),				KS_b,
149     KC(0x69),				KS_n,
150     KC(0x6a),				KS_m,
151     KC(0x6b),				KS_comma,	KS_less,
152     KC(0x6c),				KS_period,	KS_greater,
153     KC(0x6d),				KS_slash,	KS_question,
154     KC(0x6e),				KS_Shift_R,
155     KC(0x6f),				KS_Linefeed,
156     KC(0x70),				KS_KP_End,	KS_KP_1,
157     KC(0x71),				KS_KP_Down,	KS_KP_2,
158     KC(0x72),				KS_KP_Next,	KS_KP_3,
159     KC(0x76),				KS_Help,
160     KC(0x77),				KS_Caps_Lock,
161     KC(0x78),				KS_Meta_L,
162     KC(0x79),				KS_space,
163     KC(0x7a),				KS_Meta_R,
164     KC(0x7b),				KS_Next,
165     KC(0x7d),				KS_KP_Add,
166 };
167 
168 const keysym_t wssun_keydesctab_sv[] = {
169     KC(0x0d),		KS_Multi_key,
170     KC(0x0f),		KS_asciitilde,	KS_asciicircum,
171     KC(0x1f),		KS_2,		KS_quotedbl,	KS_at,
172     KC(0x20),		KS_3,		KS_numbersign,	KS_sterling,
173     KC(0x21),		KS_4,		KS_currency,	KS_dollar,
174     KC(0x23),		KS_6,		KS_ampersand,
175     KC(0x24),		KS_7,		KS_slash,	KS_braceleft,
176     KC(0x25),		KS_8,		KS_parenleft,	KS_bracketleft,
177     KC(0x26),		KS_9,		KS_parenright,	KS_bracketright,
178     KC(0x27),		KS_0,		KS_equal,	KS_braceright,
179     KC(0x28),		KS_plus,	KS_question,	KS_backslash,
180     KC(0x29),		KS_dead_acute,	KS_dead_grave,
181     KC(0x2a),		KS_apostrophe,	KS_asterisk,	KS_grave,
182     KC(0x40),		KS_aring,
183     KC(0x41),		KS_dead_diaeresis,KS_dead_circumflex,KS_dead_tilde,
184     KC(0x43),		KS_Mode_switch,
185     KC(0x4c),		KS_Caps_Lock,
186     KC(0x56),		KS_odiaeresis,
187     KC(0x57),		KS_adiaeresis,
188     KC(0x58),		KS_paragraph,	KS_onehalf,
189     KC(0x6b),		KS_comma,	KS_semicolon,
190     KC(0x6c),		KS_period,	KS_colon,
191     KC(0x6d),		KS_minus,	KS_underscore,
192     KC(0x77),		KS_Control_L,
193     KC(0x7c),		KS_less,	KS_greater,	KS_bar,
194 };
195 
196 const keysym_t wssun_keydesctab_sv_nodead[] = {
197     KC(0x29),		KS_apostrophe,	KS_grave,
198     KC(0x41),		KS_diaeresis,	KS_asciicircum,	KS_asciitilde,
199 };
200 
201 #define KBD_MAP(name, base, map) \
202 			{ name, base, sizeof(map)/sizeof(keysym_t), map }
203 /* KBD_NULLMAP generates a entry for machine native variant.
204    the entry will be modified by machine dependent keyboard driver. */
205 #define KBD_NULLMAP(name, base) { name, base, 0, 0 }
206 
207 const struct wscons_keydesc wssun_keydesctab[] = {
208 	KBD_MAP(KB_US,			0,	wssun_keydesctab_us),
209 	KBD_MAP(KB_SV,			KB_US,	wssun_keydesctab_sv),
210 	KBD_MAP(KB_SV | KB_NODEAD,	KB_SV,	wssun_keydesctab_sv_nodead),
211 	{ 0, 0, 0, 0 }
212 };
213