Home | History | Annotate | Line # | Download | only in dev
kbd.c revision 1.21
      1  1.21       is /*	$NetBSD: kbd.c,v 1.21 1996/05/16 17:50:25 is Exp $	*/
      2  1.11      cgd 
      3   1.1       mw /*
      4   1.1       mw  * Copyright (c) 1982, 1986, 1990 The Regents of the University of California.
      5   1.1       mw  * All rights reserved.
      6   1.1       mw  *
      7   1.1       mw  * Redistribution and use in source and binary forms, with or without
      8   1.1       mw  * modification, are permitted provided that the following conditions
      9   1.1       mw  * are met:
     10   1.1       mw  * 1. Redistributions of source code must retain the above copyright
     11   1.1       mw  *    notice, this list of conditions and the following disclaimer.
     12   1.1       mw  * 2. Redistributions in binary form must reproduce the above copyright
     13   1.1       mw  *    notice, this list of conditions and the following disclaimer in the
     14   1.1       mw  *    documentation and/or other materials provided with the distribution.
     15   1.1       mw  * 3. All advertising materials mentioning features or use of this software
     16   1.1       mw  *    must display the following acknowledgement:
     17   1.1       mw  *	This product includes software developed by the University of
     18   1.1       mw  *	California, Berkeley and its contributors.
     19   1.1       mw  * 4. Neither the name of the University nor the names of its contributors
     20   1.1       mw  *    may be used to endorse or promote products derived from this software
     21   1.1       mw  *    without specific prior written permission.
     22   1.1       mw  *
     23   1.1       mw  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
     24   1.1       mw  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
     25   1.1       mw  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
     26   1.1       mw  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
     27   1.1       mw  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
     28   1.1       mw  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
     29   1.1       mw  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
     30   1.1       mw  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
     31   1.1       mw  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
     32   1.1       mw  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
     33   1.1       mw  * SUCH DAMAGE.
     34   1.1       mw  *
     35   1.4       mw  *	kbd.c
     36   1.1       mw  */
     37   1.7   chopps #include <sys/param.h>
     38   1.7   chopps #include <sys/systm.h>
     39   1.9   chopps #include <sys/device.h>
     40   1.7   chopps #include <sys/ioctl.h>
     41   1.7   chopps #include <sys/tty.h>
     42   1.7   chopps #include <sys/proc.h>
     43   1.7   chopps #include <sys/file.h>
     44   1.7   chopps #include <sys/kernel.h>
     45   1.7   chopps #include <sys/syslog.h>
     46  1.18    veego #include <sys/signalvar.h>
     47   1.8   chopps #include <dev/cons.h>
     48   1.7   chopps #include <machine/cpu.h>
     49   1.9   chopps #include <amiga/amiga/device.h>
     50   1.7   chopps #include <amiga/amiga/custom.h>
     51  1.19       is #ifdef DRACO
     52  1.19       is #include <amiga/amiga/drcustom.h>
     53  1.19       is #endif
     54   1.7   chopps #include <amiga/amiga/cia.h>
     55   1.9   chopps #include <amiga/dev/itevar.h>
     56   1.9   chopps #include <amiga/dev/kbdreg.h>
     57  1.18    veego #include <amiga/dev/kbdmap.h>
     58   1.7   chopps #include <amiga/dev/event_var.h>
     59   1.7   chopps #include <amiga/dev/vuid_event.h>
     60   1.9   chopps #include "kbd.h"
     61   1.5       mw 
     62  1.18    veego #include <sys/conf.h>
     63  1.18    veego #include <machine/conf.h>
     64  1.18    veego 
     65   1.5       mw struct kbd_softc {
     66   1.9   chopps 	int k_event_mode;	/* if true, collect events, else pass to ite */
     67   1.9   chopps 	struct evvar k_events;	/* event queue state */
     68  1.19       is #ifdef DRACO
     69  1.19       is 	u_char k_rlprfx;	/* MF-II rel. prefix has been seen */
     70  1.19       is #endif
     71   1.9   chopps };
     72   1.9   chopps struct kbd_softc kbd_softc;
     73   1.9   chopps 
     74  1.17   mhitch int kbdmatch __P((struct device *, void *, void *));
     75  1.17   mhitch void kbdattach __P((struct device *, struct device *, void *));
     76  1.18    veego void kbdintr __P((int));
     77  1.19       is void kbdstuffchar __P((u_char));
     78   1.9   chopps 
     79  1.16  thorpej struct cfattach kbd_ca = {
     80  1.16  thorpej 	sizeof(struct device), kbdmatch, kbdattach
     81  1.16  thorpej };
     82  1.16  thorpej 
     83  1.16  thorpej struct cfdriver kbd_cd = {
     84  1.16  thorpej 	NULL, "kbd", DV_DULL, NULL, 0
     85  1.16  thorpej };
     86   1.9   chopps 
     87   1.9   chopps /*ARGSUSED*/
     88   1.9   chopps int
     89  1.16  thorpej kbdmatch(pdp, match, auxp)
     90   1.9   chopps 	struct device *pdp;
     91  1.16  thorpej 	void *match, *auxp;
     92   1.9   chopps {
     93  1.16  thorpej 
     94   1.9   chopps 	if (matchname((char *)auxp, "kbd"))
     95   1.9   chopps 		return(1);
     96   1.9   chopps 	return(0);
     97   1.9   chopps }
     98   1.9   chopps 
     99   1.9   chopps /*ARGSUSED*/
    100   1.9   chopps void
    101   1.9   chopps kbdattach(pdp, dp, auxp)
    102   1.9   chopps 	struct device *pdp, *dp;
    103   1.9   chopps 	void *auxp;
    104   1.9   chopps {
    105  1.19       is #ifdef DRACO
    106  1.19       is 	/*
    107  1.19       is 	 * XXX Must be kept in sync with kbdenable() switch.
    108  1.19       is 	 * XXX This should be probed, but this way we dont need to initialize
    109  1.19       is 	 * the keyboards.
    110  1.19       is 	 */
    111  1.19       is 	switch (is_draco()) {
    112  1.19       is 		case 0:
    113  1.19       is 		case 1:
    114  1.19       is 		case 2:
    115  1.19       is 			printf(": CIA A type Amiga\n");
    116  1.19       is 			break;
    117  1.19       is 		case 3:
    118  1.19       is 		case 4:
    119  1.19       is 		default:
    120  1.19       is 			printf(": QuickLogic type MF-II\n");
    121  1.19       is 			break;
    122  1.19       is 	}
    123  1.19       is #else
    124  1.19       is 	printf(": CIA A type Amiga\n");
    125  1.19       is #endif
    126  1.19       is 
    127   1.9   chopps }
    128   1.5       mw 
    129   1.5       mw /* definitions for amiga keyboard encoding. */
    130   1.5       mw #define KEY_CODE(c)  ((c) & 0x7f)
    131   1.5       mw #define KEY_UP(c)    ((c) & 0x80)
    132   1.5       mw 
    133   1.1       mw void
    134  1.18    veego kbdenable()
    135   1.1       mw {
    136   1.9   chopps 	int s;
    137  1.21       is #ifdef DRACO
    138  1.21       is 	u_char c;
    139  1.21       is #endif
    140   1.9   chopps 	/*
    141   1.9   chopps 	 * collides with external ints from SCSI, watch out for this when
    142   1.9   chopps 	 * enabling/disabling interrupts there !!
    143   1.9   chopps 	 */
    144   1.9   chopps 	s = spltty();
    145  1.19       is #ifdef DRACO
    146  1.19       is 	switch (is_draco()) {
    147  1.19       is 		case 0:
    148  1.19       is 			custom.intena = INTF_SETCLR | INTF_PORTS;
    149  1.19       is 
    150  1.19       is 			ciaa.icr = CIA_ICR_IR_SC | CIA_ICR_SP;
    151  1.19       is 						/* SP interrupt enable */
    152  1.19       is 			ciaa.cra &= ~(1<<6);	/* serial line == input */
    153  1.19       is 			printf("ok.\n");
    154  1.19       is 			break;
    155  1.19       is 		case 1:
    156  1.19       is 		case 2:
    157  1.19       is 			/* XXX: tobedone: conditionally enable that one */
    158  1.19       is 			/* XXX: for now, just enable DraCo ports and CIA */
    159  1.19       is 			*draco_intena |= DRIRQ_INT2;
    160  1.19       is 			ciaa.icr = CIA_ICR_IR_SC | CIA_ICR_SP;
    161  1.19       is 						/* SP interrupt enable */
    162  1.19       is 			ciaa.cra &= ~(1<<6);	/* serial line == input */
    163  1.19       is 			break;
    164  1.19       is 
    165  1.19       is 		case 3:
    166  1.19       is 			ciaa.icr = CIA_ICR_SP;  /* CIA SP interrupt disable */
    167  1.19       is 			ciaa.cra &= ~(1<<6);	/* serial line == input */
    168  1.19       is 			/* FALLTHROUGH */
    169  1.19       is 		case 4:
    170  1.19       is 		default:
    171  1.19       is 			/* XXX: for now: always enable own keyboard */
    172  1.19       is 
    173  1.19       is 			while (draco_ioct->io_status & DRSTAT_KBDRECV) {
    174  1.19       is 				c = draco_ioct->io_kbddata;
    175  1.19       is 				draco_ioct->io_kbdrst = 0;
    176  1.19       is 				printf(".");
    177  1.19       is 				DELAY(2000);
    178  1.19       is 			}
    179  1.19       is 
    180  1.19       is 			draco_ioct->io_control &= ~DRCNTRL_KBDINTENA;
    181  1.19       is 			break;
    182  1.19       is 	}
    183  1.19       is #else
    184   1.9   chopps 	custom.intena = INTF_SETCLR | INTF_PORTS;
    185   1.9   chopps 	ciaa.icr = CIA_ICR_IR_SC | CIA_ICR_SP;  /* SP interrupt enable */
    186   1.9   chopps 	ciaa.cra &= ~(1<<6);		/* serial line == input */
    187  1.19       is #endif
    188   1.9   chopps 	kbd_softc.k_event_mode = 0;
    189   1.9   chopps 	kbd_softc.k_events.ev_io = 0;
    190   1.9   chopps 	splx(s);
    191   1.1       mw }
    192   1.1       mw 
    193   1.1       mw 
    194   1.1       mw int
    195  1.18    veego kbdopen(dev, flags, mode, p)
    196  1.18    veego 	dev_t dev;
    197  1.18    veego 	int flags, mode;
    198  1.18    veego 	struct proc *p;
    199   1.5       mw {
    200   1.5       mw 
    201  1.18    veego 	if (kbd_softc.k_events.ev_io)
    202  1.18    veego 		return EBUSY;
    203   1.5       mw 
    204  1.18    veego 	kbd_softc.k_events.ev_io = p;
    205  1.18    veego 	ev_init(&kbd_softc.k_events);
    206  1.18    veego 	return (0);
    207   1.5       mw }
    208   1.5       mw 
    209   1.5       mw int
    210  1.18    veego kbdclose(dev, flags, mode, p)
    211  1.18    veego 	dev_t dev;
    212  1.18    veego 	int flags, mode;
    213  1.18    veego 	struct proc *p;
    214   1.5       mw {
    215  1.18    veego 
    216  1.18    veego 	/* Turn off event mode, dump the queue */
    217  1.18    veego 	kbd_softc.k_event_mode = 0;
    218  1.18    veego 	ev_fini(&kbd_softc.k_events);
    219  1.18    veego 	kbd_softc.k_events.ev_io = NULL;
    220  1.18    veego 	return (0);
    221   1.5       mw }
    222   1.5       mw 
    223   1.5       mw int
    224  1.18    veego kbdread(dev, uio, flags)
    225  1.18    veego 	dev_t dev;
    226  1.18    veego 	struct uio *uio;
    227  1.18    veego 	int flags;
    228   1.5       mw {
    229  1.18    veego 	return ev_read (&kbd_softc.k_events, uio, flags);
    230   1.5       mw }
    231   1.5       mw 
    232   1.5       mw int
    233  1.18    veego kbdioctl(dev, cmd, data, flag, p)
    234  1.18    veego 	dev_t dev;
    235  1.18    veego 	u_long cmd;
    236  1.18    veego 	register caddr_t data;
    237  1.18    veego 	int flag;
    238  1.18    veego 	struct proc *p;
    239   1.5       mw {
    240  1.18    veego 	register struct kbd_softc *k = &kbd_softc;
    241  1.18    veego 
    242  1.18    veego 	switch (cmd) {
    243  1.18    veego 		case KIOCTRANS:
    244  1.18    veego 			if (*(int *)data == TR_UNTRANS_EVENT)
    245  1.18    veego 				return 0;
    246  1.18    veego 			break;
    247  1.18    veego 
    248  1.18    veego 		case KIOCGTRANS:
    249  1.18    veego 			/* Get translation mode */
    250  1.18    veego 			*(int *)data = TR_UNTRANS_EVENT;
    251  1.18    veego 			return 0;
    252  1.18    veego 
    253  1.18    veego 		case KIOCSDIRECT:
    254  1.18    veego 			k->k_event_mode = *(int *)data;
    255  1.18    veego 			return 0;
    256  1.18    veego 
    257  1.18    veego 		case FIONBIO:	/* we will remove this someday (soon???) */
    258  1.18    veego 			return 0;
    259  1.18    veego 
    260  1.18    veego 		case FIOASYNC:
    261  1.18    veego 			k->k_events.ev_async = *(int *)data != 0;
    262  1.18    veego 			return 0;
    263  1.18    veego 
    264  1.18    veego 		case TIOCSPGRP:
    265  1.18    veego 			if (*(int *)data != k->k_events.ev_io->p_pgid)
    266  1.18    veego 				return EPERM;
    267  1.18    veego 			return 0;
    268  1.18    veego 
    269  1.18    veego 		default:
    270  1.18    veego 			return ENOTTY;
    271  1.18    veego 	}
    272   1.5       mw 
    273  1.18    veego 	/* We identified the ioctl, but we do not handle it. */
    274  1.18    veego 	return EOPNOTSUPP;	/* misuse, but what the heck */
    275   1.5       mw }
    276   1.5       mw 
    277   1.5       mw int
    278  1.18    veego kbdselect(dev, rw, p)
    279  1.18    veego 	dev_t dev;
    280  1.18    veego 	int rw;
    281  1.18    veego 	struct proc *p;
    282   1.5       mw {
    283  1.18    veego 	return ev_select (&kbd_softc.k_events, rw, p);
    284   1.5       mw }
    285   1.5       mw 
    286   1.5       mw 
    287  1.18    veego void
    288  1.18    veego kbdintr(mask)
    289  1.18    veego 	int mask;
    290   1.1       mw {
    291  1.18    veego 	u_char c;
    292  1.13   chopps #ifdef KBDRESET
    293  1.18    veego 	static int reset_warn;
    294  1.13   chopps #endif
    295   1.1       mw 
    296  1.19       is 	/*
    297  1.19       is 	 * now only invoked from generic CIA interrupt handler if there *is*
    298  1.18    veego 	 * a keyboard interrupt pending
    299  1.18    veego 	 */
    300   1.1       mw 
    301  1.18    veego 	c = ~ciaa.sdr;	/* keyboard data is inverted */
    302  1.18    veego 	/* ack */
    303  1.18    veego 	ciaa.cra |= (1 << 6);	/* serial line output */
    304  1.13   chopps #ifdef KBDRESET
    305  1.18    veego 	if (reset_warn && c == 0xf0) {
    306  1.13   chopps #ifdef DEBUG
    307  1.18    veego 		printf ("kbdintr: !!!! Reset Warning !!!!\n");
    308  1.13   chopps #endif
    309  1.18    veego 		bootsync();
    310  1.18    veego 		reset_warn = 0;
    311  1.18    veego 		DELAY(30000000);
    312  1.18    veego 	}
    313  1.13   chopps #endif
    314  1.18    veego 	/* wait 200 microseconds (for bloody Cherry keyboards..) */
    315  1.18    veego 	DELAY(2000);			/* fudge delay a bit for some keyboards */
    316  1.18    veego 	ciaa.cra &= ~(1 << 6);
    317  1.18    veego 
    318  1.18    veego 	/* process the character */
    319  1.18    veego 	c = (c >> 1) | (c << 7);	/* rotate right once */
    320   1.1       mw 
    321  1.13   chopps #ifdef KBDRESET
    322  1.18    veego 	if (c == 0x78) {
    323  1.13   chopps #ifdef DEBUG
    324  1.18    veego 		printf ("kbdintr: Reset Warning started\n");
    325  1.13   chopps #endif
    326  1.18    veego 		++reset_warn;
    327  1.18    veego 		return;
    328  1.18    veego 	}
    329  1.13   chopps #endif
    330  1.19       is 	kbdstuffchar(c);
    331  1.19       is }
    332  1.19       is 
    333  1.19       is #ifdef DRACO
    334  1.19       is /* maps MF-II keycodes to Amiga keycodes */
    335  1.19       is 
    336  1.19       is u_char drkbdtab[] = {
    337  1.19       is 	0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x50,
    338  1.19       is 	0x45, 0xff, 0xff, 0xff, 0xff, 0x42, 0x00, 0x51,
    339  1.19       is 
    340  1.19       is 	0xff, 0x64, 0x60, 0x30, 0x63, 0x10, 0x01, 0x52,
    341  1.19       is 	0xff, 0x66, 0x31, 0x21, 0x20, 0x11, 0x02, 0x53,
    342  1.19       is 
    343  1.19       is 	0xff, 0x33, 0x32, 0x22, 0x12, 0x04, 0x03, 0x54,
    344  1.19       is 	0xff, 0x40, 0x34, 0x23, 0x14, 0x13, 0x05, 0x55,
    345  1.19       is 
    346  1.19       is 	0xff, 0x36, 0x35, 0x25, 0x24, 0x15, 0x06, 0x56,
    347  1.19       is 	0xff, 0x67, 0x37, 0x26, 0x16, 0x07, 0x08, 0x57,
    348  1.19       is 	/* --- */
    349  1.19       is 	0xff, 0x38, 0x27, 0x17, 0x18, 0x0a, 0x09, 0x58,
    350  1.19       is 	0xff, 0x39, 0x3a, 0x28, 0x29, 0x19, 0x0b, 0x59,
    351  1.19       is 
    352  1.19       is 	0xff, 0xff, 0x2a, 0x2b, 0x1a, 0x0c, 0x4b, 0xff,
    353  1.19       is 	0x65, 0x61, 0x44, 0x1b, 0xff, 0xff, 0x6f, 0xff,
    354  1.19       is 
    355  1.19       is 	0x4d, 0x4f, 0xff, 0x4c, 0x0d, 0xff, 0x41, 0x46,
    356  1.19       is 	0xff, 0x1d, 0x4e, 0x2d, 0x3d, 0x4a, 0x5f, 0x62,
    357  1.19       is 
    358  1.19       is 	0x0f, 0x3c, 0x1e, 0x2e, 0x2f, 0x3e, 0x5a, 0x5b,
    359  1.19       is 	0xff, 0x43, 0x1f, 0xff, 0x5e, 0x3f, 0x5c, 0xff,
    360  1.19       is 	/* --- */
    361  1.19       is 	0xff, 0xff, 0xff, 0xff, 0x5d
    362  1.19       is };
    363  1.19       is #endif
    364  1.19       is 
    365  1.19       is 
    366  1.19       is int
    367  1.19       is kbdgetcn ()
    368  1.19       is {
    369  1.19       is 	int s;
    370  1.19       is 	u_char ints, mask, c, in;
    371  1.19       is 
    372  1.19       is #ifdef DRACO
    373  1.19       is 	/*
    374  1.19       is 	 * XXX todo: if CIA DraCo, get from cia if cia kbd
    375  1.19       is 	 * installed.
    376  1.19       is 	 */
    377  1.19       is 	if (is_draco()) {
    378  1.19       is 		c = 0;
    379  1.19       is 		s = spltty ();
    380  1.19       is 		while ((draco_ioct->io_status & DRSTAT_KBDRECV) == 0);
    381  1.19       is 		in = draco_ioct->io_kbddata;
    382  1.19       is 		draco_ioct->io_kbdrst = 0;
    383  1.19       is 		if (in == 0xF0) { /* release prefix */
    384  1.19       is 			c = 0x80;
    385  1.19       is 			while ((draco_ioct->io_status & DRSTAT_KBDRECV) == 0);
    386  1.19       is 			in = draco_ioct->io_kbddata;
    387  1.19       is 			draco_ioct->io_kbdrst = 0;
    388  1.19       is 		}
    389  1.19       is 		splx(s);
    390  1.19       is #ifdef DRACORAWKEYDEBUG
    391  1.19       is 		printf("<%02x>", in);
    392  1.19       is #endif
    393  1.19       is 		return (in>=sizeof(drkbdtab) ? 0xff : drkbdtab[in]|c);
    394  1.19       is 	}
    395  1.19       is #endif
    396  1.19       is 	s = spltty();
    397  1.19       is 	for (ints = 0; ! ((mask = ciaa.icr) & CIA_ICR_SP);
    398  1.19       is 	    ints |= mask) ;
    399  1.19       is 
    400  1.19       is 	in = ciaa.sdr;
    401  1.19       is 	c = ~in;
    402  1.19       is 
    403  1.19       is 	/* ack */
    404  1.19       is 	ciaa.cra |= (1 << 6);	/* serial line output */
    405  1.19       is 	ciaa.sdr = 0xff;	/* ack */
    406  1.19       is 	/* wait 200 microseconds */
    407  1.19       is 	DELAY(2000);	/* XXXX only works as long as DELAY doesn't
    408  1.19       is 			 * use a timer and waits.. */
    409  1.19       is 	ciaa.cra &= ~(1 << 6);
    410  1.19       is 	ciaa.sdr = in;
    411  1.19       is 
    412  1.19       is 	splx (s);
    413  1.19       is 	c = (c >> 1) | (c << 7);
    414  1.19       is 
    415  1.19       is 	/* take care that no CIA-interrupts are lost */
    416  1.19       is 	if (ints)
    417  1.19       is 		dispatch_cia_ints (0, ints);
    418  1.19       is 
    419  1.19       is 	return c;
    420  1.19       is }
    421  1.19       is 
    422  1.19       is void
    423  1.19       is kbdstuffchar(c)
    424  1.19       is 	u_char c;
    425  1.19       is {
    426  1.19       is 	struct firm_event *fe;
    427  1.19       is 	struct kbd_softc *k = &kbd_softc;
    428  1.19       is 	int put;
    429  1.19       is 
    430  1.19       is 	/*
    431  1.19       is 	 * If not in event mode, deliver straight to ite to process
    432  1.19       is 	 * key stroke
    433  1.19       is 	 */
    434  1.19       is 
    435  1.18    veego 	if (! k->k_event_mode) {
    436  1.18    veego 		ite_filter (c, ITEFILT_TTY);
    437  1.18    veego 		return;
    438  1.18    veego 	}
    439  1.18    veego 
    440  1.19       is 	/*
    441  1.19       is 	 * Keyboard is generating events. Turn this keystroke into an
    442  1.19       is 	 * event and put it in the queue. If the queue is full, the
    443  1.18    veego 	 * keystroke is lost (sorry!).
    444  1.18    veego 	 */
    445  1.19       is 
    446  1.18    veego 	put = k->k_events.ev_put;
    447  1.18    veego 	fe = &k->k_events.ev_q[put];
    448  1.18    veego 	put = (put + 1) % EV_QSIZE;
    449  1.18    veego 	if (put == k->k_events.ev_get) {
    450  1.19       is 		log(LOG_WARNING, "keyboard event queue overflow\n");
    451  1.19       is 			/* ??? */
    452  1.18    veego 		return;
    453  1.18    veego 	}
    454  1.18    veego 	fe->id = KEY_CODE(c);
    455  1.18    veego 	fe->value = KEY_UP(c) ? VKEY_UP : VKEY_DOWN;
    456  1.18    veego 	fe->time = time;
    457  1.18    veego 	k->k_events.ev_put = put;
    458  1.18    veego 	EV_WAKEUP(&k->k_events);
    459   1.1       mw }
    460   1.1       mw 
    461   1.1       mw 
    462  1.19       is #ifdef DRACO
    463  1.19       is void
    464  1.19       is drkbdintr()
    465   1.1       mw {
    466  1.19       is 	u_char in;
    467  1.19       is 	struct kbd_softc *k = &kbd_softc;
    468  1.18    veego 
    469  1.19       is 	in = draco_ioct->io_kbddata;
    470  1.19       is 	draco_ioct->io_kbdrst = 0;
    471   1.1       mw 
    472  1.19       is 	if (in == 0xF0)
    473  1.19       is 		k->k_rlprfx = 0x80;
    474  1.19       is 	else {
    475  1.19       is 		kbdstuffchar(in>=sizeof(drkbdtab) ? 0xff :
    476  1.19       is 		    drkbdtab[in] | k->k_rlprfx);
    477  1.19       is 		k->k_rlprfx = 0;
    478  1.19       is 	}
    479  1.19       is }
    480   1.1       mw 
    481  1.19       is #endif
    482