bsd_KbdMap.c revision ac15d2bc
1/* $XFree86$ */ 2 3/* 4 * Slightly modified xf86KbdBSD.c which is 5 * 6 * Derived from xf86Kbd.c by S_ren Schmidt (sos@login.dkuug.dk) 7 * which is Copyright 1990,91 by Thomas Roell, Dinkelscherben, Germany. 8 * and from xf86KbdCODrv.c by Holger Veit 9 */ 10 11#ifdef HAVE_CONFIG_H 12#include "config.h" 13#endif 14 15#include <X11/X.h> 16#include <X11/Xmd.h> 17#include "input.h" 18#include "scrnintstr.h" 19 20#include "compiler.h" 21 22#include "xf86.h" 23#include "xf86Priv.h" 24#include "xf86_OSlib.h" 25#include "xf86Xinput.h" 26#include "xf86OSKbd.h" 27#include "atKeynames.h" 28#include "xf86Keymap.h" 29#include "bsd_kbd.h" 30 31#if (defined(SYSCONS_SUPPORT) || defined(PCVT_SUPPORT)) && defined(GIO_KEYMAP) 32#define KD_GET_ENTRY(i,n) \ 33 eascii_to_x[((keymap.key[i].spcl << (n+1)) & 0x100) + keymap.key[i].map[n]] 34 35static unsigned char remap[NUM_KEYCODES] = { 36 0, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00 - 0x07 */ 37 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08 - 0x0f */ 38 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10 - 0x17 */ 39 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, /* 0x18 - 0x1f */ 40 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, /* 0x20 - 0x27 */ 41 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f, /* 0x28 - 0x2f */ 42 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0, /* 0x30 - 0x37 */ 43 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f, /* 0x38 - 0x3f */ 44 0x40, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0, /* 0x40 - 0x47 */ 45 0, 0, 0, 0, 0, 0, 0, 0, /* 0x48 - 0x4f */ 46 0, 0, 0, 0, 0, 0, 0x56, 0x57, /* 0x50 - 0x57 */ 47 0x58, 0, 0, 0, 0, 0, 0, 0, /* 0x58 - 0x5f */ 48 0, 0, 0, 0, 0, 0, 0, 0, /* 0x60 - 0x67 */ 49 0, 0, 0, 0, 0, 0, 0, 0, /* 0x68 - 0x6f */ 50 0, 0, 0x69, 0x65, 0, 0, 0, 0, /* 0x70 - 0x77 */ 51 0, 0, 0, 0, 0, 0, 0, 0, /* 0x78 - 0x7f */ 52}; 53 54/* This table assumes the ibm code page 437 coding for characters 55 * > 0x80. They are returned in this form by PCVT */ 56static KeySym eascii_to_x[512] = { 57 NoSymbol, NoSymbol, NoSymbol, NoSymbol, 58 NoSymbol, NoSymbol, NoSymbol, NoSymbol, 59 XK_BackSpace, XK_Tab, XK_Linefeed, NoSymbol, 60 NoSymbol, XK_Return, NoSymbol, NoSymbol, 61 NoSymbol, NoSymbol, NoSymbol, NoSymbol, 62 NoSymbol, NoSymbol, NoSymbol, NoSymbol, 63 NoSymbol, NoSymbol, NoSymbol, XK_Escape, 64 NoSymbol, NoSymbol, NoSymbol, NoSymbol, 65 XK_space, XK_exclam, XK_quotedbl, XK_numbersign, 66 XK_dollar, XK_percent, XK_ampersand, XK_apostrophe, 67 XK_parenleft, XK_parenright, XK_asterisk, XK_plus, 68 XK_comma, XK_minus, XK_period, XK_slash, 69 XK_0, XK_1, XK_2, XK_3, 70 XK_4, XK_5, XK_6, XK_7, 71 XK_8, XK_9, XK_colon, XK_semicolon, 72 XK_less, XK_equal, XK_greater, XK_question, 73 XK_at, XK_A, XK_B, XK_C, 74 XK_D, XK_E, XK_F, XK_G, 75 XK_H, XK_I, XK_J, XK_K, 76 XK_L, XK_M, XK_N, XK_O, 77 XK_P, XK_Q, XK_R, XK_S, 78 XK_T, XK_U, XK_V, XK_W, 79 XK_X, XK_Y, XK_Z, XK_bracketleft, 80 XK_backslash, XK_bracketright,XK_asciicircum, XK_underscore, 81 XK_grave, XK_a, XK_b, XK_c, 82 XK_d, XK_e, XK_f, XK_g, 83 XK_h, XK_i, XK_j, XK_k, 84 XK_l, XK_m, XK_n, XK_o, 85 XK_p, XK_q, XK_r, XK_s, 86 XK_t, XK_u, XK_v, XK_w, 87 XK_x, XK_y, XK_z, XK_braceleft, 88 XK_bar, XK_braceright, XK_asciitilde, XK_Delete, 89 XK_Ccedilla, XK_udiaeresis, XK_eacute, XK_acircumflex, 90 XK_adiaeresis, XK_agrave, XK_aring, XK_ccedilla, 91 XK_ecircumflex, XK_ediaeresis, XK_egrave, XK_idiaeresis, 92 XK_icircumflex, XK_igrave, XK_Adiaeresis, XK_Aring, 93 XK_Eacute, XK_ae, XK_AE, XK_ocircumflex, 94 XK_odiaeresis, XK_ograve, XK_ucircumflex, XK_ugrave, 95 XK_ydiaeresis, XK_Odiaeresis, XK_Udiaeresis, XK_cent, 96 XK_sterling, XK_yen, XK_paragraph, XK_section, 97 XK_aacute, XK_iacute, XK_oacute, XK_uacute, 98 XK_ntilde, XK_Ntilde, XK_ordfeminine, XK_masculine, 99 XK_questiondown,XK_hyphen, XK_notsign, XK_onehalf, 100 XK_onequarter, XK_exclamdown, XK_guillemotleft,XK_guillemotright, 101 NoSymbol, NoSymbol, NoSymbol, NoSymbol, 102 NoSymbol, NoSymbol, NoSymbol, NoSymbol, 103 NoSymbol, NoSymbol, NoSymbol, NoSymbol, 104 NoSymbol, NoSymbol, NoSymbol, NoSymbol, 105 NoSymbol, NoSymbol, NoSymbol, NoSymbol, 106 NoSymbol, NoSymbol, NoSymbol, NoSymbol, 107 NoSymbol, NoSymbol, NoSymbol, NoSymbol, 108 NoSymbol, NoSymbol, NoSymbol, NoSymbol, 109 NoSymbol, NoSymbol, NoSymbol, NoSymbol, 110 NoSymbol, NoSymbol, NoSymbol, NoSymbol, 111 NoSymbol, NoSymbol, NoSymbol, NoSymbol, 112 NoSymbol, NoSymbol, NoSymbol, NoSymbol, 113 XK_Greek_alpha, XK_ssharp, XK_Greek_GAMMA, XK_Greek_pi, 114 XK_Greek_SIGMA, XK_Greek_sigma, XK_mu, XK_Greek_tau, 115 XK_Greek_PHI, XK_Greek_THETA, XK_Greek_OMEGA, XK_Greek_delta, 116 XK_infinity, XK_Ooblique, XK_Greek_epsilon, XK_intersection, 117 XK_identical, XK_plusminus, XK_greaterthanequal, XK_lessthanequal, 118 XK_topintegral, XK_botintegral, XK_division, XK_similarequal, 119 XK_degree, NoSymbol, NoSymbol, XK_radical, 120 XK_Greek_eta, XK_twosuperior, XK_periodcentered, NoSymbol, 121 122 /* 123 * special marked entries (256 + x) 124 */ 125 126 /* This has been checked against what syscons actually does */ 127 NoSymbol, NoSymbol, XK_Shift_L, XK_Shift_R, 128 XK_Caps_Lock, XK_Num_Lock, XK_Scroll_Lock, XK_Alt_L, 129 XK_ISO_Left_Tab,XK_Control_L, NoSymbol, NoSymbol, 130 NoSymbol, NoSymbol, NoSymbol, NoSymbol, 131 NoSymbol, NoSymbol, NoSymbol, NoSymbol, 132 NoSymbol, NoSymbol, NoSymbol, NoSymbol, 133 NoSymbol, NoSymbol, NoSymbol, XK_F1, 134 XK_F2, XK_F3, XK_F4, XK_F5, 135 XK_F6, XK_F7, XK_F8, XK_F9, 136 XK_F10, XK_F11, XK_F12, NoSymbol, 137 NoSymbol, NoSymbol, NoSymbol, NoSymbol, 138 NoSymbol, NoSymbol, NoSymbol, NoSymbol, 139 NoSymbol, NoSymbol, NoSymbol, NoSymbol, 140 NoSymbol, NoSymbol, NoSymbol, NoSymbol, 141 NoSymbol, NoSymbol, NoSymbol, NoSymbol, 142 NoSymbol, NoSymbol, NoSymbol, NoSymbol, 143 NoSymbol, NoSymbol, NoSymbol, NoSymbol, 144 NoSymbol, NoSymbol, NoSymbol, NoSymbol, 145 NoSymbol, NoSymbol, NoSymbol, NoSymbol, 146 NoSymbol, NoSymbol, NoSymbol, NoSymbol, 147 NoSymbol, NoSymbol, NoSymbol, NoSymbol, 148 NoSymbol, NoSymbol, NoSymbol, NoSymbol, 149 NoSymbol, NoSymbol, NoSymbol, NoSymbol, 150 NoSymbol, NoSymbol, NoSymbol, NoSymbol, 151 NoSymbol, NoSymbol, NoSymbol, NoSymbol, 152 NoSymbol, NoSymbol, NoSymbol, NoSymbol, 153 NoSymbol, NoSymbol, NoSymbol, NoSymbol, 154 NoSymbol, NoSymbol, NoSymbol, NoSymbol, 155 NoSymbol, NoSymbol, NoSymbol, NoSymbol, 156 NoSymbol, NoSymbol, NoSymbol, NoSymbol, 157 NoSymbol, NoSymbol, NoSymbol, NoSymbol, 158 NoSymbol, NoSymbol, NoSymbol, NoSymbol, 159 XK_Control_R, XK_Alt_R, NoSymbol, NoSymbol, 160 NoSymbol, NoSymbol, NoSymbol, NoSymbol, 161 NoSymbol, NoSymbol, NoSymbol, NoSymbol, 162 NoSymbol, NoSymbol, NoSymbol, NoSymbol, 163 NoSymbol, NoSymbol, NoSymbol, NoSymbol, 164 NoSymbol, NoSymbol, NoSymbol, NoSymbol, 165 NoSymbol, NoSymbol, NoSymbol, NoSymbol, 166 NoSymbol, NoSymbol, NoSymbol, NoSymbol, 167 NoSymbol, NoSymbol, NoSymbol, NoSymbol, 168 NoSymbol, NoSymbol, NoSymbol, NoSymbol, 169 NoSymbol, NoSymbol, NoSymbol, NoSymbol, 170 NoSymbol, NoSymbol, NoSymbol, NoSymbol, 171 NoSymbol, NoSymbol, NoSymbol, NoSymbol, 172 NoSymbol, NoSymbol, NoSymbol, NoSymbol, 173 NoSymbol, NoSymbol, NoSymbol, NoSymbol, 174 NoSymbol, NoSymbol, NoSymbol, NoSymbol, 175 NoSymbol, NoSymbol, NoSymbol, NoSymbol, 176 NoSymbol, NoSymbol, NoSymbol, NoSymbol, 177 NoSymbol, NoSymbol, NoSymbol, NoSymbol, 178 NoSymbol, NoSymbol, NoSymbol, NoSymbol, 179 NoSymbol, NoSymbol, NoSymbol, NoSymbol, 180 NoSymbol, NoSymbol, NoSymbol, NoSymbol, 181 NoSymbol, NoSymbol, NoSymbol, NoSymbol, 182 NoSymbol, NoSymbol, NoSymbol, NoSymbol, 183 NoSymbol, NoSymbol, NoSymbol, NoSymbol, 184 NoSymbol, NoSymbol, NoSymbol, NoSymbol, 185 NoSymbol, NoSymbol, NoSymbol, NoSymbol, 186 NoSymbol, NoSymbol, NoSymbol, NoSymbol, 187 NoSymbol, NoSymbol, NoSymbol, NoSymbol, 188 NoSymbol, NoSymbol, NoSymbol, NoSymbol, 189 NoSymbol, NoSymbol, NoSymbol, NoSymbol, 190 NoSymbol, NoSymbol, NoSymbol, NoSymbol 191}; 192 193#ifdef __OpenBSD__ 194/* don't mark AltR and CtrlR for remapping, since they 195 * cannot be remapped by pccons */ 196static unsigned char pccons_remap[128] = { 197 0, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00 - 0x07 */ 198 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08 - 0x0f */ 199 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10 - 0x17 */ 200 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, /* 0x18 - 0x1f */ 201 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, /* 0x20 - 0x27 */ 202 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f, /* 0x28 - 0x2f */ 203 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0, /* 0x30 - 0x37 */ 204 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f, /* 0x38 - 0x3f */ 205 0x40, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0, /* 0x40 - 0x47 */ 206 0, 0, 0, 0, 0, 0, 0, 0, /* 0x48 - 0x4f */ 207 0, 0, 0, 0, 0, 0, 0x56, 0x57, /* 0x50 - 0x57 */ 208 0x58, 0, 0, 0, 0, 0, 0, 0, /* 0x58 - 0x5f */ 209 0, 0, 0, 0, 0, 0, 0, 0, /* 0x60 - 0x67 */ 210 0, 0, 0, 0, 0, 0, 0, 0, /* 0x68 - 0x6f */ 211 0, 0, 0, 0, 0, 0, 0, 0, /* 0x70 - 0x77 */ 212 0, 0, 0, 0, 0, 0, 0, 0, /* 0x78 - 0x7f */ 213}; 214 215/* This table assumes an iso8859_1 encoding for the characters 216 * > 80, as returned by pccons */ 217static KeySym latin1_to_x[256] = { 218 NoSymbol, NoSymbol, NoSymbol, NoSymbol, 219 NoSymbol, NoSymbol, NoSymbol, NoSymbol, 220 XK_BackSpace, XK_Tab, XK_Linefeed, NoSymbol, 221 NoSymbol, XK_Return, NoSymbol, NoSymbol, 222 NoSymbol, NoSymbol, NoSymbol, NoSymbol, 223 NoSymbol, NoSymbol, NoSymbol, NoSymbol, 224 NoSymbol, NoSymbol, NoSymbol, XK_Escape, 225 NoSymbol, NoSymbol, NoSymbol, NoSymbol, 226 XK_space, XK_exclam, XK_quotedbl, XK_numbersign, 227 XK_dollar, XK_percent, XK_ampersand, XK_apostrophe, 228 XK_parenleft, XK_parenright, XK_asterisk, XK_plus, 229 XK_comma, XK_minus, XK_period, XK_slash, 230 XK_0, XK_1, XK_2, XK_3, 231 XK_4, XK_5, XK_6, XK_7, 232 XK_8, XK_9, XK_colon, XK_semicolon, 233 XK_less, XK_equal, XK_greater, XK_question, 234 XK_at, XK_A, XK_B, XK_C, 235 XK_D, XK_E, XK_F, XK_G, 236 XK_H, XK_I, XK_J, XK_K, 237 XK_L, XK_M, XK_N, XK_O, 238 XK_P, XK_Q, XK_R, XK_S, 239 XK_T, XK_U, XK_V, XK_W, 240 XK_X, XK_Y, XK_Z, XK_bracketleft, 241 XK_backslash, XK_bracketright,XK_asciicircum, XK_underscore, 242 XK_grave, XK_a, XK_b, XK_c, 243 XK_d, XK_e, XK_f, XK_g, 244 XK_h, XK_i, XK_j, XK_k, 245 XK_l, XK_m, XK_n, XK_o, 246 XK_p, XK_q, XK_r, XK_s, 247 XK_t, XK_u, XK_v, XK_w, 248 XK_x, XK_y, XK_z, XK_braceleft, 249 XK_bar, XK_braceright, XK_asciitilde, XK_Delete, 250 NoSymbol, NoSymbol, NoSymbol, NoSymbol, 251 NoSymbol, NoSymbol, NoSymbol, NoSymbol, 252 NoSymbol, NoSymbol, NoSymbol, NoSymbol, 253 NoSymbol, NoSymbol, NoSymbol, NoSymbol, 254 NoSymbol, NoSymbol, NoSymbol, NoSymbol, 255 NoSymbol, NoSymbol, NoSymbol, NoSymbol, 256 NoSymbol, NoSymbol, NoSymbol, NoSymbol, 257 NoSymbol, NoSymbol, NoSymbol, NoSymbol, 258 XK_nobreakspace,XK_exclamdown, XK_cent, XK_sterling, 259 XK_currency, XK_yen, XK_brokenbar, XK_section, 260 XK_diaeresis, XK_copyright, XK_ordfeminine, XK_guillemotleft, 261 XK_notsign, XK_hyphen, XK_registered, XK_macron, 262 XK_degree, XK_plusminus, XK_twosuperior, XK_threesuperior, 263 XK_acute, XK_mu, XK_paragraph, XK_periodcentered, 264 XK_cedilla, XK_onesuperior, XK_masculine, XK_guillemotright, 265 XK_onequarter, XK_onehalf, XK_threequarters,XK_questiondown, 266 XK_Agrave, XK_Aacute, XK_Acircumflex, XK_Atilde, 267 XK_Adiaeresis, XK_Aring, XK_AE, XK_Ccedilla, 268 XK_Egrave, XK_Eacute, XK_Ecircumflex, XK_Ediaeresis, 269 XK_Igrave, XK_Iacute, XK_Icircumflex, XK_Idiaeresis, 270 XK_ETH, XK_Ntilde, XK_Ograve, XK_Oacute, 271 XK_Ocircumflex, XK_Otilde, XK_Odiaeresis, XK_multiply, 272 XK_Ooblique, XK_Ugrave, XK_Uacute, XK_Ucircumflex, 273 XK_Udiaeresis, XK_Yacute, XK_THORN, XK_ssharp, 274 XK_agrave, XK_aacute, XK_acircumflex, XK_atilde, 275 XK_adiaeresis, XK_aring, XK_ae, XK_ccedilla, 276 XK_egrave, XK_eacute, XK_ecircumflex, XK_ediaeresis, 277 XK_igrave, XK_iacute, XK_icircumflex, XK_idiaeresis, 278 XK_eth, XK_ntilde, XK_ograve, XK_oacute, 279 XK_ocircumflex, XK_otilde, XK_odiaeresis, XK_division, 280 XK_oslash, XK_ugrave, XK_uacute, XK_ucircumflex, 281 XK_udiaeresis, XK_yacute, XK_thorn, XK_ydiaeresis 282 }; 283#endif 284 285#ifdef SYSCONS_SUPPORT 286static 287unsigned char sysconsCODEMap[] = { 288 KEY_KP_Enter, KEY_RCtrl, KEY_KP_Divide, KEY_Print, 289 KEY_AltLang, KEY_KP_7, KEY_KP_8, KEY_KP_9, 290 KEY_KP_4, KEY_KP_6, KEY_KP_1, KEY_KP_2, 291 KEY_KP_3, KEY_KP_0, KEY_KP_Decimal, KEY_Pause, 292 KEY_LMeta, KEY_RMeta, KEY_Menu, KEY_Break 293}; 294static 295TransMapRec sysconsCODE = { 296 0x59, 297 0x6d, 298 sysconsCODEMap 299}; 300#endif 301#endif /* SYSCONS_SUPPORT || PCVT_SUPPORT */ 302 303#ifdef WSCONS_SUPPORT 304 305static CARD8 wsUsbMap[] = { 306 /* 0 */ KEY_NOTUSED, 307 /* 1 */ KEY_NOTUSED, 308 /* 2 */ KEY_NOTUSED, 309 /* 3 */ KEY_NOTUSED, 310 /* 4 */ KEY_A, 311 /* 5 */ KEY_B, 312 /* 6 */ KEY_C, 313 /* 7 */ KEY_D, 314 /* 8 */ KEY_E, 315 /* 9 */ KEY_F, 316 /* 10 */ KEY_G, 317 /* 11 */ KEY_H, 318 /* 12 */ KEY_I, 319 /* 13 */ KEY_J, 320 /* 14 */ KEY_K, 321 /* 15 */ KEY_L, 322 /* 16 */ KEY_M, 323 /* 17 */ KEY_N, 324 /* 18 */ KEY_O, 325 /* 19 */ KEY_P, 326 /* 20 */ KEY_Q, 327 /* 21 */ KEY_R, 328 /* 22 */ KEY_S, 329 /* 23 */ KEY_T, 330 /* 24 */ KEY_U, 331 /* 25 */ KEY_V, 332 /* 26 */ KEY_W, 333 /* 27 */ KEY_X, 334 /* 28 */ KEY_Y, 335 /* 29 */ KEY_Z, 336 /* 30 */ KEY_1, /* 1 !*/ 337 /* 31 */ KEY_2, /* 2 @ */ 338 /* 32 */ KEY_3, /* 3 # */ 339 /* 33 */ KEY_4, /* 4 $ */ 340 /* 34 */ KEY_5, /* 5 % */ 341 /* 35 */ KEY_6, /* 6 ^ */ 342 /* 36 */ KEY_7, /* 7 & */ 343 /* 37 */ KEY_8, /* 8 * */ 344 /* 38 */ KEY_9, /* 9 ( */ 345 /* 39 */ KEY_0, /* 0 ) */ 346 /* 40 */ KEY_Enter, /* Return */ 347 /* 41 */ KEY_Escape, /* Escape */ 348 /* 42 */ KEY_BackSpace, /* Backspace Delete */ 349 /* 43 */ KEY_Tab, /* Tab */ 350 /* 44 */ KEY_Space, /* Space */ 351 /* 45 */ KEY_Minus, /* - _ */ 352 /* 46 */ KEY_Equal, /* = + */ 353 /* 47 */ KEY_LBrace, /* [ { */ 354 /* 48 */ KEY_RBrace, /* ] } */ 355 /* 49 */ KEY_BSlash, /* \ | */ 356 /* 50 */ KEY_BSlash2, /* \ _ # ~ on some keyboards */ 357 /* 51 */ KEY_SemiColon, /* ; : */ 358 /* 52 */ KEY_Quote, /* ' " */ 359 /* 53 */ KEY_Tilde, /* ` ~ */ 360 /* 54 */ KEY_Comma, /* , < */ 361 /* 55 */ KEY_Period, /* . > */ 362 /* 56 */ KEY_Slash, /* / ? */ 363 /* 57 */ KEY_CapsLock, /* Caps Lock */ 364 /* 58 */ KEY_F1, /* F1 */ 365 /* 59 */ KEY_F2, /* F2 */ 366 /* 60 */ KEY_F3, /* F3 */ 367 /* 61 */ KEY_F4, /* F4 */ 368 /* 62 */ KEY_F5, /* F5 */ 369 /* 63 */ KEY_F6, /* F6 */ 370 /* 64 */ KEY_F7, /* F7 */ 371 /* 65 */ KEY_F8, /* F8 */ 372 /* 66 */ KEY_F9, /* F9 */ 373 /* 67 */ KEY_F10, /* F10 */ 374 /* 68 */ KEY_F11, /* F11 */ 375 /* 69 */ KEY_F12, /* F12 */ 376 /* 70 */ KEY_Print, /* PrintScrn SysReq */ 377 /* 71 */ KEY_ScrollLock, /* Scroll Lock */ 378 /* 72 */ KEY_Pause, /* Pause Break */ 379 /* 73 */ KEY_Insert, /* Insert XXX Help on some Mac Keyboards */ 380 /* 74 */ KEY_Home, /* Home */ 381 /* 75 */ KEY_PgUp, /* Page Up */ 382 /* 76 */ KEY_Delete, /* Delete */ 383 /* 77 */ KEY_End, /* End */ 384 /* 78 */ KEY_PgDown, /* Page Down */ 385 /* 79 */ KEY_Right, /* Right Arrow */ 386 /* 80 */ KEY_Left, /* Left Arrow */ 387 /* 81 */ KEY_Down, /* Down Arrow */ 388 /* 82 */ KEY_Up, /* Up Arrow */ 389 /* 83 */ KEY_NumLock, /* Num Lock */ 390 /* 84 */ KEY_KP_Divide, /* Keypad / */ 391 /* 85 */ KEY_KP_Multiply, /* Keypad * */ 392 /* 86 */ KEY_KP_Minus, /* Keypad - */ 393 /* 87 */ KEY_KP_Plus, /* Keypad + */ 394 /* 88 */ KEY_KP_Enter, /* Keypad Enter */ 395 /* 89 */ KEY_KP_1, /* Keypad 1 End */ 396 /* 90 */ KEY_KP_2, /* Keypad 2 Down */ 397 /* 91 */ KEY_KP_3, /* Keypad 3 Pg Down */ 398 /* 92 */ KEY_KP_4, /* Keypad 4 Left */ 399 /* 93 */ KEY_KP_5, /* Keypad 5 */ 400 /* 94 */ KEY_KP_6, /* Keypad 6 */ 401 /* 95 */ KEY_KP_7, /* Keypad 7 Home */ 402 /* 96 */ KEY_KP_8, /* Keypad 8 Up */ 403 /* 97 */ KEY_KP_9, /* KEypad 9 Pg Up */ 404 /* 98 */ KEY_KP_0, /* Keypad 0 Ins */ 405 /* 99 */ KEY_KP_Decimal, /* Keypad . Del */ 406 /* 100 */ KEY_Less, /* < > on some keyboards */ 407 /* 101 */ KEY_Menu, /* Menu */ 408 /* 102 */ KEY_NOTUSED, 409 /* 103 */ KEY_KP_Equal, /* Keypad = on Mac keyboards */ 410 /* 104 */ KEY_NOTUSED, 411 /* 105 */ KEY_NOTUSED, 412 /* 106 */ KEY_NOTUSED, 413 /* 107 */ KEY_NOTUSED, 414 /* 108 */ KEY_NOTUSED, 415 /* 109 */ KEY_NOTUSED, 416 /* 110 */ KEY_NOTUSED, 417 /* 111 */ KEY_NOTUSED, 418 /* 112 */ KEY_NOTUSED, 419 /* 113 */ KEY_NOTUSED, 420 /* 114 */ KEY_NOTUSED, 421 /* 115 */ KEY_NOTUSED, 422 /* 116 */ KEY_NOTUSED, 423 /* 117 */ KEY_NOTUSED, 424 /* 118 */ KEY_NOTUSED, 425 /* 119 */ KEY_NOTUSED, 426 /* 120 */ KEY_NOTUSED, 427 /* 121 */ KEY_NOTUSED, 428 /* 122 */ KEY_NOTUSED, 429 /* 123 */ KEY_NOTUSED, 430 /* 124 */ KEY_NOTUSED, 431 /* 125 */ KEY_NOTUSED, 432 /* 126 */ KEY_NOTUSED, 433 /* 127 */ KEY_NOTUSED, 434 /* 128 */ KEY_NOTUSED, 435 /* 129 */ KEY_NOTUSED, 436 /* 130 */ KEY_NOTUSED, 437 /* 131 */ KEY_NOTUSED, 438 /* 132 */ KEY_NOTUSED, 439 /* 133 */ KEY_NOTUSED, 440 /* 134 */ KEY_NOTUSED, 441 /* 135 */ KEY_NOTUSED, 442 /* 136 */ KEY_NOTUSED, 443 /* 137 */ KEY_NOTUSED, 444 /* 138 */ KEY_NOTUSED, 445 /* 139 */ KEY_NOTUSED, 446 /* 140 */ KEY_NOTUSED, 447 /* 141 */ KEY_NOTUSED, 448 /* 142 */ KEY_NOTUSED, 449 /* 143 */ KEY_NOTUSED, 450 /* 144 */ KEY_NOTUSED, 451 /* 145 */ KEY_NOTUSED, 452 /* 146 */ KEY_NOTUSED, 453 /* 147 */ KEY_NOTUSED, 454 /* 148 */ KEY_NOTUSED, 455 /* 149 */ KEY_NOTUSED, 456 /* 150 */ KEY_NOTUSED, 457 /* 151 */ KEY_NOTUSED, 458 /* 152 */ KEY_NOTUSED, 459 /* 153 */ KEY_NOTUSED, 460 /* 154 */ KEY_NOTUSED, 461 /* 155 */ KEY_NOTUSED, 462 /* 156 */ KEY_NOTUSED, 463 /* 157 */ KEY_NOTUSED, 464 /* 158 */ KEY_NOTUSED, 465 /* 159 */ KEY_NOTUSED, 466 /* 160 */ KEY_NOTUSED, 467 /* 161 */ KEY_NOTUSED, 468 /* 162 */ KEY_NOTUSED, 469 /* 163 */ KEY_NOTUSED, 470 /* 164 */ KEY_NOTUSED, 471 /* 165 */ KEY_NOTUSED, 472 /* 166 */ KEY_NOTUSED, 473 /* 167 */ KEY_NOTUSED, 474 /* 168 */ KEY_NOTUSED, 475 /* 169 */ KEY_NOTUSED, 476 /* 170 */ KEY_NOTUSED, 477 /* 171 */ KEY_NOTUSED, 478 /* 172 */ KEY_NOTUSED, 479 /* 173 */ KEY_NOTUSED, 480 /* 174 */ KEY_NOTUSED, 481 /* 175 */ KEY_NOTUSED, 482 /* 176 */ KEY_NOTUSED, 483 /* 177 */ KEY_NOTUSED, 484 /* 178 */ KEY_NOTUSED, 485 /* 179 */ KEY_NOTUSED, 486 /* 180 */ KEY_NOTUSED, 487 /* 181 */ KEY_NOTUSED, 488 /* 182 */ KEY_NOTUSED, 489 /* 183 */ KEY_NOTUSED, 490 /* 184 */ KEY_NOTUSED, 491 /* 185 */ KEY_NOTUSED, 492 /* 186 */ KEY_NOTUSED, 493 /* 187 */ KEY_NOTUSED, 494 /* 188 */ KEY_NOTUSED, 495 /* 189 */ KEY_NOTUSED, 496 /* 190 */ KEY_NOTUSED, 497 /* 191 */ KEY_NOTUSED, 498 /* 192 */ KEY_NOTUSED, 499 /* 193 */ KEY_NOTUSED, 500 /* 194 */ KEY_NOTUSED, 501 /* 195 */ KEY_NOTUSED, 502 /* 196 */ KEY_NOTUSED, 503 /* 197 */ KEY_NOTUSED, 504 /* 198 */ KEY_NOTUSED, 505 /* 199 */ KEY_NOTUSED, 506 /* 200 */ KEY_NOTUSED, 507 /* 201 */ KEY_NOTUSED, 508 /* 202 */ KEY_NOTUSED, 509 /* 203 */ KEY_NOTUSED, 510 /* 204 */ KEY_NOTUSED, 511 /* 205 */ KEY_NOTUSED, 512 /* 206 */ KEY_NOTUSED, 513 /* 207 */ KEY_NOTUSED, 514 /* 208 */ KEY_NOTUSED, 515 /* 209 */ KEY_NOTUSED, 516 /* 210 */ KEY_NOTUSED, 517 /* 211 */ KEY_NOTUSED, 518 /* 212 */ KEY_NOTUSED, 519 /* 213 */ KEY_NOTUSED, 520 /* 214 */ KEY_NOTUSED, 521 /* 215 */ KEY_NOTUSED, 522 /* 216 */ KEY_NOTUSED, 523 /* 217 */ KEY_NOTUSED, 524 /* 218 */ KEY_NOTUSED, 525 /* 219 */ KEY_NOTUSED, 526 /* 220 */ KEY_NOTUSED, 527 /* 221 */ KEY_NOTUSED, 528 /* 222 */ KEY_NOTUSED, 529 /* 223 */ KEY_NOTUSED, 530 /* 224 */ KEY_LCtrl, /* Left Control */ 531 /* 225 */ KEY_ShiftL, /* Left Shift */ 532 /* 226 */ KEY_Alt, /* Left Alt */ 533 /* 227 */ KEY_LMeta, /* Left Meta */ 534 /* 228 */ KEY_RCtrl, /* Right Control */ 535 /* 229 */ KEY_ShiftR, /* Right Shift */ 536 /* 230 */ KEY_AltLang, /* Right Alt, AKA AltGr */ 537 /* 231 */ KEY_LMeta, /* Right Meta XXX */ 538}; 539#define WS_USB_MAP_SIZE (sizeof(wsUsbMap)/sizeof(unsigned char)) 540 541static 542TransMapRec wsUsb = { 543 0, 544 WS_USB_MAP_SIZE, 545 wsUsbMap 546}; 547 548static CARD8 wsXtMap[] = { 549 /* 0 */ KEY_NOTUSED, 550 /* 1 */ KEY_Escape, 551 /* 2 */ KEY_1, 552 /* 3 */ KEY_2, 553 /* 4 */ KEY_3, 554 /* 5 */ KEY_4, 555 /* 6 */ KEY_5, 556 /* 7 */ KEY_6, 557 /* 8 */ KEY_7, 558 /* 9 */ KEY_8, 559 /* 10 */ KEY_9, 560 /* 11 */ KEY_0, 561 /* 12 */ KEY_Minus, 562 /* 13 */ KEY_Equal, 563 /* 14 */ KEY_BackSpace, 564 /* 15 */ KEY_Tab, 565 /* 16 */ KEY_Q, 566 /* 17 */ KEY_W, 567 /* 18 */ KEY_E, 568 /* 19 */ KEY_R, 569 /* 20 */ KEY_T, 570 /* 21 */ KEY_Y, 571 /* 22 */ KEY_U, 572 /* 23 */ KEY_I, 573 /* 24 */ KEY_O, 574 /* 25 */ KEY_P, 575 /* 26 */ KEY_LBrace, 576 /* 27 */ KEY_RBrace, 577 /* 28 */ KEY_Enter, 578 /* 29 */ KEY_LCtrl, 579 /* 30 */ KEY_A, 580 /* 31 */ KEY_S, 581 /* 32 */ KEY_D, 582 /* 33 */ KEY_F, 583 /* 34 */ KEY_G, 584 /* 35 */ KEY_H, 585 /* 36 */ KEY_J, 586 /* 37 */ KEY_K, 587 /* 38 */ KEY_L, 588 /* 39 */ KEY_SemiColon, 589 /* 40 */ KEY_Quote, 590 /* 41 */ KEY_Tilde, 591 /* 42 */ KEY_ShiftL, 592 /* 43 */ KEY_BSlash, 593 /* 44 */ KEY_Z, 594 /* 45 */ KEY_X, 595 /* 46 */ KEY_C, 596 /* 47 */ KEY_V, 597 /* 48 */ KEY_B, 598 /* 49 */ KEY_N, 599 /* 50 */ KEY_M, 600 /* 51 */ KEY_Comma, 601 /* 52 */ KEY_Period, 602 /* 53 */ KEY_Slash, 603 /* 54 */ KEY_ShiftR, 604 /* 55 */ KEY_KP_Multiply, 605 /* 56 */ KEY_Alt, 606 /* 57 */ KEY_Space, 607 /* 58 */ KEY_CapsLock, 608 /* 59 */ KEY_F1, 609 /* 60 */ KEY_F2, 610 /* 61 */ KEY_F3, 611 /* 62 */ KEY_F4, 612 /* 63 */ KEY_F5, 613 /* 64 */ KEY_F6, 614 /* 65 */ KEY_F7, 615 /* 66 */ KEY_F8, 616 /* 67 */ KEY_F9, 617 /* 68 */ KEY_F10, 618 /* 69 */ KEY_NumLock, 619 /* 70 */ KEY_ScrollLock, 620 /* 71 */ KEY_KP_7, 621 /* 72 */ KEY_KP_8, 622 /* 73 */ KEY_KP_9, 623 /* 74 */ KEY_KP_Minus, 624 /* 75 */ KEY_KP_4, 625 /* 76 */ KEY_KP_5, 626 /* 77 */ KEY_KP_6, 627 /* 78 */ KEY_KP_Plus, 628 /* 79 */ KEY_KP_1, 629 /* 80 */ KEY_KP_2, 630 /* 81 */ KEY_KP_3, 631 /* 82 */ KEY_KP_0, 632 /* 83 */ KEY_KP_Decimal, 633 /* 84 */ KEY_NOTUSED, 634 /* 85 */ KEY_NOTUSED, 635 /* 86 */ KEY_Less, /* backslash on uk, < on german */ 636 /* 87 */ KEY_F11, 637 /* 88 */ KEY_F12, 638 /* 89 */ KEY_NOTUSED, 639 /* 90 */ KEY_NOTUSED, 640 /* 91 */ KEY_NOTUSED, 641 /* 92 */ KEY_NOTUSED, 642 /* 93 */ KEY_NOTUSED, 643 /* 94 */ KEY_NOTUSED, 644 /* 95 */ KEY_NOTUSED, 645 /* 96 */ KEY_NOTUSED, 646 /* 97 */ KEY_NOTUSED, 647 /* 98 */ KEY_NOTUSED, 648 /* 99 */ KEY_NOTUSED, 649 /* 100 */ KEY_NOTUSED, 650 /* 101 */ KEY_NOTUSED, 651 /* 102 */ KEY_NOTUSED, 652 /* 103 */ KEY_NOTUSED, 653 /* 104 */ KEY_NOTUSED, 654 /* 105 */ KEY_NOTUSED, 655 /* 106 */ KEY_NOTUSED, 656 /* 107 */ KEY_NOTUSED, 657 /* 108 */ KEY_NOTUSED, 658 /* 109 */ KEY_NOTUSED, 659 /* 110 */ KEY_NOTUSED, 660 /* 111 */ KEY_NOTUSED, 661 /* 112 */ KEY_NOTUSED, 662 /* 113 */ KEY_NOTUSED, 663 /* 114 */ KEY_NOTUSED, 664 /* 115 */ KEY_NOTUSED, 665 /* 116 */ KEY_NOTUSED, 666 /* 117 */ KEY_NOTUSED, 667 /* 118 */ KEY_NOTUSED, 668 /* 119 */ KEY_NOTUSED, 669 /* 120 */ KEY_NOTUSED, 670 /* 121 */ KEY_NOTUSED, 671 /* 122 */ KEY_NOTUSED, 672 /* 123 */ KEY_NOTUSED, 673 /* 124 */ KEY_NOTUSED, 674 /* 125 */ KEY_NOTUSED, 675 /* 126 */ KEY_NOTUSED, 676 /* 127 */ KEY_Pause, 677 /* 128 */ KEY_NOTUSED, 678 /* 129 */ KEY_NOTUSED, 679 /* 130 */ KEY_NOTUSED, 680 /* 131 */ KEY_NOTUSED, 681 /* 132 */ KEY_NOTUSED, 682 /* 133 */ KEY_NOTUSED, 683 /* 134 */ KEY_NOTUSED, 684 /* 135 */ KEY_NOTUSED, 685 /* 136 */ KEY_NOTUSED, 686 /* 137 */ KEY_NOTUSED, 687 /* 138 */ KEY_NOTUSED, 688 /* 139 */ KEY_NOTUSED, 689 /* 140 */ KEY_NOTUSED, 690 /* 141 */ KEY_NOTUSED, 691 /* 142 */ KEY_NOTUSED, 692 /* 143 */ KEY_NOTUSED, 693 /* 144 */ KEY_NOTUSED, 694 /* 145 */ KEY_NOTUSED, 695 /* 146 */ KEY_NOTUSED, 696 /* 147 */ KEY_NOTUSED, 697 /* 148 */ KEY_NOTUSED, 698 /* 149 */ KEY_NOTUSED, 699 /* 150 */ KEY_NOTUSED, 700 /* 151 */ KEY_NOTUSED, 701 /* 152 */ KEY_NOTUSED, 702 /* 153 */ KEY_NOTUSED, 703 /* 154 */ KEY_NOTUSED, 704 /* 155 */ KEY_NOTUSED, 705 /* 156 */ KEY_KP_Enter, 706 /* 157 */ KEY_RCtrl, 707 /* 158 */ KEY_NOTUSED, 708 /* 159 */ KEY_NOTUSED, 709 /* 160 */ KEY_Mute, 710 /* 161 */ KEY_NOTUSED, 711 /* 162 */ KEY_NOTUSED, 712 /* 163 */ KEY_NOTUSED, 713 /* 164 */ KEY_NOTUSED, 714 /* 165 */ KEY_NOTUSED, 715 /* 166 */ KEY_NOTUSED, 716 /* 167 */ KEY_NOTUSED, 717 /* 168 */ KEY_NOTUSED, 718 /* 169 */ KEY_NOTUSED, 719 /* 170 */ KEY_Print, 720 /* 171 */ KEY_NOTUSED, 721 /* 172 */ KEY_NOTUSED, 722 /* 173 */ KEY_NOTUSED, 723 /* 174 */ KEY_AudioLower, 724 /* 175 */ KEY_AudioRaise, 725 /* 176 */ KEY_NOTUSED, 726 /* 177 */ KEY_NOTUSED, 727 /* 178 */ KEY_NOTUSED, 728 /* 179 */ KEY_NOTUSED, 729 /* 180 */ KEY_NOTUSED, 730 /* 181 */ KEY_KP_Divide, 731 /* 182 */ KEY_NOTUSED, 732 /* 183 */ KEY_Print, 733 /* 184 */ KEY_AltLang, 734 /* 185 */ KEY_NOTUSED, 735 /* 186 */ KEY_NOTUSED, 736 /* 187 */ KEY_NOTUSED, 737 /* 188 */ KEY_NOTUSED, 738 /* 189 */ KEY_NOTUSED, 739 /* 190 */ KEY_NOTUSED, 740 /* 191 */ KEY_NOTUSED, 741 /* 192 */ KEY_NOTUSED, 742 /* 193 */ KEY_NOTUSED, 743 /* 194 */ KEY_NOTUSED, 744 /* 195 */ KEY_NOTUSED, 745 /* 196 */ KEY_NOTUSED, 746 /* 197 */ KEY_NOTUSED, 747 /* 198 */ KEY_NOTUSED, 748 /* 199 */ KEY_Home, 749 /* 200 */ KEY_Up, 750 /* 201 */ KEY_PgUp, 751 /* 202 */ KEY_NOTUSED, 752 /* 203 */ KEY_Left, 753 /* 204 */ KEY_NOTUSED, 754 /* 205 */ KEY_Right, 755 /* 206 */ KEY_NOTUSED, 756 /* 207 */ KEY_End, 757 /* 208 */ KEY_Down, 758 /* 209 */ KEY_PgDown, 759 /* 210 */ KEY_Insert, 760 /* 211 */ KEY_Delete, 761 /* 212 */ KEY_NOTUSED, 762 /* 213 */ KEY_NOTUSED, 763 /* 214 */ KEY_NOTUSED, 764 /* 215 */ KEY_NOTUSED, 765 /* 216 */ KEY_NOTUSED, 766 /* 217 */ KEY_NOTUSED, 767 /* 218 */ KEY_NOTUSED, 768 /* 219 */ KEY_LMeta, 769 /* 220 */ KEY_RMeta, 770 /* 221 */ KEY_Menu, 771}; 772#define WS_XT_MAP_SIZE (sizeof(wsXtMap)/sizeof(unsigned char)) 773 774static 775TransMapRec wsXt = { 776 0, 777 WS_XT_MAP_SIZE, 778 wsXtMap 779}; 780 781/* Map for adb keyboards */ 782static CARD8 wsAdbMap[] = { 783 /* 0 */ KEY_A, 784 /* 1 */ KEY_S, 785 /* 2 */ KEY_D, 786 /* 3 */ KEY_F, 787 /* 4 */ KEY_H, 788 /* 5 */ KEY_G, 789 /* 6 */ KEY_Z, 790 /* 7 */ KEY_X, 791 /* 8 */ KEY_C, 792 /* 9 */ KEY_V, 793 /* 10 */ KEY_UNKNOWN, /* @ # on french keyboards */ 794 /* 11 */ KEY_B, 795 /* 12 */ KEY_Q, 796 /* 13 */ KEY_W, 797 /* 14 */ KEY_E, 798 /* 15 */ KEY_R, 799 /* 16 */ KEY_Y, 800 /* 17 */ KEY_T, 801 /* 18 */ KEY_1, 802 /* 19 */ KEY_2, 803 /* 20 */ KEY_3, 804 /* 21 */ KEY_4, 805 /* 22 */ KEY_6, 806 /* 23 */ KEY_5, 807 /* 24 */ KEY_Equal, 808 /* 25 */ KEY_9, 809 /* 26 */ KEY_7, 810 /* 27 */ KEY_Minus, 811 /* 28 */ KEY_8, 812 /* 29 */ KEY_0, 813 /* 30 */ KEY_RBrace, 814 /* 31 */ KEY_O, 815 /* 32 */ KEY_U, 816 /* 33 */ KEY_LBrace, 817 /* 34 */ KEY_I, 818 /* 35 */ KEY_P, 819 /* 36 */ KEY_Enter, 820 /* 37 */ KEY_L, 821 /* 38 */ KEY_J, 822 /* 39 */ KEY_Quote, 823 /* 40 */ KEY_K, 824 /* 41 */ KEY_SemiColon, 825 /* 42 */ KEY_BSlash, 826 /* 43 */ KEY_Comma, 827 /* 44 */ KEY_Slash, 828 /* 45 */ KEY_N, 829 /* 46 */ KEY_M, 830 /* 47 */ KEY_Period, 831 /* 48 */ KEY_Tab, 832 /* 49 */ KEY_Space, 833 /* 50 */ KEY_Tilde, 834 /* 51 */ KEY_BackSpace, 835 /* 52 */ KEY_AltLang, 836 /* 53 */ KEY_Escape, 837 /* 54 */ KEY_LCtrl, 838 /* 55 */ KEY_LMeta, 839 /* 56 */ KEY_ShiftL, 840 /* 57 */ KEY_CapsLock, 841 /* 58 */ KEY_Alt, 842 /* 59 */ KEY_Left, 843 /* 60 */ KEY_Right, 844 /* 61 */ KEY_Down, 845 /* 62 */ KEY_Up, 846 /* 63 */ KEY_UNKNOWN, /* Fn */ 847 /* 64 */ KEY_NOTUSED, 848 /* 65 */ KEY_KP_Decimal, 849 /* 66 */ KEY_NOTUSED, 850 /* 67 */ KEY_KP_Multiply, 851 /* 68 */ KEY_NOTUSED, 852 /* 69 */ KEY_KP_Plus, 853 /* 70 */ KEY_NOTUSED, 854 /* 71 */ KEY_NumLock, /* Clear */ 855 /* 72 */ KEY_NOTUSED, 856 /* 73 */ KEY_NOTUSED, 857 /* 74 */ KEY_NOTUSED, 858 /* 75 */ KEY_KP_Divide, 859 /* 76 */ KEY_KP_Enter, 860 /* 77 */ KEY_NOTUSED, 861 /* 78 */ KEY_KP_Minus, 862 /* 79 */ KEY_NOTUSED, 863 /* 80 */ KEY_NOTUSED, 864 /* 81 */ KEY_KP_Equal, /* Keypad = */ 865 /* 82 */ KEY_KP_0, 866 /* 83 */ KEY_KP_1, 867 /* 84 */ KEY_KP_2, 868 /* 85 */ KEY_KP_3, 869 /* 86 */ KEY_KP_4, 870 /* 87 */ KEY_KP_5, 871 /* 88 */ KEY_KP_6, 872 /* 89 */ KEY_KP_7, 873 /* 90 */ KEY_NOTUSED, 874 /* 91 */ KEY_KP_8, 875 /* 92 */ KEY_KP_9, 876 /* 93 */ KEY_NOTUSED, 877 /* 94 */ KEY_NOTUSED, 878 /* 95 */ KEY_KP_Decimal, /* Keypad , */ 879 /* 96 */ KEY_F5, 880 /* 97 */ KEY_F6, 881 /* 98 */ KEY_F7, 882 /* 99 */ KEY_F3, 883 /* 100 */ KEY_F8, 884 /* 101 */ KEY_F9, 885 /* 102 */ KEY_NOTUSED, 886 /* 103 */ KEY_F11, 887 /* 104 */ KEY_NOTUSED, 888 /* 105 */ KEY_Print, 889 /* 106 */ KEY_KP_Enter, 890 /* 107 */ KEY_ScrollLock, 891 /* 108 */ KEY_NOTUSED, 892 /* 109 */ KEY_F10, 893 /* 110 */ KEY_NOTUSED, 894 /* 111 */ KEY_F12, 895 /* 112 */ KEY_NOTUSED, 896 /* 113 */ KEY_Pause, 897 /* 114 */ KEY_Insert, 898 /* 115 */ KEY_Home, 899 /* 116 */ KEY_PgUp, 900 /* 117 */ KEY_Delete, 901 /* 118 */ KEY_F4, 902 /* 119 */ KEY_End, 903 /* 120 */ KEY_F2, 904 /* 121 */ KEY_PgDown, 905 /* 122 */ KEY_F1, 906 /* 123 */ KEY_NOTUSED, 907 /* 124 */ KEY_NOTUSED, 908 /* 125 */ KEY_NOTUSED, 909 /* 126 */ KEY_NOTUSED, 910 /* 127 */ KEY_Power 911}; 912#define WS_ADB_MAP_SIZE (sizeof(wsAdbMap)/sizeof(unsigned char)) 913 914static 915TransMapRec wsAdb = { 916 0, 917 WS_ADB_MAP_SIZE, 918 wsAdbMap 919}; 920 921static CARD8 wsSunMap[] = { 922 /* 0x00 */ KEY_Help, 923 /* 0x01 */ KEY_L1, /* stop */ 924 /* 0x02 */ KEY_AudioLower, /* BrightnessDown / S-VolumeDown */ 925 /* 0x03 */ KEY_L2, /* again */ 926 /* 0x04 */ KEY_AudioRaise, /* BridgtnessUp / S-VolumeUp */ 927 /* 0x05 */ KEY_F1, 928 /* 0x06 */ KEY_F2, 929 /* 0x07 */ KEY_F10, 930 /* 0x08 */ KEY_F3, 931 /* 0x09 */ KEY_F11, 932 /* 0x0a */ KEY_F4, 933 /* 0x0b */ KEY_F12, 934 /* 0x0c */ KEY_F5, 935 /* 0x0d */ KEY_AltLang, 936 /* 0x0e */ KEY_F6, 937 /* 0x0f */ KEY_NOTUSED, 938 /* 0x10 */ KEY_F7, 939 /* 0x11 */ KEY_F8, 940 /* 0x12 */ KEY_F9, 941 /* 0x13 */ KEY_Alt, 942 /* 0x14 */ KEY_Up, 943 /* 0x15 */ KEY_Pause, 944 /* 0x16 */ KEY_Print, 945 /* 0x17 */ KEY_ScrollLock, 946 /* 0x18 */ KEY_Left, 947 /* 0x19 */ KEY_L3, /* props */ 948 /* 0x1a */ KEY_L4, /* undo */ 949 /* 0x1b */ KEY_Down, 950 /* 0x1c */ KEY_Right, 951 /* 0x1d */ KEY_Escape, 952 /* 0x1e */ KEY_1, 953 /* 0x1f */ KEY_2, 954 /* 0x20 */ KEY_3, 955 /* 0x21 */ KEY_4, 956 /* 0x22 */ KEY_5, 957 /* 0x23 */ KEY_6, 958 /* 0x24 */ KEY_7, 959 /* 0x25 */ KEY_8, 960 /* 0x26 */ KEY_9, 961 /* 0x27 */ KEY_0, 962 /* 0x28 */ KEY_Minus, 963 /* 0x29 */ KEY_Equal, 964 /* 0x2a */ KEY_Tilde, 965 /* 0x2b */ KEY_BackSpace, 966 /* 0x2c */ KEY_Insert, 967 /* 0x2d */ KEY_Mute, /* Audio Mute */ 968 /* 0x2e */ KEY_KP_Divide, 969 /* 0x2f */ KEY_KP_Multiply, 970 /* 0x30 */ KEY_Power, 971 /* 0x31 */ KEY_L5, /* front */ 972 /* 0x32 */ KEY_KP_Decimal, 973 /* 0x33 */ KEY_L6, /* copy */ 974 /* 0x34 */ KEY_Home, 975 /* 0x35 */ KEY_Tab, 976 /* 0x36 */ KEY_Q, 977 /* 0x37 */ KEY_W, 978 /* 0x38 */ KEY_E, 979 /* 0x39 */ KEY_R, 980 /* 0x3a */ KEY_T, 981 /* 0x3b */ KEY_Y, 982 /* 0x3c */ KEY_U, 983 /* 0x3d */ KEY_I, 984 /* 0x3e */ KEY_O, 985 /* 0x3f */ KEY_P, 986 /* 0x40 */ KEY_LBrace, 987 /* 0x41 */ KEY_RBrace, 988 /* 0x42 */ KEY_Delete, 989 /* 0x43 */ KEY_Menu, /* compose */ 990 /* 0x44 */ KEY_KP_7, 991 /* 0x45 */ KEY_KP_8, 992 /* 0x46 */ KEY_KP_9, 993 /* 0x47 */ KEY_KP_Minus, 994 /* 0x48 */ KEY_L7, /* open */ 995 /* 0x49 */ KEY_L8, /* paste */ 996 /* 0x4a */ KEY_End, 997 /* 0x4b */ KEY_NOTUSED, 998 /* 0x4c */ KEY_LCtrl, 999 /* 0x4d */ KEY_A, 1000 /* 0x4e */ KEY_S, 1001 /* 0x4f */ KEY_D, 1002 /* 0x50 */ KEY_F, 1003 /* 0x51 */ KEY_G, 1004 /* 0x52 */ KEY_H, 1005 /* 0x53 */ KEY_J, 1006 /* 0x54 */ KEY_K, 1007 /* 0x55 */ KEY_L, 1008 /* 0x56 */ KEY_SemiColon, 1009 /* 0x57 */ KEY_Quote, 1010 /* 0x58 */ KEY_BSlash, 1011 /* 0x59 */ KEY_Enter, 1012 /* 0x5a */ KEY_KP_Enter, 1013 /* 0x5b */ KEY_KP_4, 1014 /* 0x5c */ KEY_KP_5, 1015 /* 0x5d */ KEY_KP_6, 1016 /* 0x5e */ KEY_KP_0, 1017 /* 0x5f */ KEY_L9, /* find */ 1018 /* 0x60 */ KEY_PgUp, 1019 /* 0x61 */ KEY_L10, /* cut */ 1020 /* 0x62 */ KEY_NumLock, 1021 /* 0x63 */ KEY_ShiftL, 1022 /* 0x64 */ KEY_Z, 1023 /* 0x65 */ KEY_X, 1024 /* 0x66 */ KEY_C, 1025 /* 0x67 */ KEY_V, 1026 /* 0x68 */ KEY_B, 1027 /* 0x69 */ KEY_N, 1028 /* 0x6a */ KEY_M, 1029 /* 0x6b */ KEY_Comma, 1030 /* 0x6c */ KEY_Period, 1031 /* 0x6d */ KEY_Slash, 1032 /* 0x6e */ KEY_ShiftR, 1033 /* 0x6f */ KEY_NOTUSED, /* linefeed */ 1034 /* 0x70 */ KEY_KP_1, 1035 /* 0x71 */ KEY_KP_2, 1036 /* 0x72 */ KEY_KP_3, 1037 /* 0x73 */ KEY_NOTUSED, 1038 /* 0x74 */ KEY_NOTUSED, 1039 /* 0x75 */ KEY_NOTUSED, 1040 /* 0x76 */ KEY_Help, /* help */ 1041 /* 0x77 */ KEY_CapsLock, 1042 /* 0x78 */ KEY_LMeta, 1043 /* 0x79 */ KEY_Space, 1044 /* 0x7a */ KEY_RMeta, 1045 /* 0x7b */ KEY_PgDown, 1046 /* 0x7c */ KEY_Less, /* < > on some keyboards */ 1047 /* 0x7d */ KEY_KP_Plus, 1048 /* 0x7e */ KEY_NOTUSED, 1049 /* 0x7f */ KEY_NOTUSED 1050}; 1051#define WS_SUN_MAP_SIZE (sizeof(wsSunMap)/sizeof(unsigned char)) 1052 1053static 1054TransMapRec wsSun = { 1055 0, 1056 WS_SUN_MAP_SIZE, 1057 wsSunMap 1058}; 1059 1060#endif /* WSCONS_SUPPORT */ 1061 1062/*ARGSUSED*/ 1063 1064/* 1065 * KbdGetMapping -- 1066 * Get the national keyboard mapping. The keyboard type is set, a new map 1067 * and the modifiermap is computed. 1068 */ 1069 1070void 1071KbdGetMapping (InputInfoPtr pInfo, KeySymsPtr pKeySyms, CARD8 *pModMap) 1072{ 1073 KbdDevPtr pKbd = (KbdDevPtr) pInfo->private; 1074 KeySym *k; 1075 int i; 1076 1077#ifndef __bsdi__ 1078 switch (pKbd->consType) { 1079 1080#ifdef PCCONS_SUPPORT 1081 case PCCONS: 1082#if defined(__OpenBSD__) 1083 /* 1084 * on OpenBSD, the pccons keymap is programmable, too 1085 */ 1086 { 1087 pccons_keymap_t keymap[KB_NUM_KEYS]; 1088 if (ioctl(pInfo->fd, CONSOLE_GET_KEYMAP, &keymap) != -1) { 1089 for (i = 0; i < KB_NUM_KEYS; i++) 1090 if (pccons_remap[i]) { 1091 k = map + (pccons_remap[i] << 2); 1092 switch (keymap[i].type) { 1093 case KB_ASCII: 1094 /* For ASCII keys, there is only one char in the keymap */ 1095 k[0] = latin1_to_x[(unsigned char)keymap[i].unshift[0]]; 1096 k[1] = latin1_to_x[(unsigned char)keymap[i].shift[0]]; 1097 k[2] = latin1_to_x[(unsigned char)keymap[i].altgr[0]]; 1098 k[3] = latin1_to_x[(unsigned char)keymap[i].shift_altgr[0]]; 1099 break; 1100 case KB_SCROLL: 1101 k[0] = XK_Scroll_Lock; 1102 goto special; 1103 case KB_NUM: 1104 k[0] = XK_Num_Lock; 1105 goto special; 1106 case KB_CAPS: 1107 k[0] = XK_Caps_Lock; 1108 goto special; 1109 case KB_SHIFT: 1110 switch (keymap[i].unshift[0]) { 1111 case 1: 1112 /* left shift */ 1113 k[0] = XK_Shift_L; 1114 break; 1115 case 2: 1116 /* right shift */ 1117 k[0] = XK_Shift_R; 1118 break; 1119 default: 1120 k[0] = NoSymbol; 1121 } 1122 goto special; 1123 case KB_CTL: 1124 k[0] = XK_Control_L; 1125 goto special; 1126 case KB_ALT: 1127 k[0] = XK_Alt_L; 1128 goto special; 1129 case KB_FUNC: 1130 switch (keymap[i].unshift[2]) { 1131 case 'M': 1132 k[0] = XK_F1; 1133 break; 1134 case 'N': 1135 k[0] = XK_F2; 1136 break; 1137 case 'O': 1138 k[0] = XK_F3; 1139 break; 1140 case 'P': 1141 k[0] = XK_F4; 1142 break; 1143 case 'Q': 1144 k[0] = XK_F5; 1145 break; 1146 case 'R': 1147 k[0] = XK_F6; 1148 break; 1149 case 'S': 1150 k[0] = XK_F7; 1151 break; 1152 case 'T': 1153 k[0] = XK_F8; 1154 break; 1155 case 'U': 1156 k[0] = XK_F9; 1157 break; 1158 case 'V': 1159 k[0] = XK_F10; 1160 break; 1161 case 'W': 1162 k[0] = XK_F11; 1163 break; 1164 case 'X': 1165 k[0] = XK_F12; 1166 break; 1167 default: 1168 k[0] = NoSymbol; 1169 break; 1170 } 1171 goto special; 1172 default: 1173 k[0] = NoSymbol; 1174 special: 1175 k[1] = k[2] = k[3] = NoSymbol; 1176 } 1177 } 1178 } else { 1179 ErrorF("Can't read pccons keymap\n"); 1180 } 1181 } 1182#endif /* __OpenBSD__ */ 1183 break; 1184#endif 1185 1186/* 1187 * XXX wscons has no GIO_KEYMAP 1188 */ 1189#if (defined (SYSCONS_SUPPORT) || defined (PCVT_SUPPORT)) && defined(GIO_KEYMAP) 1190 case SYSCONS: 1191 case PCVT: 1192 { 1193 keymap_t keymap; 1194 1195 if (ioctl(pInfo->fd, GIO_KEYMAP, &keymap) != -1) { 1196 for (i = 0; i < keymap.n_keys && i < NUM_KEYCODES; i++) 1197 if (remap[i]) { 1198 k = map + (remap[i] << 2); 1199 k[0] = KD_GET_ENTRY(i,0); /* non-shifed */ 1200 k[1] = KD_GET_ENTRY(i,1); /* shifted */ 1201 k[2] = KD_GET_ENTRY(i,4); /* alt */ 1202 k[3] = KD_GET_ENTRY(i,5); /* alt - shifted */ 1203 if (k[3] == k[2]) k[3] = NoSymbol; 1204 if (k[2] == k[1]) k[2] = NoSymbol; 1205 if (k[1] == k[0]) k[1] = NoSymbol; 1206 if (k[0] == k[2] && k[1] == k[3]) 1207 k[2] = k[3] = NoSymbol; 1208 } 1209 } 1210 } 1211 break; 1212#endif /* SYSCONS || PCVT */ 1213 1214 } 1215#endif /* !bsdi */ 1216 1217 /* 1218 * compute the modifier map 1219 */ 1220 for (i = 0; i < MAP_LENGTH; i++) 1221 pModMap[i] = NoSymbol; /* make sure it is restored */ 1222 1223 for (k = map, i = MIN_KEYCODE; 1224 i < (NUM_KEYCODES + MIN_KEYCODE); 1225 i++, k += 4) 1226 1227 switch(*k) { 1228 1229 case XK_Shift_L: 1230 case XK_Shift_R: 1231 pModMap[i] = ShiftMask; 1232 break; 1233 1234 case XK_Control_L: 1235 case XK_Control_R: 1236 pModMap[i] = ControlMask; 1237 break; 1238 1239 case XK_Caps_Lock: 1240 pModMap[i] = LockMask; 1241 break; 1242 1243 case XK_Alt_L: 1244 case XK_Alt_R: 1245 pModMap[i] = AltMask; 1246 break; 1247 1248 case XK_Num_Lock: 1249 pModMap[i] = NumLockMask; 1250 break; 1251 1252 case XK_Scroll_Lock: 1253 pModMap[i] = ScrollLockMask; 1254 break; 1255 1256 /* kana support */ 1257 case XK_Kana_Lock: 1258 case XK_Kana_Shift: 1259 pModMap[i] = KanaMask; 1260 break; 1261 1262 /* alternate toggle for multinational support */ 1263 case XK_Mode_switch: 1264 pModMap[i] = AltLangMask; 1265 break; 1266 1267 } 1268 1269 pKbd->kbdType = 0; 1270 1271 pKeySyms->map = map; 1272 pKeySyms->mapWidth = GLYPHS_PER_KEY; 1273 pKeySyms->minKeyCode = MIN_KEYCODE; 1274 pKeySyms->maxKeyCode = MAX_KEYCODE; 1275 1276 switch(pKbd->consType) { 1277#ifdef SYSCONS_SUPPORT 1278 case SYSCONS: 1279 if (pKbd->CustomKeycodes) 1280 pKbd->scancodeMap = &sysconsCODE; 1281 else 1282 pKbd->RemapScanCode = ATScancode; 1283 break; 1284#endif 1285#if defined(PCCONS_SUPPORT) || defined (PCVT_SUPPORT) 1286 case PCCONS: 1287 case PCVT: 1288 pKbd->RemapScanCode = ATScancode; 1289 break; 1290#endif 1291#ifdef WSCONS_SUPPORT 1292 case WSCONS: 1293 if (!pKbd->isConsole) { 1294 switch (pKbd->wsKbdType) { 1295 case WSKBD_TYPE_PC_XT: 1296 case WSKBD_TYPE_PC_AT: 1297 pKbd->scancodeMap = &wsXt; 1298 break; 1299 case WSKBD_TYPE_USB: 1300 pKbd->scancodeMap = &wsUsb; 1301 break; 1302#ifdef WSKBD_TYPE_ADB 1303 case WSKBD_TYPE_ADB: 1304 pKbd->scancodeMap = &wsAdb; 1305 break; 1306#endif 1307#ifdef WSKBD_TYPE_SUN 1308#ifdef WSKBD_TYPE_SUN5 1309 case WSKBD_TYPE_SUN5: 1310#endif 1311 case WSKBD_TYPE_SUN: 1312 pKbd->scancodeMap = &wsSun; 1313 break; 1314#endif 1315 default: 1316 ErrorF("Unknown wskbd type %d\n", pKbd->wsKbdType); 1317 } 1318 } else { 1319 pKbd->RemapScanCode = ATScancode; 1320 } 1321 break; 1322#endif 1323 } 1324 return; 1325} 1326