pKbd->scancodeMap = &wsAdb;
pKbd->RemapScanCode = ADBScanCode;
KbdGetMapping (InputInfoPtr pInfo, KeySymsPtr pKeySyms, CARD8 *pModMap){  KbdDevPtr pKbd = (KbdDevPtr) pInfo->private;  KeySym        *k;  int           i;#ifndef __bsdi__  switch (pKbd->consType) {#ifdef PCCONS_SUPPORT  case PCCONS:#if defined(__OpenBSD__)    /*     * on OpenBSD, the pccons keymap is programmable, too     */    {      pccons_keymap_t keymap[KB_NUM_KEYS];      if (ioctl(pInfo->fd, CONSOLE_GET_KEYMAP, &keymap) != -1) {	for (i = 0; i < KB_NUM_KEYS; i++) 	  if (pccons_remap[i]) {	    k = map + (pccons_remap[i] << 2);	    switch (keymap[i].type) {	    case KB_ASCII:	      /* For ASCII keys, there is only one char in the keymap */	      k[0] = latin1_to_x[(unsigned char)keymap[i].unshift[0]];	      k[1] = latin1_to_x[(unsigned char)keymap[i].shift[0]];	      k[2] = latin1_to_x[(unsigned char)keymap[i].altgr[0]];	      k[3] = latin1_to_x[(unsigned char)keymap[i].shift_altgr[0]];	      break;	    case KB_SCROLL:	      k[0] = XK_Scroll_Lock;	      goto special;	    case KB_NUM:	      k[0] = XK_Num_Lock;	      goto special;	    case KB_CAPS:	      k[0] = XK_Caps_Lock;	      goto special;	    case KB_SHIFT:	      switch (keymap[i].unshift[0]) {	      case 1:		/* left shift */		k[0] = XK_Shift_L;		break;	      case 2:		/* right shift */		k[0] = XK_Shift_R;		break;	      default:		k[0] = NoSymbol;	      }	      goto special;	    case KB_CTL:	      k[0] = XK_Control_L;	      goto special;	    case KB_ALT:	      k[0] = XK_Alt_L;	      goto special;	    case KB_FUNC:	      switch (keymap[i].unshift[2]) {	      case 'M':		k[0] = XK_F1;		break;	      case 'N':		k[0] = XK_F2;		break;	      case 'O':		k[0] = XK_F3;		break;	      case 'P':		k[0] = XK_F4;		break;	      case 'Q':		k[0] = XK_F5;		break;	      case 'R':		k[0] = XK_F6;		break;	      case 'S':		k[0] = XK_F7;		break;	      case 'T':		k[0] = XK_F8;		break;	      case 'U':		k[0] = XK_F9;		break;	      case 'V':		k[0] = XK_F10;		break;	      case 'W':		k[0] = XK_F11;		break;	      case 'X':		k[0] = XK_F12;		break;	      default:		k[0] = NoSymbol;		break;	      }	      goto special;	    default:	      k[0] = NoSymbol;	    special:	      k[1] = k[2] = k[3] = NoSymbol;	    }	  }      } else {	ErrorF("Can't read pccons keymap\n");      }    }#endif /* __OpenBSD__ */  break;#endif/* * XXX wscons has no GIO_KEYMAP */#if (defined (SYSCONS_SUPPORT) || defined (PCVT_SUPPORT)) && defined(GIO_KEYMAP)  case SYSCONS:  case PCVT:    {      keymap_t keymap;          if (ioctl(pInfo->fd, GIO_KEYMAP, &keymap) != -1) {	for (i = 0; i < keymap.n_keys && i < NUM_KEYCODES; i++)	  if (remap[i]) {	    k = map + (remap[i] << 2);	    k[0] = KD_GET_ENTRY(i,0);           /* non-shifed */	    k[1] = KD_GET_ENTRY(i,1);	      /* shifted */	    k[2] = KD_GET_ENTRY(i,4);	      /* alt */	    k[3] = KD_GET_ENTRY(i,5);	      /* alt - shifted */	    if (k[3] == k[2]) k[3] = NoSymbol;	    if (k[2] == k[1]) k[2] = NoSymbol;	    if (k[1] == k[0]) k[1] = NoSymbol;	    if (k[0] == k[2] && k[1] == k[3])	      k[2] = k[3] = NoSymbol;	  }      }    }    break;#endif /* SYSCONS || PCVT */      } #endif /* !bsdi */  /*   * compute the modifier map   */  for (i = 0; i < MAP_LENGTH; i++)    pModMap[i] = NoSymbol;  /* make sure it is restored */    for (k = map, i = MIN_KEYCODE;       i < (NUM_KEYCODES + MIN_KEYCODE);       i++, k += 4)        switch(*k) {          case XK_Shift_L:    case XK_Shift_R:      pModMap[i] = ShiftMask;      break;          case XK_Control_L:    case XK_Control_R:      pModMap[i] = ControlMask;      break;          case XK_Caps_Lock:      pModMap[i] = LockMask;      break;          case XK_Alt_L:    case XK_Alt_R:      pModMap[i] = AltMask;      break;          case XK_Num_Lock:      pModMap[i] = NumLockMask;      break;    case XK_Scroll_Lock:      pModMap[i] = ScrollLockMask;      break;      /* kana support */    case XK_Kana_Lock:    case XK_Kana_Shift:      pModMap[i] = KanaMask;      break;      /* alternate toggle for multinational support */    case XK_Mode_switch:      pModMap[i] = AltLangMask;      break;    }    pKbd->kbdType = 0;  pKeySyms->map        = map;  pKeySyms->mapWidth   = GLYPHS_PER_KEY;  pKeySyms->minKeyCode = MIN_KEYCODE;  pKeySyms->maxKeyCode = MAX_KEYCODE;   switch(pKbd->consType) {#ifdef SYSCONS_SUPPORT      case SYSCONS:           if (pKbd->CustomKeycodes)              pKbd->scancodeMap = &sysconsCODE;           else              pKbd->RemapScanCode = ATScancode;           break;#endif#if defined(PCCONS_SUPPORT) || defined (PCVT_SUPPORT)      case PCCONS:      case PCVT:           pKbd->RemapScanCode = ATScancode;#endif#ifdef WSCONS_SUPPORT      case WSCONS:           switch (pKbd->wsKbdType) {	       case WSKBD_TYPE_PC_XT:	       case WSKBD_TYPE_PC_AT:                    pKbd->RemapScanCode = ATScancode;                    break;	       case WSKBD_TYPE_USB:                    pKbd->scancodeMap = &wsUsb;                    break;#ifdef WSKBD_TYPE_ADB		       case WSKBD_TYPE_ADB:                    pKbd->scancodeMap = &wsAdb;                     break;#endif#ifdef WSKBD_TYPE_SUN#ifdef WSKBD_TYPE_SUN5	       case WSKBD_TYPE_SUN5:#endif /* WSKBD_TYPE_SUN5 */	       case WSKBD_TYPE_SUN:                    pKbd->scancodeMap = &wsSun;                    break;#endif /* WSKBD_TYPE_SUN */	       default:                    pKbd->RemapScanCode = ATScancode;                    break;           }      break;#endif  }  return;}