xref: /netbsd-src/sys/arch/sparc/dev/kbd_pckbport.c (revision bf1e9b32e27832f0c493206710fb8b58a980838a)
1 /*	$NetBSD: kbd_pckbport.c,v 1.2 2005/06/16 17:04:53 jmc 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.2 2005/06/16 17:04:53 jmc 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 resetcmd[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 			resetcmd[0] = KBC_RESET;
306 			(void)pckbport_poll_cmd(kbctag, kbcslot, resetcmd,
307 			    1, 1, 0, 1);
308 			pckbport_flush(kbctag, kbcslot);
309 			res = 0;
310 		}
311 	} else {
312 		/* Stupid 8042; set keyboard to XT codes. */
313 		cmd[0] = KBC_SETTABLE;
314 		cmd[1] = 1;
315 		res = pckbport_poll_cmd(kbctag, kbcslot, cmd, 2, 0, 0, 0);
316 #ifdef DEBUG
317 		if (res)
318 			printf("pckbd: error setting scanset 1\n");
319 #endif
320 	}
321 	return (res);
322 }
323 
324 
325 /*********************************************************************
326  *			/dev/kbd middle layer
327  */
328 
329 /*
330  * Initialization to be done at first open.
331  * This is called from kbdopen() or kd_cc_open()
332  * Called with user context.
333  */
334 static int
335 kbd_pckbport_open(kbd)
336 	struct kbd_softc *kbd;
337 {
338 	struct kbd_pckbport_softc *sc = (struct kbd_pckbport_softc *)kbd;
339 	struct kbd_state *ks;
340 	int error = 0;
341 
342 	if (kbd == NULL) {
343 		DPRINTF(("kbd_pckbport_open: kbd == NULL\n"));
344 		return (ENXIO);
345 	}
346 
347 	ks = &kbd->k_state;
348 
349 	/* tolerate extra calls */
350 	if (sc->sc_isopen)
351 		return (0);
352 
353 	/* open internal device */
354 
355 	/* reset the keyboard (and enable interrupts?) */
356 
357 	/*
358 	 * Initialize the table pointers for this type/layout.
359 	 * NB: fixed type/layout were preset during attach.
360 	 */
361 	kbd_xlate_init(ks);
362 
363 	if (error == 0)
364 		sc->sc_isopen = 1;
365 	return (error);
366 }
367 
368 
369 static int
370 kbd_pckbport_close(kbd)
371 	struct kbd_softc *kbd;
372 {
373 #if 0
374 	struct kbd_pckbport_softc *k = (struct kbd_pckbport_softc *)kbd;
375 #endif
376 	return (0);		/* nothing to do so far */
377 }
378 
379 
380 /*
381  * Upper layer talks sun keyboard protocol to us.
382  */
383 /* ARGSUSED2 */
384 static int
385 kbd_pckbport_do_cmd(kbd, suncmd, isioctl)
386 	struct kbd_softc *kbd;
387 	int suncmd;
388 	int isioctl;
389 {
390 	int error = 0;
391 
392 	switch (suncmd) {
393 
394 	case KBD_CMD_BELL:	/* FALLTHROUGH */
395 	case KBD_CMD_NOBELL:	/* FALLTHROUGH */
396 	case KBD_CMD_CLICK:	/* FALLTHROUGH */
397 	case KBD_CMD_NOCLICK:
398 		/* not supported, do nothing */
399 		DPRINTF(("%s: ignoring KIOCCMD 0x%02x\n",
400 			 kbd->k_dev.dv_xname, suncmd));
401 		break;
402 
403 	default:
404 		error = EINVAL;
405 		break;
406 	}
407 
408 	return (error);
409 }
410 
411 /* ARGSUSED2 */
412 static int
413 kbd_pckbport_set_leds(kbd, sunleds, isioctl)
414 	struct kbd_softc *kbd;
415 	int sunleds;
416 	int isioctl;
417 {
418 	struct kbd_pckbport_softc *sc = (struct kbd_pckbport_softc *)kbd;
419 	u_char pcleds;
420 	u_char cmd[2];
421 	int res;
422 
423 	/* re-encode sun leds into pckbd leds */
424 	/* pckbd: 0 - scroll; 1 - num; 2 - caps */
425 	pcleds = 0;
426 	if (sunleds & LED_SCROLL_LOCK)
427 		pcleds |= 0x01;
428 	if (sunleds & LED_NUM_LOCK)
429 		pcleds |= 0x02;
430 	if (sunleds & LED_CAPS_LOCK)
431 		pcleds |= 0x04;
432 
433 	if (pcleds == sc->sc_pcleds)
434 		return (0);
435 	sc->sc_pcleds = pcleds;
436 	DPRINTF(("leds: sun %x, pc %x\n", sunleds, pcleds));
437 
438 	/* request the change */
439 	cmd[0] = KBC_MODEIND;
440 	cmd[1] = pcleds;
441 	if (isioctl) /* user called KIOCSLED */
442 	    res = pckbport_enqueue_cmd(sc->sc_kbctag, sc->sc_kbcslot,
443 				    cmd, 2, 0, 1, NULL);
444 	else /* console updates leds - called from interrupt handler */
445 	    res = pckbport_poll_cmd(sc->sc_kbctag, sc->sc_kbcslot,
446 				 cmd, 2, 0, NULL, 0);
447 	return (res);
448 }
449 
450 
451 /*********************************************************************
452  *			 /dev/kbd lower layer
453  */
454 
455 /*
456  * Got a receive interrupt - pckbport wants to give us a byte.
457  */
458 static void
459 kbd_pckbport_input(vsc, data)
460 	void *vsc;
461 	int data;
462 {
463 	struct kbd_pckbport_softc *sc = vsc;
464 	struct kbd_softc *kbd = &sc->sc_kbd;
465 	int sunkey;
466 
467 	/* convert to sun make/break code */
468 	if (!kbd_pckbport_decode(sc, data, &sunkey))
469 		return;
470 
471 	kbd_input(kbd, sunkey);
472 }
473 
474 
475 /*
476  * Plagiarized from pckbd_decode
477  */
478 static int
479 kbd_pckbport_decode(sc, data, sundata)
480     	struct kbd_pckbport_softc *sc;
481 	int data;
482 	int *sundata;
483 {
484 	int key, up;
485 	int sunkey;
486 
487 	/* XXX: DEBUG*/
488 	DPRINTF(("%s: %02x", sc->sc_kbd.k_dev.dv_xname, data));
489 
490 	if (data == KBR_EXTENDED0) {
491 		sc->sc_extended = 1;
492 		DPRINTF(("\n"));
493 		return (0);
494 	} else if (data == KBR_EXTENDED1) {
495 		sc->sc_extended1 = 2;
496 		DPRINTF(("\n"));
497 		return (0);
498 	}
499 
500  	/* map extended keys to (unused) codes 128-254 */
501 	key = (data & 0x7f) | (sc->sc_extended ? 0x80 : 0);
502 	sc->sc_extended = 0;
503 
504 	/*
505 	 * process BREAK key (EXT1 1D 45  EXT1 9D C5):
506 	 * map to (unused) code 7F
507 	 */
508 	if (sc->sc_extended1 == 2 && (data == 0x1d || data == 0x9d)) {
509 		sc->sc_extended1 = 1;
510 		DPRINTF(("\n"));
511 		return (0);
512 	} else if (sc->sc_extended1 == 1
513 		   && (data == 0x45 || data == 0xc5)) {
514 		sc->sc_extended1 = 0;
515 		key = 0x7f;
516 	} else if (sc->sc_extended1 > 0) {
517 		sc->sc_extended1 = 0;
518 	}
519 
520 	if (data & 0x80) {
521 		sc->sc_lastchar = 0;
522 		up = 1;
523 	} else {
524 		/* always ignore typematic keys */
525 		if (key == sc->sc_lastchar) {
526 			DPRINTF(("\n"));
527 			return (0);
528 		}
529 		sc->sc_lastchar = key;
530 		up = 0;
531 	}
532 
533 
534 	sunkey = kbd_pckbport_xt_to_sun[key];
535 
536 	DPRINTF((" -> xt 0x%02x %s -> %d\n",
537 		 key, (up ? "up  " : "down"),  sunkey));
538 
539 	if (up)
540 		sunkey |= KBD_UP;
541 
542 	*sundata = sunkey;
543 	return (1);
544 }
545 
546 static const u_int8_t kbd_pckbport_xt_to_sun[256] = {
547 /* 0x00 */   0,	/*             */
548 /* 0x01 */  29,	/* Esc         */
549 /* 0x02 */  30,	/* 1           */
550 /* 0x03 */  31,	/* 2           */
551 /* 0x04 */  32,	/* 3           */
552 /* 0x05 */  33,	/* 4           */
553 /* 0x06 */  34,	/* 5           */
554 /* 0x07 */  35,	/* 6           */
555 /* 0x08 */  36,	/* 7           */
556 /* 0x09 */  37,	/* 8           */
557 /* 0x0a */  38,	/* 9           */
558 /* 0x0b */  39,	/* 0           */
559 /* 0x0c */  40,	/* minus       */
560 /* 0x0d */  41,	/* equal       */
561 /* 0x0e */  43,	/* BackSpace   */
562 /* 0x0f */  53,	/* Tab         */
563 /* 0x10 */  54,	/* Q           */
564 /* 0x11 */  55,	/* W           */
565 /* 0x12 */  56,	/* E           */
566 /* 0x13 */  57,	/* R           */
567 /* 0x14 */  58,	/* T           */
568 /* 0x15 */  59,	/* Y           */
569 /* 0x16 */  60,	/* U           */
570 /* 0x17 */  61,	/* I           */
571 /* 0x18 */  62,	/* O           */
572 /* 0x19 */  63,	/* P           */
573 /* 0x1a */  64,	/* [           */
574 /* 0x1b */  65,	/* ]           */
575 /* 0x1c */  89,	/* Return      */
576 /* 0x1d */  76,	/* Ctrl_L      */
577 /* 0x1e */  77,	/* A           */
578 /* 0x1f */  78,	/* S           */
579 /* 0x20 */  79,	/* D           */
580 /* 0x21 */  80,	/* F           */
581 /* 0x22 */  81,	/* G           */
582 /* 0x23 */  82,	/* H           */
583 /* 0x24 */  83,	/* J           */
584 /* 0x25 */  84,	/* K           */
585 /* 0x26 */  85,	/* L           */
586 /* 0x27 */  86,	/* ;           */
587 /* 0x28 */  87,	/* apostr.     */
588 /* 0x29 */  42,	/* grave/tilde */
589 /* 0x2a */  99,	/* Shift_L     */
590 /* 0x2b */  88,	/* backslash   */
591 /* 0x2c */ 100,	/* Z           */
592 /* 0x2d */ 101,	/* X           */
593 /* 0x2e */ 102,	/* C           */
594 /* 0x2f */ 103,	/* V           */
595 /* 0x30 */ 104,	/* B           */
596 /* 0x31 */ 105,	/* N           */
597 /* 0x32 */ 106,	/* M           */
598 /* 0x33 */ 107,	/* ,           */
599 /* 0x34 */ 108,	/* .           */
600 /* 0x35 */ 109,	/* /           */
601 /* 0x36 */ 110,	/* Shift_R     */
602 /* 0x37 */  47,	/* R6/KP_Mult  */
603 /* 0x38 */ 120,	/* Meta_L      */
604 /* 0x39 */ 121,	/* SpaceBar    */
605 /* 0x3a */ 119,	/* CapsLock    */
606 /* 0x3b */   5,	/* F1          */
607 /* 0x3c */   6,	/* F2          */
608 /* 0x3d */   8,	/* F3          */
609 /* 0x3e */  10,	/* F4          */
610 /* 0x3f */  12,	/* F5          */
611 /* 0x40 */  14,	/* F6          */
612 /* 0x41 */  16,	/* F7          */
613 /* 0x42 */  17,	/* F8          */
614 /* 0x43 */  18,	/* F9          */
615 /* 0x44 */   7,	/* F10         */
616 /* 0x45 */  98,	/* Num_Lock    */
617 /* 0x46 */   0,	/*             */	/* scroll lock */
618 /* 0x47 */  68,	/* R7/Home     */
619 /* 0x48 */  69,	/* R8/Up       */
620 /* 0x49 */  70,	/* R9/PgUp     */
621 /* 0x4a */  71,	/* KP_Minus    */
622 /* 0x4b */  91,	/* R10/Left    */
623 /* 0x4c */  92,	/* R11/KP_5    */
624 /* 0x4d */  93,	/* R12/Right   */
625 /* 0x4e */ 125,	/* KP_Add      */
626 /* 0x4f */ 112,	/* R13/End     */
627 /* 0x50 */ 113,	/* R14/Down    */
628 /* 0x51 */ 114,	/* R15/PgDn    */
629 /* 0x52 */  94,	/* KP_Insert   */
630 /* 0x53 */  50,	/* KP_Delete   */
631 /* 0x54 */   0,	/*             */
632 /* 0x55 */   0,	/*             */
633 /* 0x56 */   0,	/*             */
634 /* 0x57 */   9,	/* F11         */
635 /* 0x58 */  11,	/* F12         */
636 /* 0x59 */   0,	/*             */
637 /* 0x5a */   0,	/*             */
638 /* 0x5b */   0,	/*             */
639 /* 0x5c */   0,	/*             */
640 /* 0x5d */   0,	/*             */
641 /* 0x5e */   0,	/*             */
642 /* 0x5f */   0,	/*             */
643 /* 0x60 */   0,	/*             */
644 /* 0x61 */   0,	/*             */
645 /* 0x62 */   0,	/*             */
646 /* 0x63 */   0,	/*             */
647 /* 0x64 */   0,	/*             */
648 /* 0x65 */   0,	/*             */
649 /* 0x66 */   0,	/*             */
650 /* 0x67 */   0,	/*             */
651 /* 0x68 */   0,	/*             */
652 /* 0x69 */   0,	/*             */
653 /* 0x6a */   0,	/*             */
654 /* 0x6b */   0,	/*             */
655 /* 0x6c */   0,	/*             */
656 /* 0x6d */   0,	/*             */
657 /* 0x6e */   0,	/*             */
658 /* 0x6f */   0,	/*             */
659 /* 0x70 */   0,	/*             */
660 /* 0x71 */   0,	/*             */
661 /* 0x72 */   0,	/*             */
662 /* 0x73 */   0,	/*             */
663 /* 0x74 */   0,	/*             */
664 /* 0x75 */   0,	/*             */
665 /* 0x76 */   0,	/*             */
666 /* 0x77 */   0,	/*             */
667 /* 0x78 */   0,	/*             */
668 /* 0x79 */   0,	/*             */
669 /* 0x7a */   0,	/*             */
670 /* 0x7b */   0,	/*             */
671 /* 0x7c */   0,	/*             */
672 /* 0x7d */   0,	/*             */
673 /* 0x7e */   0,	/*             */
674 /* 0x7f */  23,	/* R3/Break    */
675 
676 /* 0x80 */   0,	/*             */
677 /* 0x81 */   0,	/*             */
678 /* 0x82 */   0,	/*             */
679 /* 0x83 */   0,	/*             */
680 /* 0x84 */   0,	/*             */
681 /* 0x85 */   0,	/*             */
682 /* 0x86 */   0,	/*             */
683 /* 0x87 */   0,	/*             */
684 /* 0x88 */   0,	/*             */
685 /* 0x89 */   0,	/*             */
686 /* 0x8a */   0,	/*             */
687 /* 0x8b */   0,	/*             */
688 /* 0x8c */   0,	/*             */
689 /* 0x8d */   0,	/*             */
690 /* 0x8e */   0,	/*             */
691 /* 0x8f */   0,	/*             */
692 /* 0x90 */   0,	/*             */
693 /* 0x91 */   0,	/*             */
694 /* 0x92 */   0,	/*             */
695 /* 0x93 */   0,	/*             */
696 /* 0x94 */   0,	/*             */
697 /* 0x95 */   0,	/*             */
698 /* 0x96 */   0,	/*             */
699 /* 0x97 */   0,	/*             */
700 /* 0x98 */   0,	/*             */
701 /* 0x99 */   0,	/*             */
702 /* 0x9a */   0,	/*             */
703 /* 0x9b */   0,	/*             */
704 /* 0x9c */  90,	/* KP_Enter    */
705 /* 0x9d */  76,	/* Ctrl_L      */	/* XXX: Sun kbd has no Ctrl_R */
706 /* 0x9e */   0,	/*             */
707 /* 0x9f */   0,	/*             */
708 /* 0xa0 */   0,	/*             */
709 /* 0xa1 */   0,	/*             */
710 /* 0xa2 */   0,	/*             */
711 /* 0xa3 */   0,	/*             */
712 /* 0xa4 */   0,	/*             */
713 /* 0xa5 */   0,	/*             */
714 /* 0xa6 */   0,	/*             */
715 /* 0xa7 */   0,	/*             */
716 /* 0xa8 */   0,	/*             */
717 /* 0xa9 */   0,	/*             */
718 /* 0xaa */   0,	/*             */
719 /* 0xab */   0,	/*             */
720 /* 0xac */   0,	/*             */
721 /* 0xad */   0,	/*             */
722 /* 0xae */   0,	/*             */
723 /* 0xaf */   0,	/*             */
724 /* 0xb0 */   0,	/*             */
725 /* 0xb1 */   0,	/*             */
726 /* 0xb2 */   0,	/*             */
727 /* 0xb3 */   0,	/*             */
728 /* 0xb4 */   0,	/*             */
729 /* 0xb5 */  46,	/* R5/KP_Div   */
730 /* 0xb6 */   0,	/*             */
731 /* 0xb7 */   0,	/*             */
732 /* 0xb8 */ 122,	/* Meta_R      */
733 /* 0xb9 */   0,	/*             */
734 /* 0xba */   0,	/*             */
735 /* 0xbb */   0,	/*             */
736 /* 0xbc */   0,	/*             */
737 /* 0xbd */   0,	/*             */
738 /* 0xbe */   0,	/*             */
739 /* 0xbf */   0,	/*             */
740 /* 0xc0 */   0,	/*             */
741 /* 0xc1 */   0,	/*             */
742 /* 0xc2 */   0,	/*             */
743 /* 0xc3 */   0,	/*             */
744 /* 0xc4 */   0,	/*             */
745 /* 0xc5 */   0,	/*             */
746 /* 0xc6 */   0,	/*             */
747 /* 0xc7 */  52,	/* - T5_Home   */
748 /* 0xc8 */  20,	/* T5_Up       */
749 /* 0xc9 */  96,	/* - T5_PgUp   */
750 /* 0xca */   0,	/*             */
751 /* 0xcb */  24,	/* T5_Left     */
752 /* 0xcc */   0,	/*             */
753 /* 0xcd */  28,	/* T5_Right    */
754 /* 0xce */   0,	/*             */
755 /* 0xcf */  74,	/* - T5_End    */
756 /* 0xd0 */  27,	/* T5_Down     */
757 /* 0xd1 */ 123,	/* - T5_PgDn   */
758 /* 0xd2 */  44,	/* - T5_Insert */
759 /* 0xd3 */  66,	/* Delete      */
760 /* 0xd4 */   0,	/*             */
761 /* 0xd5 */   0,	/*             */
762 /* 0xd6 */   0,	/*             */
763 /* 0xd7 */   0,	/*             */
764 /* 0xd8 */   0,	/*             */
765 /* 0xd9 */   0,	/*             */
766 /* 0xda */   0,	/*             */
767 /* 0xdb */  19,	/* Alt_L       */	/* left flying window */
768 /* 0xdc */   0,	/*             */	/* right flying window */
769 /* 0xdd */   0,	/*             */	/* (right) menu key */
770 /* 0xde */   0,	/*             */
771 /* 0xdf */   0,	/*             */
772 /* 0xe0 */   0,	/*             */
773 /* 0xe1 */   0,	/*             */
774 /* 0xe2 */   0,	/*             */
775 /* 0xe3 */   0,	/*             */
776 /* 0xe4 */   0,	/*             */
777 /* 0xe5 */   0,	/*             */
778 /* 0xe6 */   0,	/*             */
779 /* 0xe7 */   0,	/*             */
780 /* 0xe8 */   0,	/*             */
781 /* 0xe9 */   0,	/*             */
782 /* 0xea */   0,	/*             */
783 /* 0xeb */   0,	/*             */
784 /* 0xec */   0,	/*             */
785 /* 0xed */   0,	/*             */
786 /* 0xee */   0,	/*             */
787 /* 0xef */   0,	/*             */
788 /* 0xf0 */   0,	/*             */
789 /* 0xf1 */   0,	/*             */
790 /* 0xf2 */   0,	/*             */
791 /* 0xf3 */   0,	/*             */
792 /* 0xf4 */   0,	/*             */
793 /* 0xf5 */   0,	/*             */
794 /* 0xf6 */   0,	/*             */
795 /* 0xf7 */   0,	/*             */
796 /* 0xf8 */   0,	/*             */
797 /* 0xf9 */   0,	/*             */
798 /* 0xfa */   0,	/*             */
799 /* 0xfb */   0,	/*             */
800 /* 0xfc */   0,	/*             */
801 /* 0xfd */   0,	/*             */
802 /* 0xfe */   0,	/*             */
803 /* 0xff */   0	/*             */
804 }; /* kbd_pckbport_xt_to_sun */
805