1/* Portions of this file were derived from the following files: 2 * 3 ********************************************************************** 4 * 5 * xfree86/common/xf86KbdLnx.c 6 * 7 * Linux version of keymapping setup. The kernel (since 0.99.14) has support 8 * for fully remapping the keyboard, but there are some differences between 9 * the Linux map and the SVR4 map (esp. in the extended keycodes). We also 10 * remove the restriction on what keycodes can be remapped. 11 * Orest Zborowski. 12 * 13 * Copyright 1990,91 by Thomas Roell, Dinkelscherben, Germany. 14 * 15 * Permission to use, copy, modify, distribute, and sell this software and its 16 * documentation for any purpose is hereby granted without fee, provided that 17 * the above copyright notice appear in all copies and that both that 18 * copyright notice and this permission notice appear in supporting 19 * documentation, and that the name of Thomas Roell not be used in 20 * advertising or publicity pertaining to distribution of the software without 21 * specific, written prior permission. Thomas Roell makes no representations 22 * about the suitability of this software for any purpose. It is provided 23 * "as is" without express or implied warranty. 24 * 25 * THOMAS ROELL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, 26 * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO 27 * EVENT SHALL THOMAS ROELL BE LIABLE FOR ANY SPECIAL, INDIRECT OR 28 * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, 29 * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER 30 * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR 31 * PERFORMANCE OF THIS SOFTWARE. 32 * 33 */ 34 35/* 36 * Copyright 2001,2002 Red Hat Inc., Durham, North Carolina. 37 * 38 * All Rights Reserved. 39 * 40 * Permission is hereby granted, free of charge, to any person obtaining 41 * a copy of this software and associated documentation files (the 42 * "Software"), to deal in the Software without restriction, including 43 * without limitation on the rights to use, copy, modify, merge, 44 * publish, distribute, sublicense, and/or sell copies of the Software, 45 * and to permit persons to whom the Software is furnished to do so, 46 * subject to the following conditions: 47 * 48 * The above copyright notice and this permission notice (including the 49 * next paragraph) shall be included in all copies or substantial 50 * portions of the Software. 51 * 52 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 53 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 54 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 55 * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS 56 * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 57 * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 58 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 59 * SOFTWARE. 60 */ 61 62/* 63 * Authors: 64 * Rickard E. (Rik) Faith <faith@redhat.com> 65 * 66 */ 67 68/** \file 69 * 70 * This code implements a low-level device driver for a USB keyboard 71 * under Linux. The keymap description is derived from code by Thomas 72 * Roell, Orest Zborowski. */ 73 74#ifdef HAVE_DMX_CONFIG_H 75#include <dmx-config.h> 76#endif 77 78#include "atKeynames.h" 79#include "usb-private.h" 80 81#define USB_KEYBOARD_DEBUG 0 82 83/*****************************************************************************/ 84/* Define some macros to make it easier to move this file to another 85 * part of the Xserver tree. All calls to the dmx* layer are #defined 86 * here for the .c file. The .h file will also have to be edited. */ 87#include "usb-keyboard.h" 88#include <xkbsrv.h> 89 90#define GETPRIV myPrivate *priv \ 91 = ((DMXLocalInputInfoPtr)(pDev->devicePrivate))->private 92 93#define LOG0(f) dmxLog(dmxDebug,f) 94#define LOG1(f,a) dmxLog(dmxDebug,f,a) 95#define LOG2(f,a,b) dmxLog(dmxDebug,f,a,b) 96#define LOG3(f,a,b,c) dmxLog(dmxDebug,f,a,b,c) 97#define FATAL0(f) dmxLog(dmxFatal,f) 98#define FATAL1(f,a) dmxLog(dmxFatal,f,a) 99#define FATAL2(f,a,b) dmxLog(dmxFatal,f,a,b) 100#define MOTIONPROC dmxMotionProcPtr 101#define ENQUEUEPROC dmxEnqueueProcPtr 102#define CHECKPROC dmxCheckSpecialProcPtr 103#define BLOCK DMXBlockType 104 105/* End of interface definitions. */ 106/*****************************************************************************/ 107 108#define GLYPHS_PER_KEY 4 109#define NUM_KEYCODES 248 110#define MIN_KEYCODE 8 111#define MAX_KEYCODE (NUM_KEYCODES + MIN_KEYCODE - 1) 112 113static KeySym map[NUM_KEYCODES * GLYPHS_PER_KEY] = { 114/* Table modified from xc/programs/Xserver/hw/xfree86/common/xf86Keymap.h */ 115 /* 0x00 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, 116 /* 0x01 */ XK_Escape, NoSymbol, NoSymbol, NoSymbol, 117 /* 0x02 */ XK_1, XK_exclam, NoSymbol, NoSymbol, 118 /* 0x03 */ XK_2, XK_at, NoSymbol, NoSymbol, 119 /* 0x04 */ XK_3, XK_numbersign, NoSymbol, NoSymbol, 120 /* 0x05 */ XK_4, XK_dollar, NoSymbol, NoSymbol, 121 /* 0x06 */ XK_5, XK_percent, NoSymbol, NoSymbol, 122 /* 0x07 */ XK_6, XK_asciicircum, NoSymbol, NoSymbol, 123 /* 0x08 */ XK_7, XK_ampersand, NoSymbol, NoSymbol, 124 /* 0x09 */ XK_8, XK_asterisk, NoSymbol, NoSymbol, 125 /* 0x0a */ XK_9, XK_parenleft, NoSymbol, NoSymbol, 126 /* 0x0b */ XK_0, XK_parenright, NoSymbol, NoSymbol, 127 /* 0x0c */ XK_minus, XK_underscore, NoSymbol, NoSymbol, 128 /* 0x0d */ XK_equal, XK_plus, NoSymbol, NoSymbol, 129 /* 0x0e */ XK_BackSpace, NoSymbol, NoSymbol, NoSymbol, 130 /* 0x0f */ XK_Tab, XK_ISO_Left_Tab,NoSymbol, NoSymbol, 131 /* 0x10 */ XK_Q, NoSymbol, NoSymbol, NoSymbol, 132 /* 0x11 */ XK_W, NoSymbol, NoSymbol, NoSymbol, 133 /* 0x12 */ XK_E, NoSymbol, NoSymbol, NoSymbol, 134 /* 0x13 */ XK_R, NoSymbol, NoSymbol, NoSymbol, 135 /* 0x14 */ XK_T, NoSymbol, NoSymbol, NoSymbol, 136 /* 0x15 */ XK_Y, NoSymbol, NoSymbol, NoSymbol, 137 /* 0x16 */ XK_U, NoSymbol, NoSymbol, NoSymbol, 138 /* 0x17 */ XK_I, NoSymbol, NoSymbol, NoSymbol, 139 /* 0x18 */ XK_O, NoSymbol, NoSymbol, NoSymbol, 140 /* 0x19 */ XK_P, NoSymbol, NoSymbol, NoSymbol, 141 /* 0x1a */ XK_bracketleft, XK_braceleft, NoSymbol, NoSymbol, 142 /* 0x1b */ XK_bracketright,XK_braceright, NoSymbol, NoSymbol, 143 /* 0x1c */ XK_Return, NoSymbol, NoSymbol, NoSymbol, 144 /* 0x1d */ XK_Control_L, NoSymbol, NoSymbol, NoSymbol, 145 /* 0x1e */ XK_A, NoSymbol, NoSymbol, NoSymbol, 146 /* 0x1f */ XK_S, NoSymbol, NoSymbol, NoSymbol, 147 /* 0x20 */ XK_D, NoSymbol, NoSymbol, NoSymbol, 148 /* 0x21 */ XK_F, NoSymbol, NoSymbol, NoSymbol, 149 /* 0x22 */ XK_G, NoSymbol, NoSymbol, NoSymbol, 150 /* 0x23 */ XK_H, NoSymbol, NoSymbol, NoSymbol, 151 /* 0x24 */ XK_J, NoSymbol, NoSymbol, NoSymbol, 152 /* 0x25 */ XK_K, NoSymbol, NoSymbol, NoSymbol, 153 /* 0x26 */ XK_L, NoSymbol, NoSymbol, NoSymbol, 154 /* 0x27 */ XK_semicolon, XK_colon, NoSymbol, NoSymbol, 155 /* 0x28 */ XK_quoteright, XK_quotedbl, NoSymbol, NoSymbol, 156 /* 0x29 */ XK_quoteleft, XK_asciitilde, NoSymbol, NoSymbol, 157 /* 0x2a */ XK_Shift_L, NoSymbol, NoSymbol, NoSymbol, 158 /* 0x2b */ XK_backslash, XK_bar, NoSymbol, NoSymbol, 159 /* 0x2c */ XK_Z, NoSymbol, NoSymbol, NoSymbol, 160 /* 0x2d */ XK_X, NoSymbol, NoSymbol, NoSymbol, 161 /* 0x2e */ XK_C, NoSymbol, NoSymbol, NoSymbol, 162 /* 0x2f */ XK_V, NoSymbol, NoSymbol, NoSymbol, 163 /* 0x30 */ XK_B, NoSymbol, NoSymbol, NoSymbol, 164 /* 0x31 */ XK_N, NoSymbol, NoSymbol, NoSymbol, 165 /* 0x32 */ XK_M, NoSymbol, NoSymbol, NoSymbol, 166 /* 0x33 */ XK_comma, XK_less, NoSymbol, NoSymbol, 167 /* 0x34 */ XK_period, XK_greater, NoSymbol, NoSymbol, 168 /* 0x35 */ XK_slash, XK_question, NoSymbol, NoSymbol, 169 /* 0x36 */ XK_Shift_R, NoSymbol, NoSymbol, NoSymbol, 170 /* 0x37 */ XK_KP_Multiply, NoSymbol, NoSymbol, NoSymbol, 171 /* 0x38 */ XK_Alt_L, XK_Meta_L, NoSymbol, NoSymbol, 172 /* 0x39 */ XK_space, NoSymbol, NoSymbol, NoSymbol, 173 /* 0x3a */ XK_Caps_Lock, NoSymbol, NoSymbol, NoSymbol, 174 /* 0x3b */ XK_F1, NoSymbol, NoSymbol, NoSymbol, 175 /* 0x3c */ XK_F2, NoSymbol, NoSymbol, NoSymbol, 176 /* 0x3d */ XK_F3, NoSymbol, NoSymbol, NoSymbol, 177 /* 0x3e */ XK_F4, NoSymbol, NoSymbol, NoSymbol, 178 /* 0x3f */ XK_F5, NoSymbol, NoSymbol, NoSymbol, 179 /* 0x40 */ XK_F6, NoSymbol, NoSymbol, NoSymbol, 180 /* 0x41 */ XK_F7, NoSymbol, NoSymbol, NoSymbol, 181 /* 0x42 */ XK_F8, NoSymbol, NoSymbol, NoSymbol, 182 /* 0x43 */ XK_F9, NoSymbol, NoSymbol, NoSymbol, 183 /* 0x44 */ XK_F10, NoSymbol, NoSymbol, NoSymbol, 184 /* 0x45 */ XK_Num_Lock, NoSymbol, NoSymbol, NoSymbol, 185 /* 0x46 */ XK_Scroll_Lock, NoSymbol, NoSymbol, NoSymbol, 186 /* 0x47 */ XK_KP_Home, XK_KP_7, NoSymbol, NoSymbol, 187 /* 0x48 */ XK_KP_Up, XK_KP_8, NoSymbol, NoSymbol, 188 /* 0x49 */ XK_KP_Prior, XK_KP_9, NoSymbol, NoSymbol, 189 /* 0x4a */ XK_KP_Subtract, NoSymbol, NoSymbol, NoSymbol, 190 /* 0x4b */ XK_KP_Left, XK_KP_4, NoSymbol, NoSymbol, 191 /* 0x4c */ XK_KP_Begin, XK_KP_5, NoSymbol, NoSymbol, 192 /* 0x4d */ XK_KP_Right, XK_KP_6, NoSymbol, NoSymbol, 193 /* 0x4e */ XK_KP_Add, NoSymbol, NoSymbol, NoSymbol, 194 /* 0x4f */ XK_KP_End, XK_KP_1, NoSymbol, NoSymbol, 195 /* 0x50 */ XK_KP_Down, XK_KP_2, NoSymbol, NoSymbol, 196 /* 0x51 */ XK_KP_Next, XK_KP_3, NoSymbol, NoSymbol, 197 /* 0x52 */ XK_KP_Insert, XK_KP_0, NoSymbol, NoSymbol, 198 /* 0x53 */ XK_KP_Delete, XK_KP_Decimal, NoSymbol, NoSymbol, 199 /* 0x54 */ XK_Sys_Req, NoSymbol, NoSymbol, NoSymbol, 200 /* 0x55 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, 201 /* 0x56 */ XK_less, XK_greater, NoSymbol, NoSymbol, 202 /* 0x57 */ XK_F11, NoSymbol, NoSymbol, NoSymbol, 203 /* 0x58 */ XK_F12, NoSymbol, NoSymbol, NoSymbol, 204 /* 0x59 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, 205 /* 0x5a */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, 206 /* 0x5b */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, 207 /* 0x5c */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, 208 /* 0x5d */ XK_Begin, NoSymbol, NoSymbol, NoSymbol, 209 /* 0x5e */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, 210 /* 0x5f */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, 211 /* 0x60 */ XK_KP_Enter, NoSymbol, NoSymbol, NoSymbol, 212 /* 0x61 */ XK_Control_R, NoSymbol, NoSymbol, NoSymbol, 213 /* 0x62 */ XK_KP_Divide, NoSymbol, NoSymbol, NoSymbol, 214 /* 0x63 */ XK_Print, NoSymbol, NoSymbol, NoSymbol, 215 /* 0x64 */ XK_Alt_R, XK_Meta_R, NoSymbol, NoSymbol, 216 /* 0x65 */ XK_Break, NoSymbol, NoSymbol, NoSymbol, 217 /* 0x66 */ XK_Home, NoSymbol, NoSymbol, NoSymbol, 218 /* 0x67 */ XK_Up, NoSymbol, NoSymbol, NoSymbol, 219 /* 0x68 */ XK_Prior, NoSymbol, NoSymbol, NoSymbol, 220 /* 0x69 */ XK_Left, NoSymbol, NoSymbol, NoSymbol, 221 /* 0x6a */ XK_Right, NoSymbol, NoSymbol, NoSymbol, 222 /* 0x6b */ XK_End, NoSymbol, NoSymbol, NoSymbol, 223 /* 0x6c */ XK_Down, NoSymbol, NoSymbol, NoSymbol, 224 /* 0x6d */ XK_Next, NoSymbol, NoSymbol, NoSymbol, 225 /* 0x6e */ XK_Insert, NoSymbol, NoSymbol, NoSymbol, 226 /* 0x6f */ XK_Delete, NoSymbol, NoSymbol, NoSymbol, 227 /* 0x70 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, 228 /* 0x71 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, 229 /* 0x72 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, 230 /* 0x73 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, 231 /* 0x74 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, 232 /* 0x75 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, 233 /* 0x76 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, 234 /* 0x77 */ XK_Pause, NoSymbol, NoSymbol, NoSymbol, 235 /* 0x78 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, 236 /* 0x79 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, 237 /* 0x7a */ XK_Menu, NoSymbol, NoSymbol, NoSymbol, 238 /* 0x7b */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, 239 /* 0x7c */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, 240 /* 0x7d */ XK_Super_L, NoSymbol, NoSymbol, NoSymbol, 241 /* 0x7e */ XK_Super_R, NoSymbol, NoSymbol, NoSymbol, 242 /* 0x7f */ XK_Menu, NoSymbol, NoSymbol, NoSymbol, 243}; 244 245static int kbdUSBKeyDown(myPrivate *priv, int keyCode) 246{ 247 CARD8 byte = keyCode >> 5; 248 CARD32 bit = 1 << (keyCode & 0x1f); 249 250 if (byte > NUM_STATE_ENTRIES) return 0; 251 return priv->kbdState[byte] & bit; 252} 253 254static void kbdUSBKeyState(myPrivate *priv, int type, int keyCode) 255{ 256 CARD8 byte = keyCode >> 5; 257 CARD32 bit = 1 << (keyCode & 0x1f); 258 259 if (byte > NUM_STATE_ENTRIES) return; 260 if (type == KeyPress) priv->kbdState[byte] |= bit; 261 else priv->kbdState[byte] &= ~bit; 262} 263 264/** Set the LEDs. */ 265void kbdUSBCtrl(DevicePtr pDev, KeybdCtrl *ctrl) 266{ 267 GETPRIV; 268 struct timeval tv; 269 struct input_event event; 270 int i, led; 271 272 gettimeofday(&tv, NULL); 273 for (i = 0; i < 5; i++) { 274 event.time.tv_sec = tv.tv_sec; 275 event.time.tv_usec = tv.tv_usec; 276 event.type = EV_LED; 277 if (i == 0) led = 1; /* LED_CAPSL == 0x01 */ 278 else if (i == 1) led = 0; /* LED_NUML == 0x00 */ 279 else led = i; 280 event.code = led; 281 event.value = !!(ctrl->leds & (1 << led)); 282 write(priv->fd, &event, sizeof(event)); 283 } 284} 285 286/** Initialize \a pDev using #usbInit. */ 287void kbdUSBInit(DevicePtr pDev) 288{ 289 usbInit(pDev, usbKeyboard); 290} 291 292static void kbdUSBConvert(DevicePtr pDev, 293 unsigned int scanCode, 294 int value, 295 ENQUEUEPROC enqueue, 296 CHECKPROC checkspecial, 297 BLOCK block) 298{ 299 GETPRIV; 300 XkbSrvInfoPtr xkbi = priv->pKeyboard->key->xkbInfo; 301 int type; 302 int keyCode; 303 KeySym keySym = NoSymbol; 304 int switching; 305 306 /* Set up xEvent information */ 307 type = value ? KeyPress : KeyRelease; 308 keyCode = (scanCode & 0xff) + MIN_KEYCODE; 309 310 /* Handle repeats */ 311 312 if (keyCode >= xkbi->desc->min_key_code && 313 keyCode <= xkbi->desc->max_key_code) { 314 315 int effectiveGroup = XkbGetEffectiveGroup(xkbi, 316 &xkbi->state, 317 scanCode); 318 keySym = XkbKeySym(xkbi->desc, scanCode, effectiveGroup); 319#if 0 320 switch (keySym) { 321 case XK_Num_Lock: 322 case XK_Scroll_Lock: 323 case XK_Shift_Lock: 324 case XK_Caps_Lock: 325 /* Ignore releases and all but first press */ 326 if (kbdLinuxModIgnore(priv, &xE, keySym)) return; 327 if (kbdLinuxKeyDown(priv, &xE)) xE.u.u.type = KeyRelease; 328 else xE.u.u.type = KeyPress; 329 break; 330 } 331#endif 332 333 /* If key is already down, ignore or autorepeat */ 334 if (type == KeyPress && kbdUSBKeyDown(priv, keyCode)) { 335 KbdFeedbackClassRec *feed = priv->pDevice->kbdfeed; 336 337 /* No auto-repeat? */ 338 if ((feed && !feed->ctrl.autoRepeat) 339 || priv->pDevice->key->xkbInfo->desc->map->modmap[keyCode] 340 || (feed 341 && !(feed->ctrl.autoRepeats[keyCode >> 3] 342 & (1 << (keyCode & 7))))) return; /* Ignore */ 343 344 /* Do auto-repeat */ 345 enqueue(pDev, KeyRelease, keyCode, keySym, NULL, block); 346 type = KeyPress; 347 } 348 349 /* If key is already up, ignore */ 350 if (type == KeyRelease && !kbdUSBKeyDown(priv, keyCode)) return; 351 } 352 353 switching = 0; 354 if (checkspecial && type == KeyPress) 355 switching = checkspecial(pDev, keySym); 356 if (!switching) { 357 if (enqueue) 358 enqueue(pDev, type, keyCode, keySym, NULL, block); 359 kbdUSBKeyState(priv, type, keyCode); /* Update our state bitmap */ 360 } 361} 362 363/** Read an event from the \a pDev device. If the event is a motion 364 * event, enqueue it with the \a motion function. Otherwise, check for 365 * special keys with the \a checkspecial function and enqueue the event 366 * with the \a enqueue function. The \a block type is passed to the 367 * functions so that they may block SIGIO handling as appropriate to the 368 * caller of this function. */ 369void kbdUSBRead(DevicePtr pDev, 370 MOTIONPROC motion, 371 ENQUEUEPROC enqueue, 372 CHECKPROC checkspecial, 373 BLOCK block) 374{ 375 GETPRIV; 376 struct input_event raw; 377 378 while (read(priv->fd, &raw, sizeof(raw)) > 0) { 379#if USB_KEYBOARD_DEBUG 380 LOG3("KBD: type = %d, code = 0x%02x, value = %d\n", 381 raw.type, raw.code, raw.value); 382#endif 383 kbdUSBConvert(pDev, raw.code, raw.value, enqueue, checkspecial, block); 384 } 385} 386 387/** Turn \a pDev on (i.e., take input from \a pDev). */ 388int kbdUSBOn(DevicePtr pDev) 389{ 390 GETPRIV; 391 392 if (priv->fd < 0) kbdUSBInit(pDev); 393 return priv->fd; 394} 395 396static void kbdUSBGetMap(DevicePtr pDev, KeySymsPtr pKeySyms, CARD8 *pModMap) 397{ 398 KeySym *k, *mapCopy; 399 int i; 400 401 mapCopy = malloc(sizeof(map)); 402 memcpy(mapCopy, map, sizeof(map)); 403 404 /* compute the modifier map */ 405 for (i = 0; i < MAP_LENGTH; i++) 406 pModMap[i] = NoSymbol; /* make sure it is restored */ 407 408 for (k = mapCopy, i = MIN_KEYCODE; 409 i < NUM_KEYCODES + MIN_KEYCODE; 410 i++, k += 4) { 411 switch(*k) { 412 case XK_Shift_L: 413 case XK_Shift_R: pModMap[i] = ShiftMask; break; 414 case XK_Control_L: 415 case XK_Control_R: pModMap[i] = ControlMask; break; 416 case XK_Caps_Lock: pModMap[i] = LockMask; break; 417 case XK_Alt_L: 418 case XK_Alt_R: pModMap[i] = AltMask; break; 419 case XK_Num_Lock: pModMap[i] = NumLockMask; break; 420 case XK_Scroll_Lock: pModMap[i] = ScrollLockMask; break; 421 case XK_Kana_Lock: 422 case XK_Kana_Shift: pModMap[i] = KanaMask; break; 423 case XK_Mode_switch: pModMap[i] = AltLangMask; break; 424 } 425 } 426 427 pKeySyms->map = mapCopy; /* Must be XFree'able */ 428 pKeySyms->mapWidth = GLYPHS_PER_KEY; 429 pKeySyms->minKeyCode = MIN_KEYCODE; 430 pKeySyms->maxKeyCode = MAX_KEYCODE; 431} 432 433/** Fill the \a info structure with information needed to initialize \a 434 * pDev. */ 435void kbdUSBGetInfo(DevicePtr pDev, DMXLocalInitInfoPtr info) 436{ 437 info->keyboard = 1; 438 info->keyClass = 1; 439 kbdUSBGetMap(pDev, &info->keySyms, info->modMap); 440 info->focusClass = 1; 441 info->kbdFeedbackClass = 1; 442 info->names.keycodes = strdup("powerpcps2"); 443 info->force = 1; 444} 445