1 /* $NetBSD: kbd_pckbport.c,v 1.3 2005/11/16 01:39:27 uwe Exp $ */ 2 3 /* 4 * Copyright (c) 2002 Valeriy E. Ushakov 5 * All rights reserved. 6 * 7 * Redistribution and use in source and binary forms, with or without 8 * modification, are permitted provided that the following conditions 9 * are met: 10 * 1. Redistributions of source code must retain the above copyright 11 * notice, this list of conditions and the following disclaimer. 12 * 2. Redistributions in binary form must reproduce the above copyright 13 * notice, this list of conditions and the following disclaimer in the 14 * documentation and/or other materials provided with the distribution. 15 * 3. The name of the author may not be used to endorse or promote products 16 * derived from this software without specific prior written permission 17 * 18 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 19 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 20 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 21 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 22 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 23 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 24 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 25 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 27 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 */ 29 30 /*- 31 * Copyright (c) 1998 The NetBSD Foundation, Inc. 32 * All rights reserved. 33 * 34 * This code is derived from software contributed to The NetBSD Foundation 35 * by Charles M. Hannum. 36 * 37 * Redistribution and use in source and binary forms, with or without 38 * modification, are permitted provided that the following conditions 39 * are met: 40 * 1. Redistributions of source code must retain the above copyright 41 * notice, this list of conditions and the following disclaimer. 42 * 2. Redistributions in binary form must reproduce the above copyright 43 * notice, this list of conditions and the following disclaimer in the 44 * documentation and/or other materials provided with the distribution. 45 * 3. All advertising materials mentioning features or use of this software 46 * must display the following acknowledgement: 47 * This product includes software developed by the NetBSD 48 * Foundation, Inc. and its contributors. 49 * 4. Neither the name of The NetBSD Foundation nor the names of its 50 * contributors may be used to endorse or promote products derived 51 * from this software without specific prior written permission. 52 * 53 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS 54 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 55 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 56 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 57 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 58 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 59 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 60 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 61 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 62 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 63 * POSSIBILITY OF SUCH DAMAGE. 64 */ 65 66 /*- 67 * Copyright (c) 1990 The Regents of the University of California. 68 * All rights reserved. 69 * 70 * This code is derived from software contributed to Berkeley by 71 * William Jolitz and Don Ahn. 72 * 73 * Redistribution and use in source and binary forms, with or without 74 * modification, are permitted provided that the following conditions 75 * are met: 76 * 1. Redistributions of source code must retain the above copyright 77 * notice, this list of conditions and the following disclaimer. 78 * 2. Redistributions in binary form must reproduce the above copyright 79 * notice, this list of conditions and the following disclaimer in the 80 * documentation and/or other materials provided with the distribution. 81 * 3. Neither the name of the University nor the names of its contributors 82 * may be used to endorse or promote products derived from this software 83 * without specific prior written permission. 84 * 85 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 86 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 87 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 88 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 89 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 90 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 91 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 92 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 93 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 94 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 95 * SUCH DAMAGE. 96 * 97 * @(#)pccons.c 5.11 (Berkeley) 5/21/91 98 */ 99 #include <sys/cdefs.h> 100 __KERNEL_RCSID(0, "$NetBSD: kbd_pckbport.c,v 1.3 2005/11/16 01:39:27 uwe Exp $"); 101 102 /* 103 * Serve JavaStation-1 PS/2 keyboard as a Type5 keyboard with US101A 104 * layout. Since stock Xsun(1) knows this layout, JavaStation-1 gets 105 * X for free. When sparc port is switched to wscons and its X server 106 * knows how to talk wskbd, this driver will no longer be necessary, 107 * and we will be able to attach the keyboard with the MI pckbport(4) driver. 108 */ 109 110 #include <sys/param.h> 111 #include <sys/systm.h> 112 #include <sys/conf.h> 113 #include <sys/device.h> 114 #include <sys/kernel.h> 115 #include <sys/select.h> 116 117 #include <machine/autoconf.h> 118 #include <machine/bus.h> 119 #include <machine/intr.h> 120 121 #include <dev/sun/kbd_reg.h> 122 #include <dev/sun/kbio.h> 123 124 #include <dev/pckbport/pckbdreg.h> 125 #include <dev/pckbport/pckbportvar.h> 126 127 #include <dev/sun/event_var.h> 128 #include <dev/sun/kbd_xlate.h> 129 #include <dev/sun/kbdvar.h> 130 131 #define DPRINTF(args) /* printf args */ 132 133 134 struct kbd_pckbport_softc { 135 struct kbd_softc sc_kbd; 136 137 /* pckbport attachment */ 138 pckbport_tag_t sc_kbctag; 139 pckbport_slot_t sc_kbcslot; 140 141 /* 142 * Middle layer data. 143 */ 144 int sc_isopen; 145 int sc_pcleds; 146 147 /* xt scan-codes decoding */ 148 int sc_lastchar; 149 int sc_extended; 150 int sc_extended1; 151 }; 152 153 static int kbd_pckbport_match(struct device *, struct cfdata *, void *); 154 static void kbd_pckbport_attach(struct device *, struct device *, void *); 155 156 CFATTACH_DECL(kbd_pckbport, sizeof(struct kbd_pckbport_softc), 157 kbd_pckbport_match, kbd_pckbport_attach, NULL, NULL); 158 159 160 /* 161 * Middle layer. 162 */ 163 164 /* callbacks for the upper /dev/kbd layer */ 165 static int kbd_pckbport_open(struct kbd_softc *); 166 static int kbd_pckbport_close(struct kbd_softc *); 167 static int kbd_pckbport_do_cmd(struct kbd_softc *, int, int); 168 static int kbd_pckbport_set_leds(struct kbd_softc *, int, int); 169 170 static const struct kbd_ops kbd_ops_pckbport = { 171 kbd_pckbport_open, 172 kbd_pckbport_close, 173 kbd_pckbport_do_cmd, 174 kbd_pckbport_set_leds 175 }; 176 177 178 static const uint8_t kbd_pckbport_xt_to_sun[]; 179 180 static int kbd_pckbport_set_xtscancode(pckbport_tag_t, pckbport_slot_t); 181 static void kbd_pckbport_input(void *, int); 182 static int kbd_pckbport_decode(struct kbd_pckbport_softc *, int, int *); 183 184 185 /********************************************************************* 186 * Autoconfiguration 187 */ 188 189 static int 190 kbd_pckbport_match(struct device *parent, struct cfdata *cf, void *aux) 191 { 192 struct pckbport_attach_args *pa = aux; 193 194 if (pa->pa_slot != PCKBPORT_KBD_SLOT) 195 return (0); 196 197 return (1); 198 } 199 200 201 static void 202 kbd_pckbport_attach(struct device *parent, struct device *self, void *aux) 203 { 204 struct kbd_pckbport_softc *sc = (void *)self; 205 struct pckbport_attach_args *pa = aux; 206 struct kbd_softc *kbd = &sc->sc_kbd; 207 208 /* save our attachment to pckbport */ 209 sc->sc_kbctag = pa->pa_tag; 210 sc->sc_kbcslot = pa->pa_slot; 211 212 /* provide upper layer a link to our middle layer */ 213 kbd->k_ops = &kbd_ops_pckbport; 214 215 /* pre-fill keyboard type/layout */ 216 kbd->k_state.kbd_id = KB_SUN4; /* NB: type5 keyboards actually report type4 */ 217 kbd->k_state.kbd_layout = 19; /* US101A */ 218 219 if (1) { /* XXX: pckbport_machdep_cnattach should tell us */ 220 /* 221 * Hookup ourselves as the console input channel 222 */ 223 extern void kd_attach_input(struct cons_channel *); 224 struct cons_channel *cc; 225 226 if ((cc = kbd_cc_alloc(kbd)) == NULL) 227 return; 228 229 kd_attach_input(cc); /* XXX ???? */ 230 kbd->k_isconsole = 1; 231 printf(": console input"); 232 } 233 234 printf("\n"); 235 236 kbd_pckbport_set_xtscancode(sc->sc_kbctag, sc->sc_kbcslot); 237 238 /* slow down typematic (can't disable, grrr) */ 239 { 240 u_char cmd[2]; 241 int res; 242 243 cmd[0] = KBC_TYPEMATIC; 244 cmd[1] = 0x7f; /* 1s, 2/s */ 245 res = pckbport_poll_cmd(sc->sc_kbctag, sc->sc_kbcslot, 246 cmd, 2, 0, NULL, 0); 247 if (res) { 248 printf("%s: set typematic failed, error %d\n", 249 kbd->k_dev.dv_xname, res); 250 } 251 } 252 253 /* register our callback with pckbport interrupt handler */ 254 pckbport_set_inputhandler(sc->sc_kbctag, sc->sc_kbcslot, 255 kbd_pckbport_input, sc, 256 kbd->k_dev.dv_xname); 257 } 258 259 260 static int 261 kbd_pckbport_set_xtscancode(pckbport_tag_t kbctag, pckbport_slot_t kbcslot) 262 { 263 u_char cmd[2]; 264 int res; 265 266 /* 267 * Some keyboard/8042 combinations do not seem to work if the keyboard 268 * is set to table 1; in fact, it would appear that some keyboards just 269 * ignore the command altogether. So by default, we use the AT scan 270 * codes and have the 8042 translate them. Unfortunately, this is 271 * known to not work on some PS/2 machines. We try desparately to deal 272 * with this by checking the (lack of a) translate bit in the 8042 and 273 * attempting to set the keyboard to XT mode. If this all fails, well, 274 * tough luck. 275 * 276 * XXX It would perhaps be a better choice to just use AT scan codes 277 * and not bother with this. 278 */ 279 if (pckbport_xt_translation(kbctag, kbcslot, 1)) { 280 /* The 8042 is translating for us; use AT codes. */ 281 cmd[0] = KBC_SETTABLE; 282 cmd[1] = 2; 283 res = pckbport_poll_cmd(kbctag, kbcslot, cmd, 2, 0, 0, 0); 284 if (res) { 285 u_char resetcmd[1]; 286 #ifdef DEBUG 287 printf("pckbd: error setting scanset 2\n"); 288 #endif 289 /* 290 * XXX at least one keyboard is reported to lock up 291 * if a "set table" is attempted, thus the "reset". 292 * XXX ignore errors, scanset 2 should be 293 * default anyway. 294 */ 295 resetcmd[0] = KBC_RESET; 296 (void)pckbport_poll_cmd(kbctag, kbcslot, resetcmd, 297 1, 1, 0, 1); 298 pckbport_flush(kbctag, kbcslot); 299 res = 0; 300 } 301 } else { 302 /* Stupid 8042; set keyboard to XT codes. */ 303 cmd[0] = KBC_SETTABLE; 304 cmd[1] = 1; 305 res = pckbport_poll_cmd(kbctag, kbcslot, cmd, 2, 0, 0, 0); 306 #ifdef DEBUG 307 if (res) 308 printf("pckbd: error setting scanset 1\n"); 309 #endif 310 } 311 return (res); 312 } 313 314 315 /********************************************************************* 316 * /dev/kbd middle layer 317 */ 318 319 /* 320 * Initialization to be done at first open. 321 * This is called from kbdopen() or kd_cc_open() 322 * Called with user context. 323 */ 324 static int 325 kbd_pckbport_open(struct kbd_softc *kbd) 326 { 327 struct kbd_pckbport_softc *sc = (struct kbd_pckbport_softc *)kbd; 328 struct kbd_state *ks; 329 int error = 0; 330 331 if (kbd == NULL) { 332 DPRINTF(("kbd_pckbport_open: kbd == NULL\n")); 333 return (ENXIO); 334 } 335 336 ks = &kbd->k_state; 337 338 /* tolerate extra calls */ 339 if (sc->sc_isopen) 340 return (0); 341 342 /* open internal device */ 343 344 /* reset the keyboard (and enable interrupts?) */ 345 346 /* 347 * Initialize the table pointers for this type/layout. 348 * NB: fixed type/layout were preset during attach. 349 */ 350 kbd_xlate_init(ks); 351 352 if (error == 0) 353 sc->sc_isopen = 1; 354 return (error); 355 } 356 357 358 static int 359 kbd_pckbport_close(struct kbd_softc *kbd) 360 { 361 #if 0 362 struct kbd_pckbport_softc *k = (struct kbd_pckbport_softc *)kbd; 363 #endif 364 return (0); /* nothing to do so far */ 365 } 366 367 368 /* 369 * Upper layer talks sun keyboard protocol to us. 370 */ 371 /* ARGSUSED2 */ 372 static int 373 kbd_pckbport_do_cmd(struct kbd_softc *kbd, int suncmd, int isioctl) 374 { 375 int error = 0; 376 377 switch (suncmd) { 378 379 case KBD_CMD_BELL: /* FALLTHROUGH */ 380 case KBD_CMD_NOBELL: /* FALLTHROUGH */ 381 case KBD_CMD_CLICK: /* FALLTHROUGH */ 382 case KBD_CMD_NOCLICK: 383 /* not supported, do nothing */ 384 DPRINTF(("%s: ignoring KIOCCMD 0x%02x\n", 385 kbd->k_dev.dv_xname, suncmd)); 386 break; 387 388 default: 389 error = EINVAL; 390 break; 391 } 392 393 return (error); 394 } 395 396 /* ARGSUSED2 */ 397 static int 398 kbd_pckbport_set_leds(struct kbd_softc *kbd, int sunleds, int isioctl) 399 { 400 struct kbd_pckbport_softc *sc = (struct kbd_pckbport_softc *)kbd; 401 u_char pcleds; 402 u_char cmd[2]; 403 int res; 404 405 /* re-encode sun leds into pckbd leds */ 406 /* pckbd: 0 - scroll; 1 - num; 2 - caps */ 407 pcleds = 0; 408 if (sunleds & LED_SCROLL_LOCK) 409 pcleds |= 0x01; 410 if (sunleds & LED_NUM_LOCK) 411 pcleds |= 0x02; 412 if (sunleds & LED_CAPS_LOCK) 413 pcleds |= 0x04; 414 415 if (pcleds == sc->sc_pcleds) 416 return (0); 417 sc->sc_pcleds = pcleds; 418 DPRINTF(("leds: sun %x, pc %x\n", sunleds, pcleds)); 419 420 /* request the change */ 421 cmd[0] = KBC_MODEIND; 422 cmd[1] = pcleds; 423 if (isioctl) /* user called KIOCSLED */ 424 res = pckbport_enqueue_cmd(sc->sc_kbctag, sc->sc_kbcslot, 425 cmd, 2, 0, 1, NULL); 426 else /* console updates leds - called from interrupt handler */ 427 res = pckbport_poll_cmd(sc->sc_kbctag, sc->sc_kbcslot, 428 cmd, 2, 0, NULL, 0); 429 return (res); 430 } 431 432 433 /********************************************************************* 434 * /dev/kbd lower layer 435 */ 436 437 /* 438 * Got a receive interrupt - pckbport wants to give us a byte. 439 */ 440 static void 441 kbd_pckbport_input(void *vsc, int data) 442 { 443 struct kbd_pckbport_softc *sc = vsc; 444 struct kbd_softc *kbd = &sc->sc_kbd; 445 int sunkey; 446 447 /* convert to sun make/break code */ 448 if (!kbd_pckbport_decode(sc, data, &sunkey)) 449 return; 450 451 kbd_input(kbd, sunkey); 452 } 453 454 455 /* 456 * Plagiarized from pckbd_decode 457 */ 458 static int 459 kbd_pckbport_decode(struct kbd_pckbport_softc *sc, int data, int *sundata) 460 { 461 int key, up; 462 int sunkey; 463 464 /* XXX: DEBUG*/ 465 DPRINTF(("%s: %02x", sc->sc_kbd.k_dev.dv_xname, data)); 466 467 if (data == KBR_EXTENDED0) { 468 sc->sc_extended = 1; 469 DPRINTF(("\n")); 470 return (0); 471 } else if (data == KBR_EXTENDED1) { 472 sc->sc_extended1 = 2; 473 DPRINTF(("\n")); 474 return (0); 475 } 476 477 /* map extended keys to (unused) codes 128-254 */ 478 key = (data & 0x7f) | (sc->sc_extended ? 0x80 : 0); 479 sc->sc_extended = 0; 480 481 /* 482 * process BREAK key (EXT1 1D 45 EXT1 9D C5): 483 * map to (unused) code 7F 484 */ 485 if (sc->sc_extended1 == 2 && (data == 0x1d || data == 0x9d)) { 486 sc->sc_extended1 = 1; 487 DPRINTF(("\n")); 488 return (0); 489 } else if (sc->sc_extended1 == 1 490 && (data == 0x45 || data == 0xc5)) { 491 sc->sc_extended1 = 0; 492 key = 0x7f; 493 } else if (sc->sc_extended1 > 0) { 494 sc->sc_extended1 = 0; 495 } 496 497 if (data & 0x80) { 498 sc->sc_lastchar = 0; 499 up = 1; 500 } else { 501 /* always ignore typematic keys */ 502 if (key == sc->sc_lastchar) { 503 DPRINTF(("\n")); 504 return (0); 505 } 506 sc->sc_lastchar = key; 507 up = 0; 508 } 509 510 sunkey = kbd_pckbport_xt_to_sun[key]; 511 512 DPRINTF((" -> xt 0x%02x %s -> %d\n", 513 key, (up ? "up " : "down"), sunkey)); 514 515 if (up) 516 sunkey |= KBD_UP; 517 518 *sundata = sunkey; 519 return (1); 520 } 521 522 static const uint8_t kbd_pckbport_xt_to_sun[256] = { 523 /* 0x00 */ 0, /* */ 524 /* 0x01 */ 29, /* Esc */ 525 /* 0x02 */ 30, /* 1 */ 526 /* 0x03 */ 31, /* 2 */ 527 /* 0x04 */ 32, /* 3 */ 528 /* 0x05 */ 33, /* 4 */ 529 /* 0x06 */ 34, /* 5 */ 530 /* 0x07 */ 35, /* 6 */ 531 /* 0x08 */ 36, /* 7 */ 532 /* 0x09 */ 37, /* 8 */ 533 /* 0x0a */ 38, /* 9 */ 534 /* 0x0b */ 39, /* 0 */ 535 /* 0x0c */ 40, /* minus */ 536 /* 0x0d */ 41, /* equal */ 537 /* 0x0e */ 43, /* BackSpace */ 538 /* 0x0f */ 53, /* Tab */ 539 /* 0x10 */ 54, /* Q */ 540 /* 0x11 */ 55, /* W */ 541 /* 0x12 */ 56, /* E */ 542 /* 0x13 */ 57, /* R */ 543 /* 0x14 */ 58, /* T */ 544 /* 0x15 */ 59, /* Y */ 545 /* 0x16 */ 60, /* U */ 546 /* 0x17 */ 61, /* I */ 547 /* 0x18 */ 62, /* O */ 548 /* 0x19 */ 63, /* P */ 549 /* 0x1a */ 64, /* [ */ 550 /* 0x1b */ 65, /* ] */ 551 /* 0x1c */ 89, /* Return */ 552 /* 0x1d */ 76, /* Ctrl_L */ 553 /* 0x1e */ 77, /* A */ 554 /* 0x1f */ 78, /* S */ 555 /* 0x20 */ 79, /* D */ 556 /* 0x21 */ 80, /* F */ 557 /* 0x22 */ 81, /* G */ 558 /* 0x23 */ 82, /* H */ 559 /* 0x24 */ 83, /* J */ 560 /* 0x25 */ 84, /* K */ 561 /* 0x26 */ 85, /* L */ 562 /* 0x27 */ 86, /* ; */ 563 /* 0x28 */ 87, /* apostr. */ 564 /* 0x29 */ 42, /* grave/tilde */ 565 /* 0x2a */ 99, /* Shift_L */ 566 /* 0x2b */ 88, /* backslash */ 567 /* 0x2c */ 100, /* Z */ 568 /* 0x2d */ 101, /* X */ 569 /* 0x2e */ 102, /* C */ 570 /* 0x2f */ 103, /* V */ 571 /* 0x30 */ 104, /* B */ 572 /* 0x31 */ 105, /* N */ 573 /* 0x32 */ 106, /* M */ 574 /* 0x33 */ 107, /* , */ 575 /* 0x34 */ 108, /* . */ 576 /* 0x35 */ 109, /* / */ 577 /* 0x36 */ 110, /* Shift_R */ 578 /* 0x37 */ 47, /* R6/KP_Mult */ 579 /* 0x38 */ 120, /* Meta_L */ 580 /* 0x39 */ 121, /* SpaceBar */ 581 /* 0x3a */ 119, /* CapsLock */ 582 /* 0x3b */ 5, /* F1 */ 583 /* 0x3c */ 6, /* F2 */ 584 /* 0x3d */ 8, /* F3 */ 585 /* 0x3e */ 10, /* F4 */ 586 /* 0x3f */ 12, /* F5 */ 587 /* 0x40 */ 14, /* F6 */ 588 /* 0x41 */ 16, /* F7 */ 589 /* 0x42 */ 17, /* F8 */ 590 /* 0x43 */ 18, /* F9 */ 591 /* 0x44 */ 7, /* F10 */ 592 /* 0x45 */ 98, /* Num_Lock */ 593 /* 0x46 */ 0, /* */ /* scroll lock */ 594 /* 0x47 */ 68, /* R7/Home */ 595 /* 0x48 */ 69, /* R8/Up */ 596 /* 0x49 */ 70, /* R9/PgUp */ 597 /* 0x4a */ 71, /* KP_Minus */ 598 /* 0x4b */ 91, /* R10/Left */ 599 /* 0x4c */ 92, /* R11/KP_5 */ 600 /* 0x4d */ 93, /* R12/Right */ 601 /* 0x4e */ 125, /* KP_Add */ 602 /* 0x4f */ 112, /* R13/End */ 603 /* 0x50 */ 113, /* R14/Down */ 604 /* 0x51 */ 114, /* R15/PgDn */ 605 /* 0x52 */ 94, /* KP_Insert */ 606 /* 0x53 */ 50, /* KP_Delete */ 607 /* 0x54 */ 0, /* */ 608 /* 0x55 */ 0, /* */ 609 /* 0x56 */ 0, /* */ 610 /* 0x57 */ 9, /* F11 */ 611 /* 0x58 */ 11, /* F12 */ 612 /* 0x59 */ 0, /* */ 613 /* 0x5a */ 0, /* */ 614 /* 0x5b */ 0, /* */ 615 /* 0x5c */ 0, /* */ 616 /* 0x5d */ 0, /* */ 617 /* 0x5e */ 0, /* */ 618 /* 0x5f */ 0, /* */ 619 /* 0x60 */ 0, /* */ 620 /* 0x61 */ 0, /* */ 621 /* 0x62 */ 0, /* */ 622 /* 0x63 */ 0, /* */ 623 /* 0x64 */ 0, /* */ 624 /* 0x65 */ 0, /* */ 625 /* 0x66 */ 0, /* */ 626 /* 0x67 */ 0, /* */ 627 /* 0x68 */ 0, /* */ 628 /* 0x69 */ 0, /* */ 629 /* 0x6a */ 0, /* */ 630 /* 0x6b */ 0, /* */ 631 /* 0x6c */ 0, /* */ 632 /* 0x6d */ 0, /* */ 633 /* 0x6e */ 0, /* */ 634 /* 0x6f */ 0, /* */ 635 /* 0x70 */ 0, /* */ 636 /* 0x71 */ 0, /* */ 637 /* 0x72 */ 0, /* */ 638 /* 0x73 */ 0, /* */ 639 /* 0x74 */ 0, /* */ 640 /* 0x75 */ 0, /* */ 641 /* 0x76 */ 0, /* */ 642 /* 0x77 */ 0, /* */ 643 /* 0x78 */ 0, /* */ 644 /* 0x79 */ 0, /* */ 645 /* 0x7a */ 0, /* */ 646 /* 0x7b */ 0, /* */ 647 /* 0x7c */ 0, /* */ 648 /* 0x7d */ 0, /* */ 649 /* 0x7e */ 0, /* */ 650 /* 0x7f */ 23, /* R3/Break */ 651 652 /* 0x80 */ 0, /* */ 653 /* 0x81 */ 0, /* */ 654 /* 0x82 */ 0, /* */ 655 /* 0x83 */ 0, /* */ 656 /* 0x84 */ 0, /* */ 657 /* 0x85 */ 0, /* */ 658 /* 0x86 */ 0, /* */ 659 /* 0x87 */ 0, /* */ 660 /* 0x88 */ 0, /* */ 661 /* 0x89 */ 0, /* */ 662 /* 0x8a */ 0, /* */ 663 /* 0x8b */ 0, /* */ 664 /* 0x8c */ 0, /* */ 665 /* 0x8d */ 0, /* */ 666 /* 0x8e */ 0, /* */ 667 /* 0x8f */ 0, /* */ 668 /* 0x90 */ 0, /* */ 669 /* 0x91 */ 0, /* */ 670 /* 0x92 */ 0, /* */ 671 /* 0x93 */ 0, /* */ 672 /* 0x94 */ 0, /* */ 673 /* 0x95 */ 0, /* */ 674 /* 0x96 */ 0, /* */ 675 /* 0x97 */ 0, /* */ 676 /* 0x98 */ 0, /* */ 677 /* 0x99 */ 0, /* */ 678 /* 0x9a */ 0, /* */ 679 /* 0x9b */ 0, /* */ 680 /* 0x9c */ 90, /* KP_Enter */ 681 /* 0x9d */ 76, /* Ctrl_L */ /* XXX: Sun kbd has no Ctrl_R */ 682 /* 0x9e */ 0, /* */ 683 /* 0x9f */ 0, /* */ 684 /* 0xa0 */ 0, /* */ 685 /* 0xa1 */ 0, /* */ 686 /* 0xa2 */ 0, /* */ 687 /* 0xa3 */ 0, /* */ 688 /* 0xa4 */ 0, /* */ 689 /* 0xa5 */ 0, /* */ 690 /* 0xa6 */ 0, /* */ 691 /* 0xa7 */ 0, /* */ 692 /* 0xa8 */ 0, /* */ 693 /* 0xa9 */ 0, /* */ 694 /* 0xaa */ 0, /* */ 695 /* 0xab */ 0, /* */ 696 /* 0xac */ 0, /* */ 697 /* 0xad */ 0, /* */ 698 /* 0xae */ 0, /* */ 699 /* 0xaf */ 0, /* */ 700 /* 0xb0 */ 0, /* */ 701 /* 0xb1 */ 0, /* */ 702 /* 0xb2 */ 0, /* */ 703 /* 0xb3 */ 0, /* */ 704 /* 0xb4 */ 0, /* */ 705 /* 0xb5 */ 46, /* R5/KP_Div */ 706 /* 0xb6 */ 0, /* */ 707 /* 0xb7 */ 0, /* */ 708 /* 0xb8 */ 122, /* Meta_R */ 709 /* 0xb9 */ 0, /* */ 710 /* 0xba */ 0, /* */ 711 /* 0xbb */ 0, /* */ 712 /* 0xbc */ 0, /* */ 713 /* 0xbd */ 0, /* */ 714 /* 0xbe */ 0, /* */ 715 /* 0xbf */ 0, /* */ 716 /* 0xc0 */ 0, /* */ 717 /* 0xc1 */ 0, /* */ 718 /* 0xc2 */ 0, /* */ 719 /* 0xc3 */ 0, /* */ 720 /* 0xc4 */ 0, /* */ 721 /* 0xc5 */ 0, /* */ 722 /* 0xc6 */ 0, /* */ 723 /* 0xc7 */ 52, /* - T5_Home */ 724 /* 0xc8 */ 20, /* T5_Up */ 725 /* 0xc9 */ 96, /* - T5_PgUp */ 726 /* 0xca */ 0, /* */ 727 /* 0xcb */ 24, /* T5_Left */ 728 /* 0xcc */ 0, /* */ 729 /* 0xcd */ 28, /* T5_Right */ 730 /* 0xce */ 0, /* */ 731 /* 0xcf */ 74, /* - T5_End */ 732 /* 0xd0 */ 27, /* T5_Down */ 733 /* 0xd1 */ 123, /* - T5_PgDn */ 734 /* 0xd2 */ 44, /* - T5_Insert */ 735 /* 0xd3 */ 66, /* Delete */ 736 /* 0xd4 */ 0, /* */ 737 /* 0xd5 */ 0, /* */ 738 /* 0xd6 */ 0, /* */ 739 /* 0xd7 */ 0, /* */ 740 /* 0xd8 */ 0, /* */ 741 /* 0xd9 */ 0, /* */ 742 /* 0xda */ 0, /* */ 743 /* 0xdb */ 19, /* Alt_L */ /* left flying window */ 744 /* 0xdc */ 0, /* */ /* right flying window */ 745 /* 0xdd */ 0, /* */ /* (right) menu key */ 746 /* 0xde */ 0, /* */ 747 /* 0xdf */ 0, /* */ 748 /* 0xe0 */ 0, /* */ 749 /* 0xe1 */ 0, /* */ 750 /* 0xe2 */ 0, /* */ 751 /* 0xe3 */ 0, /* */ 752 /* 0xe4 */ 0, /* */ 753 /* 0xe5 */ 0, /* */ 754 /* 0xe6 */ 0, /* */ 755 /* 0xe7 */ 0, /* */ 756 /* 0xe8 */ 0, /* */ 757 /* 0xe9 */ 0, /* */ 758 /* 0xea */ 0, /* */ 759 /* 0xeb */ 0, /* */ 760 /* 0xec */ 0, /* */ 761 /* 0xed */ 0, /* */ 762 /* 0xee */ 0, /* */ 763 /* 0xef */ 0, /* */ 764 /* 0xf0 */ 0, /* */ 765 /* 0xf1 */ 0, /* */ 766 /* 0xf2 */ 0, /* */ 767 /* 0xf3 */ 0, /* */ 768 /* 0xf4 */ 0, /* */ 769 /* 0xf5 */ 0, /* */ 770 /* 0xf6 */ 0, /* */ 771 /* 0xf7 */ 0, /* */ 772 /* 0xf8 */ 0, /* */ 773 /* 0xf9 */ 0, /* */ 774 /* 0xfa */ 0, /* */ 775 /* 0xfb */ 0, /* */ 776 /* 0xfc */ 0, /* */ 777 /* 0xfd */ 0, /* */ 778 /* 0xfe */ 0, /* */ 779 /* 0xff */ 0 /* */ 780 }; /* kbd_pckbport_xt_to_sun */ 781