1ee3138f1Smrg/* 2ee3138f1Smrg * Copyright 1990,91 by Thomas Roell, Dinkelscherben, Germany. 3ee3138f1Smrg * Copyright 1993 by David Dawes <dawes@xfree86.org> 4ee3138f1Smrg * 5ee3138f1Smrg * Permission to use, copy, modify, distribute, and sell this software and its 6ee3138f1Smrg * documentation for any purpose is hereby granted without fee, provided that 7ee3138f1Smrg * the above copyright notice appear in all copies and that both that copyright 8ee3138f1Smrg * notice and this permission notice appear in supporting documentation, and 9ee3138f1Smrg * that the names of Thomas Roell and David Dawes not be used in advertising or 10ee3138f1Smrg * publicity pertaining to distribution of the software without specific, 11ee3138f1Smrg * written prior permission. Thomas Roell and David Dawes make no 12ee3138f1Smrg * representations about the suitability of this software for any purpose. It 13ee3138f1Smrg * is provided "as is" without express or implied warranty. 14ee3138f1Smrg * 15ee3138f1Smrg * THOMAS ROELL AND DAVID DAWES DISCLAIM ALL WARRANTIES WITH REGARD TO THIS 16ee3138f1Smrg * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. 17ee3138f1Smrg * IN NO EVENT SHALL THOMAS ROELL OR DAVID DAWES BE LIABLE FOR ANY SPECIAL, 18ee3138f1Smrg * INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM 19ee3138f1Smrg * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE 20ee3138f1Smrg * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR 21ee3138f1Smrg * PERFORMANCE OF THIS SOFTWARE. 22ee3138f1Smrg */ 23ee3138f1Smrg 24ee3138f1Smrg#ifdef HAVE_CONFIG_H 25ee3138f1Smrg#include "config.h" 26ee3138f1Smrg#endif 27ee3138f1Smrg 28b425557eSmrg#include <xorg-server.h> 29ee3138f1Smrg#include <X11/Xfuncproto.h> 30ee3138f1Smrg#include <X11/Sunkeysym.h> 31ee3138f1Smrg#include "atKeynames.h" 32ee3138f1Smrg#include "xf86OSKbd.h" 33ee3138f1Smrg#include "xf86Keymap.h" 34ee3138f1Smrg#include "sun_kbd.h" 35ee3138f1Smrg 36ee3138f1Smrg#include <sys/kbd.h> 37ee3138f1Smrg 38ee3138f1Smrg/* Map the Solaris keycodes to the "XFree86" keycodes. */ 39ee3138f1Smrg 40b425557eSmrg/* 41b425557eSmrg * Additional Korean 106 Keyboard Keys not defined in atKeynames.h 42b425557eSmrg * These are exactly same USB usage id with Kana(0x90) and Eisu(0x91) keys 43b425557eSmrg * in Mac Japanese keyboard. From /usr/X11/lib/X11/xkb/keycodes/xfree86, these 44b425557eSmrg * are 209 and 210. So these should be 0xc9(209-8=201) and 0xca(210-8=202). 45b425557eSmrg * <EISU> = 210; // Alphanumeric mode on macintosh 46b425557eSmrg * <KANA> = 209; // Kana mode on macintosh 47b425557eSmrg */ 48b425557eSmrg#define KEY_Hangul 0xC9 /* Also Kana in Mac Japanaese kbd */ 49b425557eSmrg#define KEY_Hangul_Hanja 0xCA /* Also Eisu in Mac Japanaese kbd */ 50b425557eSmrg 5134977a2fSmrg/* Override atKeynames.h values with unique keycodes, so we can distinguish 5234977a2fSmrg KEY_F15 from KEY_HKTG & KEY_KP_DEC from KEY_BSlash2 */ 5334977a2fSmrg#undef KEY_HKTG 5434977a2fSmrg#define KEY_HKTG /* Hirugana/Katakana tog 0xC8 */ 200 /* was 112 */ 5534977a2fSmrg#undef KEY_BSlash2 5634977a2fSmrg#define KEY_BSlash2 /* \ _ 0xCB */ 203 /* was 115 */ 5734977a2fSmrg 58ee3138f1Smrgstatic unsigned char sunmap[256] = { 59ee3138f1Smrg#if defined(i386) || defined(__i386) || defined(__i386__) || defined(__x86) 60ee3138f1Smrg KEY_NOTUSED, /* 0 */ 61ee3138f1Smrg KEY_Tilde, /* 1 */ 62ee3138f1Smrg KEY_1, /* 2 */ 63ee3138f1Smrg KEY_2, /* 3 */ 64ee3138f1Smrg KEY_3, /* 4 */ 65ee3138f1Smrg KEY_4, /* 5 */ 66ee3138f1Smrg KEY_5, /* 6 */ 67ee3138f1Smrg KEY_6, /* 7 */ 68ee3138f1Smrg KEY_7, /* 8 */ 69ee3138f1Smrg KEY_8, /* 9 */ 70ee3138f1Smrg KEY_9, /* 10 */ 71ee3138f1Smrg KEY_0, /* 11 */ 72ee3138f1Smrg KEY_Minus, /* 12 */ 73ee3138f1Smrg KEY_Equal, /* 13 */ 74ee3138f1Smrg 0x7D, /*KEY_P_YEN*/ /* 14 */ 75ee3138f1Smrg KEY_BackSpace, /* 15 */ 76ee3138f1Smrg KEY_Tab, /* 16 */ 77ee3138f1Smrg KEY_Q, /* 17 */ 78ee3138f1Smrg KEY_W, /* 18 */ 79ee3138f1Smrg KEY_E, /* 19 */ 80ee3138f1Smrg KEY_R, /* 20 */ 81ee3138f1Smrg KEY_T, /* 21 */ 82ee3138f1Smrg KEY_Y, /* 22 */ 83ee3138f1Smrg KEY_U, /* 23 */ 84ee3138f1Smrg KEY_I, /* 24 */ 85ee3138f1Smrg KEY_O, /* 25 */ 86ee3138f1Smrg KEY_P, /* 26 */ 87ee3138f1Smrg KEY_LBrace, /* 27 */ 88ee3138f1Smrg KEY_RBrace, /* 28 */ 89ee3138f1Smrg KEY_BSlash, /* 29 */ 90ee3138f1Smrg KEY_CapsLock, /* 30 */ 91ee3138f1Smrg KEY_A, /* 31 */ 92ee3138f1Smrg KEY_S, /* 32 */ 93ee3138f1Smrg KEY_D, /* 33 */ 94ee3138f1Smrg KEY_F, /* 34 */ 95ee3138f1Smrg KEY_G, /* 35 */ 96ee3138f1Smrg KEY_H, /* 36 */ 97ee3138f1Smrg KEY_J, /* 37 */ 98ee3138f1Smrg KEY_K, /* 38 */ 99ee3138f1Smrg KEY_L, /* 39 */ 100ee3138f1Smrg KEY_SemiColon, /* 40 */ 101ee3138f1Smrg KEY_Quote, /* 41 */ 102ee3138f1Smrg KEY_UNKNOWN, /* 42 */ 103ee3138f1Smrg KEY_Enter, /* 43 */ 104ee3138f1Smrg KEY_ShiftL, /* 44 */ 105ee3138f1Smrg KEY_Less, /* 45 */ 106ee3138f1Smrg KEY_Z, /* 46 */ 107ee3138f1Smrg KEY_X, /* 47 */ 108ee3138f1Smrg KEY_C, /* 48 */ 109ee3138f1Smrg KEY_V, /* 49 */ 110ee3138f1Smrg KEY_B, /* 50 */ 111ee3138f1Smrg KEY_N, /* 51 */ 112ee3138f1Smrg KEY_M, /* 52 */ 113ee3138f1Smrg KEY_Comma, /* 53 */ 114ee3138f1Smrg KEY_Period, /* 54 */ 115ee3138f1Smrg KEY_Slash, /* 55 */ 116ee3138f1Smrg KEY_BSlash2, /* 56 */ 117ee3138f1Smrg KEY_ShiftR, /* 57 */ 118ee3138f1Smrg KEY_LCtrl, /* 58 */ 119ee3138f1Smrg KEY_LMeta, /* 59 */ 120ee3138f1Smrg KEY_Alt, /* 60 */ 121ee3138f1Smrg KEY_Space, /* 61 */ 122ee3138f1Smrg KEY_AltLang, /* 62 */ 123ee3138f1Smrg KEY_RMeta, /* 63 */ 124ee3138f1Smrg KEY_RCtrl, /* 64 */ 125ee3138f1Smrg KEY_Menu, /* 65 */ 126ee3138f1Smrg KEY_UNKNOWN, /* 66 */ 127ee3138f1Smrg KEY_UNKNOWN, /* 67 */ 128ee3138f1Smrg KEY_UNKNOWN, /* 68 */ 129ee3138f1Smrg KEY_UNKNOWN, /* 69 */ 130ee3138f1Smrg KEY_UNKNOWN, /* 70 */ 131ee3138f1Smrg KEY_UNKNOWN, /* 71 */ 132ee3138f1Smrg KEY_UNKNOWN, /* 72 */ 133ee3138f1Smrg KEY_UNKNOWN, /* 73 */ 134ee3138f1Smrg KEY_UNKNOWN, /* 74 */ 135ee3138f1Smrg KEY_Insert, /* 75 */ 136ee3138f1Smrg KEY_Delete, /* 76 */ 137ee3138f1Smrg KEY_UNKNOWN, /* 77 */ 138ee3138f1Smrg KEY_UNKNOWN, /* 78 */ 139ee3138f1Smrg KEY_Left, /* 79 */ 140ee3138f1Smrg KEY_Home, /* 80 */ 141ee3138f1Smrg KEY_End, /* 81 */ 142ee3138f1Smrg KEY_UNKNOWN, /* 82 */ 143ee3138f1Smrg KEY_Up, /* 83 */ 144ee3138f1Smrg KEY_Down, /* 84 */ 145ee3138f1Smrg KEY_PgUp, /* 85 */ 146ee3138f1Smrg KEY_PgDown, /* 86 */ 147ee3138f1Smrg KEY_UNKNOWN, /* 87 */ 148ee3138f1Smrg KEY_UNKNOWN, /* 88 */ 149ee3138f1Smrg KEY_Right, /* 89 */ 150ee3138f1Smrg KEY_NumLock, /* 90 */ 151ee3138f1Smrg KEY_KP_7, /* 91 */ 152ee3138f1Smrg KEY_KP_4, /* 92 */ 153ee3138f1Smrg KEY_KP_1, /* 93 */ 154ee3138f1Smrg KEY_UNKNOWN, /* 94 */ 155ee3138f1Smrg KEY_KP_Divide, /* 95 */ 156ee3138f1Smrg KEY_KP_8, /* 96 */ 157ee3138f1Smrg KEY_KP_5, /* 97 */ 158ee3138f1Smrg KEY_KP_2, /* 98 */ 159ee3138f1Smrg KEY_KP_0, /* 99 */ 160ee3138f1Smrg KEY_KP_Multiply, /* 100 */ 161ee3138f1Smrg KEY_KP_9, /* 101 */ 162ee3138f1Smrg KEY_KP_6, /* 102 */ 163ee3138f1Smrg KEY_KP_3, /* 103 */ 164ee3138f1Smrg KEY_KP_Decimal, /* 104 */ 165ee3138f1Smrg KEY_KP_Minus, /* 105 */ 166ee3138f1Smrg KEY_KP_Plus, /* 106 */ 167ee3138f1Smrg KEY_UNKNOWN, /* 107 */ 168ee3138f1Smrg KEY_KP_Enter, /* 108 */ 169ee3138f1Smrg KEY_UNKNOWN, /* 109 */ 170ee3138f1Smrg KEY_Escape, /* 110 */ 171ee3138f1Smrg KEY_UNKNOWN, /* 111 */ 172ee3138f1Smrg KEY_F1, /* 112 */ 173ee3138f1Smrg KEY_F2, /* 113 */ 174ee3138f1Smrg KEY_F3, /* 114 */ 175ee3138f1Smrg KEY_F4, /* 115 */ 176ee3138f1Smrg KEY_F5, /* 116 */ 177ee3138f1Smrg KEY_F6, /* 117 */ 178ee3138f1Smrg KEY_F7, /* 118 */ 179ee3138f1Smrg KEY_F8, /* 119 */ 180ee3138f1Smrg KEY_F9, /* 120 */ 181ee3138f1Smrg KEY_F10, /* 121 */ 182ee3138f1Smrg KEY_F11, /* 122 */ 183ee3138f1Smrg KEY_F12, /* 123 */ 184ee3138f1Smrg KEY_Print, /* 124 */ 185ee3138f1Smrg KEY_ScrollLock, /* 125 */ 186ee3138f1Smrg KEY_Pause, /* 126 */ 187ee3138f1Smrg KEY_UNKNOWN, /* 127 */ 188ee3138f1Smrg KEY_UNKNOWN, /* 128 */ 189ee3138f1Smrg KEY_UNKNOWN, /* 129 */ 190ee3138f1Smrg KEY_UNKNOWN, /* 130 */ 191ee3138f1Smrg KEY_NFER, /* 131 */ 192ee3138f1Smrg KEY_XFER, /* 132 */ 193ee3138f1Smrg KEY_HKTG, /* 133 */ 194ee3138f1Smrg KEY_UNKNOWN, /* 134 */ 195ee3138f1Smrg#elif defined(sparc) || defined(__sparc__) 196ee3138f1Smrg KEY_UNKNOWN, /* 0x00 */ 197ee3138f1Smrg KEY_UNKNOWN, /* 0x01 */ 198ee3138f1Smrg KEY_UNKNOWN, /* 0x02 */ 199ee3138f1Smrg KEY_UNKNOWN, /* 0x03 */ 200ee3138f1Smrg KEY_UNKNOWN, /* 0x04 */ 201ee3138f1Smrg KEY_F1, /* 0x05 */ 202ee3138f1Smrg KEY_F2, /* 0x06 */ 203ee3138f1Smrg KEY_F10, /* 0x07 */ 204ee3138f1Smrg KEY_F3, /* 0x08 */ 205ee3138f1Smrg KEY_F11, /* 0x09 */ 206ee3138f1Smrg KEY_F4, /* 0x0A */ 207ee3138f1Smrg KEY_F12, /* 0x0B */ 208ee3138f1Smrg KEY_F5, /* 0x0C */ 209ee3138f1Smrg KEY_UNKNOWN, /* 0x0D */ 210ee3138f1Smrg KEY_F6, /* 0x0E */ 211ee3138f1Smrg KEY_UNKNOWN, /* 0x0F */ 212ee3138f1Smrg KEY_F7, /* 0x10 */ 213ee3138f1Smrg KEY_F8, /* 0x11 */ 214ee3138f1Smrg KEY_F9, /* 0x12 */ 215ee3138f1Smrg KEY_Alt, /* 0x13 */ 216ee3138f1Smrg KEY_Up, /* 0x14 */ 217ee3138f1Smrg KEY_Pause, /* 0x15 */ 218ee3138f1Smrg KEY_SysReqest, /* 0x16 */ 219ee3138f1Smrg KEY_ScrollLock, /* 0x17 */ 220ee3138f1Smrg KEY_Left, /* 0x18 */ 221ee3138f1Smrg KEY_UNKNOWN, /* 0x19 */ 222ee3138f1Smrg KEY_UNKNOWN, /* 0x1A */ 223ee3138f1Smrg KEY_Down, /* 0x1B */ 224ee3138f1Smrg KEY_Right, /* 0x1C */ 225ee3138f1Smrg KEY_Escape, /* 0x1D */ 226ee3138f1Smrg KEY_1, /* 0x1E */ 227ee3138f1Smrg KEY_2, /* 0x1F */ 228ee3138f1Smrg KEY_3, /* 0x20 */ 229ee3138f1Smrg KEY_4, /* 0x21 */ 230ee3138f1Smrg KEY_5, /* 0x22 */ 231ee3138f1Smrg KEY_6, /* 0x23 */ 232ee3138f1Smrg KEY_7, /* 0x24 */ 233ee3138f1Smrg KEY_8, /* 0x25 */ 234ee3138f1Smrg KEY_9, /* 0x26 */ 235ee3138f1Smrg KEY_0, /* 0x27 */ 236ee3138f1Smrg KEY_Minus, /* 0x28 */ 237ee3138f1Smrg KEY_Equal, /* 0x29 */ 238ee3138f1Smrg KEY_Tilde, /* 0x2A */ 239ee3138f1Smrg KEY_BackSpace, /* 0x2B */ 240ee3138f1Smrg KEY_Insert, /* 0x2C */ 241ee3138f1Smrg KEY_UNKNOWN, /* 0x2D */ 242ee3138f1Smrg KEY_KP_Divide, /* 0x2E */ 243ee3138f1Smrg KEY_KP_Multiply, /* 0x2F */ 244ee3138f1Smrg KEY_UNKNOWN, /* 0x30 */ 245ee3138f1Smrg KEY_UNKNOWN, /* 0x31 */ 246ee3138f1Smrg KEY_KP_Decimal, /* 0x32 */ 247ee3138f1Smrg KEY_UNKNOWN, /* 0x33 */ 248ee3138f1Smrg KEY_Home, /* 0x34 */ 249ee3138f1Smrg KEY_Tab, /* 0x35 */ 250ee3138f1Smrg KEY_Q, /* 0x36 */ 251ee3138f1Smrg KEY_W, /* 0x37 */ 252ee3138f1Smrg KEY_E, /* 0x38 */ 253ee3138f1Smrg KEY_R, /* 0x39 */ 254ee3138f1Smrg KEY_T, /* 0x3A */ 255ee3138f1Smrg KEY_Y, /* 0x3B */ 256ee3138f1Smrg KEY_U, /* 0x3C */ 257ee3138f1Smrg KEY_I, /* 0x3D */ 258ee3138f1Smrg KEY_O, /* 0x3E */ 259ee3138f1Smrg KEY_P, /* 0x3F */ 260ee3138f1Smrg KEY_LBrace, /* 0x40 */ 261ee3138f1Smrg KEY_RBrace, /* 0x41 */ 262ee3138f1Smrg KEY_Delete, /* 0x42 */ 263ee3138f1Smrg KEY_UNKNOWN, /* 0x43 */ 264ee3138f1Smrg KEY_KP_7, /* 0x44 */ 265ee3138f1Smrg KEY_KP_8, /* 0x45 */ 266ee3138f1Smrg KEY_KP_9, /* 0x46 */ 267ee3138f1Smrg KEY_KP_Minus, /* 0x47 */ 268ee3138f1Smrg KEY_UNKNOWN, /* 0x48 */ 269ee3138f1Smrg KEY_UNKNOWN, /* 0x49 */ 270ee3138f1Smrg KEY_End, /* 0x4A */ 271ee3138f1Smrg KEY_UNKNOWN, /* 0x4B */ 272ee3138f1Smrg KEY_LCtrl, /* 0x4C */ 273ee3138f1Smrg KEY_A, /* 0x4D */ 274ee3138f1Smrg KEY_S, /* 0x4E */ 275ee3138f1Smrg KEY_D, /* 0x4F */ 276ee3138f1Smrg KEY_F, /* 0x50 */ 277ee3138f1Smrg KEY_G, /* 0x51 */ 278ee3138f1Smrg KEY_H, /* 0x52 */ 279ee3138f1Smrg KEY_J, /* 0x53 */ 280ee3138f1Smrg KEY_K, /* 0x54 */ 281ee3138f1Smrg KEY_L, /* 0x55 */ 282ee3138f1Smrg KEY_SemiColon, /* 0x56 */ 283ee3138f1Smrg KEY_Quote, /* 0x57 */ 284ee3138f1Smrg KEY_BSlash, /* 0x58 */ 285ee3138f1Smrg KEY_Enter, /* 0x59 */ 286ee3138f1Smrg KEY_KP_Enter, /* 0x5A */ 287ee3138f1Smrg KEY_KP_4, /* 0x5B */ 288ee3138f1Smrg KEY_KP_5, /* 0x5C */ 289ee3138f1Smrg KEY_KP_6, /* 0x5D */ 290ee3138f1Smrg KEY_KP_0, /* 0x5E */ 291ee3138f1Smrg KEY_UNKNOWN, /* 0x5F */ 292ee3138f1Smrg KEY_PgUp, /* 0x60 */ 293ee3138f1Smrg KEY_UNKNOWN, /* 0x61 */ 294ee3138f1Smrg KEY_NumLock, /* 0x62 */ 295ee3138f1Smrg KEY_ShiftL, /* 0x63 */ 296ee3138f1Smrg KEY_Z, /* 0x64 */ 297ee3138f1Smrg KEY_X, /* 0x65 */ 298ee3138f1Smrg KEY_C, /* 0x66 */ 299ee3138f1Smrg KEY_V, /* 0x67 */ 300ee3138f1Smrg KEY_B, /* 0x68 */ 301ee3138f1Smrg KEY_N, /* 0x69 */ 302ee3138f1Smrg KEY_M, /* 0x6A */ 303ee3138f1Smrg KEY_Comma, /* 0x6B */ 304ee3138f1Smrg KEY_Period, /* 0x6C */ 305ee3138f1Smrg KEY_Slash, /* 0x6D */ 306ee3138f1Smrg KEY_ShiftR, /* 0x6E */ 307ee3138f1Smrg KEY_UNKNOWN, /* 0x6F */ 308ee3138f1Smrg KEY_KP_1, /* 0x70 */ 309ee3138f1Smrg KEY_KP_2, /* 0x71 */ 310ee3138f1Smrg KEY_KP_3, /* 0x72 */ 311ee3138f1Smrg KEY_UNKNOWN, /* 0x73 */ 312ee3138f1Smrg KEY_UNKNOWN, /* 0x74 */ 313ee3138f1Smrg KEY_UNKNOWN, /* 0x75 */ 314ee3138f1Smrg KEY_UNKNOWN, /* 0x76 */ 315ee3138f1Smrg KEY_CapsLock, /* 0x77 */ 316ee3138f1Smrg KEY_LMeta, /* 0x78 */ 317ee3138f1Smrg KEY_Space, /* 0x79 */ 318ee3138f1Smrg KEY_RMeta, /* 0x7A */ 319ee3138f1Smrg KEY_PgDown, /* 0x7B */ 320ee3138f1Smrg KEY_UNKNOWN, /* 0x7C */ 321ee3138f1Smrg KEY_KP_Plus, /* 0x7D */ 322ee3138f1Smrg KEY_UNKNOWN, /* 0x7E */ 323ee3138f1Smrg KEY_UNKNOWN, /* 0x7F */ 324ee3138f1Smrg#endif 325ee3138f1Smrg /* The rest default to KEY_UNKNOWN */ 326ee3138f1Smrg}; 327ee3138f1Smrg 328ee3138f1Smrgstatic 329ee3138f1SmrgTransMapRec sunTransMap = { 330ee3138f1Smrg 0, 331ee3138f1Smrg (sizeof(sunmap)/sizeof(unsigned char)), 332ee3138f1Smrg sunmap 333ee3138f1Smrg}; 334ee3138f1Smrg 335ee3138f1Smrg#if defined(KB_USB) 336ee3138f1Smrgstatic unsigned char usbmap[256] = { 337ee3138f1Smrg/* 338ee3138f1Smrg * partially taken from ../bsd/bsd_KbdMap.c 339ee3138f1Smrg * 340ee3138f1Smrg * added keycodes for Sun special keys (left function keys, audio control) 341ee3138f1Smrg */ 342ee3138f1Smrg /* 0 */ KEY_NOTUSED, 343ee3138f1Smrg /* 1 */ KEY_NOTUSED, 344ee3138f1Smrg /* 2 */ KEY_NOTUSED, 345ee3138f1Smrg /* 3 */ KEY_NOTUSED, 346ee3138f1Smrg /* 4 */ KEY_A, 347ee3138f1Smrg /* 5 */ KEY_B, 348ee3138f1Smrg /* 6 */ KEY_C, 349ee3138f1Smrg /* 7 */ KEY_D, 350ee3138f1Smrg /* 8 */ KEY_E, 351ee3138f1Smrg /* 9 */ KEY_F, 352ee3138f1Smrg /* 10 */ KEY_G, 353ee3138f1Smrg /* 11 */ KEY_H, 354ee3138f1Smrg /* 12 */ KEY_I, 355ee3138f1Smrg /* 13 */ KEY_J, 356ee3138f1Smrg /* 14 */ KEY_K, 357ee3138f1Smrg /* 15 */ KEY_L, 358ee3138f1Smrg /* 16 */ KEY_M, 359ee3138f1Smrg /* 17 */ KEY_N, 360ee3138f1Smrg /* 18 */ KEY_O, 361ee3138f1Smrg /* 19 */ KEY_P, 362ee3138f1Smrg /* 20 */ KEY_Q, 363ee3138f1Smrg /* 21 */ KEY_R, 364ee3138f1Smrg /* 22 */ KEY_S, 365ee3138f1Smrg /* 23 */ KEY_T, 366ee3138f1Smrg /* 24 */ KEY_U, 367ee3138f1Smrg /* 25 */ KEY_V, 368ee3138f1Smrg /* 26 */ KEY_W, 369ee3138f1Smrg /* 27 */ KEY_X, 370ee3138f1Smrg /* 28 */ KEY_Y, 371ee3138f1Smrg /* 29 */ KEY_Z, 372ee3138f1Smrg /* 30 */ KEY_1, /* 1 !*/ 373ee3138f1Smrg /* 31 */ KEY_2, /* 2 @ */ 374ee3138f1Smrg /* 32 */ KEY_3, /* 3 # */ 375ee3138f1Smrg /* 33 */ KEY_4, /* 4 $ */ 376ee3138f1Smrg /* 34 */ KEY_5, /* 5 % */ 377ee3138f1Smrg /* 35 */ KEY_6, /* 6 ^ */ 378ee3138f1Smrg /* 36 */ KEY_7, /* 7 & */ 379ee3138f1Smrg /* 37 */ KEY_8, /* 8 * */ 380ee3138f1Smrg /* 38 */ KEY_9, /* 9 ( */ 381ee3138f1Smrg /* 39 */ KEY_0, /* 0 ) */ 382ee3138f1Smrg /* 40 */ KEY_Enter, /* Return */ 383ee3138f1Smrg /* 41 */ KEY_Escape, /* Escape */ 384ee3138f1Smrg /* 42 */ KEY_BackSpace, /* Backspace Delete */ 385ee3138f1Smrg /* 43 */ KEY_Tab, /* Tab */ 386ee3138f1Smrg /* 44 */ KEY_Space, /* Space */ 387ee3138f1Smrg /* 45 */ KEY_Minus, /* - _ */ 388ee3138f1Smrg /* 46 */ KEY_Equal, /* = + */ 389ee3138f1Smrg /* 47 */ KEY_LBrace, /* [ { */ 390ee3138f1Smrg /* 48 */ KEY_RBrace, /* ] } */ 391ee3138f1Smrg /* 49 */ KEY_BSlash, /* \ | */ 392ee3138f1Smrg /* 50 */ KEY_BSlash, /* \ _ # ~ on some keyboards */ 393ee3138f1Smrg /* 51 */ KEY_SemiColon, /* ; : */ 394ee3138f1Smrg /* 52 */ KEY_Quote, /* ' " */ 395ee3138f1Smrg /* 53 */ KEY_Tilde, /* ` ~ */ 396ee3138f1Smrg /* 54 */ KEY_Comma, /* , < */ 397ee3138f1Smrg /* 55 */ KEY_Period, /* . > */ 398ee3138f1Smrg /* 56 */ KEY_Slash, /* / ? */ 399ee3138f1Smrg /* 57 */ KEY_CapsLock, /* Caps Lock */ 400ee3138f1Smrg /* 58 */ KEY_F1, /* F1 */ 401ee3138f1Smrg /* 59 */ KEY_F2, /* F2 */ 402ee3138f1Smrg /* 60 */ KEY_F3, /* F3 */ 403ee3138f1Smrg /* 61 */ KEY_F4, /* F4 */ 404ee3138f1Smrg /* 62 */ KEY_F5, /* F5 */ 405ee3138f1Smrg /* 63 */ KEY_F6, /* F6 */ 406ee3138f1Smrg /* 64 */ KEY_F7, /* F7 */ 407ee3138f1Smrg /* 65 */ KEY_F8, /* F8 */ 408ee3138f1Smrg /* 66 */ KEY_F9, /* F9 */ 409ee3138f1Smrg /* 67 */ KEY_F10, /* F10 */ 410ee3138f1Smrg /* 68 */ KEY_F11, /* F11 */ 411ee3138f1Smrg /* 69 */ KEY_F12, /* F12 */ 412ee3138f1Smrg /* 70 */ KEY_Print, /* PrintScrn SysReq */ 413ee3138f1Smrg /* 71 */ KEY_ScrollLock, /* Scroll Lock */ 414ee3138f1Smrg /* 72 */ KEY_Pause, /* Pause Break */ 415ee3138f1Smrg /* 73 */ KEY_Insert, /* Insert XXX Help on some Mac Keyboards */ 416ee3138f1Smrg /* 74 */ KEY_Home, /* Home */ 417ee3138f1Smrg /* 75 */ KEY_PgUp, /* Page Up */ 418ee3138f1Smrg /* 76 */ KEY_Delete, /* Delete */ 419ee3138f1Smrg /* 77 */ KEY_End, /* End */ 420ee3138f1Smrg /* 78 */ KEY_PgDown, /* Page Down */ 421ee3138f1Smrg /* 79 */ KEY_Right, /* Right Arrow */ 422ee3138f1Smrg /* 80 */ KEY_Left, /* Left Arrow */ 423ee3138f1Smrg /* 81 */ KEY_Down, /* Down Arrow */ 424ee3138f1Smrg /* 82 */ KEY_Up, /* Up Arrow */ 425ee3138f1Smrg /* 83 */ KEY_NumLock, /* Num Lock */ 426ee3138f1Smrg /* 84 */ KEY_KP_Divide, /* Keypad / */ 427ee3138f1Smrg /* 85 */ KEY_KP_Multiply, /* Keypad * */ 428ee3138f1Smrg /* 86 */ KEY_KP_Minus, /* Keypad - */ 429ee3138f1Smrg /* 87 */ KEY_KP_Plus, /* Keypad + */ 430ee3138f1Smrg /* 88 */ KEY_KP_Enter, /* Keypad Enter */ 431ee3138f1Smrg /* 89 */ KEY_KP_1, /* Keypad 1 End */ 432ee3138f1Smrg /* 90 */ KEY_KP_2, /* Keypad 2 Down */ 433ee3138f1Smrg /* 91 */ KEY_KP_3, /* Keypad 3 Pg Down */ 434ee3138f1Smrg /* 92 */ KEY_KP_4, /* Keypad 4 Left */ 435ee3138f1Smrg /* 93 */ KEY_KP_5, /* Keypad 5 */ 436ee3138f1Smrg /* 94 */ KEY_KP_6, /* Keypad 6 */ 437ee3138f1Smrg /* 95 */ KEY_KP_7, /* Keypad 7 Home */ 438ee3138f1Smrg /* 96 */ KEY_KP_8, /* Keypad 8 Up */ 439ee3138f1Smrg /* 97 */ KEY_KP_9, /* KEypad 9 Pg Up */ 440ee3138f1Smrg /* 98 */ KEY_KP_0, /* Keypad 0 Ins */ 441ee3138f1Smrg /* 99 */ KEY_KP_Decimal, /* Keypad . Del */ 442ee3138f1Smrg /* 100 */ KEY_Less, /* < > on some keyboards */ 443ee3138f1Smrg /* 101 */ KEY_Menu, /* Menu */ 444ee3138f1Smrg /* 102 */ KEY_Power, /* Sun: Power */ 445ee3138f1Smrg /* 103 */ KEY_KP_Equal, /* Keypad = on Mac keyboards */ 446ee3138f1Smrg /* 104 */ KEY_NOTUSED, 447ee3138f1Smrg /* 105 */ KEY_NOTUSED, 448ee3138f1Smrg /* 106 */ KEY_NOTUSED, 449ee3138f1Smrg /* 107 */ KEY_NOTUSED, 450ee3138f1Smrg /* 108 */ KEY_NOTUSED, 451ee3138f1Smrg /* 109 */ KEY_NOTUSED, 452ee3138f1Smrg /* 110 */ KEY_NOTUSED, 453ee3138f1Smrg /* 111 */ KEY_NOTUSED, 454ee3138f1Smrg /* 112 */ KEY_NOTUSED, 455ee3138f1Smrg /* 113 */ KEY_NOTUSED, 456ee3138f1Smrg /* 114 */ KEY_NOTUSED, 457ee3138f1Smrg /* 115 */ KEY_NOTUSED, 458ee3138f1Smrg /* 116 */ KEY_L7, /* Sun: Open */ 459ee3138f1Smrg /* 117 */ KEY_Help, /* Sun: Help */ 460ee3138f1Smrg /* 118 */ KEY_L3, /* Sun: Props */ 461ee3138f1Smrg /* 119 */ KEY_L5, /* Sun: Front */ 462ee3138f1Smrg /* 120 */ KEY_L1, /* Sun: Stop */ 463ee3138f1Smrg /* 121 */ KEY_L2, /* Sun: Again */ 464ee3138f1Smrg /* 122 */ KEY_L4, /* Sun: Undo */ 465ee3138f1Smrg /* 123 */ KEY_L10, /* Sun: Cut */ 466ee3138f1Smrg /* 124 */ KEY_L6, /* Sun: Copy */ 467ee3138f1Smrg /* 125 */ KEY_L8, /* Sun: Paste */ 468ee3138f1Smrg /* 126 */ KEY_L9, /* Sun: Find */ 469ee3138f1Smrg /* 127 */ KEY_Mute, /* Sun: AudioMute */ 470ee3138f1Smrg /* 128 */ KEY_AudioRaise, /* Sun: AudioRaise */ 471ee3138f1Smrg /* 129 */ KEY_AudioLower, /* Sun: AudioLower */ 472ee3138f1Smrg /* 130 */ KEY_NOTUSED, 473ee3138f1Smrg /* 131 */ KEY_NOTUSED, 474ee3138f1Smrg /* 132 */ KEY_NOTUSED, 475ee3138f1Smrg /* 133 */ KEY_NOTUSED, 476ee3138f1Smrg /* 134 */ KEY_NOTUSED, 477ee3138f1Smrg /* 135 */ KEY_BSlash2, /* Sun Japanese Kbd: Backslash / Underscore */ 478a1ed278cSmrg /* 136 */ KEY_HKTG, /* Sun Japanese type7 Kbd: Hirugana/Katakana */ 479ee3138f1Smrg /* 137 */ KEY_Yen, /* Sun Japanese Kbd: Yen / Brokenbar */ 480a1ed278cSmrg /* 138 */ KEY_XFER, /* Sun Japanese Kbd: Kanji Transfer */ 481a1ed278cSmrg /* 139 */ KEY_NFER, /* Sun Japanese Kbd: No Kanji Transfer */ 482ee3138f1Smrg /* 140 */ KEY_NOTUSED, 483ee3138f1Smrg /* 141 */ KEY_NOTUSED, 484ee3138f1Smrg /* 142 */ KEY_NOTUSED, 485ee3138f1Smrg /* 143 */ KEY_NOTUSED, 486b425557eSmrg /* 144 */ KEY_Hangul, /* Korean 106 Kbd: Hangul */ 487b425557eSmrg /* 145 */ KEY_Hangul_Hanja, /* Korean 106 Kbd: Hanja */ 488ee3138f1Smrg /* 146 */ KEY_NOTUSED, 489ee3138f1Smrg /* 147 */ KEY_NOTUSED, 490ee3138f1Smrg /* 148 */ KEY_NOTUSED, 491ee3138f1Smrg /* 149 */ KEY_NOTUSED, 492ee3138f1Smrg /* 150 */ KEY_NOTUSED, 493ee3138f1Smrg /* 151 */ KEY_NOTUSED, 494ee3138f1Smrg /* 152 */ KEY_NOTUSED, 495ee3138f1Smrg /* 153 */ KEY_NOTUSED, 496ee3138f1Smrg /* 154 */ KEY_NOTUSED, 497ee3138f1Smrg /* 155 */ KEY_NOTUSED, 498ee3138f1Smrg /* 156 */ KEY_NOTUSED, 499ee3138f1Smrg /* 157 */ KEY_NOTUSED, 500ee3138f1Smrg /* 158 */ KEY_NOTUSED, 501ee3138f1Smrg /* 159 */ KEY_NOTUSED, 502ee3138f1Smrg /* 160 */ KEY_NOTUSED, 503ee3138f1Smrg /* 161 */ KEY_NOTUSED, 504ee3138f1Smrg /* 162 */ KEY_NOTUSED, 505ee3138f1Smrg /* 163 */ KEY_NOTUSED, 506ee3138f1Smrg /* 164 */ KEY_NOTUSED, 507ee3138f1Smrg /* 165 */ KEY_NOTUSED, 508ee3138f1Smrg /* 166 */ KEY_NOTUSED, 509ee3138f1Smrg /* 167 */ KEY_NOTUSED, 510ee3138f1Smrg /* 168 */ KEY_NOTUSED, 511ee3138f1Smrg /* 169 */ KEY_NOTUSED, 512ee3138f1Smrg /* 170 */ KEY_NOTUSED, 513ee3138f1Smrg /* 171 */ KEY_NOTUSED, 514ee3138f1Smrg /* 172 */ KEY_NOTUSED, 515ee3138f1Smrg /* 173 */ KEY_NOTUSED, 516ee3138f1Smrg /* 174 */ KEY_NOTUSED, 517ee3138f1Smrg /* 175 */ KEY_NOTUSED, 518ee3138f1Smrg /* 176 */ KEY_NOTUSED, 519ee3138f1Smrg /* 177 */ KEY_NOTUSED, 520ee3138f1Smrg /* 178 */ KEY_NOTUSED, 521ee3138f1Smrg /* 179 */ KEY_NOTUSED, 522ee3138f1Smrg /* 180 */ KEY_NOTUSED, 523ee3138f1Smrg /* 181 */ KEY_NOTUSED, 524ee3138f1Smrg /* 182 */ KEY_NOTUSED, 525ee3138f1Smrg /* 183 */ KEY_NOTUSED, 526ee3138f1Smrg /* 184 */ KEY_NOTUSED, 527ee3138f1Smrg /* 185 */ KEY_NOTUSED, 528ee3138f1Smrg /* 186 */ KEY_NOTUSED, 529ee3138f1Smrg /* 187 */ KEY_NOTUSED, 530ee3138f1Smrg /* 188 */ KEY_NOTUSED, 531ee3138f1Smrg /* 189 */ KEY_NOTUSED, 532ee3138f1Smrg /* 190 */ KEY_NOTUSED, 533ee3138f1Smrg /* 191 */ KEY_NOTUSED, 534ee3138f1Smrg /* 192 */ KEY_NOTUSED, 535ee3138f1Smrg /* 193 */ KEY_NOTUSED, 536ee3138f1Smrg /* 194 */ KEY_NOTUSED, 537ee3138f1Smrg /* 195 */ KEY_NOTUSED, 538ee3138f1Smrg /* 196 */ KEY_NOTUSED, 539ee3138f1Smrg /* 197 */ KEY_NOTUSED, 540ee3138f1Smrg /* 198 */ KEY_NOTUSED, 541ee3138f1Smrg /* 199 */ KEY_NOTUSED, 542ee3138f1Smrg /* 200 */ KEY_NOTUSED, 543ee3138f1Smrg /* 201 */ KEY_NOTUSED, 544ee3138f1Smrg /* 202 */ KEY_NOTUSED, 545ee3138f1Smrg /* 203 */ KEY_NOTUSED, 546ee3138f1Smrg /* 204 */ KEY_NOTUSED, 547ee3138f1Smrg /* 205 */ KEY_NOTUSED, 548ee3138f1Smrg /* 206 */ KEY_NOTUSED, 549ee3138f1Smrg /* 207 */ KEY_NOTUSED, 550ee3138f1Smrg /* 208 */ KEY_NOTUSED, 551ee3138f1Smrg /* 209 */ KEY_NOTUSED, 552ee3138f1Smrg /* 210 */ KEY_NOTUSED, 553ee3138f1Smrg /* 211 */ KEY_NOTUSED, 554ee3138f1Smrg /* 212 */ KEY_NOTUSED, 555ee3138f1Smrg /* 213 */ KEY_NOTUSED, 556ee3138f1Smrg /* 214 */ KEY_NOTUSED, 557ee3138f1Smrg /* 215 */ KEY_NOTUSED, 558ee3138f1Smrg /* 216 */ KEY_NOTUSED, 559ee3138f1Smrg /* 217 */ KEY_NOTUSED, 560ee3138f1Smrg /* 218 */ KEY_NOTUSED, 561ee3138f1Smrg /* 219 */ KEY_NOTUSED, 562ee3138f1Smrg /* 220 */ KEY_NOTUSED, 563ee3138f1Smrg /* 221 */ KEY_NOTUSED, 564ee3138f1Smrg /* 222 */ KEY_NOTUSED, 565ee3138f1Smrg /* 223 */ KEY_NOTUSED, 566ee3138f1Smrg /* 224 */ KEY_LCtrl, /* Left Control */ 567ee3138f1Smrg /* 225 */ KEY_ShiftL, /* Left Shift */ 568ee3138f1Smrg /* 226 */ KEY_Alt, /* Left Alt */ 569ee3138f1Smrg /* 227 */ KEY_LMeta, /* Left Meta */ 570ee3138f1Smrg /* 228 */ KEY_RCtrl, /* Right Control */ 571ee3138f1Smrg /* 229 */ KEY_ShiftR, /* Right Shift */ 572ee3138f1Smrg /* 230 */ KEY_AltLang, /* Right Alt, AKA AltGr */ 573ee3138f1Smrg /* 231 */ KEY_RMeta, /* Right Meta */ 574ee3138f1Smrg}; 575ee3138f1Smrg 576ee3138f1Smrgstatic 577ee3138f1SmrgTransMapRec usbTransMap = { 578ee3138f1Smrg 0, 579ee3138f1Smrg (sizeof(usbmap)/sizeof(unsigned char)), 580ee3138f1Smrg usbmap 581ee3138f1Smrg}; 582ee3138f1Smrg#endif /* KB_USB */ 583ee3138f1Smrg 584ee3138f1Smrg_X_HIDDEN void 585ee3138f1SmrgKbdGetMapping (InputInfoPtr pInfo, KeySymsPtr pKeySyms, CARD8 *pModMap) 586ee3138f1Smrg{ 587ee3138f1Smrg KbdDevPtr pKbd = (KbdDevPtr) pInfo->private; 588ee3138f1Smrg sunKbdPrivPtr priv = (sunKbdPrivPtr) pKbd->private; 589ee3138f1Smrg int i; 590ee3138f1Smrg KeySym *k; 591ee3138f1Smrg 592ee3138f1Smrg#if defined(KB_USB) 593ee3138f1Smrg if (priv->ktype == KB_USB) 594ee3138f1Smrg pKbd->scancodeMap = &usbTransMap; 595ee3138f1Smrg else 596ee3138f1Smrg#endif 597ee3138f1Smrg pKbd->scancodeMap = &sunTransMap; 598ee3138f1Smrg 599ee3138f1Smrg /* 600ee3138f1Smrg * Add Sun keyboard keysyms to default map 601ee3138f1Smrg */ 602ee3138f1Smrg#define map_for_key(k,c) map[(k * GLYPHS_PER_KEY) + c] 603ee3138f1Smrg map_for_key(KEY_Power, 0) = SunXK_PowerSwitch; 604ee3138f1Smrg map_for_key(KEY_Power, 1) = SunXK_PowerSwitchShift; 605ee3138f1Smrg map_for_key(KEY_Mute, 0) = SunXK_AudioMute; 606ee3138f1Smrg map_for_key(KEY_Mute, 1) = SunXK_VideoDegauss; 607ee3138f1Smrg map_for_key(KEY_AudioLower, 0) = SunXK_AudioLowerVolume; 608ee3138f1Smrg map_for_key(KEY_AudioLower, 1) = SunXK_VideoLowerBrightness; 609ee3138f1Smrg map_for_key(KEY_AudioRaise, 0) = SunXK_AudioRaiseVolume; 610ee3138f1Smrg map_for_key(KEY_AudioRaise, 1) = SunXK_VideoRaiseBrightness; 611ee3138f1Smrg map_for_key(KEY_Help, 0) = XK_Help; 612ee3138f1Smrg map_for_key(KEY_L1, 0) = XK_L1; 613ee3138f1Smrg map_for_key(KEY_L2, 0) = XK_L2; 614ee3138f1Smrg map_for_key(KEY_L3, 0) = XK_L3; 615ee3138f1Smrg map_for_key(KEY_L4, 0) = XK_L4; 616ee3138f1Smrg map_for_key(KEY_L5, 0) = XK_L5; 617ee3138f1Smrg map_for_key(KEY_L6, 0) = XK_L6; 618ee3138f1Smrg map_for_key(KEY_L7, 0) = XK_L7; 619ee3138f1Smrg map_for_key(KEY_L8, 0) = XK_L8; 620ee3138f1Smrg map_for_key(KEY_L9, 0) = XK_L9; 621ee3138f1Smrg map_for_key(KEY_L10, 0) = XK_L10; 622ee3138f1Smrg map_for_key(KEY_F11, 0) = SunXK_F36; 623ee3138f1Smrg map_for_key(KEY_F12, 0) = SunXK_F37; 624ee3138f1Smrg map_for_key(KEY_Menu, 0) = XK_Multi_key; 625ee3138f1Smrg 626ee3138f1Smrg /* 627ee3138f1Smrg * compute the modifier map 628ee3138f1Smrg */ 629ee3138f1Smrg for (i = 0; i < MAP_LENGTH; i++) 630ee3138f1Smrg pModMap[i] = NoSymbol; /* make sure it is restored */ 631ee3138f1Smrg 632ee3138f1Smrg for (k = map, i = MIN_KEYCODE; 633ee3138f1Smrg i < (NUM_KEYCODES + MIN_KEYCODE); 634ee3138f1Smrg i++, k += 4) 635ee3138f1Smrg { 636ee3138f1Smrg switch(*k) { 637ee3138f1Smrg 638ee3138f1Smrg case XK_Shift_L: 639ee3138f1Smrg case XK_Shift_R: 640ee3138f1Smrg pModMap[i] = ShiftMask; 641ee3138f1Smrg break; 642ee3138f1Smrg 643ee3138f1Smrg case XK_Control_L: 644ee3138f1Smrg case XK_Control_R: 645ee3138f1Smrg pModMap[i] = ControlMask; 646ee3138f1Smrg break; 647ee3138f1Smrg 648ee3138f1Smrg case XK_Caps_Lock: 649ee3138f1Smrg pModMap[i] = LockMask; 650ee3138f1Smrg break; 651ee3138f1Smrg 652ee3138f1Smrg case XK_Alt_L: 653ee3138f1Smrg case XK_Alt_R: 654ee3138f1Smrg pModMap[i] = AltMask; 655ee3138f1Smrg break; 656ee3138f1Smrg 657ee3138f1Smrg case XK_Num_Lock: 658ee3138f1Smrg pModMap[i] = NumLockMask; 659ee3138f1Smrg break; 660ee3138f1Smrg 661ee3138f1Smrg case XK_Scroll_Lock: 662ee3138f1Smrg pModMap[i] = ScrollLockMask; 663ee3138f1Smrg break; 664ee3138f1Smrg 665ee3138f1Smrg /* kana support */ 666ee3138f1Smrg case XK_Kana_Lock: 667ee3138f1Smrg case XK_Kana_Shift: 668ee3138f1Smrg pModMap[i] = KanaMask; 669ee3138f1Smrg break; 670ee3138f1Smrg 671ee3138f1Smrg /* alternate toggle for multinational support */ 672ee3138f1Smrg case XK_Mode_switch: 673ee3138f1Smrg pModMap[i] = AltLangMask; 674ee3138f1Smrg break; 675ee3138f1Smrg 676ee3138f1Smrg } 677ee3138f1Smrg } 678ee3138f1Smrg 679ee3138f1Smrg pKeySyms->map = map; 680ee3138f1Smrg pKeySyms->mapWidth = GLYPHS_PER_KEY; 681ee3138f1Smrg pKeySyms->minKeyCode = MIN_KEYCODE; 682ee3138f1Smrg pKeySyms->maxKeyCode = MAX_KEYCODE; 683ee3138f1Smrg} 684