429 lines
14 KiB
Plaintext
429 lines
14 KiB
Plaintext
diff -crP /cdrom/usr/include/kbd.h /usr/include/kbd.h
|
|
*** /cdrom/usr/include/kbd.h Wed Dec 31 16:00:00 1969
|
|
--- /usr/include/kbd.h Sun May 11 23:22:45 1997
|
|
***************
|
|
*** 0 ****
|
|
--- 1,90 ----
|
|
+ /* $NetBSD: patch.Console,v 1.1.1.3 2001/06/09 15:03:09 tron Exp $ */
|
|
+
|
|
+ /*
|
|
+ * Copyright (c) 1992, 1993
|
|
+ * The Regents of the University of California. All rights reserved.
|
|
+ *
|
|
+ * This software was developed by the Computer Systems Engineering group
|
|
+ * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and
|
|
+ * contributed to Berkeley.
|
|
+ *
|
|
+ * All advertising materials mentioning features or use of this software
|
|
+ * must display the following acknowledgement:
|
|
+ * This product includes software developed by the University of
|
|
+ * California, Lawrence Berkeley Laboratory.
|
|
+ *
|
|
+ * Redistribution and use in source and binary forms, with or without
|
|
+ * modification, are permitted provided that the following conditions
|
|
+ * are met:
|
|
+ * 1. Redistributions of source code must retain the above copyright
|
|
+ * notice, this list of conditions and the following disclaimer.
|
|
+ * 2. Redistributions in binary form must reproduce the above copyright
|
|
+ * notice, this list of conditions and the following disclaimer in the
|
|
+ * documentation and/or other materials provided with the distribution.
|
|
+ * 3. All advertising materials mentioning features or use of this software
|
|
+ * must display the following acknowledgement:
|
|
+ * This product includes software developed by the University of
|
|
+ * California, Berkeley and its contributors.
|
|
+ * 4. Neither the name of the University nor the names of its contributors
|
|
+ * may be used to endorse or promote products derived from this software
|
|
+ * without specific prior written permission.
|
|
+ *
|
|
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
|
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
|
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
|
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
|
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
|
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
|
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
|
+ * SUCH DAMAGE.
|
|
+ *
|
|
+ * @(#)kbd.h 8.1 (Berkeley) 6/11/93
|
|
+ */
|
|
+
|
|
+ /*
|
|
+ * Keyboard `registers'. (This should be called kbd_reg.h but we need to
|
|
+ * be compatible.)
|
|
+ */
|
|
+
|
|
+ /*
|
|
+ * Control codes sent from type 2, 3, and 4 keyboards.
|
|
+ *
|
|
+ * Note that KBD_RESET is followed by a keyboard ID, while KBD_IDLE is not.
|
|
+ * KBD_IDLE does not take the place of any `up' transitions (it merely occurs
|
|
+ * after them).
|
|
+ */
|
|
+ #define KBD_RESET 0xff /* keyboard `reset' response */
|
|
+ #define KBD_IDLE 0x7f /* keyboard `all keys are up' code */
|
|
+ #define KBD_LAYOUT 0xfe /* keyboard `get layout' response */
|
|
+
|
|
+ /* Keyboard IDs */
|
|
+ #define KB_SUN2 2 /* type 2 keyboard */
|
|
+ #define KB_SUN3 3 /* type 3 keyboard */
|
|
+ #define KB_SUN4 4 /* type 4 keyboard */
|
|
+
|
|
+ /* Key codes are in 0x00..0x7e; KBD_UP is set if the key goes up */
|
|
+ #define KBD_KEYMASK 0x7f /* keyboard key mask */
|
|
+ #define KBD_UP 0x80 /* keyboard `up' transition */
|
|
+
|
|
+ /* Keyboard codes needed to recognize the L1-A sequence */
|
|
+ #define KBD_L1 1 /* keyboard code for `L1' key */
|
|
+ #define KBD_A 77 /* keyboard code for `A' key */
|
|
+
|
|
+ /* Control codes sent to the various keyboards */
|
|
+ #define KBD_CMD_RESET 1 /* reset keyboard */
|
|
+ #define KBD_CMD_BELL 2 /* turn bell on */
|
|
+ #define KBD_CMD_NOBELL 3 /* turn bell off */
|
|
+ #define KBD_CMD_CLICK 10 /* turn keyclick on */
|
|
+ #define KBD_CMD_NOCLICK 11 /* turn keyclick off */
|
|
+ #define KBD_CMD_SETLED 14 /* set LED state (type 4 kbd) */
|
|
+ #define KBD_CMD_GLAYOUT 15 /* get DIP switch (type 4 kbd) */
|
|
+
|
|
+ #define LED_NUM_LOCK 0x1
|
|
+ #if !defined(Lynx) || !defined(LED_COMPOSE)
|
|
+ #define LED_COMPOSE 0x2
|
|
+ #endif
|
|
+ #define LED_SCROLL_LOCK 0x4
|
|
+ #define LED_CAPS_LOCK 0x8
|
|
diff -crP /cdrom/usr/include/kbio.h /usr/include/kbio.h
|
|
*** /cdrom/usr/include/kbio.h Wed Dec 31 16:00:00 1969
|
|
--- /usr/include/kbio.h Sun May 11 23:22:46 1997
|
|
***************
|
|
*** 0 ****
|
|
--- 1,115 ----
|
|
+ /* $NetBSD: patch.Console,v 1.1.1.3 2001/06/09 15:03:09 tron Exp $ */
|
|
+
|
|
+ /*
|
|
+ * Copyright (c) 1992, 1993
|
|
+ * The Regents of the University of California. All rights reserved.
|
|
+ *
|
|
+ * This software was developed by the Computer Systems Engineering group
|
|
+ * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and
|
|
+ * contributed to Berkeley.
|
|
+ *
|
|
+ * All advertising materials mentioning features or use of this software
|
|
+ * must display the following acknowledgement:
|
|
+ * This product includes software developed by the University of
|
|
+ * California, Lawrence Berkeley Laboratory.
|
|
+ *
|
|
+ * Redistribution and use in source and binary forms, with or without
|
|
+ * modification, are permitted provided that the following conditions
|
|
+ * are met:
|
|
+ * 1. Redistributions of source code must retain the above copyright
|
|
+ * notice, this list of conditions and the following disclaimer.
|
|
+ * 2. Redistributions in binary form must reproduce the above copyright
|
|
+ * notice, this list of conditions and the following disclaimer in the
|
|
+ * documentation and/or other materials provided with the distribution.
|
|
+ * 3. All advertising materials mentioning features or use of this software
|
|
+ * must display the following acknowledgement:
|
|
+ * This product includes software developed by the University of
|
|
+ * California, Berkeley and its contributors.
|
|
+ * 4. Neither the name of the University nor the names of its contributors
|
|
+ * may be used to endorse or promote products derived from this software
|
|
+ * without specific prior written permission.
|
|
+ *
|
|
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
|
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
|
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
|
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
|
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
|
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
|
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
|
+ * SUCH DAMAGE.
|
|
+ *
|
|
+ * @(#)kbio.h 8.1 (Berkeley) 6/11/93
|
|
+ */
|
|
+
|
|
+ /*
|
|
+ * The following is a minimal emulation of Sun's `kio' structures
|
|
+ * and related operations necessary to make X11 happy (i.e., make it
|
|
+ * compile, and make old X11 binaries run).
|
|
+ */
|
|
+
|
|
+ /*
|
|
+ * The kiockey structure apparently gets and/or sets keyboard mappings.
|
|
+ * It seems to be kind of useless, but X11 uses it (according to the
|
|
+ * comments) to figure out when a Sun 386i has a type-4 keyboard but
|
|
+ * claims to have a type-3 keyboard. We need just enough to cause the
|
|
+ * appropriate ioctl to return the appropriate magic value.
|
|
+ *
|
|
+ * KIOCGETKEY fills in kio_entry from kio_station. Not sure what tablemask
|
|
+ * is for; X sets it before the call, so it is not an output, but we do not
|
|
+ * care anyway. KIOCSDIRECT is supposed to tell the kernel whether to send
|
|
+ * keys to the console or to X; we just send them to X whenever the keyboard
|
|
+ * is open at all. (XXX may need to change this later)
|
|
+ *
|
|
+ * Keyboard commands and types are defined in kbd.h as they are actually
|
|
+ * real hardware commands and type numbers.
|
|
+ */
|
|
+ struct okiockey { /* Out-dated key translation structure */
|
|
+ int kio_tablemask; /* whatever */
|
|
+ u_char kio_station; /* key number */
|
|
+ u_char kio_entry; /* HOLE if not present */
|
|
+ char kio_text[10]; /* the silly escape sequences (unsupported) */
|
|
+ };
|
|
+
|
|
+ struct kiockey {
|
|
+ int kio_tablemask; /* whatever */
|
|
+ u_char kio_station; /* key number */
|
|
+ u_short kio_entry; /* HOLE if not present */
|
|
+ char kio_text[10]; /* the silly escape sequences (unsupported) */
|
|
+ };
|
|
+
|
|
+ /*
|
|
+ * Values for kio_tablemask. These determine which table to read/modify
|
|
+ * in KIOC[SG]KEY ioctls. Currently, we only have "non-shift" and "shift"
|
|
+ * tables.
|
|
+ */
|
|
+ #define KIOC_NOMASK 0x0
|
|
+ #define KIOC_CAPSMASK 0x1
|
|
+ #define KIOC_SHIFTMASK 0xe
|
|
+ #define KIOC_CTRLMASK 0x30
|
|
+ #define KIOC_ALTGMASK 0x200
|
|
+ #define KIOC_NUMLMASK 0x800
|
|
+
|
|
+ #define HOLE 0x302 /* value for kio_entry to say `really type 3' */
|
|
+
|
|
+ #define KIOCTRANS _IOW('k', 0, int) /* set translation mode */
|
|
+ /* (we only accept TR_UNTRANS_EVENT) */
|
|
+ #define KIOCGETKEY _IOWR('k', 2, struct okiockey) /* fill in kio_entry */
|
|
+ #define KIOCGTRANS _IOR('k', 5, int) /* get translation mode */
|
|
+ #define KIOCCMD _IOW('k', 8, int) /* X uses this to ring bell */
|
|
+ #define KIOCTYPE _IOR('k', 9, int) /* get keyboard type */
|
|
+ #define KIOCSDIRECT _IOW('k', 10, int) /* keys to console? */
|
|
+ #define KIOCSKEY _IOW('k', 12, struct kiockey) /* set xlat mode */
|
|
+ #ifndef Lynx
|
|
+ #define KIOCGKEY _IOWR('k', 13, struct kiockey) /* get xlat mode */
|
|
+ #endif
|
|
+ #define KIOCLAYOUT _IOR('k', 20, int) /* get keyboard layout */
|
|
+ #define KIOCSLED _IOW('k', 14, char) /* set LED state */
|
|
+ #define KIOCGLED _IOR('k', 15, char) /* get LED state */
|
|
+
|
|
+ #define TR_NONE 0 /* X compat, unsupported */
|
|
+ #define TR_ASCII 1 /* X compat, unsupported */
|
|
+ #define TR_EVENT 2 /* X compat, unsupported */
|
|
+ #define TR_UNTRANS_EVENT 3
|
|
diff -crP /cdrom/sys/drivers/console/Makefile /sys/drivers/console/Makefile
|
|
*** /cdrom/sys/drivers/console/Makefile Sun Feb 9 04:43:06 1997
|
|
--- /sys/drivers/console/Makefile Sun May 11 23:24:04 1997
|
|
***************
|
|
*** 24,30 ****
|
|
|
|
LIBRARY= drivers
|
|
|
|
! SPECIAL_CFLAGS=-DMOUSESUPPORT
|
|
|
|
include ../../OBJ_RULES
|
|
|
|
--- 24,30 ----
|
|
|
|
LIBRARY= drivers
|
|
|
|
! SPECIAL_CFLAGS=-DMOUSESUPPORT -DXSERVERSUPPORT
|
|
|
|
include ../../OBJ_RULES
|
|
|
|
diff -crP /cdrom/sys/drivers/console/atc.h /sys/drivers/console/atc.h
|
|
*** /cdrom/sys/drivers/console/atc.h Sun Feb 9 04:43:06 1997
|
|
--- /sys/drivers/console/atc.h Sun May 11 23:22:46 1997
|
|
***************
|
|
*** 108,113 ****
|
|
--- 108,119 ----
|
|
#ifdef MOUSESUPPORT
|
|
struct ttystatics mousechannel;
|
|
#endif /* MOUSESUPPORT */
|
|
+ #ifdef XSERVERSUPPORT
|
|
+ int kbd_pending;
|
|
+ int kbd_id; /* keyboard type */
|
|
+ int kbd_layout; /* layout on type 4 */
|
|
+ int kbd_click; /* kbd click on? */
|
|
+ #endif
|
|
};
|
|
|
|
struct kbd_registers_type {
|
|
diff -crP /cdrom/sys/drivers/console/atcdrvr.c /sys/drivers/console/atcdrvr.c
|
|
*** /cdrom/sys/drivers/console/atcdrvr.c Sun Feb 9 04:43:06 1997
|
|
--- /sys/drivers/console/atcdrvr.c Sun May 11 23:25:15 1997
|
|
***************
|
|
*** 38,43 ****
|
|
--- 38,47 ----
|
|
#ifdef MOUSESUPPORT
|
|
#include "am8530.h"
|
|
#endif /* MOUSESUPPORT */
|
|
+ #ifdef XSERVERSUPPORT
|
|
+ #include <kbd.h>
|
|
+ #include <kbio.h>
|
|
+ #endif
|
|
|
|
char *screen_address; /* is this supposed to be in the driver info? */
|
|
|
|
***************
|
|
*** 305,310 ****
|
|
--- 309,318 ----
|
|
int m;
|
|
int ps;
|
|
extern int set_kb_lights();
|
|
+ #ifdef XSERVERSUPPORT
|
|
+ extern int kbd_docmd();
|
|
+ int err;
|
|
+ #endif
|
|
|
|
if (!atc_flag){ pseterr(EIO); return(SYSERR);}
|
|
#ifdef MOUSESUPPORT
|
|
***************
|
|
*** 354,365 ****
|
|
--- 362,398 ----
|
|
#ifdef TIOLED
|
|
case TIOLED:
|
|
#endif
|
|
+ #ifdef XSERVERSUPPORT
|
|
+ case KIOCSLED:
|
|
+ #endif
|
|
h->curled = *arg;
|
|
if (h->ledstate == -1) {
|
|
if (timeout(set_kb_lights,h,1) != -1)
|
|
h->ledstate = 0;
|
|
}
|
|
return 0;
|
|
+ #ifdef XSERVERSUPPORT
|
|
+ case KIOCTYPE:
|
|
+ if (wbounds(arg) < sizeof(int)) {
|
|
+ pseterr(EFAULT);
|
|
+ return SYSERR;
|
|
+ }
|
|
+ *(int *)arg = h->kbd_id;
|
|
+ return OK;
|
|
+ case KIOCLAYOUT:
|
|
+ if (wbounds(arg) < sizeof(int)) {
|
|
+ pseterr(EFAULT);
|
|
+ return SYSERR;
|
|
+ }
|
|
+ *(int *)arg = h->kbd_layout;
|
|
+ return OK;
|
|
+ case KIOCCMD:
|
|
+ if (err = kbd_docmd(h, *(int *)arg)) {
|
|
+ pseterr(err);
|
|
+ return SYSERR;
|
|
+ }
|
|
+ return OK;
|
|
+ #endif
|
|
case VT_OPENQRY:
|
|
if (h->multimode == SCM_ONE) {
|
|
if (!(h->open & 1)) {
|
|
***************
|
|
*** 578,583 ****
|
|
--- 611,622 ----
|
|
h->open = 0;
|
|
h->break_code = 0;
|
|
h->info = info;
|
|
+ #ifdef XSERVERSUPPORT
|
|
+ h->kbd_pending = 0;
|
|
+ h->kbd_id = KB_SUN4; /* query KBD later.... */
|
|
+ h->kbd_layout = 0; /* US_ASCII */
|
|
+ h->kbd_click = 0; /* silent movie */
|
|
+ #endif
|
|
#ifdef MOUSESUPPORT
|
|
tmgr_install(&h->mousechannel, &info->sg, 0, mouse_xmit_ena, h);
|
|
#endif /* MOUSESUPPORT */
|
|
diff -crP /cdrom/sys/drivers/console/atkey.c /sys/drivers/console/atkey.c
|
|
*** /cdrom/sys/drivers/console/atkey.c Sun Feb 9 04:43:07 1997
|
|
--- /sys/drivers/console/atkey.c Sun May 11 23:22:46 1997
|
|
***************
|
|
*** 26,31 ****
|
|
--- 26,35 ----
|
|
#ifdef MOUSESUPPORT
|
|
#include "am8530.h"
|
|
#endif /* MOUSESUPPORT */
|
|
+ #ifdef XSERVERSUPPORT
|
|
+ #include <kbd.h>
|
|
+ #include <kbio.h>
|
|
+ #endif
|
|
|
|
#define NOTHING_USEFUL -1
|
|
#define FILL NOTHING_USEFUL
|
|
diff -crP /cdrom/sys/drivers/console/atutils.c /sys/drivers/console/atutils.c
|
|
*** /cdrom/sys/drivers/console/atutils.c Sun Feb 9 04:43:07 1997
|
|
--- /sys/drivers/console/atutils.c Sun May 11 23:22:46 1997
|
|
***************
|
|
*** 361,367 ****
|
|
}
|
|
|
|
|
|
! static int byte_to_keyboard(byt)
|
|
unsigned char byt;
|
|
{
|
|
int i;
|
|
--- 361,370 ----
|
|
}
|
|
|
|
|
|
! #ifndef XSERVERSUPPORT
|
|
! static
|
|
! #endif
|
|
! int byte_to_keyboard(byt)
|
|
unsigned char byt;
|
|
{
|
|
int i;
|
|
***************
|
|
*** 400,402 ****
|
|
--- 403,449 ----
|
|
break;
|
|
}
|
|
}
|
|
+
|
|
+ #ifdef XSERVERSUPPORT
|
|
+ #include <kbd.h>
|
|
+ #include <kbio.h>
|
|
+
|
|
+ /*
|
|
+ * Execute a keyboard command; return 0 on success.
|
|
+ */
|
|
+ kbd_docmd(h, cmd)
|
|
+ register struct kdhglobals *h;
|
|
+ int cmd;
|
|
+ {
|
|
+ switch (cmd) {
|
|
+
|
|
+ case KBD_CMD_BELL:
|
|
+ case KBD_CMD_NOBELL:
|
|
+ /* Supported by type 2, 3, and 4 keyboards */
|
|
+ break;
|
|
+
|
|
+ case KBD_CMD_CLICK:
|
|
+ /* Unsupported by type 2 keyboards */
|
|
+ if (h->kbd_id != KB_SUN2) {
|
|
+ h->kbd_click = 1;
|
|
+ break;
|
|
+ }
|
|
+ return (EINVAL);
|
|
+
|
|
+ case KBD_CMD_NOCLICK:
|
|
+ /* Unsupported by type 2 keyboards */
|
|
+ if (h->kbd_id != KB_SUN2) {
|
|
+ h->kbd_click = 0;
|
|
+ break;
|
|
+ }
|
|
+ return (EINVAL);
|
|
+
|
|
+ default:
|
|
+ return (EINVAL); /* ENOTTY? EOPNOTSUPP? */
|
|
+ }
|
|
+
|
|
+ if (timeout(byte_to_keyboard, cmd, 1) < 0)
|
|
+ return (ENOSPC); /* ERESTART? */
|
|
+ return (0);
|
|
+ }
|
|
+ #endif
|