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