1*4b552d31Stsutsui /* $NetBSD: omkbdmap.c,v 1.3 2023/01/15 05:08:33 tsutsui Exp $ */ 20bcc9a72Stsutsui /* $OpenBSD: omkbdmap.c,v 1.2 2013/11/16 18:31:44 miod Exp $ */ 30bcc9a72Stsutsui 40bcc9a72Stsutsui /* Partially from: 54d52a628Stsutsui * NetBSD: lunaws.c,v 1.6 2002/03/17 19:40:42 atatat Exp 60bcc9a72Stsutsui * 70bcc9a72Stsutsui * Copyright (c) 2000 The NetBSD Foundation, Inc. 80bcc9a72Stsutsui * All rights reserved. 90bcc9a72Stsutsui * 100bcc9a72Stsutsui * This code is derived from software contributed to The NetBSD Foundation 110bcc9a72Stsutsui * by Tohru Nishimura. 120bcc9a72Stsutsui * 130bcc9a72Stsutsui * Redistribution and use in source and binary forms, with or without 140bcc9a72Stsutsui * modification, are permitted provided that the following conditions 150bcc9a72Stsutsui * are met: 160bcc9a72Stsutsui * 1. Redistributions of source code must retain the above copyright 170bcc9a72Stsutsui * notice, this list of conditions and the following disclaimer. 180bcc9a72Stsutsui * 2. Redistributions in binary form must reproduce the above copyright 190bcc9a72Stsutsui * notice, this list of conditions and the following disclaimer in the 200bcc9a72Stsutsui * documentation and/or other materials provided with the distribution. 210bcc9a72Stsutsui * 220bcc9a72Stsutsui * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS 230bcc9a72Stsutsui * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 240bcc9a72Stsutsui * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 250bcc9a72Stsutsui * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 260bcc9a72Stsutsui * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 270bcc9a72Stsutsui * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 280bcc9a72Stsutsui * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 290bcc9a72Stsutsui * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 300bcc9a72Stsutsui * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 310bcc9a72Stsutsui * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 320bcc9a72Stsutsui * POSSIBILITY OF SUCH DAMAGE. 330bcc9a72Stsutsui */ 340bcc9a72Stsutsui 350bcc9a72Stsutsui #include "opt_wsdisplay_compat.h" 360bcc9a72Stsutsui 370bcc9a72Stsutsui #include <sys/types.h> 380bcc9a72Stsutsui 390bcc9a72Stsutsui #include <dev/wscons/wsksymdef.h> 400bcc9a72Stsutsui #include <dev/wscons/wsksymvar.h> 410bcc9a72Stsutsui 420bcc9a72Stsutsui #include <luna68k/dev/omkbdmap.h> 430bcc9a72Stsutsui 440bcc9a72Stsutsui #ifdef WSDISPLAY_COMPAT_RAWKBD 450bcc9a72Stsutsui 460bcc9a72Stsutsui /* 470bcc9a72Stsutsui * Translate LUNA keycodes to US keyboard XT scancodes, for proper 480bcc9a72Stsutsui * X11-over-wsmux operation. 490bcc9a72Stsutsui * 500bcc9a72Stsutsui * XXX: Needs re-think how we should treat RAWKBD code on NetBSD. 510bcc9a72Stsutsui */ 520bcc9a72Stsutsui const uint8_t omkbd_raw[0x80] = { 530bcc9a72Stsutsui 0x00, /* 0x00 */ 540bcc9a72Stsutsui 0x00, /* 0x01 */ 550bcc9a72Stsutsui 0x00, /* 0x02 */ 560bcc9a72Stsutsui 0x00, /* 0x03 */ 570bcc9a72Stsutsui 0x00, /* 0x04 */ 580bcc9a72Stsutsui 0x00, /* 0x05 */ 590bcc9a72Stsutsui 0x00, /* 0x06 */ 600bcc9a72Stsutsui 0x00, /* 0x07 */ 610bcc9a72Stsutsui 0x00, /* 0x08 */ 620bcc9a72Stsutsui 0x0f, /* 0x09 */ 630bcc9a72Stsutsui 0x1d, /* 0x0a */ 640bcc9a72Stsutsui 0x70, /* 0x0b: Kana / No RAWKEY_XXX symbol */ 650bcc9a72Stsutsui 0x36, /* 0x0c */ 660bcc9a72Stsutsui 0x2a, /* 0x0d */ 670bcc9a72Stsutsui 0x3a, /* 0x0e */ 680bcc9a72Stsutsui 0x38, /* 0x0f: Zenmen */ 690bcc9a72Stsutsui 0x01, /* 0x10 */ 700bcc9a72Stsutsui 0x0e, /* 0x11 */ 710bcc9a72Stsutsui 0x1c, /* 0x12 */ 720bcc9a72Stsutsui 0x00, /* 0x13 */ 730bcc9a72Stsutsui 0x39, /* 0x14 */ 740bcc9a72Stsutsui 0xd3, /* 0x15 */ 750bcc9a72Stsutsui 0x38, /* 0x16: Henkan */ 760bcc9a72Stsutsui 0xb8, /* 0x17: Kakutei */ 770bcc9a72Stsutsui 0x57, /* 0x18: Shokyo */ 780bcc9a72Stsutsui 0x58, /* 0x19: Yobidashi */ 790bcc9a72Stsutsui 0x00, /* 0x1a: Bunsetsu L / f13 */ 800bcc9a72Stsutsui 0x00, /* 0x1b: Bunsetsu R / f14 */ 810bcc9a72Stsutsui 0x48, /* 0x1c */ 820bcc9a72Stsutsui 0x4b, /* 0x1d */ 830bcc9a72Stsutsui 0x4d, /* 0x1e */ 840bcc9a72Stsutsui 0x50, /* 0x1f */ 850bcc9a72Stsutsui 0x57, /* 0x20 */ 860bcc9a72Stsutsui 0x58, /* 0x21 */ 870bcc9a72Stsutsui 0x02, /* 0x22: exclam */ 880bcc9a72Stsutsui 0x03, /* 0x23: quotedbl */ 890bcc9a72Stsutsui 0x04, /* 0x24: numbersign */ 900bcc9a72Stsutsui 0x05, /* 0x25: dollar */ 910bcc9a72Stsutsui 0x06, /* 0x26: percent */ 920bcc9a72Stsutsui 0x07, /* 0x27: ampersand */ 930bcc9a72Stsutsui 0x08, /* 0x28: apostrophe */ 940bcc9a72Stsutsui 0x09, /* 0x29: parenleft */ 950bcc9a72Stsutsui 0x0a, /* 0x2a: parenright */ 960bcc9a72Stsutsui 0x0b, /* 0x2b */ 970bcc9a72Stsutsui 0x0c, /* 0x2c: equal */ 980bcc9a72Stsutsui 0x0d, /* 0x2d: asciitilde */ 990bcc9a72Stsutsui 0x7d, /* 0x2e: bar */ 1000bcc9a72Stsutsui 0x00, /* 0x2f */ 1010bcc9a72Stsutsui 0x00, /* 0x30: f13 */ 1020bcc9a72Stsutsui 0x00, /* 0x31: f14 */ 1030bcc9a72Stsutsui 0x10, /* 0x32 */ 1040bcc9a72Stsutsui 0x11, /* 0x33 */ 1050bcc9a72Stsutsui 0x12, /* 0x34 */ 1060bcc9a72Stsutsui 0x13, /* 0x35 */ 1070bcc9a72Stsutsui 0x14, /* 0x36 */ 1080bcc9a72Stsutsui 0x15, /* 0x37 */ 1090bcc9a72Stsutsui 0x16, /* 0x38 */ 1100bcc9a72Stsutsui 0x17, /* 0x39 */ 1110bcc9a72Stsutsui 0x18, /* 0x3a */ 1120bcc9a72Stsutsui 0x19, /* 0x3b */ 1130bcc9a72Stsutsui 0x1a, /* 0x3c: grave */ 1140bcc9a72Stsutsui 0x1b, /* 0x3d: braceleft */ 1150bcc9a72Stsutsui 0x00, /* 0x3e */ 1160bcc9a72Stsutsui 0x00, /* 0x3f */ 1170bcc9a72Stsutsui 0x00, /* 0x40 */ 1180bcc9a72Stsutsui 0x00, /* 0x41 */ 1190bcc9a72Stsutsui 0x1e, /* 0x42 */ 1200bcc9a72Stsutsui 0x1f, /* 0x43 */ 1210bcc9a72Stsutsui 0x20, /* 0x44 */ 1220bcc9a72Stsutsui 0x21, /* 0x45 */ 1230bcc9a72Stsutsui 0x22, /* 0x46 */ 1240bcc9a72Stsutsui 0x23, /* 0x47 */ 1250bcc9a72Stsutsui 0x24, /* 0x48 */ 1260bcc9a72Stsutsui 0x25, /* 0x49 */ 1270bcc9a72Stsutsui 0x26, /* 0x4a */ 1280bcc9a72Stsutsui 0x27, /* 0x4b: plus */ 1290bcc9a72Stsutsui 0x28, /* 0x4c: asterisk */ 1300bcc9a72Stsutsui 0x2b, /* 0x4d: braceright */ 1310bcc9a72Stsutsui 0x00, /* 0x4e */ 1320bcc9a72Stsutsui 0x00, /* 0x4f */ 1330bcc9a72Stsutsui 0x00, /* 0x50 */ 1340bcc9a72Stsutsui 0x00, /* 0x51 */ 1350bcc9a72Stsutsui 0x2c, /* 0x52 */ 1360bcc9a72Stsutsui 0x2d, /* 0x53 */ 1370bcc9a72Stsutsui 0x2e, /* 0x54 */ 1380bcc9a72Stsutsui 0x2f, /* 0x55 */ 1390bcc9a72Stsutsui 0x30, /* 0x56 */ 1400bcc9a72Stsutsui 0x31, /* 0x57 */ 1410bcc9a72Stsutsui 0x32, /* 0x58 */ 1420bcc9a72Stsutsui 0x33, /* 0x59: less */ 1430bcc9a72Stsutsui 0x34, /* 0x5a: greater */ 1440bcc9a72Stsutsui 0x35, /* 0x5b: question */ 1450bcc9a72Stsutsui 0x73, /* 0x5c: underscore */ 1460bcc9a72Stsutsui 0x00, /* 0x5d */ 1470bcc9a72Stsutsui 0x00, /* 0x5e */ 1480bcc9a72Stsutsui 0x00, /* 0x5f */ 1490bcc9a72Stsutsui 0x53, /* 0x60 */ 1500bcc9a72Stsutsui 0x4e, /* 0x61 */ 1510bcc9a72Stsutsui 0x4a, /* 0x62 */ 1520bcc9a72Stsutsui 0x47, /* 0x63: KP 7 */ 1530bcc9a72Stsutsui 0x48, /* 0x64: KP 8 */ 1540bcc9a72Stsutsui 0x49, /* 0x65: KP 9 */ 1550bcc9a72Stsutsui 0x4b, /* 0x66: KP 4 */ 1560bcc9a72Stsutsui 0x4c, /* 0x67: KP 5 */ 1570bcc9a72Stsutsui 0x4d, /* 0x68: KP 6 */ 1580bcc9a72Stsutsui 0x4f, /* 0x69: KP 1 */ 1590bcc9a72Stsutsui 0x50, /* 0x6a: KP 2 */ 1600bcc9a72Stsutsui 0x51, /* 0x6b: KP 3 */ 1610bcc9a72Stsutsui 0x52, /* 0x6c: KP 0 */ 1620bcc9a72Stsutsui 0x53, /* 0x6d: KP Decimal */ 1630bcc9a72Stsutsui 0x9c, /* 0x6e */ 1640bcc9a72Stsutsui 0x00, /* 0x6f */ 1650bcc9a72Stsutsui 0x00, /* 0x70 */ 1660bcc9a72Stsutsui 0x00, /* 0x71 */ 1670bcc9a72Stsutsui 0x3b, /* 0x72 */ 1680bcc9a72Stsutsui 0x3c, /* 0x73 */ 1690bcc9a72Stsutsui 0x3d, /* 0x74 */ 1700bcc9a72Stsutsui 0x3e, /* 0x75 */ 1710bcc9a72Stsutsui 0x3f, /* 0x76 */ 1720bcc9a72Stsutsui 0x40, /* 0x77 */ 1730bcc9a72Stsutsui 0x41, /* 0x78 */ 1740bcc9a72Stsutsui 0x42, /* 0x79 */ 1750bcc9a72Stsutsui 0x43, /* 0x7a */ 1760bcc9a72Stsutsui 0x44, /* 0x7b */ 1770bcc9a72Stsutsui 0x37, /* 0x7c */ 1780bcc9a72Stsutsui 0xb5, /* 0x7d */ 1790bcc9a72Stsutsui 0x76, /* 0x7E */ 1800bcc9a72Stsutsui 0x00, /* 0x7f: KP Separator */ 1810bcc9a72Stsutsui }; 1820bcc9a72Stsutsui #endif 1830bcc9a72Stsutsui 1840bcc9a72Stsutsui #define KC(n) KS_KEYCODE(n) 1850bcc9a72Stsutsui 1860bcc9a72Stsutsui static const keysym_t omkbd_keydesc_jp[] = { 1870bcc9a72Stsutsui /* pos command normal shifted */ 1880bcc9a72Stsutsui KC(0x09), KS_Tab, 1890bcc9a72Stsutsui KC(0x0a), KS_Cmd1, KS_Control_L, 1900bcc9a72Stsutsui KC(0x0b), KS_Mode_switch, /* Kana */ 1910bcc9a72Stsutsui KC(0x0c), KS_Shift_R, 1920bcc9a72Stsutsui KC(0x0d), KS_Shift_L, 1930bcc9a72Stsutsui KC(0x0e), KS_Caps_Lock, 1940bcc9a72Stsutsui KC(0x0f), KS_Cmd2, KS_Meta_L, /* Zenmen */ 1950bcc9a72Stsutsui KC(0x10), KS_Cmd_Debugger, KS_Escape, 1960bcc9a72Stsutsui KC(0x11), KS_BackSpace, 1970bcc9a72Stsutsui KC(0x12), KS_Return, 1980bcc9a72Stsutsui KC(0x14), KS_space, 1990bcc9a72Stsutsui KC(0x15), KS_Delete, 2000bcc9a72Stsutsui KC(0x16), KS_Alt_L, /* Henkan */ 2010bcc9a72Stsutsui KC(0x17), KS_Alt_R, /* Kakutei */ 2020bcc9a72Stsutsui KC(0x18), KS_f11, /* Shokyo */ 2030bcc9a72Stsutsui KC(0x19), KS_f12, /* Yobidashi */ 2040bcc9a72Stsutsui KC(0x1a), KS_f13, /* Bunsetsu L */ 2050bcc9a72Stsutsui KC(0x1b), KS_f14, /* Bunsetsu R */ 2060bcc9a72Stsutsui KC(0x1c), KS_KP_Up, 2070bcc9a72Stsutsui KC(0x1d), KS_KP_Left, 2080bcc9a72Stsutsui KC(0x1e), KS_KP_Right, 2090bcc9a72Stsutsui KC(0x1f), KS_KP_Down, 2100bcc9a72Stsutsui /* 0x20, KS_f11, */ 2110bcc9a72Stsutsui /* 0x21, KS_f12, */ 2120bcc9a72Stsutsui KC(0x22), KS_1, KS_exclam, 2130bcc9a72Stsutsui KC(0x23), KS_2, KS_quotedbl, 2140bcc9a72Stsutsui KC(0x24), KS_3, KS_numbersign, 2150bcc9a72Stsutsui KC(0x25), KS_4, KS_dollar, 2160bcc9a72Stsutsui KC(0x26), KS_5, KS_percent, 2170bcc9a72Stsutsui KC(0x27), KS_6, KS_ampersand, 2180bcc9a72Stsutsui KC(0x28), KS_7, KS_apostrophe, 2190bcc9a72Stsutsui KC(0x29), KS_8, KS_parenleft, 2200bcc9a72Stsutsui KC(0x2a), KS_9, KS_parenright, 2210bcc9a72Stsutsui KC(0x2b), KS_0, 2220bcc9a72Stsutsui KC(0x2c), KS_minus, KS_equal, 2230bcc9a72Stsutsui KC(0x2d), KS_asciicircum, KS_asciitilde, 2240bcc9a72Stsutsui KC(0x2e), KS_backslash, KS_bar, 2250bcc9a72Stsutsui 2260bcc9a72Stsutsui /* 0x30, KS_f13, */ 2270bcc9a72Stsutsui /* 0x31, KS_f14, */ 2280bcc9a72Stsutsui KC(0x32), KS_q, 2290bcc9a72Stsutsui KC(0x33), KS_w, 2300bcc9a72Stsutsui KC(0x34), KS_e, 2310bcc9a72Stsutsui KC(0x35), KS_r, 2320bcc9a72Stsutsui KC(0x36), KS_t, 2330bcc9a72Stsutsui KC(0x37), KS_y, 2340bcc9a72Stsutsui KC(0x38), KS_u, 2350bcc9a72Stsutsui KC(0x39), KS_i, 2360bcc9a72Stsutsui KC(0x3a), KS_o, 2370bcc9a72Stsutsui KC(0x3b), KS_p, 2380bcc9a72Stsutsui KC(0x3c), KS_at, KS_grave, 2390bcc9a72Stsutsui KC(0x3d), KS_bracketleft, KS_braceleft, 2400bcc9a72Stsutsui 2410bcc9a72Stsutsui KC(0x42), KS_a, 2420bcc9a72Stsutsui KC(0x43), KS_s, 2430bcc9a72Stsutsui KC(0x44), KS_d, 2440bcc9a72Stsutsui KC(0x45), KS_f, 2450bcc9a72Stsutsui KC(0x46), KS_g, 2460bcc9a72Stsutsui KC(0x47), KS_h, 2470bcc9a72Stsutsui KC(0x48), KS_j, 2480bcc9a72Stsutsui KC(0x49), KS_k, 2490bcc9a72Stsutsui KC(0x4a), KS_l, 2500bcc9a72Stsutsui KC(0x4b), KS_semicolon, KS_plus, 2510bcc9a72Stsutsui KC(0x4c), KS_colon, KS_asterisk, 2520bcc9a72Stsutsui KC(0x4d), KS_bracketright, KS_braceright, 2530bcc9a72Stsutsui 2540bcc9a72Stsutsui KC(0x52), KS_z, 2550bcc9a72Stsutsui KC(0x53), KS_x, 2560bcc9a72Stsutsui KC(0x54), KS_c, 2570bcc9a72Stsutsui KC(0x55), KS_v, 2580bcc9a72Stsutsui KC(0x56), KS_b, 2590bcc9a72Stsutsui KC(0x57), KS_n, 2600bcc9a72Stsutsui KC(0x58), KS_m, 2610bcc9a72Stsutsui KC(0x59), KS_comma, KS_less, 2620bcc9a72Stsutsui KC(0x5a), KS_period, KS_greater, 2630bcc9a72Stsutsui KC(0x5b), KS_slash, KS_question, 2640bcc9a72Stsutsui KC(0x5c), KS_underscore, 2650bcc9a72Stsutsui 2660bcc9a72Stsutsui KC(0x60), KS_KP_Delete, 2670bcc9a72Stsutsui KC(0x61), KS_KP_Add, 2680bcc9a72Stsutsui KC(0x62), KS_KP_Subtract, 2690bcc9a72Stsutsui KC(0x63), KS_KP_7, 2700bcc9a72Stsutsui KC(0x64), KS_KP_8, 2710bcc9a72Stsutsui KC(0x65), KS_KP_9, 2720bcc9a72Stsutsui KC(0x66), KS_KP_4, 2730bcc9a72Stsutsui KC(0x67), KS_KP_5, 2740bcc9a72Stsutsui KC(0x68), KS_KP_6, 2750bcc9a72Stsutsui KC(0x69), KS_KP_1, 2760bcc9a72Stsutsui KC(0x6a), KS_KP_2, 2770bcc9a72Stsutsui KC(0x6b), KS_KP_3, 2780bcc9a72Stsutsui KC(0x6c), KS_KP_0, 2790bcc9a72Stsutsui KC(0x6d), KS_KP_Decimal, 2800bcc9a72Stsutsui KC(0x6e), KS_KP_Enter, 2810bcc9a72Stsutsui 2820bcc9a72Stsutsui KC(0x72), KS_f1, 2830bcc9a72Stsutsui KC(0x73), KS_f2, 2840bcc9a72Stsutsui KC(0x74), KS_f3, 2850bcc9a72Stsutsui KC(0x75), KS_f4, 2860bcc9a72Stsutsui KC(0x76), KS_f5, 2870bcc9a72Stsutsui KC(0x77), KS_f6, 2880bcc9a72Stsutsui KC(0x78), KS_f7, 2890bcc9a72Stsutsui KC(0x79), KS_f8, 2900bcc9a72Stsutsui KC(0x7a), KS_f9, 2910bcc9a72Stsutsui KC(0x7b), KS_f10, 2920bcc9a72Stsutsui KC(0x7c), KS_KP_Multiply, 2930bcc9a72Stsutsui KC(0x7d), KS_KP_Divide, 2940bcc9a72Stsutsui KC(0x7e), KS_KP_Equal, 2950bcc9a72Stsutsui KC(0x7f), KS_KP_Separator, 2960bcc9a72Stsutsui }; 2970bcc9a72Stsutsui 2980bcc9a72Stsutsui #define SIZE(map) (sizeof(map)/sizeof(keysym_t)) 2990bcc9a72Stsutsui 3000bcc9a72Stsutsui const struct wscons_keydesc omkbd_keydesctab[] = { 3010bcc9a72Stsutsui { KB_JP, 0, SIZE(omkbd_keydesc_jp), omkbd_keydesc_jp, }, 3020bcc9a72Stsutsui { 0, 0, 0, 0 }, 3030bcc9a72Stsutsui }; 304