Annotation of sys/arch/hp300/dev/dnkbdmap.c, Revision 1.1.1.1
1.1 nbrk 1: /* $OpenBSD: dnkbdmap.c,v 1.2 2005/05/06 22:22:53 miod Exp $ */
2: /*
3: * Copyright (c) 2005, Miodrag Vallat
4: *
5: * Redistribution and use in source and binary forms, with or without
6: * modification, are permitted provided that the following conditions
7: * are met:
8: * 1. Redistributions of source code must retain the above copyright
9: * notice, this list of conditions and the following disclaimer.
10: * 2. Redistributions in binary form must reproduce the above copyright
11: * notice, this list of conditions and the following disclaimer in the
12: * documentation and/or other materials provided with the distribution.
13: *
14: * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
15: * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
16: * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
17: * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
18: * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
19: * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
20: * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21: * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
22: * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
23: * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
24: * POSSIBILITY OF SUCH DAMAGE.
25: */
26:
27: #include <sys/types.h>
28:
29: #include <dev/wscons/wsksymdef.h>
30: #include <dev/wscons/wsksymvar.h>
31:
32: #include <hp300/dev/dnkbdmap.h>
33:
34: #ifdef WSDISPLAY_COMPAT_RAWKBD
35: #include <dev/wscons/wskbdraw.h>
36:
37: /*
38: * Translate Domain keycodes to US keyboard XT scancodes, for proper
39: * X11-over-wsmux operation.
40: */
41: const u_int8_t dnkbd_raw[0x80] = {
42: RAWKEY_Null,
43: RAWKEY_Null, /* 01 Ins Mark */
44: RAWKEY_Null, /* 02 Line Del */
45: RAWKEY_Null, /* 03 Char Del */
46: RAWKEY_f10, /* 04 f0 */
47: RAWKEY_f1,
48: RAWKEY_f2,
49: RAWKEY_f3,
50: RAWKEY_f4,
51: RAWKEY_f5,
52: RAWKEY_f6,
53: RAWKEY_f7,
54: RAWKEY_f8,
55: RAWKEY_f9,
56: RAWKEY_Null, /* 0e Again */
57: RAWKEY_Null, /* 0f Read */
58: RAWKEY_Null, /* 10 Save Edit */
59: RAWKEY_Null, /* 11 Abort Exit */
60: RAWKEY_Hold_Screen, /* 12 Help Hold */
61: RAWKEY_Null, /* 13 Cut Copy */
62: RAWKEY_Null, /* 14 Undo Paste */
63: RAWKEY_Null, /* 15 Move Grow */
64: RAWKEY_Escape,
65: RAWKEY_Escape,
66: RAWKEY_1,
67: RAWKEY_2,
68: RAWKEY_3,
69: RAWKEY_4,
70: RAWKEY_5,
71: RAWKEY_6,
72: RAWKEY_7,
73: RAWKEY_8,
74: RAWKEY_9,
75: RAWKEY_0,
76: RAWKEY_minus,
77: RAWKEY_equal,
78: RAWKEY_grave,
79: RAWKEY_BackSpace,
80: RAWKEY_Null,
81: RAWKEY_Null, /* 27 Left Edge */
82: RAWKEY_Null, /* 28 Shell Cmd */
83: RAWKEY_Null, /* 29 Right Edge */
84: RAWKEY_Null,
85: RAWKEY_Null,
86: RAWKEY_Tab,
87: RAWKEY_q,
88: RAWKEY_w,
89: RAWKEY_e,
90: RAWKEY_r,
91: RAWKEY_t,
92: RAWKEY_y,
93: RAWKEY_u,
94: RAWKEY_i,
95: RAWKEY_o,
96: RAWKEY_p,
97: RAWKEY_bracketleft,
98: RAWKEY_bracketright,
99: RAWKEY_Null,
100: RAWKEY_Delete,
101: RAWKEY_Null,
102: RAWKEY_KP_Home,
103: RAWKEY_KP_Up,
104: RAWKEY_KP_Prior,
105: RAWKEY_KP_Add,
106: RAWKEY_Null, /* 40 Left Box */
107: RAWKEY_Up,
108: RAWKEY_Null, /* 42 Right Box */
109: RAWKEY_Control_L,
110: RAWKEY_Null,
111: RAWKEY_Null,
112: RAWKEY_a,
113: RAWKEY_s,
114: RAWKEY_d,
115: RAWKEY_f,
116: RAWKEY_g,
117: RAWKEY_h,
118: RAWKEY_j,
119: RAWKEY_k,
120: RAWKEY_l,
121: RAWKEY_semicolon,
122: RAWKEY_apostrophe,
123: RAWKEY_Null,
124: RAWKEY_Return,
125: RAWKEY_backslash,
126: RAWKEY_Null,
127: RAWKEY_KP_Left,
128: RAWKEY_KP_Begin,
129: RAWKEY_KP_Right,
130: RAWKEY_KP_Subtract,
131: RAWKEY_Left,
132: RAWKEY_Null, /* 5a Next Wndw */
133: RAWKEY_Right,
134: RAWKEY_Null,
135: RAWKEY_Null, /* 5d Rept */
136: RAWKEY_Shift_L,
137: RAWKEY_Null,
138: RAWKEY_z,
139: RAWKEY_x,
140: RAWKEY_c,
141: RAWKEY_v,
142: RAWKEY_b,
143: RAWKEY_n,
144: RAWKEY_m,
145: RAWKEY_comma,
146: RAWKEY_period,
147: RAWKEY_slash,
148: RAWKEY_Shift_R,
149: RAWKEY_Null,
150: RAWKEY_Null, /* 6c Pop */
151: RAWKEY_Null,
152: RAWKEY_KP_End,
153: RAWKEY_KP_Down,
154: RAWKEY_KP_Next,
155: RAWKEY_Null,
156: RAWKEY_Null, /* 72 Top Box */
157: RAWKEY_Down,
158: RAWKEY_Null, /* 74 Bottom Box */
159: RAWKEY_Alt_L,
160: RAWKEY_space,
161: RAWKEY_Alt_R,
162: RAWKEY_Null,
163: RAWKEY_KP_Insert,
164: RAWKEY_Null,
165: RAWKEY_KP_Delete,
166: RAWKEY_KP_Enter,
167: RAWKEY_Null,
168: RAWKEY_Caps_Lock,
169: RAWKEY_Null
170: };
171: #endif
172:
173: #define KC(n) KS_KEYCODE(n)
174:
175: /*
176: * US English
177: */
178:
179: static const keysym_t dnkbd_keydesc_us[] = {
180: /* pos command normal shifted */
181: /* 01 Ins Mark */
182: /* 02 Line Del */
183: /* 03 Char Del */
184: KC(0x04), KS_f10,
185: KC(0x05), KS_f1,
186: KC(0x06), KS_f2,
187: KC(0x07), KS_f3,
188: KC(0x08), KS_f4,
189: KC(0x09), KS_f5,
190: KC(0x0a), KS_f6,
191: KC(0x0b), KS_f7,
192: KC(0x0c), KS_f8,
193: KC(0x0d), KS_f9,
194: /* 0e Again */
195: /* 0f Read */
196: /* 10 Save Edit */
197: /* 11 Abort Exit */
198: KC(0x12), KS_Hold_Screen,
199: /* 13 Cut Copy */
200: /* 14 Undo Paste */
201: /* 15 Move Grow */
202: KC(0x17), KS_Cmd_Debugger, KS_Escape,
203: KC(0x18), KS_1, KS_exclam,
204: KC(0x19), KS_2, KS_at,
205: KC(0x1a), KS_3, KS_numbersign,
206: KC(0x1b), KS_4, KS_dollar,
207: KC(0x1c), KS_5, KS_percent,
208: KC(0x1d), KS_6, KS_asciicircum,
209: KC(0x1e), KS_7, KS_ampersand,
210: KC(0x1f), KS_8, KS_asterisk,
211: KC(0x20), KS_9, KS_parenleft,
212: KC(0x21), KS_0, KS_parenright,
213: KC(0x22), KS_minus, KS_underscore,
214: KC(0x23), KS_equal, KS_plus,
215: KC(0x24), KS_grave, KS_asciitilde,
216: KC(0x25), KS_Cmd_ResetEmul, KS_Delete, /* backspace */
217: KC(0x27), KS_Home,
218: /* 28 Shell Cmd */
219: KC(0x29), KS_End,
220: KC(0x2c), KS_Tab,
221: KC(0x2d), KS_q,
222: KC(0x2e), KS_w,
223: KC(0x2f), KS_e,
224: KC(0x30), KS_r,
225: KC(0x31), KS_t,
226: KC(0x32), KS_y,
227: KC(0x33), KS_u,
228: KC(0x34), KS_i,
229: KC(0x35), KS_o,
230: KC(0x36), KS_p,
231: KC(0x37), KS_bracketleft, KS_braceleft,
232: KC(0x38), KS_bracketright,KS_braceright,
233: KC(0x3a), KS_Delete,
234: KC(0x3c), KS_KP_7,
235: KC(0x3d), KS_KP_8,
236: KC(0x3e), KS_KP_9,
237: KC(0x3f), KS_KP_Add,
238: /* 40 Left Box */
239: KC(0x41), KS_Up,
240: /* 42 Right Box */
241: KC(0x43), KS_Cmd1, KS_Control_L,
242: KC(0x46), KS_a,
243: KC(0x47), KS_s,
244: KC(0x48), KS_d,
245: KC(0x49), KS_f,
246: KC(0x4a), KS_g,
247: KC(0x4b), KS_h,
248: KC(0x4c), KS_j,
249: KC(0x4d), KS_k,
250: KC(0x4e), KS_l,
251: KC(0x4f), KS_semicolon, KS_colon,
252: KC(0x50), KS_apostrophe, KS_quotedbl,
253: KC(0x52), KS_Return,
254: KC(0x53), KS_backslash, KS_bar,
255: KC(0x55), KS_KP_4,
256: KC(0x56), KS_KP_5,
257: KC(0x57), KS_KP_6,
258: KC(0x58), KS_KP_Subtract,
259: KC(0x59), KS_Left,
260: /* 5a Next Wndw */
261: KC(0x5b), KS_Right,
262: /* 5d Rept */
263: KC(0x5e), KS_Shift_L,
264: KC(0x60), KS_z,
265: KC(0x61), KS_x,
266: KC(0x62), KS_c,
267: KC(0x63), KS_v,
268: KC(0x64), KS_b,
269: KC(0x65), KS_n,
270: KC(0x66), KS_m,
271: KC(0x67), KS_comma, KS_less,
272: KC(0x68), KS_period, KS_greater,
273: KC(0x69), KS_slash, KS_question,
274: KC(0x6a), KS_Shift_R,
275: /* 6c Pop */
276: KC(0x6e), KS_KP_1,
277: KC(0x6f), KS_KP_2,
278: KC(0x70), KS_KP_3,
279: /* 72 Top Box */
280: KC(0x73), KS_Down,
281: /* 74 Bottom Box */
282: KC(0x75), KS_Cmd2, KS_Alt_L,
283: KC(0x76), KS_space,
284: KC(0x77), KS_Cmd2, KS_Alt_R, KS_Multi_key,
285: KC(0x79), KS_KP_0,
286: KC(0x7b), KS_KP_Separator,
287: KC(0x7c), KS_KP_Enter,
288: KC(0x7e), KS_Caps_Lock
289: };
290:
291: /*
292: * German
293: */
294:
295: static const keysym_t dnkbd_keydesc_de[] = {
296: /* pos normal shifted altgr */
297: KC(0x17), KS_dead_circumflex, KS_dead_abovering,
298: KC(0x19), KS_2, KS_quotedbl,
299: KC(0x1a), KS_3, KS_at, KS_section,
300: KC(0x1d), KS_6, KS_ampersand,
301: KC(0x1e), KS_7, KS_slash,
302: KC(0x1f), KS_8, KS_parenleft,
303: KC(0x20), KS_9, KS_parenright,
304: KC(0x21), KS_0, KS_equal,
305: KC(0x22), KS_dead_tilde, KS_question, KS_ssharp,
306: KC(0x23), KS_dead_acute, KS_dead_grave,
307: KC(0x32), KS_z,
308: KC(0x37), KS_braceright, KS_bracketright,KS_udiaeresis,
309: KC(0x38), KS_plus, KS_asterisk,
310: KC(0x4f), KS_bar, KS_backslash, KS_odiaeresis,
311: KC(0x50), KS_braceleft, KS_bracketleft, KS_adiaeresis,
312: KC(0x51), KS_numbersign, KS_apostrophe,
313: KC(0x5f), KS_less, KS_greater,
314: KC(0x60), KS_y,
315: KC(0x67), KS_comma, KS_semicolon,
316: KC(0x68), KS_period, KS_colon,
317: KC(0x69), KS_minus, KS_underscore,
318: KC(0x77), KS_Mode_switch, KS_Multi_key
319: };
320:
321: static const keysym_t dnkbd_keydesc_de_nodead[] = {
322: KC(0x17), KS_asciicircum, KS_degree,
323: KC(0x22), KS_asciitilde, KS_question, KS_ssharp,
324: KC(0x23), KS_apostrophe, KS_grave
325: };
326:
327: /*
328: * Norwegian / Danish
329: */
330:
331: static const keysym_t dnkbd_keydesc_dk[] = {
332: /* pos normal shifted altgr */
333: KC(0x17), KS_underscore,
334: KC(0x19), KS_2, KS_quotedbl,
335: KC(0x1d), KS_6, KS_ampersand,
336: KC(0x1e), KS_7, KS_slash,
337: KC(0x1f), KS_8, KS_parenleft,
338: KC(0x20), KS_9, KS_parenright,
339: KC(0x21), KS_0, KS_equal,
340: KC(0x22), KS_plus, KS_question,
341: KC(0x23), KS_dead_grave, KS_at,
342: KC(0x37), KS_braceright, KS_bracketright,KS_aring,
343: KC(0x38), KS_dead_tilde, KS_dead_circumflex,KS_dead_diaeresis,
344: KC(0x4f), KS_bar, KS_backslash, KS_oslash,
345: KC(0x50), KS_braceleft, KS_bracketleft, KS_ae,
346: KC(0x51), KS_dead_acute, KS_asterisk,
347: KC(0x5f), KS_less, KS_greater,
348: KC(0x67), KS_comma, KS_semicolon,
349: KC(0x68), KS_period, KS_colon,
350: KC(0x69), KS_minus, KS_underscore,
351: KC(0x77), KS_Mode_switch, KS_Multi_key
352: };
353:
354: static const keysym_t dnkbd_keydesc_dk_nodead[] = {
355: /* pos normal shifted altgr */
356: KC(0x23), KS_grave, KS_at,
357: KC(0x38), KS_asciitilde, KS_asciicircum, KS_diaeresis,
358: KC(0x51), KS_apostrophe, KS_asterisk,
359: };
360:
361: /*
362: * French
363: */
364:
365: static const keysym_t dnkbd_keydesc_fr[] = {
366: /* pos normal shifted altgr */
367: KC(0x17), KS_bracketleft, KS_degree,
368: KC(0x18), KS_ampersand, KS_1,
369: KC(0x19), KS_braceleft, KS_2, KS_eacute,
370: KC(0x1a), KS_quotedbl, KS_3,
371: KC(0x1b), KS_apostrophe, KS_4,
372: KC(0x1c), KS_parenleft, KS_5,
373: KC(0x1d), KS_bracketright,KS_6, KS_section,
374: KC(0x1e), KS_braceright, KS_7, KS_egrave,
375: KC(0x1f), KS_exclam, KS_8,
376: KC(0x20), KS_backslash, KS_9, KS_ccedilla,
377: KC(0x21), KS_at, KS_0, KS_agrave,
378: KC(0x22), KS_parenright, KS_degree,
379: KC(0x23), KS_minus, KS_underscore,
380: KC(0x2d), KS_a,
381: KC(0x2e), KS_z,
382: KC(0x37), KS_dead_circumflex, KS_asciitilde, KS_dead_diaeresis,
383: KC(0x38), KS_dollar, KS_asterisk,
384: KC(0x46), KS_q,
385: KC(0x4f), KS_m,
386: KC(0x50), KS_bar, KS_percent, KS_ugrave,
387: KC(0x51), KS_grave, KS_numbersign,
388: KC(0x5f), KS_less, KS_greater,
389: KC(0x60), KS_w,
390: KC(0x66), KS_comma, KS_question,
391: KC(0x67), KS_semicolon, KS_period,
392: KC(0x68), KS_colon, KS_slash,
393: KC(0x69), KS_equal, KS_plus,
394: KC(0x77), KS_Mode_switch, KS_Multi_key
395: };
396:
397: /*
398: * Japanese (and basis for international layouts)
399: *
400: * Apparently this layout lacks all japanese keys (Zenkaku/Hankaku,
401: * Hiragana/Katakana, Henkan and Muhenkan). Makes one wonder about
402: * its usefulness.
403: */
404:
405: static const keysym_t dnkbd_keydesc_jp[] = {
406: /* pos cmd normal shifted */
407: KC(0x16), KS_Cmd_Debugger, KS_Escape,
408: KC(0x17), KS_grave, KS_asciitilde,
409: KC(0x24), KS_Cmd_ResetEmul, KS_Delete, /* backspace */
410: KC(0x25), KS_Delete,
411: /* 2b Rept */
412: KC(0x3b), KS_KP_Add,
413: KC(0x3f), KS_parenleft, /* KS_KP_parenleft */
414: KC(0x51), KS_backslash, KS_bar,
415: KC(0x54), KS_KP_Subtract,
416: KC(0x58), KS_parenright, /* KS_KP_parenright */
417: KC(0x5f), KS_less, KS_greater,
418: KC(0x6d), KS_KP_Multiply,
419: KC(0x78), KS_KP_Divide,
420: };
421:
422: /*
423: * Swiss (relative to the German layout)
424: */
425:
426: static const keysym_t dnkbd_keydesc_sg[] = {
427: /* pos normal shifted altgr */
428: KC(0x17), KS_at, KS_exclam, KS_section,
429: KC(0x18), KS_1, KS_plus,
430: KC(0x1a), KS_3, KS_asterisk,
431: KC(0x1b), KS_4, KS_backslash, KS_ccedilla,
432: KC(0x22), KS_apostrophe, KS_question,
433: KC(0x23), KS_dead_circumflex,KS_dead_grave,
434: KC(0x37), KS_braceright, KS_dead_tilde, KS_udiaeresis, KS_egrave,
435: KC(0x38), KS_dead_diaeresis,KS_dead_acute,
436: KC(0x4f), KS_bar, KS_bracketleft, KS_odiaeresis, KS_eacute,
437: KC(0x50), KS_braceleft, KS_bracketright,KS_adiaeresis, KS_agrave,
438: KC(0x51), KS_dollar, KS_numbersign, KS_sterling
439: };
440:
441: static const keysym_t dnkbd_keydesc_sg_nodead[] = {
442: /* pos normal shifted altgr */
443: KC(0x23), KS_asciicircum, KS_grave,
444: KC(0x37), KS_braceright, KS_asciitilde, KS_udiaeresis, KS_egrave,
445: KC(0x38), KS_diaeresis, KS_apostrophe
446: };
447:
448: /*
449: * Swedish / Finnish (relative to the Norwegian / Danish layout)
450: */
451:
452: static const keysym_t dnkbd_keydesc_sv[] = {
453: /* pos normal shifted altgr */
454: KC(0x1b), KS_4, KS_dollar, KS_currency,
455: KC(0x23), KS_dead_grave, KS_at, KS_eacute,
456: KC(0x38), KS_dead_tilde, KS_dead_circumflex,KS_udiaeresis,
457: KC(0x4f), KS_bar, KS_backslash, KS_odiaeresis,
458: KC(0x50), KS_braceleft, KS_bracketleft, KS_adiaeresis
459: };
460:
461: static const keysym_t dnkbd_keydesc_sv_nodead[] = {
462: /* pos normal shifted altgr */
463: KC(0x23), KS_grave, KS_at, KS_eacute,
464: KC(0x38), KS_asciitilde, KS_asciicircum, KS_udiaeresis,
465: KC(0x51), KS_apostrophe, KS_asterisk,
466: };
467:
468: /*
469: * UK English
470: */
471:
472: static const keysym_t dnkbd_keydesc_uk[] = {
473: /* pos normal shifted */
474: KC(0x17), KS_underscore,
475: KC(0x19), KS_2, KS_quotedbl,
476: KC(0x1d), KS_6, KS_ampersand,
477: KC(0x1e), KS_7, KS_apostrophe,
478: KC(0x1f), KS_8, KS_parenleft,
479: KC(0x20), KS_9, KS_parenright,
480: KC(0x21), KS_0, KS_underscore,
481: KC(0x22), KS_minus, KS_equal,
482: KC(0x23), KS_asciicircum, KS_asciitilde,
483: KC(0x37), KS_at, KS_grave,
484: KC(0x38), KS_bracketleft, KS_braceleft,
485: KC(0x4f), KS_semicolon, KS_plus,
486: KC(0x50), KS_colon, KS_asterisk,
487: KC(0x51), KS_bracketright,KS_braceright,
488: KC(0x5f), KS_backslash, KS_bar
489: };
490:
491: #define KBD_MAP(name, base, map) \
492: { name, base, sizeof(map) / sizeof(keysym_t), map }
493:
494: const struct wscons_keydesc dnkbd_keydesctab[] = {
495: KBD_MAP(KB_US, 0, dnkbd_keydesc_us),
496: KBD_MAP(KB_DE, KB_JP, dnkbd_keydesc_de),
497: KBD_MAP(KB_DE | KB_NODEAD, KB_DE, dnkbd_keydesc_de_nodead),
498: KBD_MAP(KB_DK, KB_JP, dnkbd_keydesc_dk),
499: KBD_MAP(KB_DK | KB_NODEAD, KB_DK, dnkbd_keydesc_dk_nodead),
500: KBD_MAP(KB_FR, KB_JP, dnkbd_keydesc_fr),
501: KBD_MAP(KB_JP, KB_US, dnkbd_keydesc_jp),
502: KBD_MAP(KB_SG, KB_DE, dnkbd_keydesc_sg),
503: KBD_MAP(KB_SG | KB_NODEAD, KB_SG, dnkbd_keydesc_sg_nodead),
504: KBD_MAP(KB_SV, KB_DK, dnkbd_keydesc_sv),
505: KBD_MAP(KB_SV | KB_NODEAD, KB_SV, dnkbd_keydesc_sv_nodead),
506: KBD_MAP(KB_UK, KB_JP, dnkbd_keydesc_uk),
507: { 0, 0, 0, 0 }
508: };
CVSweb