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