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