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