Index: head/sys/alpha/conf/files.alpha =================================================================== --- head/sys/alpha/conf/files.alpha (revision 44627) +++ head/sys/alpha/conf/files.alpha (revision 44628) @@ -1,155 +1,159 @@ # This file tells config what files go into building a kernel, # files marked standard are always included. # -# $Id: files.alpha,v 1.15 1999/01/18 20:26:50 gallatin Exp $ +# $Id: files.alpha,v 1.16 1999/01/23 16:53:26 dfr Exp $ # # The long compile-with and dependency lines are required because of # limitations in config: backslash-newline doesn't work in strings, and # dependency lines other than the first are silently ignored. # # font8x16.o optional std8x16font \ compile-with "uudecode < /usr/share/syscons/fonts/${STD8X16FONT}-8x16.fnt && file2c 'unsigned char font_16[16*256] = {' '};' < ${STD8X16FONT}-8x16 > font8x16.c && ${CC} -c ${CFLAGS} font8x16.c" \ no-implicit-rule before-depend \ clean "${STD8X16FONT}-8x16 font8x16.c" - # +atkbdmap.h optional atkbd_dflt_keymap \ + compile-with "kbdcontrol -L ${ATKBD_DFLT_KEYMAP} | sed -e 's/^static keymap_t.* = /static keymap_t key_map = /' -e 's/^static accentmap_t.* = /static accentmap_t accent_map = /' > atkbdmap.h" \ + no-obj no-implicit-rule before-depend \ + clean "atkbdmap.h" +# alpha/alpha/autoconf.c standard device-driver alpha/alpha/cpuconf.c standard alpha/alpha/atomic.s standard alpha/alpha/dec_kn8ae.c optional dec_kn8ae alpha/alpha/dec_eb164.c optional dec_eb164 alpha/alpha/dec_eb64plus.c optional dec_eb64plus alpha/alpha/dec_kn20aa.c optional dec_kn20aa alpha/alpha/dec_2100_a50.c optional dec_2100_a50 alpha/alpha/dec_st550.c optional dec_st550 alpha/alpha/dec_axppci_33.c optional dec_axppci_33 alpha/alpha/dec_3000_300.c optional dec_3000_300 alpha/alpha/dec_3000_500.c optional dec_3000_500 alpha/alpha/mountroot.c optional slice alpha/alpha/ipl_funcs.c standard alpha/alpha/pal.s standard alpha/alpha/busdma_machdep.c standard alpha/alpha/cons.c standard alpha/alpha/prom.c standard alpha/alpha/promcons.c standard alpha/alpha/prom_disp.s standard alpha/alpha/alpha-gdbstub.c optional ddb alpha/alpha/db_disasm.c optional ddb alpha/alpha/db_interface.c optional ddb alpha/alpha/db_trace.c optional ddb alpha/alpha/exception.s standard alpha/alpha/in_cksum.c optional inet # locore.s needs to be handled in Makefile to put it first. Otherwise it's # now normal. # alpha/alpha/locore.s standard alpha/alpha/machdep.c standard alpha/alpha/fp_emulate.c standard alpha/alpha/ieee_float.c standard alpha/alpha/mem.c standard alpha/alpha/mp_machdep.c optional smp alpha/alpha/perfmon.c optional perfmon profiling-routine alpha/alpha/perfmon.c optional perfmon alpha/alpha/pmap.c standard alpha/alpha/procfs_machdep.c standard alpha/alpha/simplelock.s optional smp alpha/alpha/support.s standard alpha/alpha/swtch.s standard alpha/alpha/sys_machdep.c standard alpha/alpha/trap.c standard alpha/alpha/interrupt.c standard alpha/alpha/userconfig.c optional userconfig alpha/alpha/vm_machdep.c standard alpha/alpha/clock.c standard clock_if.o standard \ dependency "clock_if.c" \ compile-with "${NORMAL_C}" \ no-implicit-rule local clock_if.c standard \ dependency "$S/kern/makedevops.pl $S/alpha/alpha/clock_if.m" \ compile-with "perl $S/kern/makedevops.pl -c $S/alpha/alpha/clock_if.m" \ no-obj no-implicit-rule before-depend local \ clean "clock_if.c" clock_if.h standard \ dependency "$S/kern/makedevops.pl $S/alpha/alpha/clock_if.m" \ compile-with "perl $S/kern/makedevops.pl -h $S/alpha/alpha/clock_if.m" \ no-obj no-implicit-rule before-depend \ clean "clock_if.h" alpha/alpha/diskslice_machdep.c standard alpha/tlsb/tlsb.c optional tlsb alpha/tlsb/gbus.c optional gbus alpha/tlsb/kftxx.c optional kft alpha/tlsb/mcclock_tlsb.c optional gbus alpha/tlsb/zs_tlsb.c optional gbus alpha/tlsb/dwlpx.c optional dwlpx alpha/tc/tcasic.c optional tcasic alpha/tc/tc.c optional tc alpha/tc/ioasic.c optional tc alpha/tc/mcclock_ioasic.c optional tc alpha/tc/if_le_ioasic.c optional le device-driver alpha/tc/if_le_dec.c optional le device-driver alpha/tc/am7990.c optional le device-driver alpha/tc/tcds.c optional tcds device-driver alpha/tc/tcds_dma.c optional tcds device-driver alpha/tc/esp.c optional esp device-driver dev/dec/mcclock.c standard device-driver mcclock_if.o standard \ dependency "mcclock_if.c" \ compile-with "${NORMAL_C}" \ no-implicit-rule local mcclock_if.c standard \ dependency "$S/kern/makedevops.pl $S/dev/dec/mcclock_if.m" \ compile-with "perl $S/kern/makedevops.pl -c $S/dev/dec/mcclock_if.m" \ no-obj no-implicit-rule before-depend local \ clean "mcclock_if.c" mcclock_if.h standard \ dependency "$S/kern/makedevops.pl $S/dev/dec/mcclock_if.m" \ compile-with "perl $S/kern/makedevops.pl -h $S/dev/dec/mcclock_if.m" \ no-obj no-implicit-rule before-depend \ clean "mcclock_if.h" alpha/pci/cia.c optional cia alpha/pci/pci_eb164_intr.s optional cia alpha/pci/apecs.c optional apecs alpha/pci/pci_eb64plus_intr.s optional apecs alpha/pci/lca.c optional lca alpha/pci/pcibus.c optional pci alpha/isa/isa.c optional isa alpha/isa/mcclock_isa.c optional isa alpha/alpha/elf_machdep.c standard libkern/bcd.c standard libkern/bcmp.c standard libkern/ffs.c standard libkern/inet_ntoa.c standard libkern/index.c standard libkern/mcount.c optional profiling-routine libkern/qsort.c standard libkern/random.c standard libkern/rindex.c standard libkern/scanc.c standard libkern/skpc.c standard libkern/strcat.c standard libkern/strcmp.c standard libkern/strcpy.c standard libkern/strlen.c standard libkern/strncmp.c standard libkern/strncpy.c standard libkern/alpha/htonl.S standard libkern/alpha/htons.S standard libkern/alpha/ntohl.S standard libkern/alpha/ntohs.S standard isa/sio.c optional sio device-driver dev/fb/fb.c optional fb device-driver dev/fb/fb.c optional vga device-driver isa/vga_isa.c optional vga device-driver dev/fb/splash.c optional splash dev/kbd/atkbd.c optional atkbd device-driver isa/atkbd_isa.c optional atkbd device-driver dev/kbd/atkbdc.c optional atkbdc device-driver isa/atkbdc_isa.c optional atkbdc device-driver dev/kbd/kbd.c optional atkbd device-driver dev/kbd/kbd.c optional kbd device-driver -#dev/kbd/kbd.c optional ukbd device-driver +dev/kbd/kbd.c optional ukbd device-driver dev/syscons/syscons.c optional sc device-driver dev/syscons/scvidctl.c optional sc device-driver isa/syscons_isa.c optional sc device-driver isa/psm.c optional psm device-driver Index: head/sys/alpha/conf/options.alpha =================================================================== --- head/sys/alpha/conf/options.alpha (revision 44627) +++ head/sys/alpha/conf/options.alpha (revision 44628) @@ -1,51 +1,55 @@ -# $Id: options.alpha,v 1.8 1999/01/18 20:26:50 gallatin Exp $ +# $Id: options.alpha,v 1.9 1999/01/23 16:53:26 dfr Exp $ EV5 opt_global.h EV4 opt_global.h DEC_KN8AE opt_cpu.h DEC_EB164 opt_cpu.h DEC_EB64PLUS opt_cpu.h DEC_KN20AA opt_cpu.h DEC_2100_A50 opt_cpu.h DEC_ST550 opt_cpu.h DEC_AXPPCI_33 opt_cpu.h DEC_3000_300 opt_cpu.h DEC_3000_500 opt_cpu.h ATAPI opt_atapi.h ATAPI_STATIC opt_atapi.h CMD640 opt_wd.h SHOW_BUSYBUFS PANIC_REBOOT_WAIT_TIME opt_panic.h SC_SPLASH_SCREEN opt_syscons.h MAXCONS opt_syscons.h SLOW_VGA opt_syscons.h STD8X16FONT opt_syscons.h SC_HISTORY_SIZE opt_syscons.h SC_DISABLE_REBOOT opt_syscons.h SC_MOUSE_CHAR opt_syscons.h VGA_ALT_SEQACCESS opt_vga.h VGA_DEBUG opt_vga.h VGA_NO_FONT_LOADING opt_vga.h VGA_NO_MODE_CHANGE opt_vga.h VGA_SLOW_IOACCESS opt_vga.h PSM_HOOKAPM opt_psm.h PSM_RESETAFTERSUSPEND opt_psm.h PSM_DEBUG opt_psm.h # Fb options FB_INSTALL_CDEV opt_fb.h +# Atkbd options +ATKBD_DFLT_KEYMAP opt_atkbd.h + # Kbd options +KBD_DISABLE_KEYMAP_LOAD opt_kbd.h KBD_INSTALL_CDEV opt_kbd.h KBD_MAXRETRY opt_kbd.h KBD_MAXWAIT opt_kbd.h KBD_RESETDELAY opt_kbd.h KBDIO_DEBUG opt_kbd.h BREAK_TO_DEBUGGER opt_comconsole.h Index: head/sys/alpha/include/console.h =================================================================== --- head/sys/alpha/include/console.h (revision 44627) +++ head/sys/alpha/include/console.h (revision 44628) @@ -1,634 +1,636 @@ /*- * Copyright (c) 1991-1996 Søren Schmidt * All rights reserved. * * 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 * in this position and unchanged. * 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. The name of the author may not be used to endorse or promote products * derived from this software without specific prior written permission * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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. * - * $Id: console.h,v 1.42 1999/01/23 16:53:27 dfr Exp $ + * $Id: console.h,v 1.43 1999/02/05 11:51:56 yokota Exp $ * from: i386/include console.h,v 1.43 */ #ifndef _MACHINE_CONSOLE_H_ #define _MACHINE_CONSOLE_H_ #ifndef KERNEL #include #endif #include #define KDGKBMODE _IOR('K', 6, int) #define KDSKBMODE _IO('K', 7 /*, int */) #define KDMKTONE _IO('K', 8 /*, int */) #define KDGETMODE _IOR('K', 9, int) #define KDSETMODE _IO('K', 10 /*, int */) #define KDSBORDER _IO('K', 13 /*, int */) #define KDGKBSTATE _IOR('K', 19, int) #define KDSKBSTATE _IO('K', 20 /*, int */) #define KDENABIO _IO('K', 60) #define KDDISABIO _IO('K', 61) #define KIOCSOUND _IO('K', 63 /*, int */) #define KDGKBTYPE _IOR('K', 64, int) #define KDGETLED _IOR('K', 65, int) #define KDSETLED _IO('K', 66 /*, int */) -#define KDSETRAD _IO('K', 67 /*, int */) +#define KDSETRAD _IO('K', 67 /*, int */) /* obsolete */ #define KDRASTER _IOW('K', 100, scr_size_t) #define KDGKBINFO _IOR('K', 101, keyboard_info_t) +#define KDSETREPEAT _IOW('K', 102, keyboard_delay_t) #define GETFKEY _IOWR('k', 0, fkeyarg_t) #define SETFKEY _IOWR('k', 1, fkeyarg_t) #define GIO_SCRNMAP _IOR('k', 2, scrmap_t) #define PIO_SCRNMAP _IOW('k', 3, scrmap_t) #define GIO_KEYMAP _IOR('k', 6, keymap_t) #define PIO_KEYMAP _IOW('k', 7, keymap_t) #define GIO_DEADKEYMAP _IOR('k', 8, accentmap_t) #define PIO_DEADKEYMAP _IOW('k', 9, accentmap_t) #define GIO_KEYMAPENT _IOWR('k', 10, keyarg_t) #define PIO_KEYMAPENT _IOW('k', 11, keyarg_t) #define GIO_ATTR _IOR('a', 0, int) #define GIO_COLOR _IOR('c', 0, int) #define CONS_CURRENT _IOR('c', 1, int) #define CONS_GET _IOR('c', 2, int) #define CONS_IO _IO('c', 3) #define CONS_BLANKTIME _IOW('c', 4, int) #define CONS_SSAVER _IOW('c', 5, ssaver_t) #define CONS_GSAVER _IOWR('c', 6, ssaver_t) #define CONS_CURSORTYPE _IOW('c', 7, int) #define CONS_BELLTYPE _IOW('c', 8, int) #define CONS_HISTORY _IOW('c', 9, int) #define CONS_MOUSECTL _IOWR('c', 10, mouse_info_t) #define CONS_IDLE _IOR('c', 11, int) #define CONS_SAVERMODE _IOW('c', 12, int) #define CONS_SAVERSTART _IOW('c', 13, int) #define PIO_FONT8x8 _IOW('c', 64, fnt8_t) #define GIO_FONT8x8 _IOR('c', 65, fnt8_t) #define PIO_FONT8x14 _IOW('c', 66, fnt14_t) #define GIO_FONT8x14 _IOR('c', 67, fnt14_t) #define PIO_FONT8x16 _IOW('c', 68, fnt16_t) #define GIO_FONT8x16 _IOR('c', 69, fnt16_t) #define CONS_GETINFO _IOWR('c', 73, vid_info_t) #define CONS_GETVERS _IOR('c', 74, int) #define CONS_CURRENTADP _IOR('c', 100, int) #define CONS_ADPINFO _IOWR('c', 101, video_adapter_info_t) #define CONS_MODEINFO _IOWR('c', 102, video_info_t) #define CONS_FINDMODE _IOWR('c', 103, video_info_t) #define CONS_SETWINORG _IO('c', 104 /* u_int */) #define CONS_SETKBD _IO('c', 110 /* int */) #define CONS_RELKBD _IO('c', 111) /* CONS_SAVERMODE */ #define CONS_LKM_SAVER 0 #define CONS_USR_SAVER 1 #ifdef PC98 #define ADJUST_CLOCK _IO('t',100) /* for 98note resume */ #endif #define VT_OPENQRY _IOR('v', 1, int) #define VT_SETMODE _IOW('v', 2, vtmode_t) #define VT_GETMODE _IOR('v', 3, vtmode_t) #define VT_RELDISP _IO('v', 4 /*, int */) #define VT_ACTIVATE _IO('v', 5 /*, int */) #define VT_WAITACTIVE _IO('v', 6 /*, int */) #define VT_GETACTIVE _IOR('v', 7, int) #define VT_FALSE 0 #define VT_TRUE 1 #define VT_ACKACQ 2 #define VT_AUTO 0 /* switching is automatic */ #define VT_PROCESS 1 /* switching controlled by prog */ #define VT_KERNEL 255 /* switching controlled in kernel */ #ifndef _VT_MODE_DECLARED #define _VT_MODE_DECLARED struct vt_mode { char mode; char waitv; /* not implemented yet SOS */ short relsig; short acqsig; short frsig; /* not implemented yet SOS */ }; typedef struct vt_mode vtmode_t; #endif /* !_VT_MODE_DECLARED */ struct mouse_data { int x; int y; int z; int buttons; }; struct mouse_mode { int mode; int signal; }; struct mouse_event { int id; /* one based */ int value; }; #define MOUSE_SHOW 0x01 #define MOUSE_HIDE 0x02 #define MOUSE_MOVEABS 0x03 #define MOUSE_MOVEREL 0x04 #define MOUSE_GETINFO 0x05 #define MOUSE_MODE 0x06 #define MOUSE_ACTION 0x07 #define MOUSE_MOTION_EVENT 0x08 #define MOUSE_BUTTON_EVENT 0x09 struct mouse_info { int operation; union { struct mouse_data data; struct mouse_mode mode; struct mouse_event event; }u; }; #define KD_MONO 1 /* monochrome adapter */ #define KD_HERCULES 2 /* hercules adapter */ #define KD_CGA 3 /* color graphics adapter */ #define KD_EGA 4 /* enhanced graphics adapter */ #define KD_VGA 5 /* video graphics adapter */ #define KD_PC98 6 /* PC-98 display */ #define KD_TEXT 0 /* set text mode restore fonts */ #define KD_TEXT0 0 /* ditto */ #define KD_TEXT1 2 /* set text mode !restore fonts */ #define KD_GRAPHICS 1 /* set graphics mode */ #define KD_PIXEL 3 /* set pixel mode */ #define K_RAW 0 /* keyboard returns scancodes */ #define K_XLATE 1 /* keyboard returns ascii */ #define K_CODE 2 /* keyboard returns keycodes */ #define KB_84 1 /* 'old' 84 key AT-keyboard */ #define KB_101 2 /* MF-101 or MF-102 keyboard */ #define KB_OTHER 3 /* keyboard not known */ #define CLKED 1 /* Caps locked */ #define NLKED 2 /* Num locked */ #define SLKED 4 /* Scroll locked */ #define ALKED 8 /* AltGr locked */ #define LOCK_MASK (CLKED | NLKED | SLKED | ALKED) #define LED_CAP 1 /* Caps lock LED */ #define LED_NUM 2 /* Num lock LED */ #define LED_SCR 4 /* Scroll lock LED */ #define LED_MASK (LED_CAP | LED_NUM | LED_SCR) /* possible flag values */ #define FLAG_LOCK_O 0 #define FLAG_LOCK_C 1 #define FLAG_LOCK_N 2 #define NUM_KEYS 256 /* number of keys in table */ #define NUM_STATES 8 /* states per key */ #define ALTGR_OFFSET 128 /* offset for altlock keys */ #ifndef _KEYMAP_DECLARED #define _KEYMAP_DECLARED struct keyent_t { u_char map[NUM_STATES]; u_char spcl; u_char flgs; }; struct keymap { u_short n_keys; struct keyent_t key[NUM_KEYS]; }; typedef struct keymap keymap_t; struct keyarg { u_short keynum; struct keyent_t key; }; typedef struct keyarg keyarg_t; #endif /* !_KEYMAP_DECLARED */ #define NUM_DEADKEYS 15 /* number of accent keys */ #define NUM_ACCENTCHARS 52 /* max number of accent chars */ struct acc_t { u_char accchar; u_char map[NUM_ACCENTCHARS][2]; }; struct accentmap { u_short n_accs; struct acc_t acc[NUM_DEADKEYS]; }; #define MAXFK 16 #define NUM_FKEYS 96 struct fkeytab { u_char str[MAXFK]; u_char len; }; struct fkeyarg { u_short keynum; char keydef[MAXFK]; char flen; }; struct colors { char fore; char back; }; struct vid_info { short size; short m_num; u_short mv_row, mv_col; u_short mv_rsz, mv_csz; struct colors mv_norm, mv_rev, mv_grfc; u_char mv_ovscan; u_char mk_keylock; }; #define MAXSSAVER 16 struct ssaver { char name[MAXSSAVER]; int num; long time; }; /* video mode information block */ struct video_info { int vi_mode; int vi_flags; #define V_INFO_COLOR (1<<0) #define V_INFO_GRAPHICS (1<<1) #define V_INFO_LINEAR (1<<2) #define V_INFO_VESA (1<<3) int vi_width; int vi_height; int vi_cwidth; int vi_cheight; int vi_depth; int vi_planes; u_int vi_window; /* physical address */ size_t vi_window_size; size_t vi_window_gran; u_int vi_buffer; /* physical address */ size_t vi_buffer_size; /* XXX pixel format, memory model,... */ }; /* adapter infromation block */ struct video_adapter { int va_index; int va_type; char *va_name; int va_unit; int va_minor; int va_flags; #define V_ADP_COLOR (1<<0) #define V_ADP_MODECHANGE (1<<1) #define V_ADP_STATESAVE (1<<2) #define V_ADP_STATELOAD (1<<3) #define V_ADP_FONT (1<<4) #define V_ADP_PALETTE (1<<5) #define V_ADP_BORDER (1<<6) #define V_ADP_VESA (1<<7) #define V_ADP_PROBED (1<<16) #define V_ADP_INITIALIZED (1<<17) #define V_ADP_REGISTERED (1<<18) int va_io_base; int va_io_size; int va_crtc_addr; int va_mem_base; int va_mem_size; u_int va_window; /* virtual address */ size_t va_window_size; size_t va_window_gran; u_int va_buffer; /* virtual address */ size_t va_buffer_size; int va_initial_mode; int va_initial_bios_mode; int va_mode; struct video_info va_info; int va_line_width; void *va_token; }; struct video_adapter_info { int va_index; int va_type; char va_name[16]; int va_unit; int va_flags; int va_io_base; int va_io_size; int va_crtc_addr; int va_mem_base; int va_mem_size; u_int va_window; /* virtual address */ size_t va_window_size; size_t va_window_gran; u_int va_buffer; /* virtual address */ size_t va_buffer_size; int va_initial_mode; int va_initial_bios_mode; int va_mode; int va_line_width; }; #define V_ADP_PRIMARY 0 #define V_ADP_SECONDARY 1 struct keyboard_info { int kb_index; /* kbdio index# */ char kb_name[16]; /* driver name */ int kb_unit; /* unit# */ int kb_type; /* KB_84, KB_101, KB_OTHER,... */ int kb_config; /* device configuration flags */ int kb_flags; /* internal flags */ }; typedef struct accentmap accentmap_t; typedef struct fkeytab fkeytab_t; typedef struct fkeyarg fkeyarg_t; typedef struct vid_info vid_info_t; typedef struct mouse_info mouse_info_t; typedef struct {char scrmap[256];} scrmap_t; typedef struct {char fnt8x8[8*256];} fnt8_t; typedef struct {char fnt8x14[14*256];} fnt14_t; typedef struct {char fnt8x16[16*256];} fnt16_t; typedef struct ssaver ssaver_t; typedef struct video_adapter video_adapter_t; typedef struct video_adapter_info video_adapter_info_t; typedef struct video_info video_info_t; typedef struct keyboard_info keyboard_info_t; typedef struct {int scr_size[3];} scr_size_t; +typedef struct {int kbd_delay[2];} keyboard_delay_t; /* defines for "special" keys (spcl bit set in keymap) */ #define NOP 0x00 /* nothing (dead key) */ #define LSH 0x02 /* left shift key */ #define RSH 0x03 /* right shift key */ #define CLK 0x04 /* caps lock key */ #define NLK 0x05 /* num lock key */ #define SLK 0x06 /* scroll lock key */ #define LALT 0x07 /* left alt key */ #define BTAB 0x08 /* backwards tab */ #define LCTR 0x09 /* left control key */ #define NEXT 0x0a /* switch to next screen */ #define F_SCR 0x0b /* switch to first screen */ #define L_SCR 0x1a /* switch to last screen */ #define F_FN 0x1b /* first function key */ #define L_FN 0x7a /* last function key */ /* 0x7b-0x7f reserved do not use ! */ #define RCTR 0x80 /* right control key */ #define RALT 0x81 /* right alt (altgr) key */ #define ALK 0x82 /* alt lock key */ #define ASH 0x83 /* alt shift key */ #define META 0x84 /* meta key */ #define RBT 0x85 /* boot machine */ #define DBG 0x86 /* call debugger */ #define SUSP 0x87 /* suspend power (APM) */ #define SPSC 0x88 /* toggle splash/text screen */ #define F_ACC DGRA /* first accent key */ #define DGRA 0x89 /* grave */ #define DACU 0x8a /* acute */ #define DCIR 0x8b /* circumflex */ #define DTIL 0x8c /* tilde */ #define DMAC 0x8d /* macron */ #define DBRE 0x8e /* breve */ #define DDOT 0x8f /* dot */ #define DUML 0x90 /* umlaut/diaresis */ #define DDIA 0x90 /* diaresis */ #define DSLA 0x91 /* slash */ #define DRIN 0x92 /* ring */ #define DCED 0x93 /* cedilla */ #define DAPO 0x94 /* apostrophe */ #define DDAC 0x95 /* double acute */ #define DOGO 0x96 /* ogonek */ #define DCAR 0x97 /* caron */ #define L_ACC DCAR /* last accent key */ #define STBY 0x98 /* Go into standby mode (apm) */ #define F(x) ((x)+F_FN-1) #define S(x) ((x)+F_SCR-1) #define ACC(x) ((x)+F_ACC) #define NOKEY 0x100 /* no key pressed marker */ #define FKEY 0x200 /* function key marker */ #define MKEY 0x400 /* meta key marker (prepend ESC)*/ #define BKEY 0x800 /* backtab (ESC [ Z) */ #define SPCLKEY 0x8000 /* special key */ #define RELKEY 0x4000 /* key released */ #define ERRKEY 0x2000 /* error */ #define KEYCHAR(c) ((c) & 0x00ff) #define KEYFLAGS(c) ((c) & ~0x00ff) /* video mode definitions */ #define M_B40x25 0 /* black & white 40 columns */ #define M_C40x25 1 /* color 40 columns */ #define M_B80x25 2 /* black & white 80 columns */ #define M_C80x25 3 /* color 80 columns */ #define M_BG320 4 /* black & white graphics 320x200 */ #define M_CG320 5 /* color graphics 320x200 */ #define M_BG640 6 /* black & white graphics 640x200 hi-res */ #define M_EGAMONO80x25 7 /* ega-mono 80x25 */ #define M_CG320_D 13 /* ega mode D */ #define M_CG640_E 14 /* ega mode E */ #define M_EGAMONOAPA 15 /* ega mode F */ #define M_CG640x350 16 /* ega mode 10 */ #define M_ENHMONOAPA2 17 /* ega mode F with extended memory */ #define M_ENH_CG640 18 /* ega mode 10* */ #define M_ENH_B40x25 19 /* ega enhanced black & white 40 columns */ #define M_ENH_C40x25 20 /* ega enhanced color 40 columns */ #define M_ENH_B80x25 21 /* ega enhanced black & white 80 columns */ #define M_ENH_C80x25 22 /* ega enhanced color 80 columns */ #define M_VGA_C40x25 23 /* vga 8x16 font on color */ #define M_VGA_C80x25 24 /* vga 8x16 font on color */ #define M_VGA_M80x25 25 /* vga 8x16 font on mono */ #define M_VGA11 26 /* vga 640x480 2 colors */ #define M_BG640x480 26 #define M_VGA12 27 /* vga 640x480 16 colors */ #define M_CG640x480 27 #define M_VGA13 28 /* vga 640x200 256 colors */ #define M_VGA_CG320 28 #define M_VGA_C80x50 30 /* vga 8x8 font on color */ #define M_VGA_M80x50 31 /* vga 8x8 font on color */ #define M_VGA_C80x30 32 /* vga 8x16 font on color */ #define M_VGA_M80x30 33 /* vga 8x16 font on color */ #define M_VGA_C80x60 34 /* vga 8x8 font on color */ #define M_VGA_M80x60 35 /* vga 8x8 font on color */ #define M_VGA_CG640 36 /* vga 640x400 256 color */ #define M_VGA_MODEX 37 /* vga 320x240 256 color */ #define M_ENH_B80x43 0x70 /* ega black & white 80x43 */ #define M_ENH_C80x43 0x71 /* ega color 80x43 */ #define M_PC98_80x25 98 /* PC98 80x25 */ #define M_PC98_80x30 99 /* PC98 80x30 */ #define M_HGC_P0 0xe0 /* hercules graphics - page 0 @ B0000 */ #define M_HGC_P1 0xe1 /* hercules graphics - page 1 @ B8000 */ #define M_MCA_MODE 0xff /* monochrome adapter mode */ #define M_TEXT_80x25 200 /* generic text modes */ #define M_TEXT_80x30 201 #define M_TEXT_80x43 202 #define M_TEXT_80x50 203 #define M_TEXT_80x60 204 #define M_TEXT_132x25 205 #define M_TEXT_132x30 206 #define M_TEXT_132x43 207 #define M_TEXT_132x50 208 #define M_TEXT_132x60 209 #define SW_PC98_80x25 _IO('S', M_PC98_80x25) #define SW_PC98_80x30 _IO('S', M_PC98_80x30) #define SW_B40x25 _IO('S', M_B40x25) #define SW_C40x25 _IO('S', M_C40x25) #define SW_B80x25 _IO('S', M_B80x25) #define SW_C80x25 _IO('S', M_C80x25) #define SW_BG320 _IO('S', M_BG320) #define SW_CG320 _IO('S', M_CG320) #define SW_BG640 _IO('S', M_BG640) #define SW_EGAMONO80x25 _IO('S', M_EGAMONO80x25) #define SW_CG320_D _IO('S', M_CG320_D) #define SW_CG640_E _IO('S', M_CG640_E) #define SW_EGAMONOAPA _IO('S', M_EGAMONOAPA) #define SW_CG640x350 _IO('S', M_CG640x350) #define SW_ENH_MONOAPA2 _IO('S', M_ENHMONOAPA2) #define SW_ENH_CG640 _IO('S', M_ENH_CG640) #define SW_ENH_B40x25 _IO('S', M_ENH_B40x25) #define SW_ENH_C40x25 _IO('S', M_ENH_C40x25) #define SW_ENH_B80x25 _IO('S', M_ENH_B80x25) #define SW_ENH_C80x25 _IO('S', M_ENH_C80x25) #define SW_ENH_B80x43 _IO('S', M_ENH_B80x43) #define SW_ENH_C80x43 _IO('S', M_ENH_C80x43) #define SW_MCAMODE _IO('S', M_MCA_MODE) #define SW_VGA_C40x25 _IO('S', M_VGA_C40x25) #define SW_VGA_C80x25 _IO('S', M_VGA_C80x25) #define SW_VGA_C80x30 _IO('S', M_VGA_C80x30) #define SW_VGA_C80x50 _IO('S', M_VGA_C80x50) #define SW_VGA_C80x60 _IO('S', M_VGA_C80x60) #define SW_VGA_M80x25 _IO('S', M_VGA_M80x25) #define SW_VGA_M80x30 _IO('S', M_VGA_M80x30) #define SW_VGA_M80x50 _IO('S', M_VGA_M80x50) #define SW_VGA_M80x60 _IO('S', M_VGA_M80x60) #define SW_VGA11 _IO('S', M_VGA11) #define SW_BG640x480 _IO('S', M_VGA11) #define SW_VGA12 _IO('S', M_VGA12) #define SW_CG640x480 _IO('S', M_VGA12) #define SW_VGA13 _IO('S', M_VGA13) #define SW_VGA_CG320 _IO('S', M_VGA13) #define SW_VGA_CG640 _IO('S', M_VGA_CG640) #define SW_VGA_MODEX _IO('S', M_VGA_MODEX) #define SW_TEXT_80x25 _IO('S', M_TEXT_80x25) #define SW_TEXT_80x30 _IO('S', M_TEXT_80x30) #define SW_TEXT_80x43 _IO('S', M_TEXT_80x43) #define SW_TEXT_80x50 _IO('S', M_TEXT_80x50) #define SW_TEXT_80x60 _IO('S', M_TEXT_80x60) #define SW_TEXT_132x25 _IO('S', M_TEXT_132x25) #define SW_TEXT_132x30 _IO('S', M_TEXT_132x30) #define SW_TEXT_132x43 _IO('S', M_TEXT_132x43) #define SW_TEXT_132x50 _IO('S', M_TEXT_132x50) #define SW_TEXT_132x60 _IO('S', M_TEXT_132x60) #define M_VESA_BASE 0x100 /* VESA mode number base */ #define M_VESA_CG640x400 0x100 /* 640x400, 256 color */ #define M_VESA_CG640x480 0x101 /* 640x480, 256 color */ #define M_VESA_800x600 0x102 /* 800x600, 16 color */ #define M_VESA_CG800x600 0x103 /* 800x600, 256 color */ #define M_VESA_1024x768 0x104 /* 1024x768, 16 color */ #define M_VESA_CG1024x768 0x105 /* 1024x768, 256 color */ #define M_VESA_1280x1024 0x106 /* 1280x1024, 16 color */ #define M_VESA_CG1280x1024 0x107 /* 1280x1024, 256 color */ #define M_VESA_C80x60 0x108 /* 8x8 font */ #define M_VESA_C132x25 0x109 /* 8x16 font */ #define M_VESA_C132x43 0x10a /* 8x14 font */ #define M_VESA_C132x50 0x10b /* 8x8 font */ #define M_VESA_C132x60 0x10c /* 8x8 font */ #define M_VESA_32K_320 0x10d /* 320x200, 5:5:5 */ #define M_VESA_64K_320 0x10e /* 320x200, 5:6:5 */ #define M_VESA_FULL_320 0x10f /* 320x200, 8:8:8 */ #define M_VESA_32K_640 0x110 /* 640x480, 5:5:5 */ #define M_VESA_64K_640 0x111 /* 640x480, 5:6:5 */ #define M_VESA_FULL_640 0x112 /* 640x480, 8:8:8 */ #define M_VESA_32K_800 0x113 /* 800x600, 5:5:5 */ #define M_VESA_64K_800 0x114 /* 800x600, 5:6:5 */ #define M_VESA_FULL_800 0x115 /* 800x600, 8:8:8 */ #define M_VESA_32K_1024 0x116 /* 1024x768, 5:5:5 */ #define M_VESA_64K_1024 0x117 /* 1024x768, 5:6:5 */ #define M_VESA_FULL_1024 0x118 /* 1024x768, 8:8:8 */ #define M_VESA_32K_1280 0x119 /* 1280x1024, 5:5:5 */ #define M_VESA_64K_1280 0x11a /* 1280x1024, 5:6:5 */ #define M_VESA_FULL_1280 0x11b /* 1280x1024, 8:8:8 */ #define M_VESA_MODE_MAX 0x1ff #define SW_VESA_CG640x400 _IO('V', M_VESA_CG640x400 - M_VESA_BASE) #define SW_VESA_CG640x480 _IO('V', M_VESA_CG640x480 - M_VESA_BASE) #define SW_VESA_800x600 _IO('V', M_VESA_800x600 - M_VESA_BASE) #define SW_VESA_CG800x600 _IO('V', M_VESA_CG800x600 - M_VESA_BASE) #define SW_VESA_1024x768 _IO('V', M_VESA_1024x768 - M_VESA_BASE) #define SW_VESA_CG1024x768 _IO('V', M_VESA_CG1024x768 - M_VESA_BASE) #define SW_VESA_1280x1024 _IO('V', M_VESA_1280x1024 - M_VESA_BASE) #define SW_VESA_CG1280x1024 _IO('V', M_VESA_CG1280x1024 - M_VESA_BASE) #define SW_VESA_C80x60 _IO('V', M_VESA_C80x60 - M_VESA_BASE) #define SW_VESA_C132x25 _IO('V', M_VESA_C132x25 - M_VESA_BASE) #define SW_VESA_C132x43 _IO('V', M_VESA_C132x43 - M_VESA_BASE) #define SW_VESA_C132x50 _IO('V', M_VESA_C132x50 - M_VESA_BASE) #define SW_VESA_C132x60 _IO('V', M_VESA_C132x60 - M_VESA_BASE) #define SW_VESA_32K_320 _IO('V', M_VESA_32K_320 - M_VESA_BASE) #define SW_VESA_64K_320 _IO('V', M_VESA_64K_320 - M_VESA_BASE) #define SW_VESA_FULL_320 _IO('V', M_VESA_FULL_320 - M_VESA_BASE) #define SW_VESA_32K_640 _IO('V', M_VESA_32K_640 - M_VESA_BASE) #define SW_VESA_64K_640 _IO('V', M_VESA_64K_640 - M_VESA_BASE) #define SW_VESA_FULL_640 _IO('V', M_VESA_FULL_640 - M_VESA_BASE) #define SW_VESA_32K_800 _IO('V', M_VESA_32K_800 - M_VESA_BASE) #define SW_VESA_64K_800 _IO('V', M_VESA_64K_800 - M_VESA_BASE) #define SW_VESA_FULL_800 _IO('V', M_VESA_FULL_800 - M_VESA_BASE) #define SW_VESA_32K_1024 _IO('V', M_VESA_32K_1024 - M_VESA_BASE) #define SW_VESA_64K_1024 _IO('V', M_VESA_64K_1024 - M_VESA_BASE) #define SW_VESA_FULL_1024 _IO('V', M_VESA_FULL_1024 - M_VESA_BASE) #define SW_VESA_32K_1280 _IO('V', M_VESA_32K_1280 - M_VESA_BASE) #define SW_VESA_64K_1280 _IO('V', M_VESA_64K_1280 - M_VESA_BASE) #define SW_VESA_FULL_1280 _IO('V', M_VESA_FULL_1280 - M_VESA_BASE) #endif /* !_MACHINE_CONSOLE_H_ */ Index: head/sys/conf/files.alpha =================================================================== --- head/sys/conf/files.alpha (revision 44627) +++ head/sys/conf/files.alpha (revision 44628) @@ -1,155 +1,159 @@ # This file tells config what files go into building a kernel, # files marked standard are always included. # -# $Id: files.alpha,v 1.15 1999/01/18 20:26:50 gallatin Exp $ +# $Id: files.alpha,v 1.16 1999/01/23 16:53:26 dfr Exp $ # # The long compile-with and dependency lines are required because of # limitations in config: backslash-newline doesn't work in strings, and # dependency lines other than the first are silently ignored. # # font8x16.o optional std8x16font \ compile-with "uudecode < /usr/share/syscons/fonts/${STD8X16FONT}-8x16.fnt && file2c 'unsigned char font_16[16*256] = {' '};' < ${STD8X16FONT}-8x16 > font8x16.c && ${CC} -c ${CFLAGS} font8x16.c" \ no-implicit-rule before-depend \ clean "${STD8X16FONT}-8x16 font8x16.c" - # +atkbdmap.h optional atkbd_dflt_keymap \ + compile-with "kbdcontrol -L ${ATKBD_DFLT_KEYMAP} | sed -e 's/^static keymap_t.* = /static keymap_t key_map = /' -e 's/^static accentmap_t.* = /static accentmap_t accent_map = /' > atkbdmap.h" \ + no-obj no-implicit-rule before-depend \ + clean "atkbdmap.h" +# alpha/alpha/autoconf.c standard device-driver alpha/alpha/cpuconf.c standard alpha/alpha/atomic.s standard alpha/alpha/dec_kn8ae.c optional dec_kn8ae alpha/alpha/dec_eb164.c optional dec_eb164 alpha/alpha/dec_eb64plus.c optional dec_eb64plus alpha/alpha/dec_kn20aa.c optional dec_kn20aa alpha/alpha/dec_2100_a50.c optional dec_2100_a50 alpha/alpha/dec_st550.c optional dec_st550 alpha/alpha/dec_axppci_33.c optional dec_axppci_33 alpha/alpha/dec_3000_300.c optional dec_3000_300 alpha/alpha/dec_3000_500.c optional dec_3000_500 alpha/alpha/mountroot.c optional slice alpha/alpha/ipl_funcs.c standard alpha/alpha/pal.s standard alpha/alpha/busdma_machdep.c standard alpha/alpha/cons.c standard alpha/alpha/prom.c standard alpha/alpha/promcons.c standard alpha/alpha/prom_disp.s standard alpha/alpha/alpha-gdbstub.c optional ddb alpha/alpha/db_disasm.c optional ddb alpha/alpha/db_interface.c optional ddb alpha/alpha/db_trace.c optional ddb alpha/alpha/exception.s standard alpha/alpha/in_cksum.c optional inet # locore.s needs to be handled in Makefile to put it first. Otherwise it's # now normal. # alpha/alpha/locore.s standard alpha/alpha/machdep.c standard alpha/alpha/fp_emulate.c standard alpha/alpha/ieee_float.c standard alpha/alpha/mem.c standard alpha/alpha/mp_machdep.c optional smp alpha/alpha/perfmon.c optional perfmon profiling-routine alpha/alpha/perfmon.c optional perfmon alpha/alpha/pmap.c standard alpha/alpha/procfs_machdep.c standard alpha/alpha/simplelock.s optional smp alpha/alpha/support.s standard alpha/alpha/swtch.s standard alpha/alpha/sys_machdep.c standard alpha/alpha/trap.c standard alpha/alpha/interrupt.c standard alpha/alpha/userconfig.c optional userconfig alpha/alpha/vm_machdep.c standard alpha/alpha/clock.c standard clock_if.o standard \ dependency "clock_if.c" \ compile-with "${NORMAL_C}" \ no-implicit-rule local clock_if.c standard \ dependency "$S/kern/makedevops.pl $S/alpha/alpha/clock_if.m" \ compile-with "perl $S/kern/makedevops.pl -c $S/alpha/alpha/clock_if.m" \ no-obj no-implicit-rule before-depend local \ clean "clock_if.c" clock_if.h standard \ dependency "$S/kern/makedevops.pl $S/alpha/alpha/clock_if.m" \ compile-with "perl $S/kern/makedevops.pl -h $S/alpha/alpha/clock_if.m" \ no-obj no-implicit-rule before-depend \ clean "clock_if.h" alpha/alpha/diskslice_machdep.c standard alpha/tlsb/tlsb.c optional tlsb alpha/tlsb/gbus.c optional gbus alpha/tlsb/kftxx.c optional kft alpha/tlsb/mcclock_tlsb.c optional gbus alpha/tlsb/zs_tlsb.c optional gbus alpha/tlsb/dwlpx.c optional dwlpx alpha/tc/tcasic.c optional tcasic alpha/tc/tc.c optional tc alpha/tc/ioasic.c optional tc alpha/tc/mcclock_ioasic.c optional tc alpha/tc/if_le_ioasic.c optional le device-driver alpha/tc/if_le_dec.c optional le device-driver alpha/tc/am7990.c optional le device-driver alpha/tc/tcds.c optional tcds device-driver alpha/tc/tcds_dma.c optional tcds device-driver alpha/tc/esp.c optional esp device-driver dev/dec/mcclock.c standard device-driver mcclock_if.o standard \ dependency "mcclock_if.c" \ compile-with "${NORMAL_C}" \ no-implicit-rule local mcclock_if.c standard \ dependency "$S/kern/makedevops.pl $S/dev/dec/mcclock_if.m" \ compile-with "perl $S/kern/makedevops.pl -c $S/dev/dec/mcclock_if.m" \ no-obj no-implicit-rule before-depend local \ clean "mcclock_if.c" mcclock_if.h standard \ dependency "$S/kern/makedevops.pl $S/dev/dec/mcclock_if.m" \ compile-with "perl $S/kern/makedevops.pl -h $S/dev/dec/mcclock_if.m" \ no-obj no-implicit-rule before-depend \ clean "mcclock_if.h" alpha/pci/cia.c optional cia alpha/pci/pci_eb164_intr.s optional cia alpha/pci/apecs.c optional apecs alpha/pci/pci_eb64plus_intr.s optional apecs alpha/pci/lca.c optional lca alpha/pci/pcibus.c optional pci alpha/isa/isa.c optional isa alpha/isa/mcclock_isa.c optional isa alpha/alpha/elf_machdep.c standard libkern/bcd.c standard libkern/bcmp.c standard libkern/ffs.c standard libkern/inet_ntoa.c standard libkern/index.c standard libkern/mcount.c optional profiling-routine libkern/qsort.c standard libkern/random.c standard libkern/rindex.c standard libkern/scanc.c standard libkern/skpc.c standard libkern/strcat.c standard libkern/strcmp.c standard libkern/strcpy.c standard libkern/strlen.c standard libkern/strncmp.c standard libkern/strncpy.c standard libkern/alpha/htonl.S standard libkern/alpha/htons.S standard libkern/alpha/ntohl.S standard libkern/alpha/ntohs.S standard isa/sio.c optional sio device-driver dev/fb/fb.c optional fb device-driver dev/fb/fb.c optional vga device-driver isa/vga_isa.c optional vga device-driver dev/fb/splash.c optional splash dev/kbd/atkbd.c optional atkbd device-driver isa/atkbd_isa.c optional atkbd device-driver dev/kbd/atkbdc.c optional atkbdc device-driver isa/atkbdc_isa.c optional atkbdc device-driver dev/kbd/kbd.c optional atkbd device-driver dev/kbd/kbd.c optional kbd device-driver -#dev/kbd/kbd.c optional ukbd device-driver +dev/kbd/kbd.c optional ukbd device-driver dev/syscons/syscons.c optional sc device-driver dev/syscons/scvidctl.c optional sc device-driver isa/syscons_isa.c optional sc device-driver isa/psm.c optional psm device-driver Index: head/sys/conf/files.i386 =================================================================== --- head/sys/conf/files.i386 (revision 44627) +++ head/sys/conf/files.i386 (revision 44628) @@ -1,366 +1,376 @@ # This file tells config what files go into building a kernel, # files marked standard are always included. # -# $Id: files.i386,v 1.226 1999/03/07 16:11:12 hm Exp $ +# $Id: files.i386,v 1.227 1999/03/10 10:11:41 julian Exp $ # # The long compile-with and dependency lines are required because of # limitations in config: backslash-newline doesn't work in strings, and # dependency lines other than the first are silently ignored. # linux_genassym optional compat_linux \ dependency "$S/i386/linux/linux_genassym.c $S/i386/linux/linux.h" \ compile-with "${CC} ${CFLAGS} ${PARAM} -UKERNEL -o $@ $<" \ no-obj no-implicit-rule \ clean "linux_genassym" # linux_assym.h optional compat_linux \ dependency "linux_genassym" \ compile-with "./linux_genassym > $@" \ no-obj no-implicit-rule before-depend \ clean "linux_assym.h" # font8x16.o optional std8x16font \ compile-with "uudecode < /usr/share/syscons/fonts/${STD8X16FONT}-8x16.fnt && file2c 'unsigned char font_16[16*256] = {' '};' < ${STD8X16FONT}-8x16 > font8x16.c && ${CC} -c ${CFLAGS} font8x16.c" \ no-implicit-rule before-depend \ clean "${STD8X16FONT}-8x16 font8x16.c" # +atkbdmap.h optional atkbd_dflt_keymap \ + compile-with "kbdcontrol -L ${ATKBD_DFLT_KEYMAP} | sed -e 's/^static keymap_t.* = /static keymap_t key_map = /' -e 's/^static accentmap_t.* = /static accentmap_t accent_map = /' > atkbdmap.h" \ + no-obj no-implicit-rule before-depend \ + clean "atkbdmap.h" +# +ukbdmap.h optional ukbd_dflt_keymap \ + compile-with "kbdcontrol -L ${UKBD_DFLT_KEYMAP} | sed -e 's/^static keymap_t.* = /static keymap_t key_map = /' -e 's/^static accentmap_t.* = /static accentmap_t accent_map = /' > ukbdmap.h" \ + no-obj no-implicit-rule before-depend \ + clean "ukbdmap.h" +# dev/ata/ata-all.c optional ata device-driver dev/ata/atapi-all.c optional ata device-driver dev/ata/ata-disk.c optional atadisk device-driver dev/ata/atapi-cd.c optional atapicd device-driver dev/ata/atapi-fd.c optional atapifd device-driver dev/ata/atapi-tape.c optional atapist device-driver dev/fb/fb.c optional fb device-driver dev/fb/fb.c optional vga device-driver dev/fb/splash.c optional splash dev/kbd/atkbd.c optional atkbd device-driver dev/kbd/atkbdc.c optional atkbdc device-driver dev/kbd/kbd.c optional atkbd device-driver dev/kbd/kbd.c optional kbd device-driver -#dev/kbd/kbd.c optional ukbd device-driver +dev/kbd/kbd.c optional ukbd device-driver dev/syscons/syscons.c optional sc device-driver dev/syscons/scvidctl.c optional sc device-driver dev/syscons/scvesactl.c optional sc device-driver i386/apm/apm.c optional apm device-driver i386/apm/apm_setup.s optional apm i386/eisa/dpt_eisa.c optional eisa dpt device-driver i386/eisa/3c5x9.c optional ep device-driver i386/eisa/adv_eisa.c optional adv device-driver i386/eisa/ahc_eisa.c optional eisa ahc device-driver \ dependency "aic7xxx_reg.h $S/i386/eisa/ahc_eisa.c" i386/eisa/ahb.c optional ahb device-driver i386/eisa/bt_eisa.c optional bt device-driver i386/eisa/eisaconf.c optional eisa i386/eisa/if_vx_eisa.c optional vx device-driver i386/eisa/if_fea.c optional fea device-driver i386/i386/autoconf.c standard device-driver i386/i386/bios.c standard i386/i386/bioscall.s standard i386/i386/busdma_machdep.c standard i386/i386/cons.c standard i386/i386/db_disasm.c optional ddb i386/i386/db_interface.c optional ddb i386/i386/db_trace.c optional ddb i386/i386/elf_machdep.c standard i386/i386/exception.s standard i386/i386/globals.s standard i386/i386/i386-gdbstub.c optional ddb i386/i386/identcpu.c standard i386/i386/in_cksum.c optional inet i386/i386/initcpu.c standard # locore.s needs to be handled in Makefile to put it first. Otherwise it's # now normal. # i386/i386/locore.s standard i386/i386/machdep.c standard i386/i386/math_emulate.c optional math_emulate i386/i386/mem.c standard i386/i386/mp_machdep.c optional smp i386/i386/mpapic.c optional smp i386/i386/mpboot.s optional smp i386/i386/mplock.s optional smp i386/i386/perfmon.c optional perfmon profiling-routine i386/i386/perfmon.c optional perfmon i386/i386/pmap.c standard i386/i386/procfs_machdep.c standard i386/i386/simplelock.s optional smp i386/i386/support.s standard i386/i386/swtch.s standard i386/i386/sys_machdep.c standard i386/i386/trap.c standard i386/i386/userconfig.c optional userconfig i386/i386/vm_machdep.c standard i386/i386/vm86.c optional vm86 i386/ibcs2/ibcs2_fcntl.c optional ibcs2 i386/ibcs2/ibcs2_stat.c optional ibcs2 i386/ibcs2/ibcs2_ipc.c optional ibcs2 i386/ibcs2/ibcs2_msg.c optional ibcs2 i386/ibcs2/ibcs2_misc.c optional ibcs2 i386/ibcs2/ibcs2_other.c optional ibcs2 i386/ibcs2/ibcs2_signal.c optional ibcs2 i386/ibcs2/ibcs2_ioctl.c optional ibcs2 i386/ibcs2/ibcs2_socksys.c optional ibcs2 i386/ibcs2/ibcs2_sysi86.c optional ibcs2 i386/ibcs2/ibcs2_util.c optional ibcs2 i386/ibcs2/ibcs2_isc.c optional ibcs2 i386/ibcs2/ibcs2_isc_sysent.c optional ibcs2 i386/ibcs2/ibcs2_xenix.c optional ibcs2 i386/ibcs2/ibcs2_xenix_sysent.c optional ibcs2 i386/ibcs2/ibcs2_errno.c optional ibcs2 i386/ibcs2/ibcs2_sysent.c optional ibcs2 i386/ibcs2/ibcs2_sysvec.c optional ibcs2 i386/ibcs2/imgact_coff.c optional ibcs2 i386/isa/adv_isa.c optional adv device-driver #i386/isa/aha1542.c optional aha device-driver i386/isa/aha_isa.c optional aha device-driver #i386/isa/aic6360.c optional aic device-driver i386/isa/aic_isa.c optional aic device-driver i386/isa/atkbd_isa.c optional atkbd device-driver i386/isa/atkbdc_isa.c optional atkbdc device-driver i386/isa/bt_isa.c optional bt device-driver i386/isa/clock.c standard i386/isa/cronyx.c optional cx device-driver i386/isa/ctx.c optional ctx device-driver i386/isa/cx.c optional cx device-driver i386/isa/cy.c optional cy device-driver i386/isa/diskslice_machdep.c standard i386/isa/elink.c optional ep device-driver i386/isa/elink.c optional ie device-driver i386/isa/fd.c optional fd device-driver i386/isa/gpib.c optional gp device-driver i386/isa/asc.c optional asc device-driver i386/isa/gsc.c optional gsc device-driver i386/isa/if_ar.c optional ar device-driver i386/isa/if_cs.c optional cs device-driver i386/isa/if_cx.c optional cx device-driver i386/isa/if_ed.c optional ed device-driver i386/isa/if_el.c optional el device-driver i386/isa/if_ep.c optional ep device-driver i386/isa/if_ex.c optional ex device-driver i386/isa/if_fe.c optional fe device-driver i386/isa/if_ie.c optional ie device-driver i386/isa/if_le.c optional le device-driver i386/isa/if_lnc.c optional lnc device-driver i386/isa/if_rdp.c optional rdp device-driver i386/isa/if_sr.c optional sr device-driver i386/isa/if_wl.c optional wl device-driver i386/isa/if_ze.c optional ze device-driver i386/isa/if_zp.c optional zp device-driver contrib/dev/oltr/if_oltr.c optional oltr device-driver \ dependency "contrib/dev/oltr/trlld.o" contrib/dev/oltr/trlld.o optional oltr device-driver \ dependency "$S/contrib/dev/oltr/i386-${KERNFORMAT}.trlld.o.uu" \ compile-with "uudecode < $S/contrib/dev/oltr/i386-${KERNFORMAT}.trlld.o.uu" \ no-implicit-rule contrib/dev/oltr/trlldmac.c optional oltr device-driver contrib/dev/oltr/trlldhm.c optional oltr device-driver contrib/dev/oltr/trlldbm.c optional oltr device-driver i386/isa/ipl_funcs.c standard \ compile-with "${CC} -c ${CFLAGS} ${DEFINED_PROF:S/^$/-fomit-frame-pointer/} $<" i386/isa/intr_machdep.c standard i386/isa/isa.c optional isa device-driver i386/isa/istallion.c optional stli device-driver i386/isa/joy.c optional joy device-driver i386/isa/loran.c optional loran device-driver i386/isa/labpc.c optional labpc device-driver i386/isa/mcd.c optional mcd device-driver i386/isa/mse.c optional mse device-driver i386/isa/npx.c mandatory npx device-driver i386/isa/pcaudio.c optional pca device-driver i386/isa/matcd/matcd.c optional matcd device-driver i386/isa/pcibus.c optional pci device-driver i386/isa/pcicx.c optional ze device-driver i386/isa/pcicx.c optional zp device-driver i386/isa/pcvt/pcvt_drv.c optional vt device-driver i386/isa/pcvt/pcvt_ext.c optional vt device-driver i386/isa/pcvt/pcvt_kbd.c optional vt device-driver i386/isa/pcvt/pcvt_out.c optional vt device-driver i386/isa/pcvt/pcvt_sup.c optional vt device-driver i386/isa/pcvt/pcvt_vtf.c optional vt device-driver i386/isa/pnp.c optional pnp device-driver i386/isa/prof_machdep.c optional profiling-routine i386/isa/ppc.c optional ppc device-driver i386/isa/pcf.c optional pcf device-driver i386/isa/psm.c optional psm device-driver i386/isa/random_machdep.c standard i386/isa/rc.c optional rc device-driver i386/isa/rp.c optional rp device-driver i386/isa/scd.c optional scd device-driver i386/isa/si.c optional si device-driver i386/isa/si2_z280.c optional si device-driver i386/isa/si3_t225.c optional si device-driver i386/isa/sio.c optional sio device-driver i386/isa/snd/sound.c optional pcm device-driver i386/isa/snd/dmabuf.c optional pcm device-driver i386/isa/snd/ad1848.c optional pcm device-driver i386/isa/snd/sb_dsp.c optional pcm device-driver i386/isa/snd/clones.c optional pcm device-driver i386/isa/sound/dev_table.c optional snd device-driver i386/isa/sound/soundcard.c optional snd device-driver i386/isa/sound/sound_switch.c optional snd device-driver i386/isa/sound/audio.c optional snd device-driver i386/isa/sound/dmabuf.c optional snd device-driver i386/isa/sound/sys_timer.c optional snd device-driver i386/isa/sound/sequencer.c optional snd device-driver i386/isa/sound/patmgr.c optional snd device-driver i386/isa/sound/adlib_card.c optional opl device-driver i386/isa/sound/opl3.c optional opl device-driver i386/isa/sound/gus_card.c optional gus device-driver i386/isa/sound/gus_midi.c optional gus device-driver i386/isa/sound/gus_vol.c optional gus device-driver i386/isa/sound/gus_wave.c optional gus device-driver i386/isa/sound/ics2101.c optional gus device-driver i386/isa/sound/sound_timer.c optional gus device-driver i386/isa/sound/sound_timer.c optional css device-driver i386/isa/sound/sound_timer.c optional mss device-driver i386/isa/sound/midi_synth.c optional gus device-driver i386/isa/sound/midibuf.c optional gus device-driver i386/isa/sound/ad1848.c optional gusxvi device-driver i386/isa/sound/ad1848.c optional gus device-driver i386/isa/sound/ad1848.c optional mss device-driver i386/isa/sound/ad1848.c optional css device-driver i386/isa/sound/sound_timer.c optional mss device-driver i386/isa/sound/midi_synth.c optional mss device-driver i386/isa/sound/midibuf.c optional mss device-driver i386/isa/sound/mpu401.c optional mpu device-driver i386/isa/sound/midi_synth.c optional mpu device-driver i386/isa/sound/midibuf.c optional mpu device-driver i386/isa/sound/pas2_card.c optional pas device-driver i386/isa/sound/pas2_midi.c optional pas device-driver i386/isa/sound/pas2_mixer.c optional pas device-driver i386/isa/sound/pas2_pcm.c optional pas device-driver i386/isa/sound/midi_synth.c optional pas device-driver i386/isa/sound/midibuf.c optional pas device-driver i386/isa/sound/sb_card.c optional sb device-driver i386/isa/sound/sb_dsp.c optional sb device-driver i386/isa/sound/sb_midi.c optional sb device-driver i386/isa/sound/sb_mixer.c optional sb device-driver i386/isa/sound/midi_synth.c optional sb device-driver i386/isa/sound/midibuf.c optional sb device-driver i386/isa/sound/sb16_dsp.c optional sbxvi device-driver i386/isa/sound/sb16_midi.c optional sbmidi device-driver i386/isa/sound/uart6850.c optional uart device-driver i386/isa/sound/midi_synth.c optional uart device-driver i386/isa/sound/midi_synth.c optional css device-driver i386/isa/sound/midibuf.c optional uart device-driver i386/isa/sound/midibuf.c optional css device-driver i386/isa/sound/trix.c optional trix device-driver i386/isa/sound/adlib_card.c optional trix device-driver i386/isa/sound/opl3.c optional trix device-driver i386/isa/sound/ad1848.c optional trix device-driver i386/isa/sound/sound_timer.c optional trix device-driver i386/isa/sound/sscape.c optional sscape device-driver i386/isa/sound/ad1848.c optional sscape device-driver i386/isa/sound/sound_timer.c optional sscape device-driver i386/isa/sound/mpu401.c optional sscape device-driver i386/isa/sound/midi_synth.c optional sscape device-driver i386/isa/sound/midibuf.c optional sscape device-driver i386/isa/sound/cs4232.c optional css device-driver i386/isa/spigot.c optional spigot device-driver i386/isa/spkr.c optional speaker device-driver i386/isa/stallion.c optional stl device-driver i386/isa/syscons_isa.c optional sc device-driver i386/isa/vesa.c optional vga device-driver i386/isa/vga_isa.c optional vga device-driver i386/isa/tw.c optional tw device-driver i386/isa/wd.c optional wdc device-driver i386/isa/wd.c optional wd device-driver i386/isa/atapi.c optional atapi device-driver i386/isa/atapi-cd.c optional acd device-driver i386/isa/wfd.c optional wfd device-driver i386/isa/wst.c optional wst device-driver i386/isa/wt.c optional wt device-driver i386/linux/imgact_linux.c optional compat_linux i386/linux/linux_dummy.c optional compat_linux i386/linux/linux_file.c optional compat_linux i386/linux/linux_ioctl.c optional compat_linux i386/linux/linux_ipc.c optional compat_linux i386/linux/linux_locore.s optional compat_linux \ dependency "linux_assym.h" i386/linux/linux_misc.c optional compat_linux i386/linux/linux_signal.c optional compat_linux i386/linux/linux_socket.c optional compat_linux i386/linux/linux_stats.c optional compat_linux i386/linux/linux_sysent.c optional compat_linux i386/linux/linux_sysvec.c optional compat_linux i386/linux/linux_util.c optional compat_linux i4b/layer1/i4b_isic.c optional isic device-driver i4b/layer1/i4b_isic_isa.c optional isic device-driver i4b/layer1/i4b_isic_pnp.c optional isic device-driver i4b/layer1/i4b_isic_pci.c optional isic device-driver i4b/layer1/i4b_isic_pcmcia.c optional isic device-driver i4b/layer1/i4b_isac.c optional isic device-driver i4b/layer1/i4b_hscx.c optional isic device-driver i4b/layer1/i4b_l1.c optional isic device-driver i4b/layer1/i4b_l1fsm.c optional isic device-driver i4b/layer1/i4b_bchan.c optional isic device-driver i4b/layer1/i4b_tel_s08.c optional isic device-driver i4b/layer1/i4b_tel_s016.c optional isic device-driver i4b/layer1/i4b_tel_s0163.c optional isic device-driver i4b/layer1/i4b_tel_s0P.c optional isic device-driver i4b/layer1/i4b_ctx_s0P.c optional isic device-driver i4b/layer1/i4b_avm_a1.c optional isic device-driver i4b/layer1/i4b_avm_fritz_pci.c optional isic device-driver i4b/layer1/i4b_avm_fritz_pcmcia.c optional isic device-driver i4b/layer1/i4b_usr_sti.c optional isic device-driver i4b/layer1/i4b_itk_ix1.c optional isic device-driver i4b/layer1/i4b_drn_ngo.c optional isic device-driver i4b/layer1/i4b_sws.c optional isic device-driver i4b/layer1/i4b_dynalink.c optional isic device-driver i4b/layer1/i4b_elsa_qs1i.c optional isic device-driver i4b/layer1/i4b_elsa_qs1p.c optional isic device-driver libkern/bcd.c standard libkern/divdi3.c standard libkern/inet_ntoa.c standard libkern/index.c standard libkern/mcount.c optional profiling-routine libkern/moddi3.c standard libkern/qdivrem.c standard libkern/qsort.c standard libkern/random.c standard libkern/rindex.c standard libkern/scanc.c standard libkern/skpc.c standard libkern/strcat.c standard libkern/strcmp.c standard libkern/strcpy.c standard libkern/strlen.c standard libkern/strncmp.c standard libkern/strncpy.c standard libkern/udivdi3.c standard libkern/umoddi3.c standard gnu/i386/fpemul/div_small.s optional gpl_math_emulate gnu/i386/fpemul/errors.c optional gpl_math_emulate gnu/i386/fpemul/fpu_arith.c optional gpl_math_emulate gnu/i386/fpemul/fpu_aux.c optional gpl_math_emulate gnu/i386/fpemul/fpu_entry.c optional gpl_math_emulate gnu/i386/fpemul/fpu_etc.c optional gpl_math_emulate gnu/i386/fpemul/fpu_trig.c optional gpl_math_emulate gnu/i386/fpemul/get_address.c optional gpl_math_emulate gnu/i386/fpemul/load_store.c optional gpl_math_emulate gnu/i386/fpemul/poly_2xm1.c optional gpl_math_emulate gnu/i386/fpemul/poly_atan.c optional gpl_math_emulate gnu/i386/fpemul/poly_div.s optional gpl_math_emulate gnu/i386/fpemul/poly_l2.c optional gpl_math_emulate gnu/i386/fpemul/poly_mul64.s optional gpl_math_emulate gnu/i386/fpemul/poly_sin.c optional gpl_math_emulate gnu/i386/fpemul/poly_tan.c optional gpl_math_emulate gnu/i386/fpemul/polynomial.s optional gpl_math_emulate gnu/i386/fpemul/reg_add_sub.c optional gpl_math_emulate gnu/i386/fpemul/reg_compare.c optional gpl_math_emulate gnu/i386/fpemul/reg_constant.c optional gpl_math_emulate gnu/i386/fpemul/reg_div.s optional gpl_math_emulate gnu/i386/fpemul/reg_ld_str.c optional gpl_math_emulate gnu/i386/fpemul/reg_mul.c optional gpl_math_emulate gnu/i386/fpemul/reg_norm.s optional gpl_math_emulate gnu/i386/fpemul/reg_round.s optional gpl_math_emulate gnu/i386/fpemul/reg_u_add.s optional gpl_math_emulate gnu/i386/fpemul/reg_u_div.s optional gpl_math_emulate gnu/i386/fpemul/reg_u_mul.s optional gpl_math_emulate gnu/i386/fpemul/reg_u_sub.s optional gpl_math_emulate gnu/i386/fpemul/wm_shrx.s optional gpl_math_emulate gnu/i386/fpemul/wm_sqrt.s optional gpl_math_emulate gnu/i386/isa/dgb.c optional dgb device-driver gnu/i386/isa/dgm.c optional dgm device-driver gnu/i386/isa/sound/awe_wave.c optional awe device-driver pci/es1370.c optional pcm device-driver pci/ide_pci.c optional wd device-driver Index: head/sys/conf/options.alpha =================================================================== --- head/sys/conf/options.alpha (revision 44627) +++ head/sys/conf/options.alpha (revision 44628) @@ -1,51 +1,55 @@ -# $Id: options.alpha,v 1.8 1999/01/18 20:26:50 gallatin Exp $ +# $Id: options.alpha,v 1.9 1999/01/23 16:53:26 dfr Exp $ EV5 opt_global.h EV4 opt_global.h DEC_KN8AE opt_cpu.h DEC_EB164 opt_cpu.h DEC_EB64PLUS opt_cpu.h DEC_KN20AA opt_cpu.h DEC_2100_A50 opt_cpu.h DEC_ST550 opt_cpu.h DEC_AXPPCI_33 opt_cpu.h DEC_3000_300 opt_cpu.h DEC_3000_500 opt_cpu.h ATAPI opt_atapi.h ATAPI_STATIC opt_atapi.h CMD640 opt_wd.h SHOW_BUSYBUFS PANIC_REBOOT_WAIT_TIME opt_panic.h SC_SPLASH_SCREEN opt_syscons.h MAXCONS opt_syscons.h SLOW_VGA opt_syscons.h STD8X16FONT opt_syscons.h SC_HISTORY_SIZE opt_syscons.h SC_DISABLE_REBOOT opt_syscons.h SC_MOUSE_CHAR opt_syscons.h VGA_ALT_SEQACCESS opt_vga.h VGA_DEBUG opt_vga.h VGA_NO_FONT_LOADING opt_vga.h VGA_NO_MODE_CHANGE opt_vga.h VGA_SLOW_IOACCESS opt_vga.h PSM_HOOKAPM opt_psm.h PSM_RESETAFTERSUSPEND opt_psm.h PSM_DEBUG opt_psm.h # Fb options FB_INSTALL_CDEV opt_fb.h +# Atkbd options +ATKBD_DFLT_KEYMAP opt_atkbd.h + # Kbd options +KBD_DISABLE_KEYMAP_LOAD opt_kbd.h KBD_INSTALL_CDEV opt_kbd.h KBD_MAXRETRY opt_kbd.h KBD_MAXWAIT opt_kbd.h KBD_RESETDELAY opt_kbd.h KBDIO_DEBUG opt_kbd.h BREAK_TO_DEBUGGER opt_comconsole.h Index: head/sys/conf/options.i386 =================================================================== --- head/sys/conf/options.i386 (revision 44627) +++ head/sys/conf/options.i386 (revision 44628) @@ -1,180 +1,184 @@ -# $Id: options.i386,v 1.107 1999/03/09 20:20:02 phk Exp $ +# $Id: options.i386,v 1.108 1999/03/10 10:11:42 julian Exp $ DISABLE_PSE IDE_DELAY USER_LDT MATH_EMULATE opt_math_emulate.h GPL_MATH_EMULATE opt_math_emulate.h PMAP_SHPGPERPROC opt_pmap.h VM86 opt_vm86.h IBCS2 opt_dontuse.h COMPAT_LINUX opt_dontuse.h LINUX opt_dontuse.h DEBUG_LINUX opt_linux.h PPC_DEBUG opt_ppc.h SHOW_BUSYBUFS TUNE_1542 PANIC_REBOOT_WAIT_TIME opt_panic.h MAXMEM PERFMON opt_perfmon.h POWERFAIL_NMI opt_trap.h AUTO_EOI_1 opt_auto_eoi.h AUTO_EOI_2 opt_auto_eoi.h BREAK_TO_DEBUGGER opt_comconsole.h CONSPEED opt_comconsole.h COM_ESP opt_sio.h COM_MULTIPORT opt_sio.h EXTRA_SIO opt_sio.h I586_PMC_GUPROF opt_i586_guprof.h WLCACHE opt_wavelan.h WLDEBUG opt_wavelan.h # i386 SMP options APIC_IO opt_global.h NAPIC opt_smp.h NINTR opt_smp.h CLK_CALIBRATION_LOOP opt_clock.h CLK_USE_I8254_CALIBRATION opt_clock.h CLK_USE_TSC_CALIBRATION opt_clock.h TIMER_FREQ opt_clock.h NO_F00F_HACK opt_cpu.h CPU_BLUELIGHTNING_FPU_OP_CACHE opt_cpu.h CPU_BLUELIGHTNING_3X opt_cpu.h CPU_BTB_EN opt_cpu.h CPU_DIRECT_MAPPED_CACHE opt_cpu.h CPU_DISABLE_5X86_LSSER opt_cpu.h CPU_FASTER_5X86_FPU opt_cpu.h CPU_I486_ON_386 opt_cpu.h CPU_IORT opt_cpu.h CPU_LOOP_EN opt_cpu.h CPU_RSTK_EN opt_cpu.h CPU_SUSP_HLT opt_cpu.h CPU_UPGRADE_HW_CACHE opt_cpu.h CPU_WT_ALLOC opt_cpu.h CYRIX_CACHE_WORKS opt_cpu.h CYRIX_CACHE_REALLY_WORKS opt_cpu.h NO_MEMORY_HOLE opt_cpu.h # The CPU type affects the endian conversion functions all over the kernel. I386_CPU opt_global.h I486_CPU opt_global.h I586_CPU opt_global.h I686_CPU opt_global.h MAXCONS opt_syscons.h STD8X16FONT opt_syscons.h SC_HISTORY_SIZE opt_syscons.h SC_DISABLE_REBOOT opt_syscons.h SC_MOUSE_CHAR opt_syscons.h FB_INSTALL_CDEV opt_fb.h VGA_ALT_SEQACCESS opt_vga.h VGA_NO_FONT_LOADING opt_vga.h VGA_NO_MODE_CHANGE opt_vga.h VGA_SLOW_IOACCESS opt_vga.h VESA opt_vesa.h VESA_DEBUG opt_vesa.h PSM_HOOKAPM opt_psm.h PSM_RESETAFTERSUSPEND opt_psm.h PSM_DEBUG opt_psm.h PCIC_RESUME_RESET opt_pcic.h +ATKBD_DFLT_KEYMAP opt_atkbd.h +UKBD_DFLT_KEYMAP opt_ukbd.h + +KBD_DISABLE_KEYMAP_LOAD opt_kbd.h KBD_INSTALL_CDEV opt_kbd.h KBD_MAXRETRY opt_kbd.h KBD_MAXWAIT opt_kbd.h KBD_RESETDELAY opt_kbd.h KBDIO_DEBUG opt_kbd.h ATAPI opt_atapi.h ATAPI_STATIC opt_atapi.h CMD640 opt_wd.h USERCONFIG opt_userconfig.h VISUAL_USERCONFIG opt_userconfig.h INTRO_USERCONFIG opt_userconfig.h EISA_SLOTS opt_eisa.h FDC_DEBUG opt_fdc.h FDC_PRINT_BOGUS_CHIPTYPE opt_fdc.h FDC_YE opt_fdc.h FE_8BIT_SUPPORT opt_fe.h # pcvt(4) has a bunch of options FAT_CURSOR opt_pcvt.h XSERVER opt_pcvt.h PCVT_24LINESDEF opt_pcvt.h PCVT_CTRL_ALT_DEL opt_pcvt.h PCVT_EMU_MOUSE opt_pcvt.h PCVT_FREEBSD opt_pcvt.h PCVT_META_ESC opt_pcvt.h PCVT_NSCREENS opt_pcvt.h PCVT_PRETTYSCRNS opt_pcvt.h PCVT_SCANSET opt_pcvt.h PCVT_SCREENSAVER opt_pcvt.h PCVT_USEKBDSEC opt_pcvt.h PCVT_VT220KEYB opt_pcvt.h # voxware options GUS_DMA2 opt_sound.h GUS_DMA opt_sound.h GUS_IRQ opt_sound.h # Video spigot SPIGOT_UNSECURE opt_spigot.h # ------------------------------- # isdn4bsd: passive ISA cards # ------------------------------- TEL_S0_8 opt_i4b.h TEL_S0_16 opt_i4b.h TEL_S0_16_3 opt_i4b.h AVM_A1 opt_i4b.h USR_STI opt_i4b.h ITKIX1 opt_i4b.h # ------------------------------- # isdn4bsd: passive ISA PnP cards # ------------------------------- CRTX_S0_P opt_i4b.h DRN_NGO opt_i4b.h TEL_S0_16_3_P opt_i4b.h SEDLBAUER opt_i4b.h DYNALINK opt_i4b.h ELSA_QS1ISA opt_i4b.h # ------------------------------- # isdn4bsd: passive PCI cards # ------------------------------- ELSA_QS1PCI opt_i4b.h AVM_A1_PCI opt_i4b.h # ------------------------------- # isdn4bsd: passive PCMCIA cards # ------------------------------- AVM_A1_PCMCIA opt_i4b.h # ------------------------------- # isdn4bsd: misc options # ------------------------------- # temporary workaround for SMP machines I4B_SMP_WORKAROUND opt_i4b.h # enable VJ compression code for ipr i/f IPR_VJ opt_i4b.h # ------------------------------- # oltr: build options # ------------------------------- # Exclude microcode options OLTR_NO_TMS_MAC opt_oltr.h OLTR_NO_HAWKEYE_MAC opt_oltr.h OLTR_NO_BULLSEYE_MAC opt_oltr.h # ------------------------------- # EOF # ------------------------------- Index: head/sys/dev/atkbdc/atkbd.c =================================================================== --- head/sys/dev/atkbdc/atkbd.c (revision 44627) +++ head/sys/dev/atkbdc/atkbd.c (revision 44628) @@ -1,1350 +1,1422 @@ /*- * Copyright (c) 1999 Kazutaka YOKOTA * All rights reserved. * * 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 as * the first lines of this file unmodified. * 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. * * THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``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 AUTHORS 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. * - * $Id: atkbd.c,v 1.3 1999/01/19 11:31:14 yokota Exp $ + * $Id: atkbd.c,v 1.4 1999/01/28 10:55:55 yokota Exp $ */ #include "atkbd.h" #include "opt_kbd.h" +#include "opt_atkbd.h" #include "opt_devfs.h" #if NATKBD > 0 #include #include #include #include #include #include #include #include #include #include #include #ifndef __i386__ +#include #include +extern devclass_t atkbd_devclass; + #define ATKBD_SOFTC(unit) \ ((atkbd_softc_t *)devclass_get_softc(atkbd_devclass, unit)) #else /* __i386__ */ #include #include extern struct isa_driver atkbddriver; /* XXX: a kludge; see below */ static atkbd_softc_t *atkbd_softc[NATKBD]; -#define ATKBD_SOFTC(unit) atkbd_softc[(unit)] +#define ATKBD_SOFTC(unit) \ + (((unit) >= NATKBD) ? NULL : atkbd_softc[(unit)]) #endif /* __i386__ */ static timeout_t atkbd_timeout; #ifdef KBD_INSTALL_CDEV static d_open_t atkbdopen; static d_close_t atkbdclose; static d_read_t atkbdread; static d_ioctl_t atkbdioctl; static d_poll_t atkbdpoll; static struct cdevsw atkbd_cdevsw = { atkbdopen, atkbdclose, atkbdread, nowrite, atkbdioctl, nostop, nullreset, nodevtotty, atkbdpoll, nommap, NULL, ATKBD_DRIVER_NAME, NULL, -1, }; #endif /* KBD_INSTALL_CDEV */ #ifdef __i386__ atkbd_softc_t *atkbd_get_softc(int unit) { atkbd_softc_t *sc; if (unit >= sizeof(atkbd_softc)/sizeof(atkbd_softc[0])) return NULL; sc = atkbd_softc[unit]; if (sc == NULL) { sc = atkbd_softc[unit] = malloc(sizeof(*sc), M_DEVBUF, M_NOWAIT); if (sc == NULL) return NULL; bzero(sc, sizeof(*sc)); } return sc; } #endif /* __i386__ */ int -atkbd_probe_unit(int unit, atkbd_softc_t *sc, int port, int irq, int flags) +atkbd_probe_unit(int unit, int port, int irq, int flags) { keyboard_switch_t *sw; int args[2]; + int error; - if (sc->flags & ATKBD_ATTACHED) - return 0; - sw = kbd_get_switch(ATKBD_DRIVER_NAME); if (sw == NULL) return ENXIO; args[0] = port; args[1] = irq; - return (*sw->probe)(unit, &sc->kbd, args, flags); + error = (*sw->probe)(unit, args, flags); + if (error) + return error; + return 0; } int -atkbd_attach_unit(int unit, atkbd_softc_t *sc) +atkbd_attach_unit(int unit, atkbd_softc_t *sc, int port, int irq, int flags) { keyboard_switch_t *sw; + int args[2]; int error; if (sc->flags & ATKBD_ATTACHED) return 0; sw = kbd_get_switch(ATKBD_DRIVER_NAME); if (sw == NULL) return ENXIO; /* reset, initialize and enable the device */ - error = (*sw->init)(sc->kbd); + args[0] = port; + args[1] = irq; + sc->kbd = NULL; + error = (*sw->probe)(unit, args, flags); if (error) - return ENXIO; + return error; + error = (*sw->init)(unit, &sc->kbd, args, flags); + if (error) + return error; (*sw->enable)(sc->kbd); #ifdef KBD_INSTALL_CDEV /* attach a virtual keyboard cdev */ error = kbd_attach(makedev(0, ATKBD_MKMINOR(unit)), sc->kbd, &atkbd_cdevsw); if (error) return error; #endif /* * This is a kludge to compensate for lost keyboard interrupts. * A similar code used to be in syscons. See below. XXX */ atkbd_timeout(sc->kbd); if (bootverbose) (*sw->diag)(sc->kbd, bootverbose); sc->flags |= ATKBD_ATTACHED; return 0; } static void atkbd_timeout(void *arg) { keyboard_t *kbd; int s; /* The following comments are extracted from syscons.c (1.287) */ /* * With release 2.1 of the Xaccel server, the keyboard is left * hanging pretty often. Apparently an interrupt from the * keyboard is lost, and I don't know why (yet). * This ugly hack calls scintr if input is ready for the keyboard * and conveniently hides the problem. XXX */ /* * Try removing anything stuck in the keyboard controller; whether * it's a keyboard scan code or mouse data. `scintr()' doesn't * read the mouse data directly, but `kbdio' routines will, as a * side effect. */ s = spltty(); kbd = (keyboard_t *)arg; if ((*kbdsw[kbd->kb_index]->lock)(kbd, TRUE)) { /* * We have seen the lock flag is not set. Let's reset * the flag early, otherwise the LED update routine fails * which may want the lock during the interrupt routine. */ (*kbdsw[kbd->kb_index]->lock)(kbd, FALSE); if ((*kbdsw[kbd->kb_index]->check_char)(kbd)) - (*kbdsw[kbd->kb_index]->intr)(kbd); + (*kbdsw[kbd->kb_index]->intr)(kbd, NULL); } splx(s); timeout(atkbd_timeout, arg, hz/10); } /* cdev driver functions */ #ifdef KBD_INSTALL_CDEV static int atkbdopen(dev_t dev, int flag, int mode, struct proc *p) { atkbd_softc_t *sc; - int unit; - unit = ATKBD_UNIT(dev); - if ((unit >= NATKBD) || ((sc = ATKBD_SOFTC(unit)) == NULL)) + sc = ATKBD_SOFTC(ATKBD_UNIT(dev)); + if (sc == NULL) return ENXIO; if (mode & (FWRITE | O_CREAT | O_APPEND | O_TRUNC)) return ENODEV; /* FIXME: set the initial input mode (K_XLATE?) and lock state? */ return genkbdopen(&sc->gensc, sc->kbd, flag, mode, p); } static int atkbdclose(dev_t dev, int flag, int mode, struct proc *p) { atkbd_softc_t *sc; sc = ATKBD_SOFTC(ATKBD_UNIT(dev)); return genkbdclose(&sc->gensc, sc->kbd, flag, mode, p); } static int atkbdread(dev_t dev, struct uio *uio, int flag) { atkbd_softc_t *sc; sc = ATKBD_SOFTC(ATKBD_UNIT(dev)); return genkbdread(&sc->gensc, sc->kbd, uio, flag); } static int atkbdioctl(dev_t dev, u_long cmd, caddr_t arg, int flag, struct proc *p) { atkbd_softc_t *sc; sc = ATKBD_SOFTC(ATKBD_UNIT(dev)); return genkbdioctl(&sc->gensc, sc->kbd, cmd, arg, flag, p); } static int atkbdpoll(dev_t dev, int event, struct proc *p) { atkbd_softc_t *sc; sc = ATKBD_SOFTC(ATKBD_UNIT(dev)); return genkbdpoll(&sc->gensc, sc->kbd, event, p); } #endif /* KBD_INSTALL_CDEV */ /* LOW-LEVEL */ #include #include #include #define ATKBD_DEFAULT 0 typedef struct atkbd_state { KBDC kbdc; /* keyboard controller */ /* XXX: don't move this field; pcvt * expects `kbdc' to be the first * field in this structure. */ int ks_mode; /* input mode (K_XLATE,K_RAW,K_CODE) */ int ks_flags; /* flags */ #define COMPOSE (1 << 0) + int ks_polling; int ks_state; /* shift/lock key state */ int ks_accents; /* accent key index (> 0) */ u_int ks_composed_char; /* composed char code (> 0) */ u_char ks_prefix; /* AT scan code prefix */ } atkbd_state_t; /* keyboard driver declaration */ static int atkbd_configure(int flags); static kbd_probe_t atkbd_probe; static kbd_init_t atkbd_init; static kbd_term_t atkbd_term; static kbd_intr_t atkbd_intr; static kbd_test_if_t atkbd_test_if; static kbd_enable_t atkbd_enable; static kbd_disable_t atkbd_disable; static kbd_read_t atkbd_read; static kbd_check_t atkbd_check; static kbd_read_char_t atkbd_read_char; static kbd_check_char_t atkbd_check_char; static kbd_ioctl_t atkbd_ioctl; static kbd_lock_t atkbd_lock; static kbd_clear_state_t atkbd_clear_state; static kbd_get_state_t atkbd_get_state; static kbd_set_state_t atkbd_set_state; +static kbd_poll_mode_t atkbd_poll; keyboard_switch_t atkbdsw = { atkbd_probe, atkbd_init, atkbd_term, atkbd_intr, atkbd_test_if, atkbd_enable, atkbd_disable, atkbd_read, atkbd_check, atkbd_read_char, atkbd_check_char, atkbd_ioctl, atkbd_lock, atkbd_clear_state, atkbd_get_state, atkbd_set_state, genkbd_get_fkeystr, + atkbd_poll, genkbd_diag, }; KEYBOARD_DRIVER(atkbd, atkbdsw, atkbd_configure); /* local functions */ static int setup_kbd_port(KBDC kbdc, int port, int intr); static int get_kbd_echo(KBDC kbdc); static int probe_keyboard(KBDC kbdc, int flags); static int init_keyboard(KBDC kbdc, int *type, int flags); static int write_kbd(KBDC kbdc, int command, int data); static int get_kbd_id(KBDC kbdc); +static int typematic(int delay, int rate); /* local variables */ /* the initial key map, accent map and fkey strings */ +#ifdef ATKBD_DFLT_KEYMAP +#define KBD_DFLT_KEYMAP +#include "atkbdmap.h" +#endif #include /* structures for the default keyboard */ static keyboard_t default_kbd; static atkbd_state_t default_kbd_state; static keymap_t default_keymap; static accentmap_t default_accentmap; static fkeytab_t default_fkeytab[NUM_FKEYS]; /* * The back door to the keyboard driver! * This function is called by the console driver, via the kbdio module, * to tickle keyboard drivers when the low-level console is being initialized. * Almost nothing in the kernel has been initialied yet. Try to probe * keyboards if possible. * NOTE: because of the way the low-level conole is initialized, this routine * may be called more than once!! */ static int atkbd_configure(int flags) { keyboard_t *kbd; - KBDC kbdc; int arg[2]; #ifdef __i386__ struct isa_device *dev; + int i; /* XXX: a kludge to obtain the device configuration flags */ dev = find_isadev(isa_devtab_tty, &atkbddriver, 0); - if (dev != NULL) + if (dev != NULL) { flags |= dev->id_flags; + /* if the driver is disabled, unregister the keyboard if any */ + if (!dev->id_enabled) { + i = kbd_find_keyboard(ATKBD_DRIVER_NAME, ATKBD_DEFAULT); + if (i >= 0) { + kbd = kbd_get_keyboard(i); + kbd_unregister(kbd); + kbd->kb_flags &= ~KB_REGISTERED; + return 0; + } + } + } #endif /* probe the keyboard controller */ atkbdc_configure(); /* probe the default keyboard */ arg[0] = -1; arg[1] = -1; - if (atkbd_probe(ATKBD_DEFAULT, &kbd, arg, flags)) + kbd = NULL; + if (atkbd_probe(ATKBD_DEFAULT, arg, flags)) return 0; + if (atkbd_init(ATKBD_DEFAULT, &kbd, arg, flags)) + return 0; - /* initialize it */ - kbdc = ((atkbd_state_t *)kbd->kb_data)->kbdc; - if (!(flags & KB_CONF_PROBE_ONLY) && !KBD_IS_INITIALIZED(kbd)) { - if (KBD_HAS_DEVICE(kbd) - && init_keyboard(kbdc, &kbd->kb_type, flags) - && (flags & KB_CONF_FAIL_IF_NO_KBD)) - return 0; - KBD_INIT_DONE(kbd); - } + /* return the number of found keyboards */ + return 1; +} - /* and register */ - if (!KBD_IS_CONFIGURED(kbd)) { - if (kbd_register(kbd) < 0) +/* low-level functions */ + +/* detect a keyboard */ +static int +atkbd_probe(int unit, void *arg, int flags) +{ + KBDC kbdc; + int *data = (int *)arg; + + /* XXX */ + if (unit == ATKBD_DEFAULT) { + if (KBD_IS_PROBED(&default_kbd)) return 0; - KBD_CONFIG_DONE(kbd); } - return 1; /* return the number of found keyboards */ + kbdc = kbdc_open(data[0]); + if (kbdc == NULL) + return ENXIO; + if (probe_keyboard(kbdc, flags)) { + if (flags & KB_CONF_FAIL_IF_NO_KBD) + return ENXIO; + } + return 0; } -/* low-level functions */ - -/* initialize the keyboard_t structure and try to detect a keyboard */ +/* reset and initialize the device */ static int -atkbd_probe(int unit, keyboard_t **kbdp, void *arg, int flags) +atkbd_init(int unit, keyboard_t **kbdp, void *arg, int flags) { keyboard_t *kbd; atkbd_state_t *state; keymap_t *keymap; accentmap_t *accmap; fkeytab_t *fkeymap; int fkeymap_size; - KBDC kbdc; int *data = (int *)arg; /* XXX */ if (unit == ATKBD_DEFAULT) { *kbdp = kbd = &default_kbd; - if (KBD_IS_PROBED(kbd)) + if (KBD_IS_INITIALIZED(kbd) && KBD_IS_CONFIGURED(kbd)) return 0; state = &default_kbd_state; keymap = &default_keymap; accmap = &default_accentmap; fkeymap = default_fkeytab; fkeymap_size = sizeof(default_fkeytab)/sizeof(default_fkeytab[0]); } else if (*kbdp == NULL) { *kbdp = kbd = malloc(sizeof(*kbd), M_DEVBUF, M_NOWAIT); if (kbd == NULL) return ENOMEM; bzero(kbd, sizeof(*kbd)); state = malloc(sizeof(*state), M_DEVBUF, M_NOWAIT); keymap = malloc(sizeof(key_map), M_DEVBUF, M_NOWAIT); accmap = malloc(sizeof(accent_map), M_DEVBUF, M_NOWAIT); fkeymap = malloc(sizeof(fkey_tab), M_DEVBUF, M_NOWAIT); fkeymap_size = sizeof(fkey_tab)/sizeof(fkey_tab[0]); if ((state == NULL) || (keymap == NULL) || (accmap == NULL) || (fkeymap == NULL)) { if (state != NULL) free(state, M_DEVBUF); if (keymap != NULL) free(keymap, M_DEVBUF); if (accmap != NULL) free(accmap, M_DEVBUF); if (fkeymap != NULL) free(fkeymap, M_DEVBUF); free(kbd, M_DEVBUF); return ENOMEM; } bzero(state, sizeof(*state)); - } else if (KBD_IS_PROBED(*kbdp)) { + } else if (KBD_IS_INITIALIZED(*kbdp) && KBD_IS_CONFIGURED(*kbdp)) { return 0; } else { kbd = *kbdp; state = (atkbd_state_t *)kbd->kb_data; bzero(state, sizeof(*state)); keymap = kbd->kb_keymap; accmap = kbd->kb_accentmap; fkeymap = kbd->kb_fkeytab; fkeymap_size = kbd->kb_fkeytab_size; } - state->kbdc = kbdc = kbdc_open(data[0]); - if (kbdc == NULL) - return ENXIO; - kbd_init_struct(kbd, ATKBD_DRIVER_NAME, KB_OTHER, unit, flags, data[0], - IO_KBDSIZE); - bcopy(&key_map, keymap, sizeof(key_map)); - bcopy(&accent_map, accmap, sizeof(accent_map)); - bcopy(fkey_tab, fkeymap, - imin(fkeymap_size*sizeof(fkeymap[0]), sizeof(fkey_tab))); - kbd_set_maps(kbd, keymap, accmap, fkeymap, fkeymap_size); - kbd->kb_data = (void *)state; - - if (probe_keyboard(kbdc, flags)) { - if (flags & KB_CONF_FAIL_IF_NO_KBD) + if (!KBD_IS_PROBED(kbd)) { + state->kbdc = kbdc_open(data[0]); + if (state->kbdc == NULL) return ENXIO; - } else { - KBD_FOUND_DEVICE(kbd); + kbd_init_struct(kbd, ATKBD_DRIVER_NAME, KB_OTHER, unit, flags, + data[0], IO_KBDSIZE); + bcopy(&key_map, keymap, sizeof(key_map)); + bcopy(&accent_map, accmap, sizeof(accent_map)); + bcopy(fkey_tab, fkeymap, + imin(fkeymap_size*sizeof(fkeymap[0]), sizeof(fkey_tab))); + kbd_set_maps(kbd, keymap, accmap, fkeymap, fkeymap_size); + kbd->kb_data = (void *)state; + + if (probe_keyboard(state->kbdc, flags)) { /* shouldn't happen */ + if (flags & KB_CONF_FAIL_IF_NO_KBD) + return ENXIO; + } else { + KBD_FOUND_DEVICE(kbd); + } + atkbd_clear_state(kbd); + state->ks_mode = K_XLATE; + /* + * FIXME: set the initial value for lock keys in ks_state + * according to the BIOS data? + */ + KBD_PROBE_DONE(kbd); } - atkbd_clear_state(kbd); - state->ks_mode = K_XLATE; - /* - * FIXME: set the initial value for lock keys in ks_state - * according to the BIOS data? - */ - - KBD_PROBE_DONE(kbd); - return 0; -} - -/* reset and initialize the device */ -static int -atkbd_init(keyboard_t *kbd) -{ - KBDC kbdc; - - if ((kbd == NULL) || !KBD_IS_PROBED(kbd)) - return ENXIO; /* shouldn't happen */ - kbdc = ((atkbd_state_t *)kbd->kb_data)->kbdc; - if (kbdc == NULL) - return ENXIO; /* shouldn't happen */ - - if (!KBD_IS_INITIALIZED(kbd)) { + if (!KBD_IS_INITIALIZED(kbd) && !(flags & KB_CONF_PROBE_ONLY)) { if (KBD_HAS_DEVICE(kbd) - && init_keyboard(kbdc, &kbd->kb_type, kbd->kb_config) - && (kbd->kb_config & KB_CONF_FAIL_IF_NO_KBD)) + && init_keyboard(state->kbdc, &kbd->kb_type, kbd->kb_config) + && (kbd->kb_config & KB_CONF_FAIL_IF_NO_KBD)) return ENXIO; - atkbd_ioctl(kbd, KDSETLED, - (caddr_t)&((atkbd_state_t *)(kbd->kb_data))->ks_state); + atkbd_ioctl(kbd, KDSETLED, (caddr_t)&state->ks_state); KBD_INIT_DONE(kbd); } if (!KBD_IS_CONFIGURED(kbd)) { if (kbd_register(kbd) < 0) return ENXIO; KBD_CONFIG_DONE(kbd); } return 0; } /* finish using this keyboard */ static int atkbd_term(keyboard_t *kbd) { kbd_unregister(kbd); return 0; } /* keyboard interrupt routine */ static int -atkbd_intr(keyboard_t *kbd) +atkbd_intr(keyboard_t *kbd, void *arg) { atkbd_state_t *state; int c; if (KBD_IS_ACTIVE(kbd) && KBD_IS_BUSY(kbd)) { /* let the callback function to process the input */ (*kbd->kb_callback.kc_func)(kbd, KBDIO_KEYINPUT, kbd->kb_callback.kc_arg); } else { /* read and discard the input; no one is waiting for input */ do { c = atkbd_read_char(kbd, FALSE); } while (c != NOKEY); if (!KBD_HAS_DEVICE(kbd)) { /* * The keyboard was not detected before; * it must have been reconnected! */ state = (atkbd_state_t *)kbd->kb_data; init_keyboard(state->kbdc, &kbd->kb_type, kbd->kb_config); atkbd_ioctl(kbd, KDSETLED, (caddr_t)&state->ks_state); KBD_FOUND_DEVICE(kbd); } } return 0; } /* test the interface to the device */ static int atkbd_test_if(keyboard_t *kbd) { int error; int s; error = 0; empty_both_buffers(((atkbd_state_t *)kbd->kb_data)->kbdc, 10); s = spltty(); if (!test_controller(((atkbd_state_t *)kbd->kb_data)->kbdc)) error = EIO; else if (test_kbd_port(((atkbd_state_t *)kbd->kb_data)->kbdc) != 0) error = EIO; splx(s); return error; } /* * Enable the access to the device; until this function is called, * the client cannot read from the keyboard. */ static int atkbd_enable(keyboard_t *kbd) { int s; s = spltty(); KBD_ACTIVATE(kbd); splx(s); return 0; } /* disallow the access to the device */ static int atkbd_disable(keyboard_t *kbd) { int s; s = spltty(); KBD_DEACTIVATE(kbd); splx(s); return 0; } /* read one byte from the keyboard if it's allowed */ static int atkbd_read(keyboard_t *kbd, int wait) { int c; if (wait) c = read_kbd_data(((atkbd_state_t *)kbd->kb_data)->kbdc); else c = read_kbd_data_no_wait(((atkbd_state_t *)kbd->kb_data)->kbdc); return (KBD_IS_ACTIVE(kbd) ? c : -1); } /* check if data is waiting */ static int atkbd_check(keyboard_t *kbd) { if (!KBD_IS_ACTIVE(kbd)) return FALSE; return kbdc_data_ready(((atkbd_state_t *)kbd->kb_data)->kbdc); } /* read char from the keyboard */ static u_int atkbd_read_char(keyboard_t *kbd, int wait) { atkbd_state_t *state; u_int action; int scancode; int keycode; state = (atkbd_state_t *)kbd->kb_data; next_code: /* do we have a composed char to return? */ if (!(state->ks_flags & COMPOSE) && (state->ks_composed_char > 0)) { action = state->ks_composed_char; state->ks_composed_char = 0; if (action > UCHAR_MAX) return ERRKEY; return action; } /* see if there is something in the keyboard port */ if (wait) { do { scancode = read_kbd_data(state->kbdc); } while (scancode == -1); } else { scancode = read_kbd_data_no_wait(state->kbdc); if (scancode == -1) return NOKEY; } /* return the byte as is for the K_RAW mode */ if (state->ks_mode == K_RAW) return scancode; /* translate the scan code into a keycode */ keycode = scancode & 0x7F; switch (state->ks_prefix) { case 0x00: /* normal scancode */ switch(scancode) { case 0xB8: /* left alt (compose key) released */ if (state->ks_flags & COMPOSE) { state->ks_flags &= ~COMPOSE; if (state->ks_composed_char > UCHAR_MAX) state->ks_composed_char = 0; } break; case 0x38: /* left alt (compose key) pressed */ if (!(state->ks_flags & COMPOSE)) { state->ks_flags |= COMPOSE; state->ks_composed_char = 0; } break; case 0xE0: case 0xE1: state->ks_prefix = scancode; goto next_code; } break; case 0xE0: /* 0xE0 prefix */ state->ks_prefix = 0; switch (keycode) { case 0x1C: /* right enter key */ keycode = 0x59; break; case 0x1D: /* right ctrl key */ keycode = 0x5A; break; case 0x35: /* keypad divide key */ keycode = 0x5B; break; case 0x37: /* print scrn key */ keycode = 0x5C; break; case 0x38: /* right alt key (alt gr) */ keycode = 0x5D; break; case 0x46: /* ctrl-pause/break on AT 101 (see below) */ keycode = 0x68; break; case 0x47: /* grey home key */ keycode = 0x5E; break; case 0x48: /* grey up arrow key */ keycode = 0x5F; break; case 0x49: /* grey page up key */ keycode = 0x60; break; case 0x4B: /* grey left arrow key */ keycode = 0x61; break; case 0x4D: /* grey right arrow key */ keycode = 0x62; break; case 0x4F: /* grey end key */ keycode = 0x63; break; case 0x50: /* grey down arrow key */ keycode = 0x64; break; case 0x51: /* grey page down key */ keycode = 0x65; break; case 0x52: /* grey insert key */ keycode = 0x66; break; case 0x53: /* grey delete key */ keycode = 0x67; break; /* the following 3 are only used on the MS "Natural" keyboard */ case 0x5b: /* left Window key */ keycode = 0x69; break; case 0x5c: /* right Window key */ keycode = 0x6a; break; case 0x5d: /* menu key */ keycode = 0x6b; break; default: /* ignore everything else */ goto next_code; } break; case 0xE1: /* 0xE1 prefix */ /* * The pause/break key on the 101 keyboard produces: * E1-1D-45 E1-9D-C5 * Ctrl-pause/break produces: * E0-46 E0-C6 (See above.) */ state->ks_prefix = 0; if (keycode == 0x1D) state->ks_prefix = 0x1D; goto next_code; /* NOT REACHED */ case 0x1D: /* pause / break */ state->ks_prefix = 0; if (keycode != 0x45) goto next_code; keycode = 0x68; break; } if (kbd->kb_type == KB_84) { switch (keycode) { case 0x37: /* *(numpad)/print screen */ if (state->ks_flags & SHIFTS) keycode = 0x5c; /* print screen */ break; case 0x45: /* num lock/pause */ if (state->ks_flags & CTLS) keycode = 0x68; /* pause */ break; case 0x46: /* scroll lock/break */ if (state->ks_flags & CTLS) keycode = 0x6c; /* break */ break; } } else if (kbd->kb_type == KB_101) { switch (keycode) { case 0x5c: /* print screen */ if (state->ks_flags & ALTS) keycode = 0x54; /* sysrq */ break; case 0x68: /* pause/break */ if (state->ks_flags & CTLS) keycode = 0x6c; /* break */ break; } } /* return the key code in the K_CODE mode */ if (state->ks_mode == K_CODE) return (keycode | (scancode & 0x80)); /* compose a character code */ if (state->ks_flags & COMPOSE) { switch (scancode) { /* key pressed, process it */ case 0x47: case 0x48: case 0x49: /* keypad 7,8,9 */ state->ks_composed_char *= 10; state->ks_composed_char += scancode - 0x40; if (state->ks_composed_char > UCHAR_MAX) return ERRKEY; goto next_code; case 0x4B: case 0x4C: case 0x4D: /* keypad 4,5,6 */ state->ks_composed_char *= 10; state->ks_composed_char += scancode - 0x47; if (state->ks_composed_char > UCHAR_MAX) return ERRKEY; goto next_code; case 0x4F: case 0x50: case 0x51: /* keypad 1,2,3 */ state->ks_composed_char *= 10; state->ks_composed_char += scancode - 0x4E; if (state->ks_composed_char > UCHAR_MAX) return ERRKEY; goto next_code; case 0x52: /* keypad 0 */ state->ks_composed_char *= 10; if (state->ks_composed_char > UCHAR_MAX) return ERRKEY; goto next_code; /* key released, no interest here */ case 0xC7: case 0xC8: case 0xC9: /* keypad 7,8,9 */ case 0xCB: case 0xCC: case 0xCD: /* keypad 4,5,6 */ case 0xCF: case 0xD0: case 0xD1: /* keypad 1,2,3 */ case 0xD2: /* keypad 0 */ goto next_code; case 0x38: /* left alt key */ break; default: if (state->ks_composed_char > 0) { state->ks_flags &= ~COMPOSE; state->ks_composed_char = 0; return ERRKEY; } break; } } /* keycode to key action */ action = genkbd_keyaction(kbd, keycode, scancode & 0x80, &state->ks_state, &state->ks_accents); if (action == NOKEY) goto next_code; else return action; } /* check if char is waiting */ static int atkbd_check_char(keyboard_t *kbd) { atkbd_state_t *state; if (!KBD_IS_ACTIVE(kbd)) return FALSE; state = (atkbd_state_t *)kbd->kb_data; if (!(state->ks_flags & COMPOSE) && (state->ks_composed_char > 0)) return TRUE; return kbdc_data_ready(state->kbdc); } /* some useful control functions */ static int atkbd_ioctl(keyboard_t *kbd, u_long cmd, caddr_t arg) { /* trasnlate LED_XXX bits into the device specific bits */ static u_char ledmap[8] = { 0, 4, 2, 6, 1, 5, 3, 7, }; atkbd_state_t *state = kbd->kb_data; int error; int s; int i; s = spltty(); switch (cmd) { case KDGKBMODE: /* get keyboard mode */ *(int *)arg = state->ks_mode; break; case KDSKBMODE: /* set keyboard mode */ switch (*(int *)arg) { case K_XLATE: if (state->ks_mode != K_XLATE) { /* make lock key state and LED state match */ state->ks_state &= ~LOCK_MASK; state->ks_state |= KBD_LED_VAL(kbd); } /* FALL THROUGH */ case K_RAW: case K_CODE: if (state->ks_mode != *(int *)arg) { atkbd_clear_state(kbd); state->ks_mode = *(int *)arg; } break; default: splx(s); return EINVAL; } break; case KDGETLED: /* get keyboard LED */ *(int *)arg = KBD_LED_VAL(kbd); break; case KDSETLED: /* set keyboard LED */ /* NOTE: lock key state in ks_state won't be changed */ if (*(int *)arg & ~LOCK_MASK) { splx(s); return EINVAL; } i = *(int *)arg; /* replace CAPS LED with ALTGR LED for ALTGR keyboards */ if (kbd->kb_keymap->n_keys > ALTGR_OFFSET) { if (i & ALKED) i |= CLKED; else i &= ~CLKED; } if (KBD_HAS_DEVICE(kbd)) { error = write_kbd(state->kbdc, KBDC_SET_LEDS, ledmap[i & LED_MASK]); if (error) { splx(s); return error; } } KBD_LED_VAL(kbd) = *(int *)arg; break; case KDGKBSTATE: /* get lock key state */ *(int *)arg = state->ks_state & LOCK_MASK; break; case KDSKBSTATE: /* set lock key state */ if (*(int *)arg & ~LOCK_MASK) { splx(s); return EINVAL; } state->ks_state &= ~LOCK_MASK; state->ks_state |= *(int *)arg; splx(s); /* set LEDs and quit */ return atkbd_ioctl(kbd, KDSETLED, arg); - case KDSETRAD: /* set keyboard repeat rate */ + case KDSETREPEAT: /* set keyboard repeat rate (new interface) */ splx(s); if (!KBD_HAS_DEVICE(kbd)) return 0; - return write_kbd(state->kbdc, KBDC_SET_TYPEMATIC, - *(int *)arg); + i = typematic(((int *)arg)[0], ((int *)arg)[1]); + return write_kbd(state->kbdc, KBDC_SET_TYPEMATIC, i); + case KDSETRAD: /* set keyboard repeat rate (old interface) */ + splx(s); + if (!KBD_HAS_DEVICE(kbd)) + return 0; + return write_kbd(state->kbdc, KBDC_SET_TYPEMATIC, *(int *)arg); + case PIO_KEYMAP: /* set keyboard translation table */ case PIO_KEYMAPENT: /* set keyboard translation table entry */ case PIO_DEADKEYMAP: /* set accent key translation table */ state->ks_accents = 0; /* FALL THROUGH */ default: splx(s); return genkbd_commonioctl(kbd, cmd, arg); } splx(s); return 0; } /* lock the access to the keyboard */ static int atkbd_lock(keyboard_t *kbd, int lock) { return kbdc_lock(((atkbd_state_t *)kbd->kb_data)->kbdc, lock); } /* clear the internal state of the keyboard */ static void atkbd_clear_state(keyboard_t *kbd) { atkbd_state_t *state; state = (atkbd_state_t *)kbd->kb_data; state->ks_flags = 0; + state->ks_polling = 0; state->ks_state &= LOCK_MASK; /* preserve locking key state */ state->ks_accents = 0; state->ks_composed_char = 0; #if 0 state->ks_prefix = 0; /* XXX */ #endif } /* save the internal state */ static int atkbd_get_state(keyboard_t *kbd, void *buf, size_t len) { if (len == 0) return sizeof(atkbd_state_t); if (len < sizeof(atkbd_state_t)) return -1; bcopy(kbd->kb_data, buf, sizeof(atkbd_state_t)); return 0; } /* set the internal state */ static int atkbd_set_state(keyboard_t *kbd, void *buf, size_t len) { if (len < sizeof(atkbd_state_t)) return ENOMEM; if (((atkbd_state_t *)kbd->kb_data)->kbdc != ((atkbd_state_t *)buf)->kbdc) return ENOMEM; bcopy(buf, kbd->kb_data, sizeof(atkbd_state_t)); return 0; } +static int +atkbd_poll(keyboard_t *kbd, int on) +{ + atkbd_state_t *state; + int s; + + state = (atkbd_state_t *)kbd->kb_data; + s = spltty(); + if (on) + ++state->ks_polling; + else + --state->ks_polling; + splx(s); + return 0; +} + /* local functions */ static int setup_kbd_port(KBDC kbdc, int port, int intr) { if (!set_controller_command_byte(kbdc, KBD_KBD_CONTROL_BITS, ((port) ? KBD_ENABLE_KBD_PORT : KBD_DISABLE_KBD_PORT) | ((intr) ? KBD_ENABLE_KBD_INT : KBD_DISABLE_KBD_INT))) return 1; return 0; } static int get_kbd_echo(KBDC kbdc) { /* enable the keyboard port, but disable the keyboard intr. */ if (setup_kbd_port(kbdc, TRUE, FALSE)) /* CONTROLLER ERROR: there is very little we can do... */ return ENXIO; /* see if something is present */ write_kbd_command(kbdc, KBDC_ECHO); if (read_kbd_data(kbdc) != KBD_ECHO) { empty_both_buffers(kbdc, 10); test_controller(kbdc); test_kbd_port(kbdc); return ENXIO; } /* enable the keyboard port and intr. */ if (setup_kbd_port(kbdc, TRUE, TRUE)) { /* * CONTROLLER ERROR * This is serious; the keyboard intr is left disabled! */ return ENXIO; } return 0; } static int probe_keyboard(KBDC kbdc, int flags) { /* * Don't try to print anything in this function. The low-level * console may not have been initialized yet... */ int err; int c; int m; if (!kbdc_lock(kbdc, TRUE)) { /* driver error? */ return ENXIO; } /* flush any noise in the buffer */ empty_both_buffers(kbdc, 10); /* save the current keyboard controller command byte */ m = kbdc_get_device_mask(kbdc) & ~KBD_KBD_CONTROL_BITS; c = get_controller_command_byte(kbdc); if (c == -1) { /* CONTROLLER ERROR */ kbdc_set_device_mask(kbdc, m); kbdc_lock(kbdc, FALSE); return ENXIO; } /* * The keyboard may have been screwed up by the boot block. * We may just be able to recover from error by testing the controller * and the keyboard port. The controller command byte needs to be * saved before this recovery operation, as some controllers seem * to set the command byte to particular values. */ test_controller(kbdc); test_kbd_port(kbdc); err = get_kbd_echo(kbdc); if (err == 0) { kbdc_set_device_mask(kbdc, m | KBD_KBD_CONTROL_BITS); } else { if (c != -1) /* try to restore the command byte as before */ set_controller_command_byte(kbdc, 0xff, c); kbdc_set_device_mask(kbdc, m); } kbdc_lock(kbdc, FALSE); return err; } static int init_keyboard(KBDC kbdc, int *type, int flags) { int codeset; int id; int c; if (!kbdc_lock(kbdc, TRUE)) { /* driver error? */ return EIO; } /* save the current controller command byte */ empty_both_buffers(kbdc, 10); c = get_controller_command_byte(kbdc); if (c == -1) { /* CONTROLLER ERROR */ kbdc_lock(kbdc, FALSE); printf("atkbd: unable to get the current command byte value.\n"); return EIO; } if (bootverbose) printf("atkbd: the current kbd controller command byte %04x\n", c); #if 0 /* override the keyboard lock switch */ c |= KBD_OVERRIDE_KBD_LOCK; #endif /* enable the keyboard port, but disable the keyboard intr. */ if (setup_kbd_port(kbdc, TRUE, FALSE)) { /* CONTROLLER ERROR: there is very little we can do... */ printf("atkbd: unable to set the command byte.\n"); kbdc_lock(kbdc, FALSE); return EIO; } /* * Check if we have an XT keyboard before we attempt to reset it. * The procedure assumes that the keyboard and the controller have * been set up properly by BIOS and have not been messed up * during the boot process. */ codeset = -1; if (flags & KB_CONF_ALT_SCANCODESET) /* the user says there is a XT keyboard */ codeset = 1; #ifdef KBD_DETECT_XT_KEYBOARD else if ((c & KBD_TRANSLATION) == 0) { /* SET_SCANCODE_SET is not always supported; ignore error */ if (send_kbd_command_and_data(kbdc, KBDC_SET_SCANCODE_SET, 0) == KBD_ACK) codeset = read_kbd_data(kbdc); } if (bootverbose) printf("atkbd: scancode set %d\n", codeset); #endif /* KBD_DETECT_XT_KEYBOARD */ *type = KB_OTHER; id = get_kbd_id(kbdc); switch(id) { case 0x41ab: case 0x83ab: *type = KB_101; break; case -1: /* AT 84 keyboard doesn't return ID */ *type = KB_84; break; default: break; } if (bootverbose) printf("atkbd: keyboard ID 0x%x (%d)\n", id, *type); /* reset keyboard hardware */ if (!(flags & KB_CONF_NO_RESET) && !reset_kbd(kbdc)) { /* * KEYBOARD ERROR * Keyboard reset may fail either because the keyboard * doen't exist, or because the keyboard doesn't pass * the self-test, or the keyboard controller on the * motherboard and the keyboard somehow fail to shake hands. * It is just possible, particularly in the last case, * that the keyoard controller may be left in a hung state. * test_controller() and test_kbd_port() appear to bring * the keyboard controller back (I don't know why and how, * though.) */ empty_both_buffers(kbdc, 10); test_controller(kbdc); test_kbd_port(kbdc); /* * We could disable the keyboard port and interrupt... but, * the keyboard may still exist (see above). */ set_controller_command_byte(kbdc, 0xff, c); kbdc_lock(kbdc, FALSE); if (bootverbose) printf("atkbd: failed to reset the keyboard.\n"); return EIO; } /* * Allow us to set the XT_KEYBD flag in UserConfig so that keyboards * such as those on the IBM ThinkPad laptop computers can be used * with the standard console driver. */ if (codeset == 1) { if (send_kbd_command_and_data(kbdc, KBDC_SET_SCANCODE_SET, codeset) == KBD_ACK) { /* XT kbd doesn't need scan code translation */ c &= ~KBD_TRANSLATION; } else { /* * KEYBOARD ERROR * The XT kbd isn't usable unless the proper scan * code set is selected. */ set_controller_command_byte(kbdc, 0xff, c); kbdc_lock(kbdc, FALSE); printf("atkbd: unable to set the XT keyboard mode.\n"); return EIO; } } #ifdef __alpha__ if (send_kbd_command_and_data( kbdc, KBDC_SET_SCANCODE_SET, 2) != KBD_ACK) { printf("atkbd: can't set translation.\n"); } c |= KBD_TRANSLATION; #endif /* enable the keyboard port and intr. */ if (!set_controller_command_byte(kbdc, KBD_KBD_CONTROL_BITS | KBD_TRANSLATION | KBD_OVERRIDE_KBD_LOCK, (c & (KBD_TRANSLATION | KBD_OVERRIDE_KBD_LOCK)) | KBD_ENABLE_KBD_PORT | KBD_ENABLE_KBD_INT)) { /* * CONTROLLER ERROR * This is serious; we are left with the disabled * keyboard intr. */ set_controller_command_byte(kbdc, 0xff, c); kbdc_lock(kbdc, FALSE); printf("atkbd: unable to enable the keyboard port and intr.\n"); return EIO; } kbdc_lock(kbdc, FALSE); return 0; } static int write_kbd(KBDC kbdc, int command, int data) { int s; /* prevent the timeout routine from polling the keyboard */ if (!kbdc_lock(kbdc, TRUE)) return EBUSY; /* disable the keyboard and mouse interrupt */ s = spltty(); #if 0 c = get_controller_command_byte(kbdc); if ((c == -1) || !set_controller_command_byte(kbdc, kbdc_get_device_mask(kbdc), KBD_DISABLE_KBD_PORT | KBD_DISABLE_KBD_INT | KBD_DISABLE_AUX_PORT | KBD_DISABLE_AUX_INT)) { /* CONTROLLER ERROR */ kbdc_lock(kbdc, FALSE); splx(s); return EIO; } /* * Now that the keyboard controller is told not to generate * the keyboard and mouse interrupts, call `splx()' to allow * the other tty interrupts. The clock interrupt may also occur, * but the timeout routine (`scrn_timer()') will be blocked * by the lock flag set via `kbdc_lock()' */ splx(s); #endif if (send_kbd_command_and_data(kbdc, command, data) != KBD_ACK) send_kbd_command(kbdc, KBDC_ENABLE_KBD); #if 0 /* restore the interrupts */ if (!set_controller_command_byte(kbdc, kbdc_get_device_mask(kbdc), c & (KBD_KBD_CONTROL_BITS | KBD_AUX_CONTROL_BITS))) { /* CONTROLLER ERROR */ } #else splx(s); #endif kbdc_lock(kbdc, FALSE); return 0; } static int get_kbd_id(KBDC kbdc) { int id1, id2; empty_both_buffers(kbdc, 10); id1 = id2 = -1; if (send_kbd_command(kbdc, KBDC_SEND_DEV_ID) != KBD_ACK) return -1; DELAY(10000); /* 10 msec delay */ id1 = read_kbd_data(kbdc); if (id1 != -1) id2 = read_kbd_data(kbdc); if ((id1 == -1) || (id2 == -1)) { empty_both_buffers(kbdc, 10); test_controller(kbdc); test_kbd_port(kbdc); return -1; } return ((id2 << 8) | id1); +} + +static int +typematic(int delay, int rate) +{ + static int delays[] = { 250, 500, 750, 1000 }; + static int rates[] = { 34, 38, 42, 46, 50, 55, 59, 63, + 68, 76, 84, 92, 100, 110, 118, 126, + 136, 152, 168, 184, 200, 220, 236, 252, + 272, 304, 336, 368, 400, 440, 472, 504 }; + int value; + int i; + + for (i = sizeof(delays)/sizeof(delays[0]) - 1; i > 0; --i) { + if (delay >= delays[i]) + break; + } + value = i << 5; + for (i = sizeof(rates)/sizeof(rates[0]) - 1; i > 0; --i) { + if (rate >= rates[i]) + break; + } + value |= i; + return value; } #endif /* NATKBD > 0 */ Index: head/sys/dev/atkbdc/atkbd_atkbdc.c =================================================================== --- head/sys/dev/atkbdc/atkbd_atkbdc.c (revision 44627) +++ head/sys/dev/atkbdc/atkbd_atkbdc.c (revision 44628) @@ -1,119 +1,130 @@ /*- * Copyright (c) 1999 Kazutaka YOKOTA * All rights reserved. * * 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 as * the first lines of this file unmodified. * 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. * * THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``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 AUTHORS 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. * - * $Id: $ + * $Id: atkbd_isa.c,v 1.1 1999/01/23 16:53:27 dfr Exp $ */ #include "atkbd.h" #include "opt_kbd.h" #if NATKBD > 0 #include #include #include #include #include #include #include #include #include #include #include #include #include devclass_t atkbd_devclass; static int atkbdprobe(device_t dev); static int atkbdattach(device_t dev); +static void atkbd_isa_intr(void *arg); static device_method_t atkbd_methods[] = { DEVMETHOD(device_probe, atkbdprobe), DEVMETHOD(device_attach, atkbdattach), { 0, 0 } }; static driver_t atkbd_driver = { ATKBD_DRIVER_NAME, atkbd_methods, DRIVER_TYPE_TTY, sizeof(atkbd_softc_t), }; static int atkbdprobe(device_t dev) { - atkbd_softc_t *sc; u_long port; u_long irq; u_long flags; - sc = (atkbd_softc_t *)device_get_softc(dev); - device_set_desc(dev, "AT Keyboard"); /* obtain parameters */ BUS_READ_IVAR(device_get_parent(dev), dev, KBDC_IVAR_PORT, &port); BUS_READ_IVAR(device_get_parent(dev), dev, KBDC_IVAR_IRQ, &irq); BUS_READ_IVAR(device_get_parent(dev), dev, KBDC_IVAR_FLAGS, &flags); /* probe the device */ - return atkbd_probe_unit(device_get_unit(dev), sc, port, irq, flags); + return atkbd_probe_unit(device_get_unit(dev), port, irq, flags); } static int atkbdattach(device_t dev) { atkbd_softc_t *sc; + u_long port; u_long irq; + u_long flags; struct resource *res; void *ih; int zero = 0; int error; sc = (atkbd_softc_t *)device_get_softc(dev); - error = atkbd_attach_unit(device_get_unit(dev), sc); + BUS_READ_IVAR(device_get_parent(dev), dev, KBDC_IVAR_PORT, &port); + BUS_READ_IVAR(device_get_parent(dev), dev, KBDC_IVAR_IRQ, &irq); + BUS_READ_IVAR(device_get_parent(dev), dev, KBDC_IVAR_FLAGS, &flags); + + error = atkbd_attach_unit(device_get_unit(dev), sc, port, irq, flags); if (error) return error; /* declare our interrupt handler */ - BUS_READ_IVAR(device_get_parent(dev), dev, KBDC_IVAR_IRQ, &irq); res = bus_alloc_resource(dev, SYS_RES_IRQ, &zero, irq, irq, 1, RF_SHAREABLE | RF_ACTIVE); - BUS_SETUP_INTR(device_get_parent(dev), dev, res, - (driver_intr_t *) kbdsw[sc->kbd->kb_index]->intr, sc->kbd, + BUS_SETUP_INTR(device_get_parent(dev), dev, res, atkbd_isa_intr, sc, &ih); return 0; +} + +static void +atkbd_isa_intr(void *arg) +{ + atkbd_softc_t *sc; + + sc = (atkbd_softc_t *)arg; + (*kbdsw[sc->kbd->kb_index]->intr)(sc->kbd, NULL); } DRIVER_MODULE(atkbd, atkbdc, atkbd_driver, atkbd_devclass, 0, 0); #endif /* NATKBD > 0 */ Index: head/sys/dev/atkbdc/atkbd_isa.c =================================================================== --- head/sys/dev/atkbdc/atkbd_isa.c (revision 44627) +++ head/sys/dev/atkbdc/atkbd_isa.c (revision 44628) @@ -1,119 +1,130 @@ /*- * Copyright (c) 1999 Kazutaka YOKOTA * All rights reserved. * * 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 as * the first lines of this file unmodified. * 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. * * THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``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 AUTHORS 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. * - * $Id: $ + * $Id: atkbd_isa.c,v 1.1 1999/01/23 16:53:27 dfr Exp $ */ #include "atkbd.h" #include "opt_kbd.h" #if NATKBD > 0 #include #include #include #include #include #include #include #include #include #include #include #include #include devclass_t atkbd_devclass; static int atkbdprobe(device_t dev); static int atkbdattach(device_t dev); +static void atkbd_isa_intr(void *arg); static device_method_t atkbd_methods[] = { DEVMETHOD(device_probe, atkbdprobe), DEVMETHOD(device_attach, atkbdattach), { 0, 0 } }; static driver_t atkbd_driver = { ATKBD_DRIVER_NAME, atkbd_methods, DRIVER_TYPE_TTY, sizeof(atkbd_softc_t), }; static int atkbdprobe(device_t dev) { - atkbd_softc_t *sc; u_long port; u_long irq; u_long flags; - sc = (atkbd_softc_t *)device_get_softc(dev); - device_set_desc(dev, "AT Keyboard"); /* obtain parameters */ BUS_READ_IVAR(device_get_parent(dev), dev, KBDC_IVAR_PORT, &port); BUS_READ_IVAR(device_get_parent(dev), dev, KBDC_IVAR_IRQ, &irq); BUS_READ_IVAR(device_get_parent(dev), dev, KBDC_IVAR_FLAGS, &flags); /* probe the device */ - return atkbd_probe_unit(device_get_unit(dev), sc, port, irq, flags); + return atkbd_probe_unit(device_get_unit(dev), port, irq, flags); } static int atkbdattach(device_t dev) { atkbd_softc_t *sc; + u_long port; u_long irq; + u_long flags; struct resource *res; void *ih; int zero = 0; int error; sc = (atkbd_softc_t *)device_get_softc(dev); - error = atkbd_attach_unit(device_get_unit(dev), sc); + BUS_READ_IVAR(device_get_parent(dev), dev, KBDC_IVAR_PORT, &port); + BUS_READ_IVAR(device_get_parent(dev), dev, KBDC_IVAR_IRQ, &irq); + BUS_READ_IVAR(device_get_parent(dev), dev, KBDC_IVAR_FLAGS, &flags); + + error = atkbd_attach_unit(device_get_unit(dev), sc, port, irq, flags); if (error) return error; /* declare our interrupt handler */ - BUS_READ_IVAR(device_get_parent(dev), dev, KBDC_IVAR_IRQ, &irq); res = bus_alloc_resource(dev, SYS_RES_IRQ, &zero, irq, irq, 1, RF_SHAREABLE | RF_ACTIVE); - BUS_SETUP_INTR(device_get_parent(dev), dev, res, - (driver_intr_t *) kbdsw[sc->kbd->kb_index]->intr, sc->kbd, + BUS_SETUP_INTR(device_get_parent(dev), dev, res, atkbd_isa_intr, sc, &ih); return 0; +} + +static void +atkbd_isa_intr(void *arg) +{ + atkbd_softc_t *sc; + + sc = (atkbd_softc_t *)arg; + (*kbdsw[sc->kbd->kb_index]->intr)(sc->kbd, NULL); } DRIVER_MODULE(atkbd, atkbdc, atkbd_driver, atkbd_devclass, 0, 0); #endif /* NATKBD > 0 */ Index: head/sys/dev/atkbdc/atkbdreg.h =================================================================== --- head/sys/dev/atkbdc/atkbdreg.h (revision 44627) +++ head/sys/dev/atkbdc/atkbdreg.h (revision 44628) @@ -1,61 +1,61 @@ /*- * Copyright (c) 1999 Kazutaka YOKOTA * All rights reserved. * * 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 as * the first lines of this file unmodified. * 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. * * THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``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 AUTHORS 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. * - * $Id: $ + * $Id: atkbdreg.h,v 1.1 1999/01/09 02:44:50 yokota Exp $ */ #ifndef _DEV_KBD_ATKBDREG_H_ #define _DEV_KBD_ATKBDREG_H_ #define ATKBD_DRIVER_NAME "atkbd" #define ATKBD_UNIT(dev) minor(dev) #define ATKBD_MKMINOR(unit) (unit) /* device configuration flags (atkbdprobe, atkbdattach) */ #define KB_CONF_FAIL_IF_NO_KBD (1 << 0) /* don't install if no kbd is found */ #define KB_CONF_NO_RESET (1 << 1) /* don't reset the keyboard */ #define KB_CONF_ALT_SCANCODESET (1 << 2) /* assume the XT type keyboard */ #ifdef KERNEL typedef struct atkbd_softc { short flags; #define ATKBD_ATTACHED (1 << 0) keyboard_t *kbd; #ifdef KBD_INSTALL_CDEV genkbd_softc_t gensc; #endif } atkbd_softc_t; #ifdef __i386__ atkbd_softc_t *atkbd_get_softc(int unit); #endif -int atkbd_probe_unit(int unit, atkbd_softc_t *sc, +int atkbd_probe_unit(int unit, int port, int irq, int flags); +int atkbd_attach_unit(int unit, atkbd_softc_t *sc, int port, int irq, int flags); -int atkbd_attach_unit(int unit, atkbd_softc_t *sc); #endif /* KERNEL */ #endif /* !_DEV_KBD_ATKBDREG_H_ */ Index: head/sys/dev/kbd/atkbd.c =================================================================== --- head/sys/dev/kbd/atkbd.c (revision 44627) +++ head/sys/dev/kbd/atkbd.c (revision 44628) @@ -1,1350 +1,1422 @@ /*- * Copyright (c) 1999 Kazutaka YOKOTA * All rights reserved. * * 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 as * the first lines of this file unmodified. * 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. * * THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``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 AUTHORS 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. * - * $Id: atkbd.c,v 1.3 1999/01/19 11:31:14 yokota Exp $ + * $Id: atkbd.c,v 1.4 1999/01/28 10:55:55 yokota Exp $ */ #include "atkbd.h" #include "opt_kbd.h" +#include "opt_atkbd.h" #include "opt_devfs.h" #if NATKBD > 0 #include #include #include #include #include #include #include #include #include #include #include #ifndef __i386__ +#include #include +extern devclass_t atkbd_devclass; + #define ATKBD_SOFTC(unit) \ ((atkbd_softc_t *)devclass_get_softc(atkbd_devclass, unit)) #else /* __i386__ */ #include #include extern struct isa_driver atkbddriver; /* XXX: a kludge; see below */ static atkbd_softc_t *atkbd_softc[NATKBD]; -#define ATKBD_SOFTC(unit) atkbd_softc[(unit)] +#define ATKBD_SOFTC(unit) \ + (((unit) >= NATKBD) ? NULL : atkbd_softc[(unit)]) #endif /* __i386__ */ static timeout_t atkbd_timeout; #ifdef KBD_INSTALL_CDEV static d_open_t atkbdopen; static d_close_t atkbdclose; static d_read_t atkbdread; static d_ioctl_t atkbdioctl; static d_poll_t atkbdpoll; static struct cdevsw atkbd_cdevsw = { atkbdopen, atkbdclose, atkbdread, nowrite, atkbdioctl, nostop, nullreset, nodevtotty, atkbdpoll, nommap, NULL, ATKBD_DRIVER_NAME, NULL, -1, }; #endif /* KBD_INSTALL_CDEV */ #ifdef __i386__ atkbd_softc_t *atkbd_get_softc(int unit) { atkbd_softc_t *sc; if (unit >= sizeof(atkbd_softc)/sizeof(atkbd_softc[0])) return NULL; sc = atkbd_softc[unit]; if (sc == NULL) { sc = atkbd_softc[unit] = malloc(sizeof(*sc), M_DEVBUF, M_NOWAIT); if (sc == NULL) return NULL; bzero(sc, sizeof(*sc)); } return sc; } #endif /* __i386__ */ int -atkbd_probe_unit(int unit, atkbd_softc_t *sc, int port, int irq, int flags) +atkbd_probe_unit(int unit, int port, int irq, int flags) { keyboard_switch_t *sw; int args[2]; + int error; - if (sc->flags & ATKBD_ATTACHED) - return 0; - sw = kbd_get_switch(ATKBD_DRIVER_NAME); if (sw == NULL) return ENXIO; args[0] = port; args[1] = irq; - return (*sw->probe)(unit, &sc->kbd, args, flags); + error = (*sw->probe)(unit, args, flags); + if (error) + return error; + return 0; } int -atkbd_attach_unit(int unit, atkbd_softc_t *sc) +atkbd_attach_unit(int unit, atkbd_softc_t *sc, int port, int irq, int flags) { keyboard_switch_t *sw; + int args[2]; int error; if (sc->flags & ATKBD_ATTACHED) return 0; sw = kbd_get_switch(ATKBD_DRIVER_NAME); if (sw == NULL) return ENXIO; /* reset, initialize and enable the device */ - error = (*sw->init)(sc->kbd); + args[0] = port; + args[1] = irq; + sc->kbd = NULL; + error = (*sw->probe)(unit, args, flags); if (error) - return ENXIO; + return error; + error = (*sw->init)(unit, &sc->kbd, args, flags); + if (error) + return error; (*sw->enable)(sc->kbd); #ifdef KBD_INSTALL_CDEV /* attach a virtual keyboard cdev */ error = kbd_attach(makedev(0, ATKBD_MKMINOR(unit)), sc->kbd, &atkbd_cdevsw); if (error) return error; #endif /* * This is a kludge to compensate for lost keyboard interrupts. * A similar code used to be in syscons. See below. XXX */ atkbd_timeout(sc->kbd); if (bootverbose) (*sw->diag)(sc->kbd, bootverbose); sc->flags |= ATKBD_ATTACHED; return 0; } static void atkbd_timeout(void *arg) { keyboard_t *kbd; int s; /* The following comments are extracted from syscons.c (1.287) */ /* * With release 2.1 of the Xaccel server, the keyboard is left * hanging pretty often. Apparently an interrupt from the * keyboard is lost, and I don't know why (yet). * This ugly hack calls scintr if input is ready for the keyboard * and conveniently hides the problem. XXX */ /* * Try removing anything stuck in the keyboard controller; whether * it's a keyboard scan code or mouse data. `scintr()' doesn't * read the mouse data directly, but `kbdio' routines will, as a * side effect. */ s = spltty(); kbd = (keyboard_t *)arg; if ((*kbdsw[kbd->kb_index]->lock)(kbd, TRUE)) { /* * We have seen the lock flag is not set. Let's reset * the flag early, otherwise the LED update routine fails * which may want the lock during the interrupt routine. */ (*kbdsw[kbd->kb_index]->lock)(kbd, FALSE); if ((*kbdsw[kbd->kb_index]->check_char)(kbd)) - (*kbdsw[kbd->kb_index]->intr)(kbd); + (*kbdsw[kbd->kb_index]->intr)(kbd, NULL); } splx(s); timeout(atkbd_timeout, arg, hz/10); } /* cdev driver functions */ #ifdef KBD_INSTALL_CDEV static int atkbdopen(dev_t dev, int flag, int mode, struct proc *p) { atkbd_softc_t *sc; - int unit; - unit = ATKBD_UNIT(dev); - if ((unit >= NATKBD) || ((sc = ATKBD_SOFTC(unit)) == NULL)) + sc = ATKBD_SOFTC(ATKBD_UNIT(dev)); + if (sc == NULL) return ENXIO; if (mode & (FWRITE | O_CREAT | O_APPEND | O_TRUNC)) return ENODEV; /* FIXME: set the initial input mode (K_XLATE?) and lock state? */ return genkbdopen(&sc->gensc, sc->kbd, flag, mode, p); } static int atkbdclose(dev_t dev, int flag, int mode, struct proc *p) { atkbd_softc_t *sc; sc = ATKBD_SOFTC(ATKBD_UNIT(dev)); return genkbdclose(&sc->gensc, sc->kbd, flag, mode, p); } static int atkbdread(dev_t dev, struct uio *uio, int flag) { atkbd_softc_t *sc; sc = ATKBD_SOFTC(ATKBD_UNIT(dev)); return genkbdread(&sc->gensc, sc->kbd, uio, flag); } static int atkbdioctl(dev_t dev, u_long cmd, caddr_t arg, int flag, struct proc *p) { atkbd_softc_t *sc; sc = ATKBD_SOFTC(ATKBD_UNIT(dev)); return genkbdioctl(&sc->gensc, sc->kbd, cmd, arg, flag, p); } static int atkbdpoll(dev_t dev, int event, struct proc *p) { atkbd_softc_t *sc; sc = ATKBD_SOFTC(ATKBD_UNIT(dev)); return genkbdpoll(&sc->gensc, sc->kbd, event, p); } #endif /* KBD_INSTALL_CDEV */ /* LOW-LEVEL */ #include #include #include #define ATKBD_DEFAULT 0 typedef struct atkbd_state { KBDC kbdc; /* keyboard controller */ /* XXX: don't move this field; pcvt * expects `kbdc' to be the first * field in this structure. */ int ks_mode; /* input mode (K_XLATE,K_RAW,K_CODE) */ int ks_flags; /* flags */ #define COMPOSE (1 << 0) + int ks_polling; int ks_state; /* shift/lock key state */ int ks_accents; /* accent key index (> 0) */ u_int ks_composed_char; /* composed char code (> 0) */ u_char ks_prefix; /* AT scan code prefix */ } atkbd_state_t; /* keyboard driver declaration */ static int atkbd_configure(int flags); static kbd_probe_t atkbd_probe; static kbd_init_t atkbd_init; static kbd_term_t atkbd_term; static kbd_intr_t atkbd_intr; static kbd_test_if_t atkbd_test_if; static kbd_enable_t atkbd_enable; static kbd_disable_t atkbd_disable; static kbd_read_t atkbd_read; static kbd_check_t atkbd_check; static kbd_read_char_t atkbd_read_char; static kbd_check_char_t atkbd_check_char; static kbd_ioctl_t atkbd_ioctl; static kbd_lock_t atkbd_lock; static kbd_clear_state_t atkbd_clear_state; static kbd_get_state_t atkbd_get_state; static kbd_set_state_t atkbd_set_state; +static kbd_poll_mode_t atkbd_poll; keyboard_switch_t atkbdsw = { atkbd_probe, atkbd_init, atkbd_term, atkbd_intr, atkbd_test_if, atkbd_enable, atkbd_disable, atkbd_read, atkbd_check, atkbd_read_char, atkbd_check_char, atkbd_ioctl, atkbd_lock, atkbd_clear_state, atkbd_get_state, atkbd_set_state, genkbd_get_fkeystr, + atkbd_poll, genkbd_diag, }; KEYBOARD_DRIVER(atkbd, atkbdsw, atkbd_configure); /* local functions */ static int setup_kbd_port(KBDC kbdc, int port, int intr); static int get_kbd_echo(KBDC kbdc); static int probe_keyboard(KBDC kbdc, int flags); static int init_keyboard(KBDC kbdc, int *type, int flags); static int write_kbd(KBDC kbdc, int command, int data); static int get_kbd_id(KBDC kbdc); +static int typematic(int delay, int rate); /* local variables */ /* the initial key map, accent map and fkey strings */ +#ifdef ATKBD_DFLT_KEYMAP +#define KBD_DFLT_KEYMAP +#include "atkbdmap.h" +#endif #include /* structures for the default keyboard */ static keyboard_t default_kbd; static atkbd_state_t default_kbd_state; static keymap_t default_keymap; static accentmap_t default_accentmap; static fkeytab_t default_fkeytab[NUM_FKEYS]; /* * The back door to the keyboard driver! * This function is called by the console driver, via the kbdio module, * to tickle keyboard drivers when the low-level console is being initialized. * Almost nothing in the kernel has been initialied yet. Try to probe * keyboards if possible. * NOTE: because of the way the low-level conole is initialized, this routine * may be called more than once!! */ static int atkbd_configure(int flags) { keyboard_t *kbd; - KBDC kbdc; int arg[2]; #ifdef __i386__ struct isa_device *dev; + int i; /* XXX: a kludge to obtain the device configuration flags */ dev = find_isadev(isa_devtab_tty, &atkbddriver, 0); - if (dev != NULL) + if (dev != NULL) { flags |= dev->id_flags; + /* if the driver is disabled, unregister the keyboard if any */ + if (!dev->id_enabled) { + i = kbd_find_keyboard(ATKBD_DRIVER_NAME, ATKBD_DEFAULT); + if (i >= 0) { + kbd = kbd_get_keyboard(i); + kbd_unregister(kbd); + kbd->kb_flags &= ~KB_REGISTERED; + return 0; + } + } + } #endif /* probe the keyboard controller */ atkbdc_configure(); /* probe the default keyboard */ arg[0] = -1; arg[1] = -1; - if (atkbd_probe(ATKBD_DEFAULT, &kbd, arg, flags)) + kbd = NULL; + if (atkbd_probe(ATKBD_DEFAULT, arg, flags)) return 0; + if (atkbd_init(ATKBD_DEFAULT, &kbd, arg, flags)) + return 0; - /* initialize it */ - kbdc = ((atkbd_state_t *)kbd->kb_data)->kbdc; - if (!(flags & KB_CONF_PROBE_ONLY) && !KBD_IS_INITIALIZED(kbd)) { - if (KBD_HAS_DEVICE(kbd) - && init_keyboard(kbdc, &kbd->kb_type, flags) - && (flags & KB_CONF_FAIL_IF_NO_KBD)) - return 0; - KBD_INIT_DONE(kbd); - } + /* return the number of found keyboards */ + return 1; +} - /* and register */ - if (!KBD_IS_CONFIGURED(kbd)) { - if (kbd_register(kbd) < 0) +/* low-level functions */ + +/* detect a keyboard */ +static int +atkbd_probe(int unit, void *arg, int flags) +{ + KBDC kbdc; + int *data = (int *)arg; + + /* XXX */ + if (unit == ATKBD_DEFAULT) { + if (KBD_IS_PROBED(&default_kbd)) return 0; - KBD_CONFIG_DONE(kbd); } - return 1; /* return the number of found keyboards */ + kbdc = kbdc_open(data[0]); + if (kbdc == NULL) + return ENXIO; + if (probe_keyboard(kbdc, flags)) { + if (flags & KB_CONF_FAIL_IF_NO_KBD) + return ENXIO; + } + return 0; } -/* low-level functions */ - -/* initialize the keyboard_t structure and try to detect a keyboard */ +/* reset and initialize the device */ static int -atkbd_probe(int unit, keyboard_t **kbdp, void *arg, int flags) +atkbd_init(int unit, keyboard_t **kbdp, void *arg, int flags) { keyboard_t *kbd; atkbd_state_t *state; keymap_t *keymap; accentmap_t *accmap; fkeytab_t *fkeymap; int fkeymap_size; - KBDC kbdc; int *data = (int *)arg; /* XXX */ if (unit == ATKBD_DEFAULT) { *kbdp = kbd = &default_kbd; - if (KBD_IS_PROBED(kbd)) + if (KBD_IS_INITIALIZED(kbd) && KBD_IS_CONFIGURED(kbd)) return 0; state = &default_kbd_state; keymap = &default_keymap; accmap = &default_accentmap; fkeymap = default_fkeytab; fkeymap_size = sizeof(default_fkeytab)/sizeof(default_fkeytab[0]); } else if (*kbdp == NULL) { *kbdp = kbd = malloc(sizeof(*kbd), M_DEVBUF, M_NOWAIT); if (kbd == NULL) return ENOMEM; bzero(kbd, sizeof(*kbd)); state = malloc(sizeof(*state), M_DEVBUF, M_NOWAIT); keymap = malloc(sizeof(key_map), M_DEVBUF, M_NOWAIT); accmap = malloc(sizeof(accent_map), M_DEVBUF, M_NOWAIT); fkeymap = malloc(sizeof(fkey_tab), M_DEVBUF, M_NOWAIT); fkeymap_size = sizeof(fkey_tab)/sizeof(fkey_tab[0]); if ((state == NULL) || (keymap == NULL) || (accmap == NULL) || (fkeymap == NULL)) { if (state != NULL) free(state, M_DEVBUF); if (keymap != NULL) free(keymap, M_DEVBUF); if (accmap != NULL) free(accmap, M_DEVBUF); if (fkeymap != NULL) free(fkeymap, M_DEVBUF); free(kbd, M_DEVBUF); return ENOMEM; } bzero(state, sizeof(*state)); - } else if (KBD_IS_PROBED(*kbdp)) { + } else if (KBD_IS_INITIALIZED(*kbdp) && KBD_IS_CONFIGURED(*kbdp)) { return 0; } else { kbd = *kbdp; state = (atkbd_state_t *)kbd->kb_data; bzero(state, sizeof(*state)); keymap = kbd->kb_keymap; accmap = kbd->kb_accentmap; fkeymap = kbd->kb_fkeytab; fkeymap_size = kbd->kb_fkeytab_size; } - state->kbdc = kbdc = kbdc_open(data[0]); - if (kbdc == NULL) - return ENXIO; - kbd_init_struct(kbd, ATKBD_DRIVER_NAME, KB_OTHER, unit, flags, data[0], - IO_KBDSIZE); - bcopy(&key_map, keymap, sizeof(key_map)); - bcopy(&accent_map, accmap, sizeof(accent_map)); - bcopy(fkey_tab, fkeymap, - imin(fkeymap_size*sizeof(fkeymap[0]), sizeof(fkey_tab))); - kbd_set_maps(kbd, keymap, accmap, fkeymap, fkeymap_size); - kbd->kb_data = (void *)state; - - if (probe_keyboard(kbdc, flags)) { - if (flags & KB_CONF_FAIL_IF_NO_KBD) + if (!KBD_IS_PROBED(kbd)) { + state->kbdc = kbdc_open(data[0]); + if (state->kbdc == NULL) return ENXIO; - } else { - KBD_FOUND_DEVICE(kbd); + kbd_init_struct(kbd, ATKBD_DRIVER_NAME, KB_OTHER, unit, flags, + data[0], IO_KBDSIZE); + bcopy(&key_map, keymap, sizeof(key_map)); + bcopy(&accent_map, accmap, sizeof(accent_map)); + bcopy(fkey_tab, fkeymap, + imin(fkeymap_size*sizeof(fkeymap[0]), sizeof(fkey_tab))); + kbd_set_maps(kbd, keymap, accmap, fkeymap, fkeymap_size); + kbd->kb_data = (void *)state; + + if (probe_keyboard(state->kbdc, flags)) { /* shouldn't happen */ + if (flags & KB_CONF_FAIL_IF_NO_KBD) + return ENXIO; + } else { + KBD_FOUND_DEVICE(kbd); + } + atkbd_clear_state(kbd); + state->ks_mode = K_XLATE; + /* + * FIXME: set the initial value for lock keys in ks_state + * according to the BIOS data? + */ + KBD_PROBE_DONE(kbd); } - atkbd_clear_state(kbd); - state->ks_mode = K_XLATE; - /* - * FIXME: set the initial value for lock keys in ks_state - * according to the BIOS data? - */ - - KBD_PROBE_DONE(kbd); - return 0; -} - -/* reset and initialize the device */ -static int -atkbd_init(keyboard_t *kbd) -{ - KBDC kbdc; - - if ((kbd == NULL) || !KBD_IS_PROBED(kbd)) - return ENXIO; /* shouldn't happen */ - kbdc = ((atkbd_state_t *)kbd->kb_data)->kbdc; - if (kbdc == NULL) - return ENXIO; /* shouldn't happen */ - - if (!KBD_IS_INITIALIZED(kbd)) { + if (!KBD_IS_INITIALIZED(kbd) && !(flags & KB_CONF_PROBE_ONLY)) { if (KBD_HAS_DEVICE(kbd) - && init_keyboard(kbdc, &kbd->kb_type, kbd->kb_config) - && (kbd->kb_config & KB_CONF_FAIL_IF_NO_KBD)) + && init_keyboard(state->kbdc, &kbd->kb_type, kbd->kb_config) + && (kbd->kb_config & KB_CONF_FAIL_IF_NO_KBD)) return ENXIO; - atkbd_ioctl(kbd, KDSETLED, - (caddr_t)&((atkbd_state_t *)(kbd->kb_data))->ks_state); + atkbd_ioctl(kbd, KDSETLED, (caddr_t)&state->ks_state); KBD_INIT_DONE(kbd); } if (!KBD_IS_CONFIGURED(kbd)) { if (kbd_register(kbd) < 0) return ENXIO; KBD_CONFIG_DONE(kbd); } return 0; } /* finish using this keyboard */ static int atkbd_term(keyboard_t *kbd) { kbd_unregister(kbd); return 0; } /* keyboard interrupt routine */ static int -atkbd_intr(keyboard_t *kbd) +atkbd_intr(keyboard_t *kbd, void *arg) { atkbd_state_t *state; int c; if (KBD_IS_ACTIVE(kbd) && KBD_IS_BUSY(kbd)) { /* let the callback function to process the input */ (*kbd->kb_callback.kc_func)(kbd, KBDIO_KEYINPUT, kbd->kb_callback.kc_arg); } else { /* read and discard the input; no one is waiting for input */ do { c = atkbd_read_char(kbd, FALSE); } while (c != NOKEY); if (!KBD_HAS_DEVICE(kbd)) { /* * The keyboard was not detected before; * it must have been reconnected! */ state = (atkbd_state_t *)kbd->kb_data; init_keyboard(state->kbdc, &kbd->kb_type, kbd->kb_config); atkbd_ioctl(kbd, KDSETLED, (caddr_t)&state->ks_state); KBD_FOUND_DEVICE(kbd); } } return 0; } /* test the interface to the device */ static int atkbd_test_if(keyboard_t *kbd) { int error; int s; error = 0; empty_both_buffers(((atkbd_state_t *)kbd->kb_data)->kbdc, 10); s = spltty(); if (!test_controller(((atkbd_state_t *)kbd->kb_data)->kbdc)) error = EIO; else if (test_kbd_port(((atkbd_state_t *)kbd->kb_data)->kbdc) != 0) error = EIO; splx(s); return error; } /* * Enable the access to the device; until this function is called, * the client cannot read from the keyboard. */ static int atkbd_enable(keyboard_t *kbd) { int s; s = spltty(); KBD_ACTIVATE(kbd); splx(s); return 0; } /* disallow the access to the device */ static int atkbd_disable(keyboard_t *kbd) { int s; s = spltty(); KBD_DEACTIVATE(kbd); splx(s); return 0; } /* read one byte from the keyboard if it's allowed */ static int atkbd_read(keyboard_t *kbd, int wait) { int c; if (wait) c = read_kbd_data(((atkbd_state_t *)kbd->kb_data)->kbdc); else c = read_kbd_data_no_wait(((atkbd_state_t *)kbd->kb_data)->kbdc); return (KBD_IS_ACTIVE(kbd) ? c : -1); } /* check if data is waiting */ static int atkbd_check(keyboard_t *kbd) { if (!KBD_IS_ACTIVE(kbd)) return FALSE; return kbdc_data_ready(((atkbd_state_t *)kbd->kb_data)->kbdc); } /* read char from the keyboard */ static u_int atkbd_read_char(keyboard_t *kbd, int wait) { atkbd_state_t *state; u_int action; int scancode; int keycode; state = (atkbd_state_t *)kbd->kb_data; next_code: /* do we have a composed char to return? */ if (!(state->ks_flags & COMPOSE) && (state->ks_composed_char > 0)) { action = state->ks_composed_char; state->ks_composed_char = 0; if (action > UCHAR_MAX) return ERRKEY; return action; } /* see if there is something in the keyboard port */ if (wait) { do { scancode = read_kbd_data(state->kbdc); } while (scancode == -1); } else { scancode = read_kbd_data_no_wait(state->kbdc); if (scancode == -1) return NOKEY; } /* return the byte as is for the K_RAW mode */ if (state->ks_mode == K_RAW) return scancode; /* translate the scan code into a keycode */ keycode = scancode & 0x7F; switch (state->ks_prefix) { case 0x00: /* normal scancode */ switch(scancode) { case 0xB8: /* left alt (compose key) released */ if (state->ks_flags & COMPOSE) { state->ks_flags &= ~COMPOSE; if (state->ks_composed_char > UCHAR_MAX) state->ks_composed_char = 0; } break; case 0x38: /* left alt (compose key) pressed */ if (!(state->ks_flags & COMPOSE)) { state->ks_flags |= COMPOSE; state->ks_composed_char = 0; } break; case 0xE0: case 0xE1: state->ks_prefix = scancode; goto next_code; } break; case 0xE0: /* 0xE0 prefix */ state->ks_prefix = 0; switch (keycode) { case 0x1C: /* right enter key */ keycode = 0x59; break; case 0x1D: /* right ctrl key */ keycode = 0x5A; break; case 0x35: /* keypad divide key */ keycode = 0x5B; break; case 0x37: /* print scrn key */ keycode = 0x5C; break; case 0x38: /* right alt key (alt gr) */ keycode = 0x5D; break; case 0x46: /* ctrl-pause/break on AT 101 (see below) */ keycode = 0x68; break; case 0x47: /* grey home key */ keycode = 0x5E; break; case 0x48: /* grey up arrow key */ keycode = 0x5F; break; case 0x49: /* grey page up key */ keycode = 0x60; break; case 0x4B: /* grey left arrow key */ keycode = 0x61; break; case 0x4D: /* grey right arrow key */ keycode = 0x62; break; case 0x4F: /* grey end key */ keycode = 0x63; break; case 0x50: /* grey down arrow key */ keycode = 0x64; break; case 0x51: /* grey page down key */ keycode = 0x65; break; case 0x52: /* grey insert key */ keycode = 0x66; break; case 0x53: /* grey delete key */ keycode = 0x67; break; /* the following 3 are only used on the MS "Natural" keyboard */ case 0x5b: /* left Window key */ keycode = 0x69; break; case 0x5c: /* right Window key */ keycode = 0x6a; break; case 0x5d: /* menu key */ keycode = 0x6b; break; default: /* ignore everything else */ goto next_code; } break; case 0xE1: /* 0xE1 prefix */ /* * The pause/break key on the 101 keyboard produces: * E1-1D-45 E1-9D-C5 * Ctrl-pause/break produces: * E0-46 E0-C6 (See above.) */ state->ks_prefix = 0; if (keycode == 0x1D) state->ks_prefix = 0x1D; goto next_code; /* NOT REACHED */ case 0x1D: /* pause / break */ state->ks_prefix = 0; if (keycode != 0x45) goto next_code; keycode = 0x68; break; } if (kbd->kb_type == KB_84) { switch (keycode) { case 0x37: /* *(numpad)/print screen */ if (state->ks_flags & SHIFTS) keycode = 0x5c; /* print screen */ break; case 0x45: /* num lock/pause */ if (state->ks_flags & CTLS) keycode = 0x68; /* pause */ break; case 0x46: /* scroll lock/break */ if (state->ks_flags & CTLS) keycode = 0x6c; /* break */ break; } } else if (kbd->kb_type == KB_101) { switch (keycode) { case 0x5c: /* print screen */ if (state->ks_flags & ALTS) keycode = 0x54; /* sysrq */ break; case 0x68: /* pause/break */ if (state->ks_flags & CTLS) keycode = 0x6c; /* break */ break; } } /* return the key code in the K_CODE mode */ if (state->ks_mode == K_CODE) return (keycode | (scancode & 0x80)); /* compose a character code */ if (state->ks_flags & COMPOSE) { switch (scancode) { /* key pressed, process it */ case 0x47: case 0x48: case 0x49: /* keypad 7,8,9 */ state->ks_composed_char *= 10; state->ks_composed_char += scancode - 0x40; if (state->ks_composed_char > UCHAR_MAX) return ERRKEY; goto next_code; case 0x4B: case 0x4C: case 0x4D: /* keypad 4,5,6 */ state->ks_composed_char *= 10; state->ks_composed_char += scancode - 0x47; if (state->ks_composed_char > UCHAR_MAX) return ERRKEY; goto next_code; case 0x4F: case 0x50: case 0x51: /* keypad 1,2,3 */ state->ks_composed_char *= 10; state->ks_composed_char += scancode - 0x4E; if (state->ks_composed_char > UCHAR_MAX) return ERRKEY; goto next_code; case 0x52: /* keypad 0 */ state->ks_composed_char *= 10; if (state->ks_composed_char > UCHAR_MAX) return ERRKEY; goto next_code; /* key released, no interest here */ case 0xC7: case 0xC8: case 0xC9: /* keypad 7,8,9 */ case 0xCB: case 0xCC: case 0xCD: /* keypad 4,5,6 */ case 0xCF: case 0xD0: case 0xD1: /* keypad 1,2,3 */ case 0xD2: /* keypad 0 */ goto next_code; case 0x38: /* left alt key */ break; default: if (state->ks_composed_char > 0) { state->ks_flags &= ~COMPOSE; state->ks_composed_char = 0; return ERRKEY; } break; } } /* keycode to key action */ action = genkbd_keyaction(kbd, keycode, scancode & 0x80, &state->ks_state, &state->ks_accents); if (action == NOKEY) goto next_code; else return action; } /* check if char is waiting */ static int atkbd_check_char(keyboard_t *kbd) { atkbd_state_t *state; if (!KBD_IS_ACTIVE(kbd)) return FALSE; state = (atkbd_state_t *)kbd->kb_data; if (!(state->ks_flags & COMPOSE) && (state->ks_composed_char > 0)) return TRUE; return kbdc_data_ready(state->kbdc); } /* some useful control functions */ static int atkbd_ioctl(keyboard_t *kbd, u_long cmd, caddr_t arg) { /* trasnlate LED_XXX bits into the device specific bits */ static u_char ledmap[8] = { 0, 4, 2, 6, 1, 5, 3, 7, }; atkbd_state_t *state = kbd->kb_data; int error; int s; int i; s = spltty(); switch (cmd) { case KDGKBMODE: /* get keyboard mode */ *(int *)arg = state->ks_mode; break; case KDSKBMODE: /* set keyboard mode */ switch (*(int *)arg) { case K_XLATE: if (state->ks_mode != K_XLATE) { /* make lock key state and LED state match */ state->ks_state &= ~LOCK_MASK; state->ks_state |= KBD_LED_VAL(kbd); } /* FALL THROUGH */ case K_RAW: case K_CODE: if (state->ks_mode != *(int *)arg) { atkbd_clear_state(kbd); state->ks_mode = *(int *)arg; } break; default: splx(s); return EINVAL; } break; case KDGETLED: /* get keyboard LED */ *(int *)arg = KBD_LED_VAL(kbd); break; case KDSETLED: /* set keyboard LED */ /* NOTE: lock key state in ks_state won't be changed */ if (*(int *)arg & ~LOCK_MASK) { splx(s); return EINVAL; } i = *(int *)arg; /* replace CAPS LED with ALTGR LED for ALTGR keyboards */ if (kbd->kb_keymap->n_keys > ALTGR_OFFSET) { if (i & ALKED) i |= CLKED; else i &= ~CLKED; } if (KBD_HAS_DEVICE(kbd)) { error = write_kbd(state->kbdc, KBDC_SET_LEDS, ledmap[i & LED_MASK]); if (error) { splx(s); return error; } } KBD_LED_VAL(kbd) = *(int *)arg; break; case KDGKBSTATE: /* get lock key state */ *(int *)arg = state->ks_state & LOCK_MASK; break; case KDSKBSTATE: /* set lock key state */ if (*(int *)arg & ~LOCK_MASK) { splx(s); return EINVAL; } state->ks_state &= ~LOCK_MASK; state->ks_state |= *(int *)arg; splx(s); /* set LEDs and quit */ return atkbd_ioctl(kbd, KDSETLED, arg); - case KDSETRAD: /* set keyboard repeat rate */ + case KDSETREPEAT: /* set keyboard repeat rate (new interface) */ splx(s); if (!KBD_HAS_DEVICE(kbd)) return 0; - return write_kbd(state->kbdc, KBDC_SET_TYPEMATIC, - *(int *)arg); + i = typematic(((int *)arg)[0], ((int *)arg)[1]); + return write_kbd(state->kbdc, KBDC_SET_TYPEMATIC, i); + case KDSETRAD: /* set keyboard repeat rate (old interface) */ + splx(s); + if (!KBD_HAS_DEVICE(kbd)) + return 0; + return write_kbd(state->kbdc, KBDC_SET_TYPEMATIC, *(int *)arg); + case PIO_KEYMAP: /* set keyboard translation table */ case PIO_KEYMAPENT: /* set keyboard translation table entry */ case PIO_DEADKEYMAP: /* set accent key translation table */ state->ks_accents = 0; /* FALL THROUGH */ default: splx(s); return genkbd_commonioctl(kbd, cmd, arg); } splx(s); return 0; } /* lock the access to the keyboard */ static int atkbd_lock(keyboard_t *kbd, int lock) { return kbdc_lock(((atkbd_state_t *)kbd->kb_data)->kbdc, lock); } /* clear the internal state of the keyboard */ static void atkbd_clear_state(keyboard_t *kbd) { atkbd_state_t *state; state = (atkbd_state_t *)kbd->kb_data; state->ks_flags = 0; + state->ks_polling = 0; state->ks_state &= LOCK_MASK; /* preserve locking key state */ state->ks_accents = 0; state->ks_composed_char = 0; #if 0 state->ks_prefix = 0; /* XXX */ #endif } /* save the internal state */ static int atkbd_get_state(keyboard_t *kbd, void *buf, size_t len) { if (len == 0) return sizeof(atkbd_state_t); if (len < sizeof(atkbd_state_t)) return -1; bcopy(kbd->kb_data, buf, sizeof(atkbd_state_t)); return 0; } /* set the internal state */ static int atkbd_set_state(keyboard_t *kbd, void *buf, size_t len) { if (len < sizeof(atkbd_state_t)) return ENOMEM; if (((atkbd_state_t *)kbd->kb_data)->kbdc != ((atkbd_state_t *)buf)->kbdc) return ENOMEM; bcopy(buf, kbd->kb_data, sizeof(atkbd_state_t)); return 0; } +static int +atkbd_poll(keyboard_t *kbd, int on) +{ + atkbd_state_t *state; + int s; + + state = (atkbd_state_t *)kbd->kb_data; + s = spltty(); + if (on) + ++state->ks_polling; + else + --state->ks_polling; + splx(s); + return 0; +} + /* local functions */ static int setup_kbd_port(KBDC kbdc, int port, int intr) { if (!set_controller_command_byte(kbdc, KBD_KBD_CONTROL_BITS, ((port) ? KBD_ENABLE_KBD_PORT : KBD_DISABLE_KBD_PORT) | ((intr) ? KBD_ENABLE_KBD_INT : KBD_DISABLE_KBD_INT))) return 1; return 0; } static int get_kbd_echo(KBDC kbdc) { /* enable the keyboard port, but disable the keyboard intr. */ if (setup_kbd_port(kbdc, TRUE, FALSE)) /* CONTROLLER ERROR: there is very little we can do... */ return ENXIO; /* see if something is present */ write_kbd_command(kbdc, KBDC_ECHO); if (read_kbd_data(kbdc) != KBD_ECHO) { empty_both_buffers(kbdc, 10); test_controller(kbdc); test_kbd_port(kbdc); return ENXIO; } /* enable the keyboard port and intr. */ if (setup_kbd_port(kbdc, TRUE, TRUE)) { /* * CONTROLLER ERROR * This is serious; the keyboard intr is left disabled! */ return ENXIO; } return 0; } static int probe_keyboard(KBDC kbdc, int flags) { /* * Don't try to print anything in this function. The low-level * console may not have been initialized yet... */ int err; int c; int m; if (!kbdc_lock(kbdc, TRUE)) { /* driver error? */ return ENXIO; } /* flush any noise in the buffer */ empty_both_buffers(kbdc, 10); /* save the current keyboard controller command byte */ m = kbdc_get_device_mask(kbdc) & ~KBD_KBD_CONTROL_BITS; c = get_controller_command_byte(kbdc); if (c == -1) { /* CONTROLLER ERROR */ kbdc_set_device_mask(kbdc, m); kbdc_lock(kbdc, FALSE); return ENXIO; } /* * The keyboard may have been screwed up by the boot block. * We may just be able to recover from error by testing the controller * and the keyboard port. The controller command byte needs to be * saved before this recovery operation, as some controllers seem * to set the command byte to particular values. */ test_controller(kbdc); test_kbd_port(kbdc); err = get_kbd_echo(kbdc); if (err == 0) { kbdc_set_device_mask(kbdc, m | KBD_KBD_CONTROL_BITS); } else { if (c != -1) /* try to restore the command byte as before */ set_controller_command_byte(kbdc, 0xff, c); kbdc_set_device_mask(kbdc, m); } kbdc_lock(kbdc, FALSE); return err; } static int init_keyboard(KBDC kbdc, int *type, int flags) { int codeset; int id; int c; if (!kbdc_lock(kbdc, TRUE)) { /* driver error? */ return EIO; } /* save the current controller command byte */ empty_both_buffers(kbdc, 10); c = get_controller_command_byte(kbdc); if (c == -1) { /* CONTROLLER ERROR */ kbdc_lock(kbdc, FALSE); printf("atkbd: unable to get the current command byte value.\n"); return EIO; } if (bootverbose) printf("atkbd: the current kbd controller command byte %04x\n", c); #if 0 /* override the keyboard lock switch */ c |= KBD_OVERRIDE_KBD_LOCK; #endif /* enable the keyboard port, but disable the keyboard intr. */ if (setup_kbd_port(kbdc, TRUE, FALSE)) { /* CONTROLLER ERROR: there is very little we can do... */ printf("atkbd: unable to set the command byte.\n"); kbdc_lock(kbdc, FALSE); return EIO; } /* * Check if we have an XT keyboard before we attempt to reset it. * The procedure assumes that the keyboard and the controller have * been set up properly by BIOS and have not been messed up * during the boot process. */ codeset = -1; if (flags & KB_CONF_ALT_SCANCODESET) /* the user says there is a XT keyboard */ codeset = 1; #ifdef KBD_DETECT_XT_KEYBOARD else if ((c & KBD_TRANSLATION) == 0) { /* SET_SCANCODE_SET is not always supported; ignore error */ if (send_kbd_command_and_data(kbdc, KBDC_SET_SCANCODE_SET, 0) == KBD_ACK) codeset = read_kbd_data(kbdc); } if (bootverbose) printf("atkbd: scancode set %d\n", codeset); #endif /* KBD_DETECT_XT_KEYBOARD */ *type = KB_OTHER; id = get_kbd_id(kbdc); switch(id) { case 0x41ab: case 0x83ab: *type = KB_101; break; case -1: /* AT 84 keyboard doesn't return ID */ *type = KB_84; break; default: break; } if (bootverbose) printf("atkbd: keyboard ID 0x%x (%d)\n", id, *type); /* reset keyboard hardware */ if (!(flags & KB_CONF_NO_RESET) && !reset_kbd(kbdc)) { /* * KEYBOARD ERROR * Keyboard reset may fail either because the keyboard * doen't exist, or because the keyboard doesn't pass * the self-test, or the keyboard controller on the * motherboard and the keyboard somehow fail to shake hands. * It is just possible, particularly in the last case, * that the keyoard controller may be left in a hung state. * test_controller() and test_kbd_port() appear to bring * the keyboard controller back (I don't know why and how, * though.) */ empty_both_buffers(kbdc, 10); test_controller(kbdc); test_kbd_port(kbdc); /* * We could disable the keyboard port and interrupt... but, * the keyboard may still exist (see above). */ set_controller_command_byte(kbdc, 0xff, c); kbdc_lock(kbdc, FALSE); if (bootverbose) printf("atkbd: failed to reset the keyboard.\n"); return EIO; } /* * Allow us to set the XT_KEYBD flag in UserConfig so that keyboards * such as those on the IBM ThinkPad laptop computers can be used * with the standard console driver. */ if (codeset == 1) { if (send_kbd_command_and_data(kbdc, KBDC_SET_SCANCODE_SET, codeset) == KBD_ACK) { /* XT kbd doesn't need scan code translation */ c &= ~KBD_TRANSLATION; } else { /* * KEYBOARD ERROR * The XT kbd isn't usable unless the proper scan * code set is selected. */ set_controller_command_byte(kbdc, 0xff, c); kbdc_lock(kbdc, FALSE); printf("atkbd: unable to set the XT keyboard mode.\n"); return EIO; } } #ifdef __alpha__ if (send_kbd_command_and_data( kbdc, KBDC_SET_SCANCODE_SET, 2) != KBD_ACK) { printf("atkbd: can't set translation.\n"); } c |= KBD_TRANSLATION; #endif /* enable the keyboard port and intr. */ if (!set_controller_command_byte(kbdc, KBD_KBD_CONTROL_BITS | KBD_TRANSLATION | KBD_OVERRIDE_KBD_LOCK, (c & (KBD_TRANSLATION | KBD_OVERRIDE_KBD_LOCK)) | KBD_ENABLE_KBD_PORT | KBD_ENABLE_KBD_INT)) { /* * CONTROLLER ERROR * This is serious; we are left with the disabled * keyboard intr. */ set_controller_command_byte(kbdc, 0xff, c); kbdc_lock(kbdc, FALSE); printf("atkbd: unable to enable the keyboard port and intr.\n"); return EIO; } kbdc_lock(kbdc, FALSE); return 0; } static int write_kbd(KBDC kbdc, int command, int data) { int s; /* prevent the timeout routine from polling the keyboard */ if (!kbdc_lock(kbdc, TRUE)) return EBUSY; /* disable the keyboard and mouse interrupt */ s = spltty(); #if 0 c = get_controller_command_byte(kbdc); if ((c == -1) || !set_controller_command_byte(kbdc, kbdc_get_device_mask(kbdc), KBD_DISABLE_KBD_PORT | KBD_DISABLE_KBD_INT | KBD_DISABLE_AUX_PORT | KBD_DISABLE_AUX_INT)) { /* CONTROLLER ERROR */ kbdc_lock(kbdc, FALSE); splx(s); return EIO; } /* * Now that the keyboard controller is told not to generate * the keyboard and mouse interrupts, call `splx()' to allow * the other tty interrupts. The clock interrupt may also occur, * but the timeout routine (`scrn_timer()') will be blocked * by the lock flag set via `kbdc_lock()' */ splx(s); #endif if (send_kbd_command_and_data(kbdc, command, data) != KBD_ACK) send_kbd_command(kbdc, KBDC_ENABLE_KBD); #if 0 /* restore the interrupts */ if (!set_controller_command_byte(kbdc, kbdc_get_device_mask(kbdc), c & (KBD_KBD_CONTROL_BITS | KBD_AUX_CONTROL_BITS))) { /* CONTROLLER ERROR */ } #else splx(s); #endif kbdc_lock(kbdc, FALSE); return 0; } static int get_kbd_id(KBDC kbdc) { int id1, id2; empty_both_buffers(kbdc, 10); id1 = id2 = -1; if (send_kbd_command(kbdc, KBDC_SEND_DEV_ID) != KBD_ACK) return -1; DELAY(10000); /* 10 msec delay */ id1 = read_kbd_data(kbdc); if (id1 != -1) id2 = read_kbd_data(kbdc); if ((id1 == -1) || (id2 == -1)) { empty_both_buffers(kbdc, 10); test_controller(kbdc); test_kbd_port(kbdc); return -1; } return ((id2 << 8) | id1); +} + +static int +typematic(int delay, int rate) +{ + static int delays[] = { 250, 500, 750, 1000 }; + static int rates[] = { 34, 38, 42, 46, 50, 55, 59, 63, + 68, 76, 84, 92, 100, 110, 118, 126, + 136, 152, 168, 184, 200, 220, 236, 252, + 272, 304, 336, 368, 400, 440, 472, 504 }; + int value; + int i; + + for (i = sizeof(delays)/sizeof(delays[0]) - 1; i > 0; --i) { + if (delay >= delays[i]) + break; + } + value = i << 5; + for (i = sizeof(rates)/sizeof(rates[0]) - 1; i > 0; --i) { + if (rate >= rates[i]) + break; + } + value |= i; + return value; } #endif /* NATKBD > 0 */ Index: head/sys/dev/kbd/atkbdreg.h =================================================================== --- head/sys/dev/kbd/atkbdreg.h (revision 44627) +++ head/sys/dev/kbd/atkbdreg.h (revision 44628) @@ -1,61 +1,61 @@ /*- * Copyright (c) 1999 Kazutaka YOKOTA * All rights reserved. * * 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 as * the first lines of this file unmodified. * 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. * * THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``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 AUTHORS 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. * - * $Id: $ + * $Id: atkbdreg.h,v 1.1 1999/01/09 02:44:50 yokota Exp $ */ #ifndef _DEV_KBD_ATKBDREG_H_ #define _DEV_KBD_ATKBDREG_H_ #define ATKBD_DRIVER_NAME "atkbd" #define ATKBD_UNIT(dev) minor(dev) #define ATKBD_MKMINOR(unit) (unit) /* device configuration flags (atkbdprobe, atkbdattach) */ #define KB_CONF_FAIL_IF_NO_KBD (1 << 0) /* don't install if no kbd is found */ #define KB_CONF_NO_RESET (1 << 1) /* don't reset the keyboard */ #define KB_CONF_ALT_SCANCODESET (1 << 2) /* assume the XT type keyboard */ #ifdef KERNEL typedef struct atkbd_softc { short flags; #define ATKBD_ATTACHED (1 << 0) keyboard_t *kbd; #ifdef KBD_INSTALL_CDEV genkbd_softc_t gensc; #endif } atkbd_softc_t; #ifdef __i386__ atkbd_softc_t *atkbd_get_softc(int unit); #endif -int atkbd_probe_unit(int unit, atkbd_softc_t *sc, +int atkbd_probe_unit(int unit, int port, int irq, int flags); +int atkbd_attach_unit(int unit, atkbd_softc_t *sc, int port, int irq, int flags); -int atkbd_attach_unit(int unit, atkbd_softc_t *sc); #endif /* KERNEL */ #endif /* !_DEV_KBD_ATKBDREG_H_ */ Index: head/sys/dev/kbd/kbd.c =================================================================== --- head/sys/dev/kbd/kbd.c (revision 44627) +++ head/sys/dev/kbd/kbd.c (revision 44628) @@ -1,1198 +1,1244 @@ /*- * Copyright (c) 1999 Kazutaka YOKOTA * All rights reserved. * * 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 as * the first lines of this file unmodified. * 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. * * THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``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 AUTHORS 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. * - * $Id: kbd.c,v 1.2 1999/01/12 10:35:58 yokota Exp $ + * $Id: kbd.c,v 1.3 1999/01/12 12:23:00 yokota Exp $ */ #include "kbd.h" #include "opt_kbd.h" #include #include #include #include #include #include #include #include #include #include #include #include /* local arrays */ /* * We need at least one entry each in order to initialize a keyboard * for the kernel console. The arrays will be increased dynamically * when necessary. */ static int keyboards = 1; static keyboard_t *kbd_ini; static keyboard_t **keyboard = &kbd_ini; static keyboard_switch_t *kbdsw_ini; keyboard_switch_t **kbdsw = &kbdsw_ini; #ifdef KBD_INSTALL_CDEV - -#define ARRAY_DELTA 4 - static struct cdevsw *kbdcdevsw_ini; static struct cdevsw **kbdcdevsw = &kbdcdevsw_ini; +#endif -static void +#define ARRAY_DELTA 4 + +static int kbd_realloc_array(void) { keyboard_t **new_kbd; keyboard_switch_t **new_kbdsw; +#ifdef KBD_INSTALL_CDEV struct cdevsw **new_cdevsw; +#endif int newsize; int s; s = spltty(); newsize = ((keyboards + ARRAY_DELTA)/ARRAY_DELTA)*ARRAY_DELTA; new_kbd = malloc(sizeof(*new_kbd)*newsize, M_DEVBUF, M_NOWAIT); + if (new_kbd == NULL) { + splx(s); + return ENOMEM; + } new_kbdsw = malloc(sizeof(*new_kbdsw)*newsize, M_DEVBUF, M_NOWAIT); + if (new_kbdsw == NULL) { + free(new_kbd, M_DEVBUF); + splx(s); + return ENOMEM; + } +#ifdef KBD_INSTALL_CDEV new_cdevsw = malloc(sizeof(*new_cdevsw)*newsize, M_DEVBUF, M_NOWAIT); + if (new_cdevsw == NULL) { + free(new_kbd, M_DEVBUF); + free(new_kbdsw, M_DEVBUF); + splx(s); + return ENOMEM; + } +#endif bzero(new_kbd, sizeof(*new_kbd)*newsize); bzero(new_kbdsw, sizeof(*new_kbdsw)*newsize); - bzero(new_cdevsw, sizeof(*new_cdevsw)*newsize); bcopy(keyboard, new_kbd, sizeof(*keyboard)*keyboards); bcopy(kbdsw, new_kbdsw, sizeof(*kbdsw)*keyboards); +#ifdef KBD_INSTALL_CDEV + bzero(new_cdevsw, sizeof(*new_cdevsw)*newsize); bcopy(kbdcdevsw, new_cdevsw, sizeof(*kbdcdevsw)*keyboards); +#endif if (keyboards > 1) { free(keyboard, M_DEVBUF); free(kbdsw, M_DEVBUF); +#ifdef KBD_INSTALL_CDEV free(kbdcdevsw, M_DEVBUF); +#endif } keyboard = new_kbd; kbdsw = new_kbdsw; +#ifdef KBD_INSTALL_CDEV kbdcdevsw = new_cdevsw; +#endif keyboards = newsize; splx(s); if (bootverbose) printf("kbd: new array size %d\n", keyboards); + + return 0; } -#endif /* KBD_INSTALL_CDEV */ - /* * Low-level keyboard driver functions * Keyboard subdrivers, such as the AT keyboard driver and the USB keyboard * driver, call these functions to initialize the keyboard_t structure * and register it to the virtual keyboard driver `kbd'. */ /* initialize the keyboard_t structure */ void kbd_init_struct(keyboard_t *kbd, char *name, int type, int unit, int config, int port, int port_size) { kbd->kb_flags = KB_NO_DEVICE; /* device has not been found */ kbd->kb_name = name; kbd->kb_type = type; kbd->kb_unit = unit; - kbd->kb_config = config; + kbd->kb_config = config & ~KB_CONF_PROBE_ONLY; kbd->kb_led = 0; /* unknown */ kbd->kb_io_base = port; kbd->kb_io_size = port_size; kbd->kb_data = NULL; kbd->kb_keymap = NULL; kbd->kb_accentmap = NULL; kbd->kb_fkeytab = NULL; kbd->kb_fkeytab_size = 0; + kbd->kb_delay1 = KB_DELAY1; /* these values are advisory only */ + kbd->kb_delay2 = KB_DELAY2; } void kbd_set_maps(keyboard_t *kbd, keymap_t *keymap, accentmap_t *accmap, fkeytab_t *fkeymap, int fkeymap_size) { kbd->kb_keymap = keymap; kbd->kb_accentmap = accmap; kbd->kb_fkeytab = fkeymap; kbd->kb_fkeytab_size = fkeymap_size; } /* register a keyboard and associate it with a function table */ int kbd_register(keyboard_t *kbd) { keyboard_driver_t **list; keyboard_driver_t *p; int index; for (index = 0; index < keyboards; ++index) { if (keyboard[index] == NULL) break; } - if (index >= keyboards) - return -1; + if (index >= keyboards) { + if (kbd_realloc_array()) + return -1; + } kbd->kb_index = index; KBD_UNBUSY(kbd); KBD_VALID(kbd); kbd->kb_active = 0; /* disabled until someone calls kbd_enable() */ kbd->kb_token = NULL; kbd->kb_callback.kc_func = NULL; kbd->kb_callback.kc_arg = NULL; list = (keyboard_driver_t **)kbddriver_set.ls_items; while ((p = *list++) != NULL) { if (strcmp(p->name, kbd->kb_name) == 0) { keyboard[index] = kbd; kbdsw[index] = p->kbdsw; return index; } } return -1; } int kbd_unregister(keyboard_t *kbd) { int error; int s; if ((kbd->kb_index < 0) || (kbd->kb_index >= keyboards)) return ENOENT; if (keyboard[kbd->kb_index] != kbd) return ENOENT; s = spltty(); if (KBD_IS_BUSY(kbd)) { error = (*kbd->kb_callback.kc_func)(kbd, KBDIO_UNLOADING, kbd->kb_callback.kc_arg); if (error) { splx(s); return error; } if (KBD_IS_BUSY(kbd)) { splx(s); return EBUSY; } } KBD_INVALID(kbd); keyboard[kbd->kb_index] = NULL; kbdsw[kbd->kb_index] = NULL; splx(s); return 0; } /* find a funciton table by the driver name */ keyboard_switch_t *kbd_get_switch(char *driver) { keyboard_driver_t **list; keyboard_driver_t *p; list = (keyboard_driver_t **)kbddriver_set.ls_items; while ((p = *list++) != NULL) { if (strcmp(p->name, driver) == 0) return p->kbdsw; } return NULL; } /* * Keyboard client functions * Keyboard clients, such as the console driver `syscons' and the keyboard * cdev driver, use these functions to claim and release a keyboard for * exclusive use. */ /* find the keyboard specified by a driver name and a unit number */ int kbd_find_keyboard(char *driver, int unit) { int i; for (i = 0; i < keyboards; ++i) { if (keyboard[i] == NULL) continue; if (!KBD_IS_VALID(keyboard[i])) continue; if (strcmp("*", driver) && strcmp(keyboard[i]->kb_name, driver)) continue; if ((unit != -1) && (keyboard[i]->kb_unit != unit)) continue; return i; } return -1; } /* allocate a keyboard */ int kbd_allocate(char *driver, int unit, void *id, kbd_callback_func_t *func, void *arg) { int index; int s; if (func == NULL) return -1; s = spltty(); index = kbd_find_keyboard(driver, unit); if (index >= 0) { if (KBD_IS_BUSY(keyboard[index])) { splx(s); return -1; } keyboard[index]->kb_token = id; KBD_BUSY(keyboard[index]); keyboard[index]->kb_callback.kc_func = func; keyboard[index]->kb_callback.kc_arg = arg; (*kbdsw[index]->clear_state)(keyboard[index]); } splx(s); return index; } int kbd_release(keyboard_t *kbd, void *id) { int error; int s; s = spltty(); if (!KBD_IS_VALID(kbd) || !KBD_IS_BUSY(kbd)) { error = EINVAL; } else if (kbd->kb_token != id) { error = EPERM; } else { kbd->kb_token = NULL; KBD_UNBUSY(kbd); kbd->kb_callback.kc_func = NULL; kbd->kb_callback.kc_arg = NULL; (*kbdsw[kbd->kb_index]->clear_state)(kbd); error = 0; } splx(s); return error; } int kbd_change_callback(keyboard_t *kbd, void *id, kbd_callback_func_t *func, void *arg) { int error; int s; s = spltty(); if (!KBD_IS_VALID(kbd) || !KBD_IS_BUSY(kbd)) { error = EINVAL; } else if (kbd->kb_token != id) { error = EPERM; } else if (func == NULL) { error = EINVAL; } else { kbd->kb_callback.kc_func = func; kbd->kb_callback.kc_arg = arg; error = 0; } splx(s); return error; } /* get a keyboard structure */ keyboard_t *kbd_get_keyboard(int index) { if ((index < 0) || (index >= keyboards)) return NULL; if (!KBD_IS_VALID(keyboard[index])) return NULL; return keyboard[index]; } /* * The back door for the console driver; configure keyboards * This function is for the kernel console to initialize keyboards * at very early stage. */ int kbd_configure(int flags) { keyboard_driver_t **list; keyboard_driver_t *p; list = (keyboard_driver_t **)kbddriver_set.ls_items; while ((p = *list++) != NULL) { if (p->configure != NULL) (*p->configure)(flags); } return 0; } #ifdef KBD_INSTALL_CDEV /* * Virtual keyboard cdev driver functions * The virtual keyboard driver dispatches driver functions to * appropriate subdrivers. */ #define KBD_UNIT(dev) minor(dev) static d_open_t kbdopen; static d_close_t kbdclose; static d_read_t kbdread; static d_write_t kbdwrite; static d_ioctl_t kbdioctl; static d_reset_t kbdreset; static d_devtotty_t kbddevtotty; static d_poll_t kbdpoll; static d_mmap_t kbdmmap; #define CDEV_MAJOR 112 static struct cdevsw kbd_cdevsw = { kbdopen, kbdclose, kbdread, kbdwrite, /* ??? */ kbdioctl, nullstop, kbdreset, kbddevtotty, kbdpoll, kbdmmap, nostrategy, "kbd", NULL, -1, nodump, nopsize, }; static void vkbdattach(void *arg) { static int kbd_devsw_installed = FALSE; dev_t dev; if (!kbd_devsw_installed) { dev = makedev(CDEV_MAJOR, 0); cdevsw_add(&dev, &kbd_cdevsw, NULL); kbd_devsw_installed = TRUE; } } PSEUDO_SET(vkbdattach, kbd); int kbd_attach(dev_t dev, keyboard_t *kbd, struct cdevsw *cdevsw) { int s; if (kbd->kb_index >= keyboards) return EINVAL; if (keyboard[kbd->kb_index] != kbd) return EINVAL; s = spltty(); kbd->kb_minor = minor(dev); kbdcdevsw[kbd->kb_index] = cdevsw; splx(s); /* XXX: DEVFS? */ - if (kbd->kb_index + 1 >= keyboards) - kbd_realloc_array(); - printf("kbd%d at %s%d\n", kbd->kb_index, kbd->kb_name, kbd->kb_unit); return 0; } int kbd_detach(dev_t dev, keyboard_t *kbd, struct cdevsw *cdevsw) { int s; if (kbd->kb_index >= keyboards) return EINVAL; if (keyboard[kbd->kb_index] != kbd) return EINVAL; if (kbdcdevsw[kbd->kb_index] != cdevsw) return EINVAL; s = spltty(); (*kbdsw[kbd->kb_index]->term)(kbd); kbdcdevsw[kbd->kb_index] = NULL; splx(s); return 0; } static int kbdopen(dev_t dev, int flag, int mode, struct proc *p) { int unit; unit = KBD_UNIT(dev); if (unit >= keyboards) return ENXIO; if (kbdcdevsw[unit] == NULL) return ENXIO; if (KBD_IS_BUSY(keyboard[unit])) return EBUSY; return (*kbdcdevsw[unit]->d_open)(makedev(0, keyboard[unit]->kb_minor), flag, mode, p); } static int kbdclose(dev_t dev, int flag, int mode, struct proc *p) { int unit; unit = KBD_UNIT(dev); if (kbdcdevsw[unit] == NULL) return ENXIO; return (*kbdcdevsw[unit]->d_close)(makedev(0, keyboard[unit]->kb_minor), flag, mode, p); } static int kbdread(dev_t dev, struct uio *uio, int flag) { int unit; unit = KBD_UNIT(dev); if (kbdcdevsw[unit] == NULL) return ENXIO; return (*kbdcdevsw[unit]->d_read)(makedev(0, keyboard[unit]->kb_minor), uio, flag); } static int kbdwrite(dev_t dev, struct uio *uio, int flag) { int unit; unit = KBD_UNIT(dev); if (kbdcdevsw[unit] == NULL) return ENXIO; return (*kbdcdevsw[unit]->d_write)(makedev(0, keyboard[unit]->kb_minor), uio, flag); } static int kbdioctl(dev_t dev, u_long cmd, caddr_t arg, int flag, struct proc *p) { int unit; unit = KBD_UNIT(dev); if (kbdcdevsw[unit] == NULL) return ENXIO; return (*kbdcdevsw[unit]->d_ioctl)(makedev(0, keyboard[unit]->kb_minor), cmd, arg, flag, p); } static int kbdreset(dev_t dev) { int unit; unit = KBD_UNIT(dev); if (kbdcdevsw[unit] == NULL) return ENXIO; return (*kbdcdevsw[unit]->d_reset)(makedev(0, keyboard[unit]->kb_minor)); } static struct tty *kbddevtotty(dev_t dev) { int unit; unit = KBD_UNIT(dev); if (kbdcdevsw[unit] == NULL) return NULL; return (*kbdcdevsw[unit]->d_devtotty)(makedev(0, keyboard[unit]->kb_minor)); } static int kbdpoll(dev_t dev, int event, struct proc *p) { int unit; unit = KBD_UNIT(dev); if (kbdcdevsw[unit] == NULL) return ENXIO; return (*kbdcdevsw[unit]->d_poll)(makedev(0, keyboard[unit]->kb_minor), event, p); } static int kbdmmap(dev_t dev, vm_offset_t offset, int nprot) { int unit; unit = KBD_UNIT(dev); if (kbdcdevsw[unit] == NULL) return ENXIO; return (*kbdcdevsw[unit]->d_mmap)(makedev(0, keyboard[unit]->kb_minor), offset, nprot); } /* * Generic keyboard cdev driver functions * Keyboard subdrivers may call these functions to implement common * driver functions. */ #define KB_QSIZE 512 #define KB_BUFSIZE 64 static kbd_callback_func_t genkbd_event; int genkbdopen(genkbd_softc_t *sc, keyboard_t *kbd, int mode, int flag, struct proc *p) { int s; int i; s = spltty(); if (!KBD_IS_VALID(kbd)) { splx(s); return ENXIO; } i = kbd_allocate(kbd->kb_name, kbd->kb_unit, sc, genkbd_event, (void *)sc); if (i < 0) { splx(s); return EBUSY; } /* assert(i == kbd->kb_index) */ /* assert(kbd == kbd_get_keyboard(i)) */ /* * NOTE: even when we have successfully claimed a keyboard, * the device may still be missing (!KBD_HAS_DEVICE(kbd)). */ #if 0 bzero(&sc->gkb_q, sizeof(sc->gkb_q)); #endif clist_alloc_cblocks(&sc->gkb_q, KB_QSIZE, KB_QSIZE/2); /* XXX */ sc->gkb_rsel.si_flags = 0; sc->gkb_rsel.si_pid = 0; splx(s); return 0; } int genkbdclose(genkbd_softc_t *sc, keyboard_t *kbd, int mode, int flag, struct proc *p) { int s; /* * NOTE: the device may have already become invalid. * !KBD_IS_VALID(kbd) */ s = spltty(); kbd_release(kbd, (void *)sc); #if 0 clist_free_cblocks(&sc->gkb_q); #endif splx(s); return 0; } int genkbdread(genkbd_softc_t *sc, keyboard_t *kbd, struct uio *uio, int flag) { u_char buffer[KB_BUFSIZE]; int len; int error; int s; /* wait for input */ s = spltty(); while (sc->gkb_q.c_cc == 0) { if (!KBD_IS_VALID(kbd)) { splx(s); return EIO; } if (flag & IO_NDELAY) { splx(s); return EWOULDBLOCK; } sc->gkb_flags |= KB_ASLEEP; error = tsleep((caddr_t)sc, PZERO | PCATCH, "kbdrea", 0); if (error) { sc->gkb_flags &= ~KB_ASLEEP; splx(s); return error; } } splx(s); /* copy as much input as possible */ error = 0; while (uio->uio_resid > 0) { len = imin(uio->uio_resid, sizeof(buffer)); len = q_to_b(&sc->gkb_q, buffer, len); if (len <= 0) break; error = uiomove(buffer, len, uio); if (error) break; } return error; } int genkbdwrite(genkbd_softc_t *sc, keyboard_t *kbd, struct uio *uio, int flag) { if (!KBD_IS_VALID(kbd)) return ENXIO; return ENODEV; } int genkbdioctl(genkbd_softc_t *sc, keyboard_t *kbd, u_long cmd, caddr_t arg, int flag, struct proc *p) { int error; if (kbd == NULL) /* XXX */ return ENXIO; if (!KBD_IS_VALID(kbd)) return ENXIO; error = (*kbdsw[kbd->kb_index]->ioctl)(kbd, cmd, arg); if (error == ENOIOCTL) error = ENODEV; return error; } int genkbdpoll(genkbd_softc_t *sc, keyboard_t *kbd, int events, struct proc *p) { int revents; int s; revents = 0; s = spltty(); if (events & (POLLIN | POLLRDNORM)) { if ((sc->gkb_q.c_cc > 0) || !KBD_IS_VALID(kbd)) revents |= (POLLIN | POLLRDNORM); else selrecord(p, &sc->gkb_rsel); } splx(s); return revents; } static int genkbd_event(keyboard_t *kbd, int event, void *arg) { genkbd_softc_t *sc; size_t len; u_char *cp; int mode; int c; /* assert(KBD_IS_VALID(kbd)) */ sc = (genkbd_softc_t *)arg; switch (event) { case KBDIO_KEYINPUT: break; case KBDIO_UNLOADING: /* the keyboard is going... */ kbd_release(kbd, (void *)sc); return 0; default: return EINVAL; } /* obtain the current key input mode */ if ((*kbdsw[kbd->kb_index]->ioctl)(kbd, KDGKBMODE, (caddr_t)&mode)) mode = K_XLATE; /* read all pending input */ while ((*kbdsw[kbd->kb_index]->check_char)(kbd)) { c = (*kbdsw[kbd->kb_index]->read_char)(kbd, FALSE); if (c == NOKEY) continue; if (c == ERRKEY) /* XXX: ring bell? */ continue; if (!KBD_IS_BUSY(kbd)) /* the device is not open, discard the input */ continue; /* store the byte as is for K_RAW and K_CODE modes */ if (mode != K_XLATE) { putc(KEYCHAR(c), &sc->gkb_q); continue; } /* K_XLATE */ if (c & RELKEY) /* key release is ignored */ continue; /* process special keys; most of them are just ignored... */ if (c & SPCLKEY) { switch (KEYCHAR(c)) { /* locking keys */ case NLK: case CLK: case SLK: case ALK: /* shift keys */ case LSH: case RSH: case LCTR: case RCTR: case LALT: case RALT: case ASH: case META: /* other special keys */ case NOP: case SPSC: case RBT: case SUSP: case STBY: case DBG: case NEXT: /* ignore them... */ continue; case BTAB: /* a backtab: ESC [ Z */ putc(0x1b, &sc->gkb_q); putc('[', &sc->gkb_q); putc('Z', &sc->gkb_q); continue; } } /* normal chars, normal chars with the META, function keys */ switch (KEYFLAGS(c)) { case 0: /* a normal char */ putc(KEYCHAR(c), &sc->gkb_q); break; case MKEY: /* the META flag: prepend ESC */ putc(0x1b, &sc->gkb_q); putc(KEYCHAR(c), &sc->gkb_q); break; case FKEY | SPCLKEY: /* a function key, return string */ cp = (*kbdsw[kbd->kb_index]->get_fkeystr)(kbd, KEYCHAR(c), &len); if (cp != NULL) { while (len-- > 0) putc(*cp++, &sc->gkb_q); } break; } } /* wake up sleeping/polling processes */ if (sc->gkb_q.c_cc > 0) { if (sc->gkb_flags & KB_ASLEEP) { sc->gkb_flags &= ~KB_ASLEEP; wakeup((caddr_t)sc); } selwakeup(&sc->gkb_rsel); } return 0; } #endif /* KBD_INSTALL_CDEV */ /* * Generic low-level keyboard functions * The low-level functions in the keyboard subdriver may use these * functions. */ int genkbd_commonioctl(keyboard_t *kbd, u_long cmd, caddr_t arg) { keyarg_t *keyp; fkeyarg_t *fkeyp; int s; int i; s = spltty(); switch (cmd) { case KDGKBINFO: /* get keyboard information */ ((keyboard_info_t *)arg)->kb_index = kbd->kb_index; i = imin(strlen(kbd->kb_name) + 1, sizeof(((keyboard_info_t *)arg)->kb_name)); bcopy(kbd->kb_name, ((keyboard_info_t *)arg)->kb_name, i); ((keyboard_info_t *)arg)->kb_unit = kbd->kb_unit; ((keyboard_info_t *)arg)->kb_type = kbd->kb_type; ((keyboard_info_t *)arg)->kb_config = kbd->kb_config; ((keyboard_info_t *)arg)->kb_flags = kbd->kb_flags; break; case KDGKBTYPE: /* get keyboard type */ *(int *)arg = kbd->kb_type; break; case GIO_KEYMAP: /* get keyboard translation table */ bcopy(kbd->kb_keymap, arg, sizeof(*kbd->kb_keymap)); break; case PIO_KEYMAP: /* set keyboard translation table */ +#ifndef KBD_DISABLE_KEYMAP_LOAD bzero(kbd->kb_accentmap, sizeof(*kbd->kb_accentmap)); bcopy(arg, kbd->kb_keymap, sizeof(*kbd->kb_keymap)); break; +#else + splx(s); + return ENODEV; +#endif case GIO_KEYMAPENT: /* get keyboard translation table entry */ keyp = (keyarg_t *)arg; if (keyp->keynum >= sizeof(kbd->kb_keymap->key) /sizeof(kbd->kb_keymap->key[0])) { splx(s); return EINVAL; } bcopy(&kbd->kb_keymap->key[keyp->keynum], &keyp->key, sizeof(keyp->key)); break; case PIO_KEYMAPENT: /* set keyboard translation table entry */ +#ifndef KBD_DISABLE_KEYMAP_LOAD keyp = (keyarg_t *)arg; if (keyp->keynum >= sizeof(kbd->kb_keymap->key) /sizeof(kbd->kb_keymap->key[0])) { splx(s); return EINVAL; } bcopy(&keyp->key, &kbd->kb_keymap->key[keyp->keynum], sizeof(keyp->key)); break; +#else + splx(s); + return ENODEV; +#endif case GIO_DEADKEYMAP: /* get accent key translation table */ bcopy(kbd->kb_accentmap, arg, sizeof(*kbd->kb_accentmap)); break; case PIO_DEADKEYMAP: /* set accent key translation table */ +#ifndef KBD_DISABLE_KEYMAP_LOAD bcopy(arg, kbd->kb_accentmap, sizeof(*kbd->kb_accentmap)); break; +#else + splx(s); + return ENODEV; +#endif case GETFKEY: /* get functionkey string */ fkeyp = (fkeyarg_t *)arg; if (fkeyp->keynum >= kbd->kb_fkeytab_size) { splx(s); return EINVAL; } bcopy(kbd->kb_fkeytab[fkeyp->keynum].str, fkeyp->keydef, kbd->kb_fkeytab[fkeyp->keynum].len); fkeyp->flen = kbd->kb_fkeytab[fkeyp->keynum].len; break; case SETFKEY: /* set functionkey string */ +#ifndef KBD_DISABLE_KEYMAP_LOAD fkeyp = (fkeyarg_t *)arg; if (fkeyp->keynum >= kbd->kb_fkeytab_size) { splx(s); return EINVAL; } kbd->kb_fkeytab[fkeyp->keynum].len = imin(fkeyp->flen, MAXFK); bcopy(fkeyp->keydef, kbd->kb_fkeytab[fkeyp->keynum].str, kbd->kb_fkeytab[fkeyp->keynum].len); break; +#else + splx(s); + return ENODEV; +#endif default: splx(s); return ENOIOCTL; } splx(s); return 0; } /* get a pointer to the string associated with the given function key */ u_char *genkbd_get_fkeystr(keyboard_t *kbd, int fkey, size_t *len) { if (kbd == NULL) return NULL; fkey -= F_FN; if (fkey > kbd->kb_fkeytab_size) return NULL; *len = kbd->kb_fkeytab[fkey].len; return kbd->kb_fkeytab[fkey].str; } /* diagnostic dump */ static char *get_kbd_type_name(int type) { static struct { int type; char *name; } name_table[] = { { KB_84, "AT 84" }, { KB_101, "AT 101/102" }, { KB_OTHER, "generic" }, }; int i; for (i = 0; i < sizeof(name_table)/sizeof(name_table[0]); ++i) { if (type == name_table[i].type) return name_table[i].name; } return "unknown"; } void genkbd_diag(keyboard_t *kbd, int level) { if (level > 0) { printf("kbd%d: %s%d, %s (%d), config:0x%x, flags:0x%x", kbd->kb_index, kbd->kb_name, kbd->kb_unit, get_kbd_type_name(kbd->kb_type), kbd->kb_type, kbd->kb_config, kbd->kb_flags); if (kbd->kb_io_base > 0) printf(", port:0x%x-0x%x", kbd->kb_io_base, kbd->kb_io_base + kbd->kb_io_size - 1); printf("\n"); } } #define set_lockkey_state(k, s, l) \ if (!((s) & l ## DOWN)) { \ int i; \ (s) |= l ## DOWN; \ (s) ^= l ## ED; \ i = (s) & LOCK_MASK; \ (*kbdsw[(k)->kb_index]->ioctl)((k), KDSETLED, (caddr_t)&i); \ } static u_int save_accent_key(keyboard_t *kbd, u_int key, int *accents) { int i; /* make an index into the accent map */ i = key - F_ACC + 1; if ((i > kbd->kb_accentmap->n_accs) || (kbd->kb_accentmap->acc[i - 1].accchar == 0)) { /* the index is out of range or pointing to an empty entry */ *accents = 0; return ERRKEY; } /* * If the same accent key has been hit twice, produce the accent char * itself. */ if (i == *accents) { key = kbd->kb_accentmap->acc[i - 1].accchar; *accents = 0; return key; } /* remember the index and wait for the next key */ *accents = i; return NOKEY; } static u_int make_accent_char(keyboard_t *kbd, u_int ch, int *accents) { struct acc_t *acc; int i; acc = &kbd->kb_accentmap->acc[*accents - 1]; *accents = 0; /* * If the accent key is followed by the space key, * produce the accent char itself. */ if (ch == ' ') return acc->accchar; /* scan the accent map */ for (i = 0; i < NUM_ACCENTCHARS; ++i) { if (acc->map[i][0] == 0) /* end of table */ break; if (acc->map[i][0] == ch) return acc->map[i][1]; } /* this char cannot be accented... */ return ERRKEY; } int genkbd_keyaction(keyboard_t *kbd, int keycode, int up, int *shiftstate, int *accents) { struct keyent_t *key; int state = *shiftstate; int action; int f; int i; f = state & (AGRS | ALKED); if ((f == AGRS1) || (f == AGRS2) || (f == ALKED)) keycode += ALTGR_OFFSET; key = &kbd->kb_keymap->key[keycode]; i = ((state & SHIFTS) ? 1 : 0) | ((state & CTLS) ? 2 : 0) | ((state & ALTS) ? 4 : 0); if (((key->flgs & FLAG_LOCK_C) && (state & CLKED)) || ((key->flgs & FLAG_LOCK_N) && (state & NLKED)) ) i ^= 1; action = key->map[i]; if (up) { /* break: key released */ if (key->spcl & (0x80 >> i)) { /* special keys */ switch (action) { case LSH: state &= ~SHIFTS1; break; case RSH: state &= ~SHIFTS2; break; case LCTR: state &= ~CTLS1; break; case RCTR: state &= ~CTLS2; break; case LALT: state &= ~ALTS1; break; case RALT: state &= ~ALTS2; break; case ASH: state &= ~AGRS1; break; case META: state &= ~METAS1; break; case NLK: state &= ~NLKDOWN; break; case CLK: #ifndef PC98 state &= ~CLKDOWN; #else state &= ~CLKED; i = state & LOCK_MASK; (*kbdsw[kbd->kb_index]->ioctl)(kbd, KDSETLED, (caddr_t)&i); #endif break; case SLK: state &= ~SLKDOWN; break; case ALK: state &= ~ALKDOWN; break; } *shiftstate = state; return (SPCLKEY | RELKEY | action); } /* release events of regular keys are not reported */ return NOKEY; } else { /* make: key pressed */ if (key->spcl & (0x80 >> i)) { /* special keys */ switch (action) { /* LOCKING KEYS */ case NLK: set_lockkey_state(kbd, state, NLK); break; case CLK: #ifndef PC98 set_lockkey_state(kbd, state, CLK); #else state |= CLKED; i = state & LOCK_MASK; (*kbdsw[kbd->kb_index]->ioctl)(kbd, KDSETLED, (caddr_t)&i); #endif break; case SLK: set_lockkey_state(kbd, state, SLK); break; case ALK: set_lockkey_state(kbd, state, ALK); break; /* NON-LOCKING KEYS */ case SPSC: case RBT: case SUSP: case STBY: case DBG: case NEXT: *accents = 0; break; case BTAB: *accents = 0; action |= BKEY; break; case LSH: state |= SHIFTS1; break; case RSH: state |= SHIFTS2; break; case LCTR: state |= CTLS1; break; case RCTR: state |= CTLS2; break; case LALT: state |= ALTS1; break; case RALT: state |= ALTS2; break; case ASH: state |= AGRS1; break; case META: state |= METAS1; break; default: /* is this an accent (dead) key? */ if (action >= F_ACC && action <= L_ACC) { action = save_accent_key(kbd, action, accents); switch (action) { case NOKEY: case ERRKEY: return action; default: if (state & METAS) return (action | MKEY); else return action; } /* NOT REACHED */ } /* other special keys */ if (*accents > 0) { *accents = 0; return ERRKEY; } if (action >= F_FN && action <= L_FN) action |= FKEY; /* XXX: return fkey string for the FKEY? */ } *shiftstate = state; return (SPCLKEY | action); } else { /* regular keys */ if (*accents > 0) { /* make an accented char */ action = make_accent_char(kbd, action, accents); if (action == ERRKEY) return action; } if (state & METAS) action |= MKEY; return action; } } /* NOT REACHED */ } Index: head/sys/dev/kbd/kbdreg.h =================================================================== --- head/sys/dev/kbd/kbdreg.h (revision 44627) +++ head/sys/dev/kbd/kbdreg.h (revision 44628) @@ -1,270 +1,276 @@ /*- * Copyright (c) 1999 Kazutaka YOKOTA * All rights reserved. * * 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 as * the first lines of this file unmodified. * 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. * * THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``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 AUTHORS 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. * - * $Id: kbdreg.h,v 1.1 1999/01/09 02:44:50 yokota Exp $ + * $Id: kbdreg.h,v 1.2 1999/01/19 11:31:14 yokota Exp $ */ #ifndef _DEV_KBD_KBDREG_H_ #define _DEV_KBD_KBDREG_H_ /* forward declarations */ typedef struct keyboard keyboard_t; struct keymap; struct accentmap; struct fkeytab; /* call back funcion */ typedef int kbd_callback_func_t(keyboard_t *kbd, int event, void *arg); /* event types */ #define KBDIO_KEYINPUT 0 #define KBDIO_UNLOADING 1 typedef struct keyboard_callback { kbd_callback_func_t *kc_func; void *kc_arg; } keyboard_callback_t; /* keyboard */ struct keyboard { /* the following fields are managed by kbdio */ int kb_index; /* kbdio index# */ int kb_minor; /* minor number of the sub-device */ int kb_flags; /* internal flags */ #define KB_VALID (1 << 16) /* this entry is valid */ #define KB_NO_DEVICE (1 << 17) /* device not present */ #define KB_PROBED (1 << 18) /* device probed */ #define KB_INITIALIZED (1 << 19) /* device initialized */ #define KB_REGISTERED (1 << 20) /* device registered to kbdio */ #define KB_BUSY (1 << 21) /* device used by a client */ int kb_active; /* 0: inactive */ void *kb_token; /* id of the current client */ keyboard_callback_t kb_callback;/* callback function */ /* * Device configuration flags: * The upper 16 bits are common between various keyboard devices. * The lower 16 bits are device-specific. */ int kb_config; #define KB_CONF_PROBE_ONLY (1 << 16) /* probe only, don't initialize */ /* the following fields are set up by the driver */ char *kb_name; /* driver name */ int kb_unit; /* unit # */ int kb_type; /* KB_84, KB_101, KB_OTHER,... */ int kb_io_base; /* port# if any */ int kb_io_size; /* # of occupied port */ int kb_led; /* LED status */ struct keymap *kb_keymap; /* key map */ struct accentmap *kb_accentmap; /* accent map */ struct fkeytab *kb_fkeytab; /* function key strings */ int kb_fkeytab_size;/* # of function key strings */ void *kb_data; /* the driver's private data */ + int kb_delay1; + int kb_delay2; +#define KB_DELAY1 500 +#define KB_DELAY2 100 }; #define KBD_IS_VALID(k) ((k)->kb_flags & KB_VALID) #define KBD_VALID(k) ((k)->kb_flags |= KB_VALID) #define KBD_INVALID(k) ((k)->kb_flags &= ~KB_VALID) #define KBD_HAS_DEVICE(k) (!((k)->kb_flags & KB_NO_DEVICE)) #define KBD_FOUND_DEVICE(k) ((k)->kb_flags &= ~KB_NO_DEVICE) #define KBD_IS_PROBED(k) ((k)->kb_flags & KB_PROBED) #define KBD_PROBE_DONE(k) ((k)->kb_flags |= KB_PROBED) #define KBD_IS_INITIALIZED(k) ((k)->kb_flags & KB_INITIALIZED) #define KBD_INIT_DONE(k) ((k)->kb_flags |= KB_INITIALIZED) #define KBD_IS_CONFIGURED(k) ((k)->kb_flags & KB_REGISTERED) #define KBD_CONFIG_DONE(k) ((k)->kb_flags |= KB_REGISTERED) #define KBD_IS_BUSY(k) ((k)->kb_flags & KB_BUSY) #define KBD_BUSY(k) ((k)->kb_flags |= KB_BUSY) #define KBD_UNBUSY(k) ((k)->kb_flags &= ~KB_BUSY) #define KBD_IS_ACTIVE(k) ((k)->kb_active) #define KBD_ACTIVATE(k) (++(k)->kb_active) #define KBD_DEACTIVATE(k) (--(k)->kb_active) #define KBD_LED_VAL(k) ((k)->kb_led) /* keyboard function table */ -typedef int kbd_probe_t(int unit, keyboard_t **kbdp, void *arg, - int flags); -typedef int kbd_init_t(keyboard_t *kbd); +typedef int kbd_probe_t(int unit, void *arg, int flags); +typedef int kbd_init_t(int unit, keyboard_t **kbdp, void *arg, + int flags); typedef int kbd_term_t(keyboard_t *kbd); -typedef int kbd_intr_t(keyboard_t *kbd); +typedef int kbd_intr_t(keyboard_t *kbd, void *arg); typedef int kbd_test_if_t(keyboard_t *kbd); typedef int kbd_enable_t(keyboard_t *kbd); typedef int kbd_disable_t(keyboard_t *kbd); typedef int kbd_read_t(keyboard_t *kbd, int wait); typedef int kbd_check_t(keyboard_t *kbd); typedef u_int kbd_read_char_t(keyboard_t *kbd, int wait); typedef int kbd_check_char_t(keyboard_t *kbd); typedef int kbd_ioctl_t(keyboard_t *kbd, u_long cmd, caddr_t data); typedef int kbd_lock_t(keyboard_t *kbd, int lock); typedef void kbd_clear_state_t(keyboard_t *kbd); typedef int kbd_get_state_t(keyboard_t *kbd, void *buf, size_t len); typedef int kbd_set_state_t(keyboard_t *kbd, void *buf, size_t len); typedef u_char *kbd_get_fkeystr_t(keyboard_t *kbd, int fkey, size_t *len); +typedef int kbd_poll_mode_t(keyboard_t *kbd, int on); typedef void kbd_diag_t(keyboard_t *kbd, int level); typedef struct keyboard_switch { kbd_probe_t *probe; kbd_init_t *init; kbd_term_t *term; kbd_intr_t *intr; kbd_test_if_t *test_if; kbd_enable_t *enable; kbd_disable_t *disable; kbd_read_t *read; kbd_check_t *check; kbd_read_char_t *read_char; kbd_check_char_t *check_char; kbd_ioctl_t *ioctl; kbd_lock_t *lock; kbd_clear_state_t *clear_state; kbd_get_state_t *get_state; kbd_set_state_t *set_state; kbd_get_fkeystr_t *get_fkeystr; + kbd_poll_mode_t *poll; kbd_diag_t *diag; } keyboard_switch_t; /* keyboard driver */ typedef struct keyboard_driver { char *name; keyboard_switch_t *kbdsw; int (*configure)(int); /* backdoor for the console driver */ } keyboard_driver_t; #ifdef KERNEL #define KEYBOARD_DRIVER(name, sw, config) \ - static struct keyboard_driver name##_driver = { \ + static struct keyboard_driver name##_kbd_driver = { \ #name, &sw, config \ }; \ - DATA_SET(kbddriver_set, name##_driver); + DATA_SET(kbddriver_set, name##_kbd_driver); /* global variables */ extern keyboard_switch_t **kbdsw; extern struct linker_set kbddriver_set; /* functions for the keyboard driver */ int kbd_register(keyboard_t *kbd); int kbd_unregister(keyboard_t *kbd); keyboard_switch_t *kbd_get_switch(char *driver); void kbd_init_struct(keyboard_t *kbd, char *name, int type, int unit, int config, int port, int port_size); void kbd_set_maps(keyboard_t *kbd, struct keymap *keymap, struct accentmap *accmap, struct fkeytab *fkeymap, int fkeymap_size); /* functions for the keyboard client */ int kbd_allocate(char *driver, int unit, void *id, kbd_callback_func_t *func, void *arg); int kbd_release(keyboard_t *kbd, void *id); int kbd_change_callback(keyboard_t *kbd, void *id, kbd_callback_func_t *func, void *arg); int kbd_find_keyboard(char *driver, int unit); keyboard_t *kbd_get_keyboard(int index); /* a back door for the console driver to tickle the keyboard driver XXX */ int kbd_configure(int flags); /* see `kb_config' above for flag bit definitions */ #ifdef KBD_INSTALL_CDEV /* virtual keyboard cdev driver functions */ int kbd_attach(dev_t dev, keyboard_t *kbd, struct cdevsw *sw); int kbd_detach(dev_t dev, keyboard_t *kbd, struct cdevsw *sw); /* generic keyboard cdev driver functions */ typedef struct genkbd_softc { int gkb_flags; /* flag/status bits */ #define KB_ASLEEP (1 << 0) struct clist gkb_q; /* input queue */ struct selinfo gkb_rsel; } genkbd_softc_t; int genkbdopen(genkbd_softc_t *sc, keyboard_t *kbd, int flag, int mode, struct proc *p); int genkbdclose(genkbd_softc_t *sc, keyboard_t *kbd, int flag, int mode, struct proc *p); int genkbdread(genkbd_softc_t *sc, keyboard_t *kbd, struct uio *uio, int flag); int genkbdwrite(genkbd_softc_t *sc, keyboard_t *kbd, struct uio *uio, int flag); int genkbdioctl(genkbd_softc_t *sc, keyboard_t *kbd, u_long cmd, caddr_t arg, int flag, struct proc *p); int genkbdpoll(genkbd_softc_t *sc, keyboard_t *kbd, int event, struct proc *p); #endif /* KBD_INSTALL_CDEV */ /* generic low-level keyboard functions */ /* shift key state */ #define SHIFTS1 (1 << 16) #define SHIFTS2 (1 << 17) #define SHIFTS (SHIFTS1 | SHIFTS2) #define CTLS1 (1 << 18) #define CTLS2 (1 << 19) #define CTLS (CTLS1 | CTLS2) #define ALTS1 (1 << 20) #define ALTS2 (1 << 21) #define ALTS (ALTS1 | ALTS2) #define AGRS1 (1 << 22) #define AGRS2 (1 << 23) #define AGRS (AGRS1 | AGRS2) #define METAS1 (1 << 24) #define METAS2 (1 << 25) #define METAS (METAS1 | METAS2) #define NLKDOWN (1 << 26) #define SLKDOWN (1 << 27) #define CLKDOWN (1 << 28) #define ALKDOWN (1 << 29) /* lock key state (defined in machine/console.h) */ /* #define CLKED LED_CAP #define NLKED LED_NUM #define SLKED LED_SCR #define ALKED (1 << 3) #define LOCK_MASK (CLKED | NLKED | SLKED | ALKED) #define LED_CAP (1 << 0) #define LED_NUM (1 << 1) #define LED_SCR (1 << 2) #define LED_MASK (LED_CAP | LED_NUM | LED_SCR) */ kbd_get_fkeystr_t genkbd_get_fkeystr; kbd_diag_t genkbd_diag; int genkbd_commonioctl(keyboard_t *kbd, u_long cmd, caddr_t arg); int genkbd_keyaction(keyboard_t *kbd, int keycode, int down, int *shiftstate, int *accents); #endif /* KERNEL */ #endif /* !_DEV_KBD_KBDREG_H_ */ Index: head/sys/dev/kbd/kbdtables.h =================================================================== --- head/sys/dev/kbd/kbdtables.h (revision 44627) +++ head/sys/dev/kbd/kbdtables.h (revision 44628) @@ -1,1343 +1,380 @@ /*- * Copyright (c) 1992-1998 Søren Schmidt * All rights reserved. * * 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, * without modification, immediately at the beginning of the file. * 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. The name of the author may not be used to endorse or promote products * derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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. * - * $Id: kbdtables.h,v 1.43 1999/01/28 01:59:48 dillon Exp $ + * $Id: kbdtables.h,v 1.44 1999/01/28 10:55:55 yokota Exp $ */ -#define SET8 0x80 /* set eight bit on */ +#ifndef KBD_DFLT_KEYMAP #ifdef PC98 #define NO_ACCENTCHARS /* PC-9801 keymap by kuribo@isl.melco.co.jp */ static keymap_t key_map = { 0x80, { /* PC98 keymap */ /* alt * scan cntrl alt alt cntrl * code base shift cntrl shift alt shift cntrl shift spcl flgs * --------------------------------------------------------------------------- */ /* sc=00 */ 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, DBG, 0x1B, 0x02, 0x00, /* sc=01 */ '1', '!', '!', '!', '1', '!', '!', '!', 0x00, 0x00, /* sc=02 */ '2', '\"', 0x1A, 0x1A, '2', '@', 0x00, 0x00, 0x00, 0x00, /* sc=03 */ '3', '#', 0x1B, 0x1B, '3', '#', 0x1B, 0x1B, 0x00, 0x00, /* sc=04 */ '4', '$', 0x1C, 0x1C, '4', '$', 0x1C, 0x1C, 0x00, 0x00, /* sc=05 */ '5', '%', 0x1D, 0x1D, '5', '%', 0x1D, 0x1D, 0x00, 0x00, /* sc=06 */ '6', '&', 0x1E, 0x1E, '6', '^', 0x1E, 0x1E, 0x00, 0x00, /* sc=07 */ '7', '\'', 0x1F, 0x1F, '7', '&', '&', '&', 0x00, 0x00, /* sc=08 */ '8', '(', 0x7F, 0x7F, '8', '*', 0x08, 0x08, 0x00, 0x00, /* sc=09 */ '9', ')', '9', '9', '9', '(', '(', '(', 0x00, 0x00, /* sc=0a */ '0', NOP, '0', '0', '0', ')', ')', ')', 0x40, 0x00, /* sc=0b */ '-', '=', '-', '-', '-', '_', 0x1F, 0x1F, 0x00, 0x00, /* sc=0c */ '^', '`', 0x1E, 0x1E, '=', '+', '+', '+', 0x00, 0x00, /* sc=0d */ '\\', '|', 0x1C, 0x1C, '\\', '|', 0x1C, 0x1C, 0x00, 0x00, /* sc=0e */ 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x00, 0x00, /* sc=0f */ '\t', '\t', '\t', '\t', '\t', '\t', '\t', '\t', 0x00, 0x00, /* sc=10 */ 'q', 'Q', 0x11, 0x11, 'q', 'Q', 0x11, 0x11, 0x00, 0x01, /* sc=11 */ 'w', 'W', 0x17, 0x17, 'w', 'W', 0x17, 0x17, 0x00, 0x01, /* sc=12 */ 'e', 'E', 0x05, 0x05, 'e', 'E', 0x05, 0x05, 0x00, 0x01, /* sc=13 */ 'r', 'R', 0x12, 0x12, 'r', 'R', 0x12, 0x12, 0x00, 0x01, /* sc=14 */ 't', 'T', 0x14, 0x14, 't', 'T', 0x14, 0x14, 0x00, 0x01, /* sc=15 */ 'y', 'Y', 0x19, 0x19, 'y', 'Y', 0x19, 0x19, 0x00, 0x01, /* sc=16 */ 'u', 'U', 0x15, 0x15, 'u', 'U', 0x15, 0x15, 0x00, 0x01, /* sc=17 */ 'i', 'I', 0x09, 0x09, 'i', 'I', 0x09, 0x09, 0x00, 0x01, /* sc=18 */ 'o', 'O', 0x0F, 0x0F, 'o', 'O', 0x0F, 0x0F, 0x00, 0x01, /* sc=19 */ 'p', 'P', 0x10, 0x10, 'p', 'P', 0x10, 0x10, 0x00, 0x01, /* sc=1a */ '@', '~', 0x00, 0x00, '[', '{', 0x1B, 0x1B, 0x00, 0x00, /* sc=1b */ '[', '{', 0x1B, 0x1B, ']', '}', 0x1D, 0x1D, 0x00, 0x00, /* sc=1c */ '\r', '\r', '\n', '\n', '\r', '\r', '\n', '\n', 0x00, 0x00, /* sc=1d */ 'a', 'A', 0x01, 0x01, 'a', 'A', 0x01, 0x01, 0x00, 0x01, /* sc=1e */ 's', 'S', 0x13, 0x13, 's', 'S', 0x13, 0x13, 0x00, 0x01, /* sc=1f */ 'd', 'D', 0x04, 0x04, 'd', 'D', 0x04, 0x04, 0x00, 0x01, /* sc=20 */ 'f', 'F', 0x06, 0x06, 'f', 'F', 0x06, 0x06, 0x00, 0x01, /* sc=21 */ 'g', 'G', 0x07, 0x07, 'g', 'G', 0x07, 0x07, 0x00, 0x01, /* sc=22 */ 'h', 'H', 0x08, 0x08, 'h', 'H', 0x08, 0x08, 0x00, 0x01, /* sc=23 */ 'j', 'J', '\n', '\n', 'j', 'J', '\n', '\n', 0x00, 0x01, /* sc=24 */ 'k', 'K', 0x0B, 0x0B, 'k', 'K', 0x0B, 0x0B, 0x00, 0x01, /* sc=25 */ 'l', 'L', 0x0C, 0x0C, 'l', 'L', 0x0C, 0x0C, 0x00, 0x01, /* sc=26 */ ';', '+', ';', ';', ';', ':', ';', ';', 0x00, 0x00, /* sc=27 */ ':', '*', ':', ':', '\'', '\"', '\'', '\'', 0x00, 0x00, /* sc=28 */ ']', '}', 0x1D, 0x1D, '`', '~', '~', '~', 0x00, 0x00, /* sc=29 */ 'z', 'Z', 0x1A, 0x1A, 'z', 'Z', 0x1A, 0x1A, 0x00, 0x01, /* sc=2a */ 'x', 'X', 0x18, 0x18, 'x', 'X', 0x18, 0x18, 0x00, 0x01, /* sc=2b */ 'c', 'C', 0x03, 0x03, 'c', 'C', 0x03, 0x03, 0x00, 0x01, /* sc=2c */ 'v', 'V', 0x16, 0x16, 'v', 'V', 0x16, 0x16, 0x00, 0x01, /* sc=2d */ 'b', 'B', 0x02, 0x02, 'b', 'B', 0x02, 0x02, 0x00, 0x01, /* sc=2e */ 'n', 'N', 0x0E, 0x0E, 'n', 'N', 0x0E, 0x0E, 0x00, 0x01, /* sc=2f */ 'm', 'M', '\r', '\r', 'm', 'M', '\r', '\r', 0x00, 0x01, /* sc=30 */ ',', '<', '<', '<', ',', '<', '<', '<', 0x00, 0x00, /* sc=31 */ '.', '>', '>', '>', '.', '>', '>', '>', 0x00, 0x00, /* sc=32 */ '/', '?', 0x7F, 0x7F, '/', '?', 0x7F, 0x7F, 0x00, 0x00, /* sc=33 */ NOP, '_', 0x1F, 0x1F, '\\', '|', 0x1C, 0x1C, 0x80, 0x00, /* sc=34 */ ' ', ' ', 0x00, 0x00, ' ', ' ', 0x00, 0x00, 0x00, 0x00, /* sc=35 */ 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x00, 0x00, /* sc=36 */ F(59), F(59), F(59), F(59), F(59), F(59), F(59), F(59), 0xFF, 0x00, /* sc=37 */ F(51), F(51), F(51), F(51), F(51), F(51), F(51), F(51), 0xFF, 0x00, /* sc=38 */ F(60), F(60), F(60), F(60), F(60), F(60), F(60), F(60), 0xFF, 0x00, /* sc=39 */ 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, RBT, RBT, 0x03, 0x02, /* sc=3a */ F(50), F(50), F(50), F(50), F(50), F(50), F(50), F(50), 0xFF, 0x00, /* sc=3b */ F(53), F(53), F(53), F(53), F(53), F(53), F(53), F(53), 0xFF, 0x00, /* sc=3c */ F(55), F(55), F(55), F(55), F(55), F(55), F(55), F(55), 0xFF, 0x00, /* sc=3d */ F(58), F(58), F(58), F(58), F(58), F(58), F(58), F(58), 0xFF, 0x00, /* sc=3e */ F(49), F(49), F(49), F(49), F(49), F(49), F(49), F(49), 0xFF, 0x00, /* sc=3f */ NOP, NOP, NOP, NOP, NOP, NOP, NOP, NOP, 0xFF, 0x00, /* sc=40 */ '-', '-', '-', '-', '-', '-', '-', '-', 0x00, 0x00, /* sc=41 */ '/', '/', '/', '/', '/', '/', '/', '/', 0x00, 0x00, /* sc=42 */ '7', '7', '7', '7', '7', '7', '7', '7', 0x00, 0x00, /* sc=43 */ '8', '8', '8', '8', '8', '8', '8', '8', 0x00, 0x00, /* sc=44 */ '9', '9', '9', '9', '9', '9', '9', '9', 0x00, 0x00, /* sc=45 */ '*', '*', '*', '*', '*', '*', '*', '*', 0x00, 0x00, /* sc=46 */ '4', '4', '4', '4', '4', '4', '4', '4', 0x00, 0x00, /* sc=47 */ '5', '5', '5', '5', '5', '5', '5', '5', 0x00, 0x00, /* sc=48 */ '6', '6', '6', '6', '6', '6', '6', '6', 0x00, 0x00, /* sc=49 */ '+', '+', '+', '+', '+', '+', '+', '+', 0x00, 0x00, /* sc=4a */ '1', '1', '1', '1', '1', '1', '1', '1', 0x00, 0x00, /* sc=4b */ '2', '2', '2', '2', '2', '2', '2', '2', 0x00, 0x00, /* sc=4c */ '3', '3', '3', '3', '3', '3', '3', '3', 0x00, 0x00, /* sc=4d */ '=', '=', '=', '=', '=', '=', '=', '=', 0x00, 0x00, /* sc=4e */ '0', '0', '0', '0', '0', '0', '0', '0', 0x00, 0x00, /* sc=4f */ ',', ',', ',', ',', ',', ',', ',', ',', 0x00, 0x00, /* sc=50 */ '.', '.', '.', '.', '.', '.', '.', '.', 0x00, 0x00, /* sc=51 */ 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x00, 0x00, /* sc=52 */ F(11), F(23), F(35), F(47), S(11), S(11), S(11), S(11), 0xFF, 0x00, /* sc=53 */ F(12), F(24), F(36), F(48), S(12), S(12), S(12), S(12), 0xFF, 0x00, /* sc=54 */ SLK, SLK, SLK, SLK, SLK, SLK, SLK, SLK, 0xFF, 0x00, /* sc=55 */ NOP, NOP, NOP, NOP, NOP, NOP, NOP, NOP, 0xFF, 0x00, /* sc=56 */ NOP, NOP, NOP, NOP, NOP, NOP, NOP, NOP, 0xFF, 0x00, /* sc=57 */ NOP, NOP, NOP, NOP, NOP, NOP, NOP, NOP, 0xFF, 0x00, /* sc=58 */ NOP, NOP, NOP, NOP, NOP, NOP, NOP, NOP, 0xFF, 0x00, /* sc=59 */ NOP, NOP, NOP, NOP, NOP, NOP, NOP, NOP, 0xFF, 0x00, /* sc=5a */ NOP, NOP, NOP, NOP, NOP, NOP, NOP, NOP, 0xFF, 0x00, /* sc=5b */ NOP, NOP, NOP, NOP, NOP, NOP, NOP, NOP, 0xFF, 0x00, /* sc=5c */ NOP, NOP, NOP, NOP, NOP, NOP, NOP, NOP, 0xFF, 0x00, /* sc=5d */ NOP, NOP, NOP, NOP, NOP, NOP, NOP, NOP, 0xFF, 0x00, /* sc=5e */ NOP, NOP, NOP, NOP, NOP, NOP, NOP, NOP, 0xFF, 0x00, /* sc=5f */ NOP, NOP, NOP, NOP, NOP, NOP, NOP, NOP, 0xFF, 0x00, /* sc=60 */ F(57), F(57), F(57), F(57), F(57), F(57), F(57), F(57), 0xFF, 0x00, /* sc=61 */ NOP, NOP, NOP, NOP, NOP, NOP, NOP, NOP, 0xFF, 0x00, /* sc=62 */ F( 1), F(13), F(25), F(37), S( 1), S( 1), S( 1), S( 1), 0xFF, 0x00, /* sc=63 */ F( 2), F(14), F(26), F(38), S( 2), S( 2), S( 2), S( 2), 0xFF, 0x00, /* sc=64 */ F( 3), F(15), F(27), F(39), S( 3), S( 3), S( 3), S( 3), 0xFF, 0x00, /* sc=65 */ F( 4), F(16), F(28), F(40), S( 4), S( 4), S( 4), S( 4), 0xFF, 0x00, /* sc=66 */ F( 5), F(17), F(29), F(41), S( 5), S( 5), S( 5), S( 5), 0xFF, 0x00, /* sc=67 */ F( 6), F(18), F(30), F(42), S( 6), S( 6), S( 6), S( 6), 0xFF, 0x00, /* sc=68 */ F( 7), F(19), F(31), F(43), S( 7), S( 7), S( 7), S( 7), 0xFF, 0x00, /* sc=69 */ F( 8), F(20), F(32), F(44), S( 8), S( 8), S( 8), S( 8), 0xFF, 0x00, /* sc=6a */ F( 9), F(21), F(33), F(45), S( 9), S( 9), S( 9), S( 9), 0xFF, 0x00, /* sc=6b */ F(10), F(22), F(34), F(46), S(10), S(10), S(10), S(10), 0xFF, 0x00, /* sc=6c */ NOP, NOP, NOP, NOP, NOP, NOP, NOP, NOP, 0xFF, 0x00, /* sc=6d */ NOP, NOP, NOP, NOP, NOP, NOP, NOP, NOP, 0xFF, 0x00, /* sc=6e */ NOP, NOP, NOP, NOP, NOP, NOP, NOP, NOP, 0xFF, 0x00, /* sc=6f */ NOP, NOP, NOP, NOP, NOP, NOP, NOP, NOP, 0xFF, 0x00, /* sc=70 */ LSH, LSH, LSH, LSH, LSH, LSH, LSH, LSH, 0xFF, 0x00, /* sc=71 */ CLK, CLK, CLK, CLK, CLK, CLK, CLK, CLK, 0xFF, 0x00, /* sc=72 */ LALT, LALT, LALT, LALT, LALT, LALT, LALT, LALT, 0xFF, 0x00, /* sc=73 */ LALT, LALT, LALT, LALT, LALT, LALT, LALT, LALT, 0xFF, 0x00, /* sc=74 */ LCTR, LCTR, LCTR, LCTR, LCTR, LCTR, LCTR, LCTR, 0xFF, 0x00, /* sc=75 */ NOP, NOP, NOP, NOP, NOP, NOP, NOP, NOP, 0xFF, 0x00, /* sc=76 */ NOP, NOP, NOP, NOP, NOP, NOP, NOP, NOP, 0xFF, 0x00, /* sc=77 */ NOP, NOP, NOP, NOP, NOP, NOP, NOP, NOP, 0xFF, 0x00, /* sc=78 */ NOP, NOP, NOP, NOP, NOP, NOP, NOP, NOP, 0xFF, 0x00, /* sc=79 */ NOP, NOP, NOP, NOP, NOP, NOP, NOP, NOP, 0xFF, 0x00, /* sc=7a */ NOP, NOP, NOP, NOP, NOP, NOP, NOP, NOP, 0xFF, 0x00, /* sc=7b */ NOP, NOP, NOP, NOP, NOP, NOP, NOP, NOP, 0xFF, 0x00, /* sc=7c */ NOP, NOP, NOP, NOP, NOP, NOP, NOP, NOP, 0xFF, 0x00, /* sc=7d */ NOP, NOP, NOP, NOP, NOP, NOP, NOP, NOP, 0xFF, 0x00, /* sc=7e */ NOP, NOP, NOP, NOP, NOP, NOP, NOP, NOP, 0xFF, 0x00, /* sc=7f */ NOP, NOP, NOP, NOP, NOP, NOP, NOP, NOP, 0xFF, 0x00, } }; -#endif +#endif /* PC98 */ -#ifdef DKKEYMAP +#ifndef PC98 +/* US iso8859 */ #define ISO_ACCENTCHARS -static keymap_t key_map = { 0x6D, { /* DK iso8859 keymap */ -/* alt - * scan cntrl alt alt cntrl - * code base shift cntrl shift alt shift cntrl shift spcl flgs - * --------------------------------------------------------------------------- +/* + * Automatically generated from /usr/share/syscons/keymaps/us.iso.kbd. + * DO NOT EDIT! */ -/* sc=00 */ NOP, NOP, NOP, NOP, NOP, NOP, NOP, NOP, 0xFF, 0x00, -/* sc=01 */ 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, DBG, 0x1B, 0x02, 0x00, -/* sc=02 */ '1', '!', NOP, NOP, '1', '!', NOP, NOP, 0x33, 0x00, -/* sc=03 */ '2', '"', 0x00, 0x00, '@', '@', 0x00, 0x00, 0x00, 0x00, -/* sc=04 */ '3', '#', NOP, NOP, 0x9E, '#', NOP, NOP, 0x33, 0x00, -/* sc=05 */ '4', 0xA4, NOP, NOP, '$', 0xA4, NOP, NOP, 0x33, 0x00, -/* sc=06 */ '5', '%', NOP, NOP, '5', '%', NOP, NOP, 0x33, 0x00, -/* sc=07 */ '6', '&', NOP, NOP, '6', '&', NOP, NOP, 0x33, 0x00, -/* sc=08 */ '7', '/', NOP, NOP, '{', '/', NOP, NOP, 0x33, 0x00, -/* sc=09 */ '8', '(', 0x1B, 0x1B, '[', '(', 0x1B, 0x1B, 0x00, 0x00, -/* sc=0a */ '9', ')', 0x1D, 0x1D, ']', ')', 0x1D, 0x1D, 0x00, 0x00, -/* sc=0b */ '0', '=', NOP, NOP, '}', '=', NOP, NOP, 0x33, 0x00, -/* sc=0c */ '+', '?', NOP, NOP, '+', '?', NOP, NOP, 0x33, 0x00, -/* sc=0d */ '\'', '`', NOP, NOP, '|', '`', NOP, NOP, 0x33, 0x00, -/* sc=0e */ 0x08, 0x08, 0x7F, 0x7F, 0x08, 0x08, 0x7F, 0x7F, 0x00, 0x00, -/* sc=0f */ 0x09, BTAB, NOP, NOP, 0x09, BTAB, NOP, NOP, 0x77, 0x00, -/* sc=10 */ 'q', 'Q', 0x11, 0x11, 'q', 'Q', 0x11, 0x11, 0x00, 0x01, -/* sc=11 */ 'w', 'W', 0x17, 0x17, 'w', 'W', 0x17, 0x17, 0x00, 0x01, -/* sc=12 */ 'e', 'E', 0x05, 0x05, 'e', 'E', 0x05, 0x05, 0x00, 0x01, -/* sc=13 */ 'r', 'R', 0x12, 0x12, 'r', 'R', 0x12, 0x12, 0x00, 0x01, -/* sc=14 */ 't', 'T', 0x14, 0x14, 't', 'T', 0x14, 0x14, 0x00, 0x01, -/* sc=15 */ 'y', 'Y', 0x19, 0x19, 'y', 'Y', 0x19, 0x19, 0x00, 0x01, -/* sc=16 */ 'u', 'U', 0x15, 0x15, 'u', 'U', 0x15, 0x15, 0x00, 0x01, -/* sc=17 */ 'i', 'I', 0x09, 0x09, 'i', 'I', 0x09, 0x09, 0x00, 0x01, -/* sc=18 */ 'o', 'O', 0x0F, 0x0F, 'o', 'O', 0x0F, 0x0F, 0x00, 0x01, -/* sc=19 */ 'p', 'P', 0x10, 0x10, 'p', 'P', 0x10, 0x10, 0x00, 0x01, -/* sc=1a */ 0xE5, 0xC5, NOP, NOP, 0x86, 0x8F, NOP, NOP, 0x33, 0x01, -/* sc=1b */ '"', '^', 0x1E, 0x1E, '~', '^', 0x1E, 0x1E, 0x00, 0x00, -/* sc=1c */ 0x0D, 0x0D, 0x0A, 0x0A, 0x0D, 0x0D, 0x0A, 0x0A, 0x00, 0x00, -/* sc=1d */ LCTR, LCTR, LCTR, LCTR, LCTR, LCTR, LCTR, LCTR, 0xFF, 0x00, -/* sc=1e */ 'a', 'A', 0x01, 0x01, 'a', 'A', 0x01, 0x01, 0x00, 0x01, -/* sc=1f */ 's', 'S', 0x13, 0x13, 's', 'S', 0x13, 0x13, 0x00, 0x01, -/* sc=20 */ 'd', 'D', 0x04, 0x04, 'd', 'D', 0x04, 0x04, 0x00, 0x01, -/* sc=21 */ 'f', 'F', 0x06, 0x06, 'f', 'F', 0x06, 0x06, 0x00, 0x01, -/* sc=22 */ 'g', 'G', 0x07, 0x07, 'g', 'G', 0x07, 0x07, 0x00, 0x01, -/* sc=23 */ 'h', 'H', 0x08, 0x08, 'h', 'H', 0x08, 0x08, 0x00, 0x01, -/* sc=24 */ 'j', 'J', 0x0A, 0x0A, 'j', 'J', 0x0A, 0x0A, 0x00, 0x01, -/* sc=25 */ 'k', 'K', 0x0B, 0x0B, 'k', 'K', 0x0B, 0x0B, 0x00, 0x01, -/* sc=26 */ 'l', 'L', 0x0C, 0x0C, 'l', 'L', 0x0C, 0x0C, 0x00, 0x01, -/* sc=27 */ 0xE6, 0xC6, NOP, NOP, 0x91, 0x92, NOP, NOP, 0x33, 0x01, -/* sc=28 */ 0xF8, 0xD8, NOP, NOP, 0x9B, 0x9D, NOP, NOP, 0x33, 0x01, -/* sc=29 */ 0xBD, 0xA7, NOP, NOP, 0xBD, 0xA7, NOP, NOP, 0x33, 0x00, -/* sc=2a */ LSH, LSH, LSH, LSH, LSH, LSH, LSH, LSH, 0xFF, 0x00, -/* sc=2b */ '\'', '*', NOP, NOP, '\'', '*', NOP, NOP, 0x33, 0x00, -/* sc=2c */ 'z', 'Z', 0x1A, 0x1A, 'z', 'Z', 0x1A, 0x1A, 0x00, 0x01, -/* sc=2d */ 'x', 'X', 0x18, 0x18, 'x', 'X', 0x18, 0x18, 0x00, 0x01, -/* sc=2e */ 'c', 'C', 0x03, 0x03, 'c', 'C', 0x03, 0x03, 0x00, 0x01, -/* sc=2f */ 'v', 'V', 0x16, 0x16, 'v', 'V', 0x16, 0x16, 0x00, 0x01, -/* sc=30 */ 'b', 'B', 0x02, 0x02, 'b', 'B', 0x02, 0x02, 0x00, 0x01, -/* sc=31 */ 'n', 'N', 0x0E, 0x0E, 'n', 'N', 0x0E, 0x0E, 0x00, 0x01, -/* sc=32 */ 'm', 'M', 0x0D, 0x0D, 'm', 'M', 0x0D, 0x0D, 0x00, 0x01, -/* sc=33 */ ',', ';', NOP, NOP, ',', ';', NOP, NOP, 0x33, 0x00, -/* sc=34 */ '.', ':', NOP, NOP, '.', ':', NOP, NOP, 0x33, 0x00, -/* sc=35 */ '-', '_', 0x1F, 0x1F, '-', '_', 0x1F, 0x1F, 0x00, 0x00, -/* sc=36 */ RSH, RSH, RSH, RSH, RSH, RSH, RSH, RSH, 0xFF, 0x00, -/* sc=37 */ '*', '*', '*', '*', '*', '*', '*', '*', 0x00, 0x00, -/* sc=38 */ LALT, LALT, LALT, LALT, LALT, LALT, LALT, LALT, 0xFF, 0x00, -/* sc=39 */ ' ', ' ', 0x00, ' ', ' ', ' ', SUSP, ' ', 0x02, 0x00, -/* sc=3a */ CLK, CLK, CLK, CLK, CLK, CLK, CLK, CLK, 0xFF, 0x00, -/* sc=3b */ F( 1), F(13), F(25), F(37), S( 1), S(11), S( 1), S(11), 0xFF, 0x00, -/* sc=3c */ F( 2), F(14), F(26), F(38), S( 2), S(12), S( 2), S(12), 0xFF, 0x00, -/* sc=3d */ F( 3), F(15), F(27), F(39), S( 3), S(13), S( 3), S(13), 0xFF, 0x00, -/* sc=3e */ F( 4), F(16), F(28), F(40), S( 4), S(14), S( 4), S(14), 0xFF, 0x00, -/* sc=3f */ F( 5), F(17), F(29), F(41), S( 5), S(15), S( 5), S(15), 0xFF, 0x00, -/* sc=40 */ F( 6), F(18), F(30), F(42), S( 6), S(16), S( 6), S(16), 0xFF, 0x00, -/* sc=41 */ F( 7), F(19), F(31), F(43), S( 7), S( 7), S( 7), S( 7), 0xFF, 0x00, -/* sc=42 */ F( 8), F(20), F(32), F(44), S( 8), S( 8), S( 8), S( 8), 0xFF, 0x00, -/* sc=43 */ F( 9), F(21), F(33), F(45), S( 9), S( 9), S( 9), S( 9), 0xFF, 0x00, -/* sc=44 */ F(10), F(22), F(34), F(46), S(10), S(10), S(10), S(10), 0xFF, 0x00, -/* sc=45 */ NLK, NLK, NLK, NLK, NLK, NLK, NLK, NLK, 0xFF, 0x00, -/* sc=46 */ SLK, SLK, SLK, SLK, SLK, SLK, SLK, SLK, 0xFF, 0x00, -/* sc=47 */ F(49), '7', '7', '7', '7', '7', '7', '7', 0x80, 0x02, -/* sc=48 */ F(50), '8', '8', '8', '8', '8', '8', '8', 0x80, 0x02, -/* sc=49 */ F(51), '9', '9', '9', '9', '9', '9', '9', 0x80, 0x02, -/* sc=4a */ F(52), '-', '-', '-', '-', '-', '-', '-', 0x80, 0x02, -/* sc=4b */ F(53), '4', '4', '4', '4', '4', '4', '4', 0x80, 0x02, -/* sc=4c */ F(54), '5', '5', '5', '5', '5', '5', '5', 0x80, 0x02, -/* sc=4d */ F(55), '6', '6', '6', '6', '6', '6', '6', 0x80, 0x02, -/* sc=4e */ F(56), '+', '+', '+', '+', '+', '+', '+', 0x80, 0x02, -/* sc=4f */ F(57), '1', '1', '1', '1', '1', '1', '1', 0x80, 0x02, -/* sc=50 */ F(58), '2', '2', '2', '2', '2', '2', '2', 0x80, 0x02, -/* sc=51 */ F(59), '3', '3', '3', '3', '3', '3', '3', 0x80, 0x02, -/* sc=52 */ F(60), '0', '0', '0', '0', '0', '0', '0', 0x80, 0x02, -/* sc=53 */ 0x7F, '.', '.', '.', '.', '.', RBT, RBT, 0x03, 0x02, -/* sc=54 */ NOP, NOP, NOP, NOP, NOP, NOP, NOP, NOP, 0xFF, 0x00, -/* sc=55 */ NOP, NOP, NOP, NOP, NOP, NOP, NOP, NOP, 0xFF, 0x00, -/* sc=56 */ '<', '>', 0x1C, 0x1C, '\\', '>', 0x1C, 0x1C, 0x00, 0x00, -/* sc=57 */ F(11), F(23), F(35), F(47), S(11), S(11), S(11), S(11), 0xFF, 0x00, -/* sc=58 */ F(12), F(24), F(36), F(48), S(12), S(12), S(12), S(12), 0xFF, 0x00, -/* sc=59 */ 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x00, 0x02, -/* sc=5a */ RCTR, RCTR, RCTR, RCTR, RCTR, RCTR, RCTR, RCTR, 0xFF, 0x00, -/* sc=5b */ '/', '/', '/', '/', '/', '/', '/', '/', 0x00, 0x00, -/* sc=5c */ NEXT, NEXT, DBG, DBG, NOP, NOP, NOP, NOP, 0xFF, 0x00, -/* sc=5d */ RALT, RALT, RALT, RALT, RALT, RALT, RALT, RALT, 0xFF, 0x00, -/* sc=5e */ F(49), F(49), F(49), F(49), F(49), F(49), F(49), F(49), 0xFF, 0x00, -/* sc=5f */ F(50), F(50), F(50), F(50), F(50), F(50), F(50), F(50), 0xFF, 0x00, -/* sc=60 */ F(51), F(51), F(51), F(51), F(51), F(51), F(51), F(51), 0xFF, 0x00, -/* sc=61 */ F(53), F(53), F(53), F(53), F(53), F(53), F(53), F(53), 0xFF, 0x00, -/* sc=62 */ F(55), F(55), F(55), F(55), F(55), F(55), F(55), F(55), 0xFF, 0x00, -/* sc=63 */ F(57), F(57), F(57), F(57), F(57), F(57), F(57), F(57), 0xFF, 0x00, -/* sc=64 */ F(58), F(58), F(58), F(58), F(58), F(58), F(58), F(58), 0xFF, 0x00, -/* sc=65 */ F(59), F(59), F(59), F(59), F(59), F(59), F(59), F(59), 0xFF, 0x00, -/* sc=66 */ F(60), F(60), F(60), F(60), F(60), F(60), F(60), F(60), 0xFF, 0x00, -/* sc=67 */ F(61), F(61), F(61), F(61), F(61), F(61), RBT, F(61), 0xFF, 0x00, -/* sc=68 */ SLK, SPSC, SLK, SPSC, SUSP, NOP, SUSP, NOP, 0xFF, 0x00, -/* sc=69 */ F(62), F(62), F(62), F(62), F(62), F(62), F(62), F(62), 0xFF, 0x00, -/* sc=6a */ F(63), F(63), F(63), F(63), F(63), F(63), F(63), F(63), 0xFF, 0x00, -/* sc=6b */ F(64), F(64), F(64), F(64), F(64), F(64), F(64), F(64), 0xFF, 0x00, -/* sc=6c */ NOP, NOP, NOP, NOP, NOP, NOP, NOP, NOP, 0xFF, 0x00, -} }; -#endif - -#ifdef UKKEYMAP -#define ISO_ACCENTCHARS -static keymap_t key_map = { 0x6D, { /* uk iso8859 keymap */ -/* alt - * scan cntrl alt alt cntrl - * code base shift cntrl shift alt shift cntrl shift spcl flgs +static keymap_t key_map = { 0x6d, { +/* alt + * scan cntrl alt alt cntrl + * code base shift cntrl shift alt shift cntrl shift spcl flgs * --------------------------------------------------------------------------- */ -/* sc=00 */ NOP, NOP, NOP, NOP, NOP, NOP, NOP, NOP, 0xFF, 0x00, -/* sc=01 */ 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, DBG, 0x1B, 0x02, 0x00, -/* sc=02 */ '1', '!', NOP, NOP, '`', '`', NOP, NOP, 0x33, 0x00, -/* sc=03 */ '2', '"', 0x00, 0x00, '@', '@', 0x00, 0x00, 0x00, 0x00, -/* sc=04 */ '3', 0xA3, NOP, NOP, '#', '#', NOP, NOP, 0x33, 0x00, -/* sc=05 */ '4', '$', NOP, NOP, '4', '$', NOP, NOP, 0x33, 0x00, -/* sc=06 */ '5', '%', NOP, NOP, '5', '%', NOP, NOP, 0x33, 0x00, -/* sc=07 */ '6', '^', 0x1E, 0x1E, '^', '^', 0x1E, 0x1E, 0x00, 0x00, -/* sc=08 */ '7', '&', NOP, NOP, '[', '[', 0x1B, 0x1B, 0x30, 0x00, -/* sc=09 */ '8', '*', NOP, NOP, '8', '*', NOP, NOP, 0x33, 0x00, -/* sc=0a */ '9', '(', NOP, NOP, ']', ']', 0x1D, 0x1D, 0x30, 0x00, -/* sc=0b */ '0', ')', NOP, NOP, '{', '{', NOP, NOP, 0x33, 0x00, -/* sc=0c */ '-', '_', 0x1F, 0x1F, '|', '|', 0x1F, 0x1F, 0x00, 0x00, -/* sc=0d */ '=', '+', NOP, NOP, '}', '}', NOP, NOP, 0x33, 0x00, -/* sc=0e */ 0x08, 0x08, 0x7F, 0x7F, 0x08, 0x08, 0x7F, 0x7F, 0x00, 0x00, -/* sc=0f */ 0x09, BTAB, NOP, NOP, 0x09, BTAB, NOP, NOP, 0x77, 0x00, -/* sc=10 */ 'q', 'Q', 0x11, 0x11, 'q', 'Q', 0x11, 0x11, 0x00, 0x01, -/* sc=11 */ 'w', 'W', 0x17, 0x17, 'w', 'W', 0x17, 0x17, 0x00, 0x01, -/* sc=12 */ 'e', 'E', 0x05, 0x05, 'e', 'E', 0x05, 0x05, 0x00, 0x01, -/* sc=13 */ 'r', 'R', 0x12, 0x12, 'r', 'R', 0x12, 0x12, 0x00, 0x01, -/* sc=14 */ 't', 'T', 0x14, 0x14, 't', 'T', 0x14, 0x14, 0x00, 0x01, -/* sc=15 */ 'y', 'Y', 0x19, 0x19, 'y', 'Y', 0x19, 0x19, 0x00, 0x01, -/* sc=16 */ 'u', 'U', 0x15, 0x15, 'u', 'U', 0x15, 0x15, 0x00, 0x01, -/* sc=17 */ 'i', 'I', 0x09, 0x09, 'i', 'I', 0x09, 0x09, 0x00, 0x01, -/* sc=18 */ 'o', 'O', 0x0F, 0x0F, 'o', 'O', 0x0F, 0x0F, 0x00, 0x01, -/* sc=19 */ 'p', 'P', 0x10, 0x10, 'p', 'P', 0x10, 0x10, 0x00, 0x01, -/* sc=1a */ '[', '{', 0x1B, 0x1B, '[', '{', 0x1B, 0x1B, 0x00, 0x00, -/* sc=1b */ ']', '}', 0x1D, 0x1D, ']', '}', 0x1D, 0x1D, 0x00, 0x00, -/* sc=1c */ 0x0D, 0x0D, 0x0A, 0x0A, 0x0D, 0x0D, 0x0A, 0x0A, 0x00, 0x00, -/* sc=1d */ LCTR, LCTR, LCTR, LCTR, LCTR, LCTR, LCTR, LCTR, 0xFF, 0x00, -/* sc=1e */ 'a', 'A', 0x01, 0x01, 'a', 'A', 0x01, 0x01, 0x00, 0x01, -/* sc=1f */ 's', 'S', 0x13, 0x13, 's', 'S', 0x13, 0x13, 0x00, 0x01, -/* sc=20 */ 'd', 'D', 0x04, 0x04, 'd', 'D', 0x04, 0x04, 0x00, 0x01, -/* sc=21 */ 'f', 'F', 0x06, 0x06, 'f', 'F', 0x06, 0x06, 0x00, 0x01, -/* sc=22 */ 'g', 'G', 0x07, 0x07, 'g', 'G', 0x07, 0x07, 0x00, 0x01, -/* sc=23 */ 'h', 'H', 0x08, 0x08, 'h', 'H', 0x08, 0x08, 0x00, 0x01, -/* sc=24 */ 'j', 'J', 0x0A, 0x0A, 'j', 'J', 0x0A, 0x0A, 0x00, 0x01, -/* sc=25 */ 'k', 'K', 0x0B, 0x0B, 'k', 'K', 0x0B, 0x0B, 0x00, 0x01, -/* sc=26 */ 'l', 'L', 0x0C, 0x0C, 'l', 'L', 0x0C, 0x0C, 0x00, 0x01, -/* sc=27 */ ';', ':', NOP, NOP, ';', ':', NOP, NOP, 0x33, 0x00, -/* sc=28 */ '\'', '@', 0x00, 0x00, '\'', '@', 0x00, 0x00, 0x00, 0x00, -/* sc=29 */ '\\', '|', 0x1C, 0x1C, '\\', '\\', 0x1C, 0x1C, 0x00, 0x00, -/* sc=2a */ LSH, LSH, LSH, LSH, LSH, LSH, LSH, LSH, 0xFF, 0x00, -/* sc=2b */ '#', '~', NOP, NOP, '~', '~', NOP, NOP, 0x33, 0x00, -/* sc=2c */ 'z', 'Z', 0x1A, 0x1A, 'z', 'Z', 0x1A, 0x1A, 0x00, 0x01, -/* sc=2d */ 'x', 'X', 0x18, 0x18, 'x', 'X', 0x18, 0x18, 0x00, 0x01, -/* sc=2e */ 'c', 'C', 0x03, 0x03, 'c', 'C', 0x03, 0x03, 0x00, 0x01, -/* sc=2f */ 'v', 'V', 0x16, 0x16, 'v', 'V', 0x16, 0x16, 0x00, 0x01, -/* sc=30 */ 'b', 'B', 0x02, 0x02, 'b', 'B', 0x02, 0x02, 0x00, 0x01, -/* sc=31 */ 'n', 'N', 0x0E, 0x0E, 'n', 'N', 0x0E, 0x0E, 0x00, 0x01, -/* sc=32 */ 'm', 'M', 0x0D, 0x0D, 'm', 'M', 0x0D, 0x0D, 0x00, 0x01, -/* sc=33 */ ',', '<', NOP, NOP, ',', '<', NOP, NOP, 0x33, 0x00, -/* sc=34 */ '.', '>', NOP, NOP, '.', '>', NOP, NOP, 0x33, 0x00, -/* sc=35 */ '/', '?', NOP, NOP, '/', '?', NOP, NOP, 0x33, 0x00, -/* sc=36 */ RSH, RSH, RSH, RSH, RSH, RSH, RSH, RSH, 0xFF, 0x00, -/* sc=37 */ '*', '*', '*', '*', '*', '*', '*', '*', 0x00, 0x00, -/* sc=38 */ LALT, LALT, LALT, LALT, LALT, LALT, LALT, LALT, 0xFF, 0x00, -/* sc=39 */ ' ', ' ', 0x00, ' ', ' ', ' ', SUSP, ' ', 0x02, 0x00, -/* sc=3a */ CLK, CLK, CLK, CLK, CLK, CLK, CLK, CLK, 0xFF, 0x00, -/* sc=3b */ F( 1), F(13), F(25), F(37), S( 1), S(11), S( 1), S(11), 0xFF, 0x00, -/* sc=3c */ F( 2), F(14), F(26), F(38), S( 2), S(12), S( 2), S(12), 0xFF, 0x00, -/* sc=3d */ F( 3), F(15), F(27), F(39), S( 3), S(13), S( 3), S(13), 0xFF, 0x00, -/* sc=3e */ F( 4), F(16), F(28), F(40), S( 4), S(14), S( 4), S(14), 0xFF, 0x00, -/* sc=3f */ F( 5), F(17), F(29), F(41), S( 5), S(15), S( 5), S(15), 0xFF, 0x00, -/* sc=40 */ F( 6), F(18), F(30), F(42), S( 6), S(16), S( 6), S(16), 0xFF, 0x00, -/* sc=41 */ F( 7), F(19), F(31), F(43), S( 7), S( 7), S( 7), S( 7), 0xFF, 0x00, -/* sc=42 */ F( 8), F(20), F(32), F(44), S( 8), S( 8), S( 8), S( 8), 0xFF, 0x00, -/* sc=43 */ F( 9), F(21), F(33), F(45), S( 9), S( 9), S( 9), S( 9), 0xFF, 0x00, -/* sc=44 */ F(10), F(22), F(34), F(46), S(10), S(10), S(10), S(10), 0xFF, 0x00, -/* sc=45 */ NLK, NLK, NLK, NLK, NLK, NLK, NLK, NLK, 0xFF, 0x00, -/* sc=46 */ SLK, SLK, SLK, SLK, SLK, SLK, SLK, SLK, 0xFF, 0x00, -/* sc=47 */ F(49), '7', '7', '7', '7', '7', '7', '7', 0x80, 0x02, -/* sc=48 */ F(50), '8', '8', '8', '8', '8', '8', '8', 0x80, 0x02, -/* sc=49 */ F(51), '9', '9', '9', '9', '9', '9', '9', 0x80, 0x02, -/* sc=4a */ F(52), '-', '-', '-', '-', '-', '-', '-', 0x80, 0x02, -/* sc=4b */ F(53), '4', '4', '4', '4', '4', '4', '4', 0x80, 0x02, -/* sc=4c */ F(54), '5', '5', '5', '5', '5', '5', '5', 0x80, 0x02, -/* sc=4d */ F(55), '6', '6', '6', '6', '6', '6', '6', 0x80, 0x02, -/* sc=4e */ F(56), '+', '+', '+', '+', '+', '+', '+', 0x80, 0x02, -/* sc=4f */ F(57), '1', '1', '1', '1', '1', '1', '1', 0x80, 0x02, -/* sc=50 */ F(58), '2', '2', '2', '2', '2', '2', '2', 0x80, 0x02, -/* sc=51 */ F(59), '3', '3', '3', '3', '3', '3', '3', 0x80, 0x02, -/* sc=52 */ F(60), '0', '0', '0', '0', '0', '0', '0', 0x80, 0x02, -/* sc=53 */ 0x7F, '.', '.', '.', '.', '.', RBT, RBT, 0x03, 0x02, -/* sc=54 */ NOP, NOP, NOP, NOP, NOP, NOP, NOP, NOP, 0xFF, 0x00, -/* sc=55 */ NOP, NOP, NOP, NOP, NOP, NOP, NOP, NOP, 0xFF, 0x00, -/* sc=56 */ '\\', '|', 0x1C, 0x1C, '\\', '|', 0x1C, 0x1C, 0x00, 0x00, -/* sc=57 */ F(11), F(23), F(35), F(47), S(11), S(11), S(11), S(11), 0xFF, 0x00, -/* sc=58 */ F(12), F(24), F(36), F(48), S(12), S(12), S(12), S(12), 0xFF, 0x00, -/* sc=59 */ 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0xFF, 0x02, -/* sc=5a */ RCTR, RCTR, RCTR, RCTR, RCTR, RCTR, RCTR, RCTR, 0xFF, 0x00, -/* sc=5b */ '/', '/', '/', '/', '/', '/', '/', '/', 0x00, 0x02, -/* sc=5c */ NEXT, NEXT, DBG, DBG, NOP, NOP, NOP, NOP, 0xFF, 0x00, -/* sc=5d */ RALT, RALT, RALT, RALT, RALT, RALT, RALT, RALT, 0xFF, 0x00, -/* sc=5e */ F(49), F(49), F(49), F(49), F(49), F(49), F(49), F(49), 0xFF, 0x00, -/* sc=5f */ F(50), F(50), F(50), F(50), F(50), F(50), F(50), F(50), 0xFF, 0x00, -/* sc=60 */ F(51), F(51), F(51), F(51), F(51), F(51), F(51), F(51), 0xFF, 0x00, -/* sc=61 */ F(53), F(53), F(53), F(53), F(53), F(53), F(53), F(53), 0xFF, 0x00, -/* sc=62 */ F(55), F(55), F(55), F(55), F(55), F(55), F(55), F(55), 0xFF, 0x00, -/* sc=63 */ F(57), F(57), F(57), F(57), F(57), F(57), F(57), F(57), 0xFF, 0x00, -/* sc=64 */ F(58), F(58), F(58), F(58), F(58), F(58), F(58), F(58), 0xFF, 0x00, -/* sc=65 */ F(59), F(59), F(59), F(59), F(59), F(59), F(59), F(59), 0xFF, 0x00, -/* sc=66 */ F(60), F(60), F(60), F(60), F(60), F(60), F(60), F(60), 0xFF, 0x00, -/* sc=67 */ F(61), F(61), F(61), F(61), F(61), F(61), RBT, F(61), 0xFF, 0x00, -/* sc=68 */ SLK, SPSC, SLK, SPSC, SUSP, NOP, SUSP, NOP, 0xFF, 0x00, -/* sc=69 */ F(62), F(62), F(62), F(62), F(62), F(62), F(62), F(62), 0xFF, 0x00, -/* sc=6a */ F(63), F(63), F(63), F(63), F(63), F(63), F(63), F(63), 0xFF, 0x00, -/* sc=6b */ F(64), F(64), F(64), F(64), F(64), F(64), F(64), F(64), 0xFF, 0x00, -/* sc=6c */ NOP, NOP, NOP, NOP, NOP, NOP, NOP, NOP, 0xFF, 0x00, +/*00*/{{ NOP, NOP, NOP, NOP, NOP, NOP, NOP, NOP, }, 0xFF,0x00 }, +/*01*/{{ 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, DBG, 0x1B, }, 0x02,0x00 }, +/*02*/{{ '1', '!', NOP, NOP, '1', '!', NOP, NOP, }, 0x33,0x00 }, +/*03*/{{ '2', '@', 0x00, 0x00, '2', '@', 0x00, 0x00, }, 0x00,0x00 }, +/*04*/{{ '3', '#', NOP, NOP, '3', '#', NOP, NOP, }, 0x33,0x00 }, +/*05*/{{ '4', '$', NOP, NOP, '4', '$', NOP, NOP, }, 0x33,0x00 }, +/*06*/{{ '5', '%', NOP, NOP, '5', '%', NOP, NOP, }, 0x33,0x00 }, +/*07*/{{ '6', '^', 0x1E, 0x1E, '6', '^', 0x1E, 0x1E, }, 0x00,0x00 }, +/*08*/{{ '7', '&', NOP, NOP, '7', '&', NOP, NOP, }, 0x33,0x00 }, +/*09*/{{ '8', '*', NOP, NOP, '8', '*', NOP, NOP, }, 0x33,0x00 }, +/*0a*/{{ '9', '(', NOP, NOP, '9', '(', NOP, NOP, }, 0x33,0x00 }, +/*0b*/{{ '0', ')', NOP, NOP, '0', ')', NOP, NOP, }, 0x33,0x00 }, +/*0c*/{{ '-', '_', 0x1F, 0x1F, '-', '_', 0x1F, 0x1F, }, 0x00,0x00 }, +/*0d*/{{ '=', '+', NOP, NOP, '=', '+', NOP, NOP, }, 0x33,0x00 }, +/*0e*/{{ 0x08, 0x08, 0x7F, 0x7F, 0x08, 0x08, 0x7F, 0x7F, }, 0x00,0x00 }, +/*0f*/{{ 0x09, BTAB, NOP, NOP, 0x09, BTAB, NOP, NOP, }, 0x77,0x00 }, +/*10*/{{ 'q', 'Q', 0x11, 0x11, 'q', 'Q', 0x11, 0x11, }, 0x00,0x01 }, +/*11*/{{ 'w', 'W', 0x17, 0x17, 'w', 'W', 0x17, 0x17, }, 0x00,0x01 }, +/*12*/{{ 'e', 'E', 0x05, 0x05, 'e', 'E', 0x05, 0x05, }, 0x00,0x01 }, +/*13*/{{ 'r', 'R', 0x12, 0x12, 'r', 'R', 0x12, 0x12, }, 0x00,0x01 }, +/*14*/{{ 't', 'T', 0x14, 0x14, 't', 'T', 0x14, 0x14, }, 0x00,0x01 }, +/*15*/{{ 'y', 'Y', 0x19, 0x19, 'y', 'Y', 0x19, 0x19, }, 0x00,0x01 }, +/*16*/{{ 'u', 'U', 0x15, 0x15, 'u', 'U', 0x15, 0x15, }, 0x00,0x01 }, +/*17*/{{ 'i', 'I', 0x09, 0x09, 'i', 'I', 0x09, 0x09, }, 0x00,0x01 }, +/*18*/{{ 'o', 'O', 0x0F, 0x0F, 'o', 'O', 0x0F, 0x0F, }, 0x00,0x01 }, +/*19*/{{ 'p', 'P', 0x10, 0x10, 'p', 'P', 0x10, 0x10, }, 0x00,0x01 }, +/*1a*/{{ '[', '{', 0x1B, 0x1B, '[', '{', 0x1B, 0x1B, }, 0x00,0x00 }, +/*1b*/{{ ']', '}', 0x1D, 0x1D, ']', '}', 0x1D, 0x1D, }, 0x00,0x00 }, +/*1c*/{{ 0x0D, 0x0D, 0x0A, 0x0A, 0x0D, 0x0D, 0x0A, 0x0A, }, 0x00,0x00 }, +/*1d*/{{ LCTR, LCTR, LCTR, LCTR, LCTR, LCTR, LCTR, LCTR, }, 0xFF,0x00 }, +/*1e*/{{ 'a', 'A', 0x01, 0x01, 'a', 'A', 0x01, 0x01, }, 0x00,0x01 }, +/*1f*/{{ 's', 'S', 0x13, 0x13, 's', 'S', 0x13, 0x13, }, 0x00,0x01 }, +/*20*/{{ 'd', 'D', 0x04, 0x04, 'd', 'D', 0x04, 0x04, }, 0x00,0x01 }, +/*21*/{{ 'f', 'F', 0x06, 0x06, 'f', 'F', 0x06, 0x06, }, 0x00,0x01 }, +/*22*/{{ 'g', 'G', 0x07, 0x07, 'g', 'G', 0x07, 0x07, }, 0x00,0x01 }, +/*23*/{{ 'h', 'H', 0x08, 0x08, 'h', 'H', 0x08, 0x08, }, 0x00,0x01 }, +/*24*/{{ 'j', 'J', 0x0A, 0x0A, 'j', 'J', 0x0A, 0x0A, }, 0x00,0x01 }, +/*25*/{{ 'k', 'K', 0x0B, 0x0B, 'k', 'K', 0x0B, 0x0B, }, 0x00,0x01 }, +/*26*/{{ 'l', 'L', 0x0C, 0x0C, 'l', 'L', 0x0C, 0x0C, }, 0x00,0x01 }, +/*27*/{{ ';', ':', NOP, NOP, ';', ':', NOP, NOP, }, 0x33,0x00 }, +/*28*/{{ '\'', '"', NOP, NOP, '\'', '"', NOP, NOP, }, 0x33,0x00 }, +/*29*/{{ '`', '~', NOP, NOP, '`', '~', NOP, NOP, }, 0x33,0x00 }, +/*2a*/{{ LSH, LSH, LSH, LSH, LSH, LSH, LSH, LSH, }, 0xFF,0x00 }, +/*2b*/{{ '\\', '|', 0x1C, 0x1C, '\\', '|', 0x1C, 0x1C, }, 0x00,0x00 }, +/*2c*/{{ 'z', 'Z', 0x1A, 0x1A, 'z', 'Z', 0x1A, 0x1A, }, 0x00,0x01 }, +/*2d*/{{ 'x', 'X', 0x18, 0x18, 'x', 'X', 0x18, 0x18, }, 0x00,0x01 }, +/*2e*/{{ 'c', 'C', 0x03, 0x03, 'c', 'C', 0x03, 0x03, }, 0x00,0x01 }, +/*2f*/{{ 'v', 'V', 0x16, 0x16, 'v', 'V', 0x16, 0x16, }, 0x00,0x01 }, +/*30*/{{ 'b', 'B', 0x02, 0x02, 'b', 'B', 0x02, 0x02, }, 0x00,0x01 }, +/*31*/{{ 'n', 'N', 0x0E, 0x0E, 'n', 'N', 0x0E, 0x0E, }, 0x00,0x01 }, +/*32*/{{ 'm', 'M', 0x0D, 0x0D, 'm', 'M', 0x0D, 0x0D, }, 0x00,0x01 }, +/*33*/{{ ',', '<', NOP, NOP, ',', '<', NOP, NOP, }, 0x33,0x00 }, +/*34*/{{ '.', '>', NOP, NOP, '.', '>', NOP, NOP, }, 0x33,0x00 }, +/*35*/{{ '/', '?', NOP, NOP, '/', '?', NOP, NOP, }, 0x33,0x00 }, +/*36*/{{ RSH, RSH, RSH, RSH, RSH, RSH, RSH, RSH, }, 0xFF,0x00 }, +/*37*/{{ '*', '*', '*', '*', '*', '*', '*', '*', }, 0x00,0x00 }, +/*38*/{{ LALT, LALT, LALT, LALT, LALT, LALT, LALT, LALT, }, 0xFF,0x00 }, +/*39*/{{ ' ', ' ', 0x00, ' ', ' ', ' ', SUSP, ' ', }, 0x02,0x00 }, +/*3a*/{{ CLK, CLK, CLK, CLK, CLK, CLK, CLK, CLK, }, 0xFF,0x00 }, +/*3b*/{{ F( 1), F(13), F(25), F(37), S( 1), S(11), S( 1), S(11),}, 0xFF,0x00 }, +/*3c*/{{ F( 2), F(14), F(26), F(38), S( 2), S(12), S( 2), S(12),}, 0xFF,0x00 }, +/*3d*/{{ F( 3), F(15), F(27), F(39), S( 3), S(13), S( 3), S(13),}, 0xFF,0x00 }, +/*3e*/{{ F( 4), F(16), F(28), F(40), S( 4), S(14), S( 4), S(14),}, 0xFF,0x00 }, +/*3f*/{{ F( 5), F(17), F(29), F(41), S( 5), S(15), S( 5), S(15),}, 0xFF,0x00 }, +/*40*/{{ F( 6), F(18), F(30), F(42), S( 6), S(16), S( 6), S(16),}, 0xFF,0x00 }, +/*41*/{{ F( 7), F(19), F(31), F(43), S( 7), S( 7), S( 7), S( 7),}, 0xFF,0x00 }, +/*42*/{{ F( 8), F(20), F(32), F(44), S( 8), S( 8), S( 8), S( 8),}, 0xFF,0x00 }, +/*43*/{{ F( 9), F(21), F(33), F(45), S( 9), S( 9), S( 9), S( 9),}, 0xFF,0x00 }, +/*44*/{{ F(10), F(22), F(34), F(46), S(10), S(10), S(10), S(10),}, 0xFF,0x00 }, +/*45*/{{ NLK, NLK, NLK, NLK, NLK, NLK, NLK, NLK, }, 0xFF,0x00 }, +/*46*/{{ SLK, SLK, SLK, SLK, SLK, SLK, SLK, SLK, }, 0xFF,0x00 }, +/*47*/{{ F(49), '7', '7', '7', '7', '7', '7', '7', }, 0x80,0x02 }, +/*48*/{{ F(50), '8', '8', '8', '8', '8', '8', '8', }, 0x80,0x02 }, +/*49*/{{ F(51), '9', '9', '9', '9', '9', '9', '9', }, 0x80,0x02 }, +/*4a*/{{ F(52), '-', '-', '-', '-', '-', '-', '-', }, 0x80,0x02 }, +/*4b*/{{ F(53), '4', '4', '4', '4', '4', '4', '4', }, 0x80,0x02 }, +/*4c*/{{ F(54), '5', '5', '5', '5', '5', '5', '5', }, 0x80,0x02 }, +/*4d*/{{ F(55), '6', '6', '6', '6', '6', '6', '6', }, 0x80,0x02 }, +/*4e*/{{ F(56), '+', '+', '+', '+', '+', '+', '+', }, 0x80,0x02 }, +/*4f*/{{ F(57), '1', '1', '1', '1', '1', '1', '1', }, 0x80,0x02 }, +/*50*/{{ F(58), '2', '2', '2', '2', '2', '2', '2', }, 0x80,0x02 }, +/*51*/{{ F(59), '3', '3', '3', '3', '3', '3', '3', }, 0x80,0x02 }, +/*52*/{{ F(60), '0', '0', '0', '0', '0', '0', '0', }, 0x80,0x02 }, +/*53*/{{ 0x7F, '.', '.', '.', '.', '.', RBT, RBT, }, 0x03,0x02 }, +/*54*/{{ NOP, NOP, NOP, NOP, NOP, NOP, NOP, NOP, }, 0xFF,0x00 }, +/*55*/{{ NOP, NOP, NOP, NOP, NOP, NOP, NOP, NOP, }, 0xFF,0x00 }, +/*56*/{{ NOP, NOP, NOP, NOP, NOP, NOP, NOP, NOP, }, 0xFF,0x00 }, +/*57*/{{ F(11), F(23), F(35), F(47), S(11), S(11), S(11), S(11),}, 0xFF,0x00 }, +/*58*/{{ F(12), F(24), F(36), F(48), S(12), S(12), S(12), S(12),}, 0xFF,0x00 }, +/*59*/{{ 0x0D, 0x0D, 0x0A, 0x0A, 0x0D, 0x0D, 0x0A, 0x0A, }, 0x00,0x00 }, +/*5a*/{{ RCTR, RCTR, RCTR, RCTR, RCTR, RCTR, RCTR, RCTR, }, 0xFF,0x00 }, +/*5b*/{{ '/', '/', '/', '/', '/', '/', '/', '/', }, 0x00,0x02 }, +/*5c*/{{ NEXT, NEXT, DBG, DBG, NOP, NOP, NOP, NOP, }, 0xFF,0x00 }, +/*5d*/{{ RALT, RALT, RALT, RALT, RALT, RALT, RALT, RALT, }, 0xFF,0x00 }, +/*5e*/{{ F(49), F(49), F(49), F(49), F(49), F(49), F(49), F(49),}, 0xFF,0x00 }, +/*5f*/{{ F(50), F(50), F(50), F(50), F(50), F(50), F(50), F(50),}, 0xFF,0x00 }, +/*60*/{{ F(51), F(51), F(51), F(51), F(51), F(51), F(51), F(51),}, 0xFF,0x00 }, +/*61*/{{ F(53), F(53), F(53), F(53), F(53), F(53), F(53), F(53),}, 0xFF,0x00 }, +/*62*/{{ F(55), F(55), F(55), F(55), F(55), F(55), F(55), F(55),}, 0xFF,0x00 }, +/*63*/{{ F(57), F(57), F(57), F(57), F(57), F(57), F(57), F(57),}, 0xFF,0x00 }, +/*64*/{{ F(58), F(58), F(58), F(58), F(58), F(58), F(58), F(58),}, 0xFF,0x00 }, +/*65*/{{ F(59), F(59), F(59), F(59), F(59), F(59), F(59), F(59),}, 0xFF,0x00 }, +/*66*/{{ F(60), F(60), F(60), F(60), F(60), F(60), F(60), F(60),}, 0xFF,0x00 }, +/*67*/{{ F(61), F(61), F(61), F(61), F(61), F(61), RBT, F(61),}, 0xFF,0x00 }, +/*68*/{{ SLK, SPSC, SLK, SPSC, SUSP, NOP, SUSP, NOP, }, 0xFF,0x00 }, +/*69*/{{ F(62), F(62), F(62), F(62), F(62), F(62), F(62), F(62),}, 0xFF,0x00 }, +/*6a*/{{ F(63), F(63), F(63), F(63), F(63), F(63), F(63), F(63),}, 0xFF,0x00 }, +/*6b*/{{ F(64), F(64), F(64), F(64), F(64), F(64), F(64), F(64),}, 0xFF,0x00 }, +/*6c*/{{ NOP, NOP, NOP, NOP, NOP, NOP, NOP, NOP, }, 0xFF,0x00 }, } }; -#endif +#endif /* !PC98 */ -#ifdef GRKEYMAP -#define ISO_ACCENTCHARS -static keymap_t key_map = { 0x6D, { /* german iso8859 keymap */ -/* alt - * scan cntrl alt alt cntrl - * code base shift cntrl shift alt shift cntrl shift spcl flgs - * --------------------------------------------------------------------------- - */ -/* sc=00 */ NOP, NOP, NOP, NOP, NOP, NOP, NOP, NOP, 0xFF, 0x00, -/* sc=01 */ 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, DBG, 0x1B, 0x02, 0x00, -/* sc=02 */ '1', '!', NOP, NOP, '`', '`', NOP, NOP, 0x33, 0x00, -/* sc=03 */ '2', '"', 0x00, 0x00, '@', '@', 0x00, 0x00, 0x00, 0x00, -/* sc=04 */ '3', 0xA7, NOP, NOP, '#', '#', NOP, NOP, 0x33, 0x00, -/* sc=05 */ '4', '$', NOP, NOP, '4', '$', NOP, NOP, 0x33, 0x00, -/* sc=06 */ '5', '%', NOP, NOP, '5', '%', NOP, NOP, 0x33, 0x00, -/* sc=07 */ '6', '&', 0x1E, 0x1E, '^', '^', 0x1E, 0x1E, 0x00, 0x00, -/* sc=08 */ '7', '/', 0x1B, 0x1B, '[', '[', 0x1B, 0x1B, 0x00, 0x00, -/* sc=09 */ '8', '(', NOP, NOP, '8', '(', NOP, NOP, 0x33, 0x00, -/* sc=0a */ '9', ')', 0x1D, 0x1D, ']', ']', 0x1D, 0x1D, 0x00, 0x00, -/* sc=0b */ '0', '=', NOP, NOP, '{', '{', NOP, NOP, 0x33, 0x00, -/* sc=0c */ 0xDF, '?', NOP, NOP, '|', '|', NOP, NOP, 0x33, 0x00, -/* sc=0d */ 0x92, 0x93, NOP, NOP, '\'', '`', NOP, NOP, 0x33, 0x00, -/* sc=0e */ 0x08, 0x08, 0x7F, 0x7F, 0x08, 0x08, 0x7F, 0x7F, 0x00, 0x00, -/* sc=0f */ 0x09, BTAB, NOP, NOP, 0x09, BTAB, NOP, NOP, 0x77, 0x00, -/* sc=10 */ 'q', 'Q', 0x11, 0x11, 'q', 'Q', 0x11, 0x11, 0x00, 0x01, -/* sc=11 */ 'w', 'W', 0x17, 0x17, 'w', 'W', 0x17, 0x17, 0x00, 0x01, -/* sc=12 */ 'e', 'E', 0x05, 0x05, 'e', 'E', 0x05, 0x05, 0x00, 0x01, -/* sc=13 */ 'r', 'R', 0x12, 0x12, 'r', 'R', 0x12, 0x12, 0x00, 0x01, -/* sc=14 */ 't', 'T', 0x14, 0x14, 't', 'T', 0x14, 0x14, 0x00, 0x01, -/* sc=15 */ 'z', 'Z', 0x1A, 0x1A, 'z', 'Z', 0x1A, 0x1A, 0x00, 0x01, -/* sc=16 */ 'u', 'U', 0x15, 0x15, 'u', 'U', 0x15, 0x15, 0x00, 0x01, -/* sc=17 */ 'i', 'I', 0x09, 0x09, 'i', 'I', 0x09, 0x09, 0x00, 0x01, -/* sc=18 */ 'o', 'O', 0x0F, 0x0F, 'o', 'O', 0x0F, 0x0F, 0x00, 0x01, -/* sc=19 */ 'p', 'P', 0x10, 0x10, 'p', 'P', 0x10, 0x10, 0x00, 0x01, -/* sc=1a */ 0xFC, 0xDC, 0x1B, 0x1B, '[', '{', 0x1B, 0x1B, 0x00, 0x01, -/* sc=1b */ '+', '*', 0x1D, 0x1D, ']', '}', 0x1D, 0x1D, 0x00, 0x00, -/* sc=1c */ 0x0D, 0x0D, 0x0A, 0x0A, 0x0D, 0x0D, 0x0A, 0x0A, 0x00, 0x00, -/* sc=1d */ LCTR, LCTR, LCTR, LCTR, LCTR, LCTR, LCTR, LCTR, 0xFF, 0x00, -/* sc=1e */ 'a', 'A', 0x01, 0x01, 'a', 'A', 0x01, 0x01, 0x00, 0x01, -/* sc=1f */ 's', 'S', 0x13, 0x13, 's', 'S', 0x13, 0x13, 0x00, 0x01, -/* sc=20 */ 'd', 'D', 0x04, 0x04, 'd', 'D', 0x04, 0x04, 0x00, 0x01, -/* sc=21 */ 'f', 'F', 0x06, 0x06, 'f', 'F', 0x06, 0x06, 0x00, 0x01, -/* sc=22 */ 'g', 'G', 0x07, 0x07, 'g', 'G', 0x07, 0x07, 0x00, 0x01, -/* sc=23 */ 'h', 'H', 0x08, 0x08, 'h', 'H', 0x08, 0x08, 0x00, 0x01, -/* sc=24 */ 'j', 'J', 0x0A, 0x0A, 'j', 'J', 0x0A, 0x0A, 0x00, 0x01, -/* sc=25 */ 'k', 'K', 0x0B, 0x0B, 'k', 'K', 0x0B, 0x0B, 0x00, 0x01, -/* sc=26 */ 'l', 'L', 0x0C, 0x0C, 'l', 'L', 0x0C, 0x0C, 0x00, 0x01, -/* sc=27 */ 0xF6, 0xD6, NOP, NOP, 0xF6, 0xD6, NOP, NOP, 0x33, 0x01, -/* sc=28 */ 0xE4, 0xC4, NOP, NOP, 0xE4, 0xC4, NOP, NOP, 0x33, 0x01, -/* sc=29 */ '<', '>', 0x1C, 0x1C, '\\', '|', 0x1C, 0x1C, 0x00, 0x00, -/* sc=2a */ LSH, LSH, LSH, LSH, LSH, LSH, LSH, LSH, 0xFF, 0x00, -/* sc=2b */ '#', '^', 0x1E, 0x1E, '`', '~', 0x1E, 0x1E, 0x00, 0x00, -/* sc=2c */ 'y', 'Y', 0x19, 0x19, 'y', 'Y', 0x19, 0x19, 0x00, 0x01, -/* sc=2d */ 'x', 'X', 0x18, 0x18, 'x', 'X', 0x18, 0x18, 0x00, 0x01, -/* sc=2e */ 'c', 'C', 0x03, 0x03, 'c', 'C', 0x03, 0x03, 0x00, 0x01, -/* sc=2f */ 'v', 'V', 0x16, 0x16, 'v', 'V', 0x16, 0x16, 0x00, 0x01, -/* sc=30 */ 'b', 'B', 0x02, 0x02, 'b', 'B', 0x02, 0x02, 0x00, 0x01, -/* sc=31 */ 'n', 'N', 0x0E, 0x0E, 'n', 'N', 0x0E, 0x0E, 0x00, 0x01, -/* sc=32 */ 'm', 'M', 0x0D, 0x0D, 'm', 'M', 0x0D, 0x0D, 0x00, 0x01, -/* sc=33 */ ',', ';', NOP, NOP, ',', ';', NOP, NOP, 0x33, 0x00, -/* sc=34 */ '.', ':', NOP, NOP, '.', ':', NOP, NOP, 0x33, 0x00, -/* sc=35 */ '-', '_', 0x1F, 0x1F, '-', '_', 0x1F, 0x1F, 0x00, 0x00, -/* sc=36 */ RSH, RSH, RSH, RSH, RSH, RSH, RSH, RSH, 0xFF, 0x00, -/* sc=37 */ '*', '*', '*', '*', '*', '*', '*', '*', 0x00, 0x00, -/* sc=38 */ LALT, LALT, LALT, LALT, LALT, LALT, LALT, LALT, 0xFF, 0x00, -/* sc=39 */ ' ', ' ', 0x00, ' ', ' ', ' ', SUSP, ' ', 0x02, 0x00, -/* sc=3a */ CLK, CLK, CLK, CLK, CLK, CLK, CLK, CLK, 0xFF, 0x00, -/* sc=3b */ F( 1), F(13), F(25), F(37), S( 1), S(11), S( 1), S(11), 0xFF, 0x00, -/* sc=3c */ F( 2), F(14), F(26), F(38), S( 2), S(12), S( 2), S(12), 0xFF, 0x00, -/* sc=3d */ F( 3), F(15), F(27), F(39), S( 3), S(13), S( 3), S(13), 0xFF, 0x00, -/* sc=3e */ F( 4), F(16), F(28), F(40), S( 4), S(14), S( 4), S(14), 0xFF, 0x00, -/* sc=3f */ F( 5), F(17), F(29), F(41), S( 5), S(15), S( 5), S(15), 0xFF, 0x00, -/* sc=40 */ F( 6), F(18), F(30), F(42), S( 6), S(16), S( 6), S(16), 0xFF, 0x00, -/* sc=41 */ F( 7), F(19), F(31), F(43), S( 7), S( 7), S( 7), S( 7), 0xFF, 0x00, -/* sc=42 */ F( 8), F(20), F(32), F(44), S( 8), S( 8), S( 8), S( 8), 0xFF, 0x00, -/* sc=43 */ F( 9), F(21), F(33), F(45), S( 9), S( 9), S( 9), S( 9), 0xFF, 0x00, -/* sc=44 */ F(10), F(22), F(34), F(46), S(10), S(10), S(10), S(10), 0xFF, 0x00, -/* sc=45 */ NLK, NLK, NLK, NLK, NLK, NLK, NLK, NLK, 0xFF, 0x00, -/* sc=46 */ SLK, SLK, SLK, SLK, SLK, SLK, SLK, SLK, 0xFF, 0x00, -/* sc=47 */ F(49), '7', '7', '7', '7', '7', '7', '7', 0x80, 0x02, -/* sc=48 */ F(50), '8', '8', '8', '8', '8', '8', '8', 0x80, 0x02, -/* sc=49 */ F(51), '9', '9', '9', '9', '9', '9', '9', 0x80, 0x02, -/* sc=4a */ F(52), '-', '-', '-', '-', '-', '-', '-', 0x80, 0x02, -/* sc=4b */ F(53), '4', '4', '4', '4', '4', '4', '4', 0x80, 0x02, -/* sc=4c */ F(54), '5', '5', '5', '5', '5', '5', '5', 0x80, 0x02, -/* sc=4d */ F(55), '6', '6', '6', '6', '6', '6', '6', 0x80, 0x02, -/* sc=4e */ F(56), '+', '+', '+', '+', '+', '+', '+', 0x80, 0x02, -/* sc=4f */ F(57), '1', '1', '1', '1', '1', '1', '1', 0x80, 0x02, -/* sc=50 */ F(58), '2', '2', '2', '2', '2', '2', '2', 0x80, 0x02, -/* sc=51 */ F(59), '3', '3', '3', '3', '3', '3', '3', 0x80, 0x02, -/* sc=52 */ F(60), '0', '0', '0', '0', '0', '0', '0', 0x80, 0x02, -/* sc=53 */ 0x7F, '.', '.', '.', '.', '.', RBT, RBT, 0x03, 0x02, -/* sc=54 */ NOP, NOP, NOP, NOP, NOP, NOP, NOP, NOP, 0xFF, 0x00, -/* sc=55 */ NOP, NOP, NOP, NOP, NOP, NOP, NOP, NOP, 0xFF, 0x00, -/* sc=56 */ NOP, NOP, NOP, NOP, NOP, NOP, NOP, NOP, 0xFF, 0x00, -/* sc=57 */ F(11), F(23), F(35), F(47), S(11), S(11), S(11), S(11), 0xFF, 0x00, -/* sc=58 */ F(12), F(24), F(36), F(48), S(12), S(12), S(12), S(12), 0xFF, 0x00, -/* sc=59 */ 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0xFF, 0x02, -/* sc=5a */ RCTR, RCTR, RCTR, RCTR, RCTR, RCTR, RCTR, RCTR, 0xFF, 0x00, -/* sc=5b */ '/', '/', '/', '/', '/', '/', '/', '/', 0x00, 0x02, -/* sc=5c */ NEXT, NEXT, DBG, DBG, NOP, NOP, NOP, NOP, 0xFF, 0x00, -/* sc=5d */ RALT, RALT, RALT, RALT, RALT, RALT, RALT, RALT, 0xFF, 0x00, -/* sc=5e */ F(49), F(49), F(49), F(49), F(49), F(49), F(49), F(49), 0xFF, 0x00, -/* sc=5f */ F(50), F(50), F(50), F(50), F(50), F(50), F(50), F(50), 0xFF, 0x00, -/* sc=60 */ F(51), F(51), F(51), F(51), F(51), F(51), F(51), F(51), 0xFF, 0x00, -/* sc=61 */ F(53), F(53), F(53), F(53), F(53), F(53), F(53), F(53), 0xFF, 0x00, -/* sc=62 */ F(55), F(55), F(55), F(55), F(55), F(55), F(55), F(55), 0xFF, 0x00, -/* sc=63 */ F(57), F(57), F(57), F(57), F(57), F(57), F(57), F(57), 0xFF, 0x00, -/* sc=64 */ F(58), F(58), F(58), F(58), F(58), F(58), F(58), F(58), 0xFF, 0x00, -/* sc=65 */ F(59), F(59), F(59), F(59), F(59), F(59), F(59), F(59), 0xFF, 0x00, -/* sc=66 */ F(60), F(60), F(60), F(60), F(60), F(60), F(60), F(60), 0xFF, 0x00, -/* sc=67 */ F(61), F(61), F(61), F(61), F(61), F(61), RBT, F(61), 0xFF, 0x00, -/* sc=68 */ SLK, SPSC, SLK, SPSC, SUSP, NOP, SUSP, NOP, 0xFF, 0x00, -/* sc=69 */ F(62), F(62), F(62), F(62), F(62), F(62), F(62), F(62), 0xFF, 0x00, -/* sc=6a */ F(63), F(63), F(63), F(63), F(63), F(63), F(63), F(63), 0xFF, 0x00, -/* sc=6b */ F(64), F(64), F(64), F(64), F(64), F(64), F(64), F(64), 0xFF, 0x00, -/* sc=6c */ NOP, NOP, NOP, NOP, NOP, NOP, NOP, NOP, 0xFF, 0x00, -} }; -#endif - -#ifdef SWKEYMAP -#define ISO_ACCENTCHARS -static keymap_t key_map = { 0x6D, { /* swedish iso8859 keymap */ -/* alt - * scan cntrl alt alt cntrl - * code base shift cntrl shift alt shift cntrl shift spcl flgs - * --------------------------------------------------------------------------- - */ -/* sc=00 */ NOP, NOP, NOP, NOP, NOP, NOP, NOP, NOP, 0xFF, 0x00, -/* sc=01 */ 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, DBG, 0x1B, 0x02, 0x00, -/* sc=02 */ '1', '!', NOP, NOP, NOP, NOP, NOP, NOP, 0x3F, 0x00, -/* sc=03 */ '2', '"', 0x00, 0x00, '@', '@', 0x00, 0x00, 0x00, 0x00, -/* sc=04 */ '3', '#', NOP, NOP, 0xA3, NOP, NOP, NOP, 0x37, 0x00, -/* sc=05 */ '4', '$', NOP, NOP, 0xA4, NOP, NOP, NOP, 0x37, 0x00, -/* sc=06 */ '5', '%', NOP, NOP, NOP, NOP, NOP, NOP, 0x3F, 0x00, -/* sc=07 */ '6', '&', NOP, NOP, NOP, NOP, NOP, NOP, 0x3F, 0x00, -/* sc=08 */ '7', '/', NOP, NOP, '{', NOP, NOP, NOP, 0x37, 0x00, -/* sc=09 */ '8', '(', NOP, NOP, '[', NOP, NOP, NOP, 0x37, 0x00, -/* sc=0a */ '9', ')', NOP, NOP, ']', NOP, NOP, NOP, 0x37, 0x00, -/* sc=0b */ '0', '=', NOP, NOP, '}', NOP, NOP, NOP, 0x37, 0x00, -/* sc=0c */ '+', '?', NOP, NOP, '\\', NOP, 0x1C, NOP, 0x35, 0x00, -/* sc=0d */ 0x180, '`', NOP, NOP, NOP, NOP, NOP, NOP, 0x3F, 0x00, -/* sc=0e */ 0x08, 0x08, 0x7F, 0x7F, 0x08, 0x08, 0x7F, 0x7F, 0x00, 0x00, -/* sc=0f */ 0x09, BTAB, NOP, NOP, 0x09, BTAB, NOP, NOP, 0x77, 0x00, -/* sc=10 */ 'q', 'Q', 0x11, 0x11, 'q', 'Q', 0x11, 0x11, 0x00, 0x01, -/* sc=11 */ 'w', 'W', 0x17, 0x17, 'w', 'W', 0x17, 0x17, 0x00, 0x01, -/* sc=12 */ 'e', 'E', 0x05, 0x05, 'e', 'E', 0x05, 0x05, 0x00, 0x01, -/* sc=13 */ 'r', 'R', 0x12, 0x12, 'r', 'R', 0x12, 0x12, 0x00, 0x01, -/* sc=14 */ 't', 'T', 0x14, 0x14, 't', 'T', 0x14, 0x14, 0x00, 0x01, -/* sc=15 */ 'y', 'Y', 0x19, 0x19, 'y', 'Y', 0x19, 0x19, 0x00, 0x01, -/* sc=16 */ 'u', 'U', 0x15, 0x15, 'u', 'U', 0x15, 0x15, 0x00, 0x01, -/* sc=17 */ 'i', 'I', 0x09, 0x09, 'i', 'I', 0x09, 0x09, 0x00, 0x01, -/* sc=18 */ 'o', 'O', 0x0F, 0x0F, 'o', 'O', 0x0F, 0x0F, 0x00, 0x01, -/* sc=19 */ 'p', 'P', 0x10, 0x10, 'p', 'P', 0x10, 0x10, 0x00, 0x01, -/* sc=1a */ 0xE5, 0xC5, NOP, NOP, '}', ']', NOP, NOP, 0x33, 0x01, -/* sc=1b */ 0xA8, '^', NOP, NOP, '~', NOP, NOP, NOP, 0x37, 0x00, -/* sc=1c */ 0x0D, 0x0D, 0x0A, 0x0A, 0x0D, 0x0D, 0x0A, 0x0A, 0x00, 0x00, -/* sc=1d */ LCTR, LCTR, LCTR, LCTR, LCTR, LCTR, LCTR, LCTR, 0xFF, 0x00, -/* sc=1e */ 'a', 'A', 0x01, 0x01, 'a', 'A', 0x01, 0x01, 0x00, 0x01, -/* sc=1f */ 's', 'S', 0x13, 0x13, 's', 'S', 0x13, 0x13, 0x00, 0x01, -/* sc=20 */ 'd', 'D', 0x04, 0x04, 'd', 'D', 0x04, 0x04, 0x00, 0x01, -/* sc=21 */ 'f', 'F', 0x06, 0x06, 'f', 'F', 0x06, 0x06, 0x00, 0x01, -/* sc=22 */ 'g', 'G', 0x07, 0x07, 'g', 'G', 0x07, 0x07, 0x00, 0x01, -/* sc=23 */ 'h', 'H', 0x08, 0x08, 'h', 'H', 0x08, 0x08, 0x00, 0x01, -/* sc=24 */ 'j', 'J', 0x0A, 0x0A, 'j', 'J', 0x0A, 0x0A, 0x00, 0x01, -/* sc=25 */ 'k', 'K', 0x0B, 0x0B, 'k', 'K', 0x0B, 0x0B, 0x00, 0x01, -/* sc=26 */ 'l', 'L', 0x0C, 0x0C, 'l', 'L', 0x0C, 0x0C, 0x00, 0x01, -/* sc=27 */ 0xF6, 0xD6, NOP, NOP, '|', '\\', NOP, NOP, 0x33, 0x01, -/* sc=28 */ 0xE4, 0xC4, NOP, NOP, '{', '[', NOP, NOP, 0x33, 0x01, -/* sc=29 */ 0xA7, 0xBD, NOP, NOP, '\\', '|', NOP, NOP, 0x33, 0x00, -/* sc=2a */ LSH, LSH, LSH, LSH, LSH, LSH, LSH, LSH, 0xFF, 0x00, -/* sc=2b */ '\'', '*', NOP, NOP, NOP, NOP, NOP, NOP, 0x3F, 0x00, -/* sc=2c */ 'z', 'Z', 0x1A, 0x1A, 'z', 'Z', 0x1A, 0x1A, 0x00, 0x01, -/* sc=2d */ 'x', 'X', 0x18, 0x18, 'x', 'X', 0x18, 0x18, 0x00, 0x01, -/* sc=2e */ 'c', 'C', 0x03, 0x03, 'c', 'C', 0x03, 0x03, 0x00, 0x01, -/* sc=2f */ 'v', 'V', 0x16, 0x16, 'v', 'V', 0x16, 0x16, 0x00, 0x01, -/* sc=30 */ 'b', 'B', 0x02, 0x02, 'b', 'B', 0x02, 0x02, 0x00, 0x01, -/* sc=31 */ 'n', 'N', 0x0E, 0x0E, 'n', 'N', 0x0E, 0x0E, 0x00, 0x01, -/* sc=32 */ 'm', 'M', 0x0D, 0x0D, 'm', 'M', 0x0D, 0x0D, 0x00, 0x01, -/* sc=33 */ ',', ';', NOP, NOP, NOP, '<', NOP, NOP, 0x3B, 0x00, -/* sc=34 */ '.', ':', NOP, NOP, NOP, '>', NOP, NOP, 0x3B, 0x00, -/* sc=35 */ '-', '_', 0x1F, NOP, '/', '?', NOP, NOP, 0x13, 0x00, -/* sc=36 */ RSH, RSH, RSH, RSH, RSH, RSH, RSH, RSH, 0xFF, 0x00, -/* sc=37 */ '*', '*', '*', '*', '*', '*', '*', '*', 0x00, 0x00, -/* sc=38 */ LALT, LALT, LALT, LALT, LALT, LALT, LALT, LALT, 0xFF, 0x00, -/* sc=39 */ ' ', ' ', 0x00, ' ', ' ', ' ', SUSP, ' ', 0x02, 0x00, -/* sc=3a */ CLK, CLK, CLK, CLK, CLK, CLK, CLK, CLK, 0xFF, 0x00, -/* sc=3b */ F( 1), F(13), F(25), F(37), S( 1), S(11), S( 1), S(11), 0xFF, 0x00, -/* sc=3c */ F( 2), F(14), F(26), F(38), S( 2), S(12), S( 2), S(12), 0xFF, 0x00, -/* sc=3d */ F( 3), F(15), F(27), F(39), S( 3), S(13), S( 3), S(13), 0xFF, 0x00, -/* sc=3e */ F( 4), F(16), F(28), F(40), S( 4), S(14), S( 4), S(14), 0xFF, 0x00, -/* sc=3f */ F( 5), F(17), F(29), F(41), S( 5), S(15), S( 5), S(15), 0xFF, 0x00, -/* sc=40 */ F( 6), F(18), F(30), F(42), S( 6), S(16), S( 6), S(16), 0xFF, 0x00, -/* sc=41 */ F( 7), F(19), F(31), F(43), S( 7), S( 7), S( 7), S( 7), 0xFF, 0x00, -/* sc=42 */ F( 8), F(20), F(32), F(44), S( 8), S( 8), S( 8), S( 8), 0xFF, 0x00, -/* sc=43 */ F( 9), F(21), F(33), F(45), S( 9), S( 9), S( 9), S( 9), 0xFF, 0x00, -/* sc=44 */ F(10), F(22), F(34), F(46), S(10), S(10), S(10), S(10), 0xFF, 0x00, -/* sc=45 */ NLK, NLK, NLK, NLK, NLK, NLK, NLK, NLK, 0xFF, 0x00, -/* sc=46 */ SLK, SLK, SLK, SLK, SLK, SLK, SLK, SLK, 0xFF, 0x00, -/* sc=47 */ F(49), '7', '7', '7', '7', '7', '7', '7', 0x80, 0x02, -/* sc=48 */ F(50), '8', '8', '8', '8', '8', '8', '8', 0x80, 0x02, -/* sc=49 */ F(51), '9', '9', '9', '9', '9', '9', '9', 0x80, 0x02, -/* sc=4a */ F(52), '-', '-', '-', '-', '-', '-', '-', 0x80, 0x02, -/* sc=4b */ F(53), '4', '4', '4', '4', '4', '4', '4', 0x80, 0x02, -/* sc=4c */ F(54), '5', '5', '5', '5', '5', '5', '5', 0x80, 0x02, -/* sc=4d */ F(55), '6', '6', '6', '6', '6', '6', '6', 0x80, 0x02, -/* sc=4e */ F(56), '+', '+', '+', '+', '+', '+', '+', 0x80, 0x02, -/* sc=4f */ F(57), '1', '1', '1', '1', '1', '1', '1', 0x80, 0x02, -/* sc=50 */ F(58), '2', '2', '2', '2', '2', '2', '2', 0x80, 0x02, -/* sc=51 */ F(59), '3', '3', '3', '3', '3', '3', '3', 0x80, 0x02, -/* sc=52 */ F(60), '0', '0', '0', '0', '0', '0', '0', 0x80, 0x02, -/* sc=53 */ 0x7F, '.', '.', '.', '.', '.', RBT, RBT, 0x03, 0x02, -/* sc=54 */ NOP, NOP, NOP, NOP, NOP, NOP, NOP, NOP, 0xFF, 0x00, -/* sc=55 */ NOP, NOP, NOP, NOP, NOP, NOP, NOP, NOP, 0xFF, 0x00, -/* sc=56 */ '<', '>', NOP, NOP, '|', NOP, NOP, NOP, 0x37, 0x00, -/* sc=57 */ F(11), F(23), F(35), F(47), S(11), S(11), S(11), S(11), 0xFF, 0x00, -/* sc=58 */ F(12), F(24), F(36), F(48), S(12), S(12), S(12), S(12), 0xFF, 0x00, -/* sc=59 */ 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0xFF, 0x02, -/* sc=5a */ RCTR, RCTR, RCTR, RCTR, RCTR, RCTR, RCTR, RCTR, 0xFF, 0x00, -/* sc=5b */ '/', '/', '/', '/', '/', '/', '/', '/', 0x00, 0x02, -/* sc=5c */ NEXT, NEXT, DBG, DBG, NOP, NOP, NOP, NOP, 0xFF, 0x00, -/* sc=5d */ RALT, RALT, RALT, RALT, RALT, RALT, RALT, RALT, 0xFF, 0x00, -/* sc=5e */ F(49), F(49), F(49), F(49), F(49), F(49), F(49), F(49), 0xFF, 0x00, -/* sc=5f */ F(50), F(50), F(50), F(50), F(50), F(50), F(50), F(50), 0xFF, 0x00, -/* sc=60 */ F(51), F(51), F(51), F(51), F(51), F(51), F(51), F(51), 0xFF, 0x00, -/* sc=61 */ F(53), F(53), F(53), F(53), F(53), F(53), F(53), F(53), 0xFF, 0x00, -/* sc=62 */ F(55), F(55), F(55), F(55), F(55), F(55), F(55), F(55), 0xFF, 0x00, -/* sc=63 */ F(57), F(57), F(57), F(57), F(57), F(57), F(57), F(57), 0xFF, 0x00, -/* sc=64 */ F(58), F(58), F(58), F(58), F(58), F(58), F(58), F(58), 0xFF, 0x00, -/* sc=65 */ F(59), F(59), F(59), F(59), F(59), F(59), F(59), F(59), 0xFF, 0x00, -/* sc=66 */ F(60), F(60), F(60), F(60), F(60), F(60), F(60), F(60), 0xFF, 0x00, -/* sc=67 */ F(61), F(61), F(61), F(61), F(61), F(61), RBT, F(61), 0xFF, 0x00, -/* sc=68 */ SLK, SPSC, SLK, SPSC, SUSP, NOP, SUSP, NOP, 0xFF, 0x00, -/* sc=69 */ F(62), F(62), F(62), F(62), F(62), F(62), F(62), F(62), 0xFF, 0x00, -/* sc=6a */ F(63), F(63), F(63), F(63), F(63), F(63), F(63), F(63), 0xFF, 0x00, -/* sc=6b */ F(64), F(64), F(64), F(64), F(64), F(64), F(64), F(64), 0xFF, 0x00, -/* sc=6c */ NOP, NOP, NOP, NOP, NOP, NOP, NOP, NOP, 0xFF, 0x00, -} }; -#endif - -#ifdef RUKEYMAP -#define NO_ACCENTCHARS -static keymap_t key_map = { 0xED, { /* keys number */ -/* alt - * scan cntrl alt alt cntrl - * code base shift cntrl shift alt shift cntrl shift spcl flgs - * ------------------------------------------------------------------------------------------- - */ -/* sc=00 */ NOP, NOP, NOP, NOP, NOP, NOP, NOP, NOP, 0xFF, 0x00, -/* sc=01 */ 0x1B, 0x1B, NOP, NOP, SET8|0x1B, SET8|0x1B, DBG, NOP, 0x33, 0x00, -/* sc=02 */ '1', '!', NOP, NOP, SET8|'1', SET8|'!', NOP, NOP, 0x33, 0x00, -/* sc=03 */ '2', '@', 0x00, 0x00, SET8|'2', SET8|'@', SET8|0x00, SET8|0x00, 0x00, 0x00, -/* sc=04 */ '3', '#', NOP, NOP, SET8|'3', SET8|'#', NOP, NOP, 0x33, 0x00, -/* sc=05 */ '4', '$', NOP, NOP, SET8|'4', SET8|'$', NOP, NOP, 0x33, 0x00, -/* sc=06 */ '5', '%', NOP, NOP, SET8|'5', SET8|'%', NOP, NOP, 0x33, 0x00, -/* sc=07 */ '6', '^', 0x1E, 0x1E, SET8|'6', SET8|'^', SET8|0x1E, SET8|0x1E, 0x00, 0x00, -/* sc=08 */ '7', '&', NOP, NOP, SET8|'7', SET8|'&', NOP, NOP, 0x33, 0x00, -/* sc=09 */ '8', '*', NOP, NOP, SET8|'8', SET8|'*', NOP, NOP, 0x33, 0x00, -/* sc=0a */ '9', '(', NOP, NOP, SET8|'9', SET8|'(', NOP, NOP, 0x33, 0x00, -/* sc=0b */ '0', ')', NOP, NOP, SET8|'0', SET8|')', NOP, NOP, 0x33, 0x00, -/* sc=0c */ '-', '_', 0x1F, 0x1F, SET8|'-', SET8|'_', SET8|0x1F, SET8|0x1F, 0x00, 0x00, -/* sc=0d */ '=', '+', NOP, NOP, SET8|'=', SET8|'+', NOP, NOP, 0x33, 0x00, -/* sc=0e */ 0x08, 0x08, 0x7F, 0x7F, SET8|0x08, SET8|0x08, SET8|0x7F, SET8|0x7F, 0x00, 0x00, -/* sc=0f */ 0x09, BTAB, NOP, NOP, SET8|0x09, BTAB, NOP, NOP, 0x77, 0x00, -/* sc=10 */ 'q', 'Q', 0x11, 0x11, SET8|'q', SET8|'Q', SET8|0x11, SET8|0x11, 0x00, 0x01, -/* sc=11 */ 'w', 'W', 0x17, 0x17, SET8|'w', SET8|'W', SET8|0x17, SET8|0x17, 0x00, 0x01, -/* sc=12 */ 'e', 'E', 0x05, 0x05, SET8|'e', SET8|'E', SET8|0x05, SET8|0x05, 0x00, 0x01, -/* sc=13 */ 'r', 'R', 0x12, 0x12, SET8|'r', SET8|'R', SET8|0x12, SET8|0x12, 0x00, 0x01, -/* sc=14 */ 't', 'T', 0x14, 0x14, SET8|'t', SET8|'T', SET8|0x14, SET8|0x14, 0x00, 0x01, -/* sc=15 */ 'y', 'Y', 0x19, 0x19, SET8|'y', SET8|'Y', SET8|0x19, SET8|0x19, 0x00, 0x01, -/* sc=16 */ 'u', 'U', 0x15, 0x15, SET8|'u', SET8|'U', SET8|0x15, SET8|0x15, 0x00, 0x01, -/* sc=17 */ 'i', 'I', 0x09, 0x09, SET8|'i', SET8|'I', SET8|0x09, SET8|0x09, 0x00, 0x01, -/* sc=18 */ 'o', 'O', 0x0F, 0x0F, SET8|'o', SET8|'O', SET8|0x0F, SET8|0x0F, 0x00, 0x01, -/* sc=19 */ 'p', 'P', 0x10, 0x10, SET8|'p', SET8|'P', SET8|0x10, SET8|0x10, 0x00, 0x01, -/* sc=1a */ '[', '{', 0x1B, 0x1B, SET8|'[', SET8|'{', SET8|0x1B, SET8|0x1B, 0x00, 0x00, -/* sc=1b */ ']', '}', 0x1D, 0x1D, SET8|']', SET8|'}', SET8|0x1D, SET8|0x1D, 0x00, 0x00, -/* sc=1c */ 0x0D, 0x0D, 0x0A, 0x0A, SET8|0x0D, SET8|0x0D, SET8|0x0A, SET8|0x0A, 0x00, 0x00, -/* sc=1d */ LCTR, LCTR, LCTR, LCTR, LCTR, LCTR, LCTR, LCTR, 0xFF, 0x00, -/* sc=1e */ 'a', 'A', 0x01, 0x01, SET8|'a', SET8|'A', SET8|0x01, SET8|0x01, 0x00, 0x01, -/* sc=1f */ 's', 'S', 0x13, 0x13, SET8|'s', SET8|'S', SET8|0x13, SET8|0x13, 0x00, 0x01, -/* sc=20 */ 'd', 'D', 0x04, 0x04, SET8|'d', SET8|'D', SET8|0x04, SET8|0x04, 0x00, 0x01, -/* sc=21 */ 'f', 'F', 0x06, 0x06, SET8|'f', SET8|'F', SET8|0x06, SET8|0x06, 0x00, 0x01, -/* sc=22 */ 'g', 'G', 0x07, 0x07, SET8|'g', SET8|'G', SET8|0x07, SET8|0x07, 0x00, 0x01, -/* sc=23 */ 'h', 'H', 0x08, 0x08, SET8|'h', SET8|'H', SET8|0x08, SET8|0x08, 0x00, 0x01, -/* sc=24 */ 'j', 'J', 0x0A, 0x0A, SET8|'j', SET8|'J', SET8|0x0A, SET8|0x0A, 0x00, 0x01, -/* sc=25 */ 'k', 'K', 0x0B, 0x0B, SET8|'k', SET8|'K', SET8|0x0B, SET8|0x0B, 0x00, 0x01, -/* sc=26 */ 'l', 'L', 0x0C, 0x0C, SET8|'l', SET8|'L', SET8|0x0C, SET8|0x0C, 0x00, 0x01, -/* sc=27 */ ';', ':', NOP, NOP, SET8|';', SET8|':', NOP, NOP, 0x33, 0x00, -/* sc=28 */ '\'', '"', NOP, NOP, SET8|'\'', SET8|'"', NOP, NOP, 0x33, 0x00, -/* sc=29 */ '`', '~', NOP, NOP, SET8|'`', SET8|'~', NOP, NOP, 0x33, 0x00, -/* sc=2a */ LSH, LSH, LSH, LSH, LSH, LSH, LSH, LSH, 0xFF, 0x00, -/* sc=2b */ '\\', '|', 0x1C, 0x1C, SET8|'\\', SET8|'|', SET8|0x1C, SET8|0x1C, 0x00, 0x00, -/* sc=2c */ 'z', 'Z', 0x1A, 0x1A, SET8|'z', SET8|'Z', SET8|0x1A, SET8|0x1A, 0x00, 0x01, -/* sc=2d */ 'x', 'X', 0x18, 0x18, SET8|'x', SET8|'X', SET8|0x18, SET8|0x18, 0x00, 0x01, -/* sc=2e */ 'c', 'C', 0x03, 0x03, SET8|'c', SET8|'C', SET8|0x03, SET8|0x03, 0x00, 0x01, -/* sc=2f */ 'v', 'V', 0x16, 0x16, SET8|'v', SET8|'V', SET8|0x16, SET8|0x16, 0x00, 0x01, -/* sc=30 */ 'b', 'B', 0x02, 0x02, SET8|'b', SET8|'B', SET8|0x02, SET8|0x02, 0x00, 0x01, -/* sc=31 */ 'n', 'N', 0x0E, 0x0E, SET8|'n', SET8|'N', SET8|0x0E, SET8|0x0E, 0x00, 0x01, -/* sc=32 */ 'm', 'M', 0x0D, 0x0D, SET8|'m', SET8|'M', SET8|0x0D, SET8|0x0D, 0x00, 0x01, -/* sc=33 */ ',', '<', NOP, NOP, SET8|',', SET8|'<', NOP, NOP, 0x33, 0x00, -/* sc=34 */ '.', '>', NOP, NOP, SET8|'.', SET8|'>', NOP, NOP, 0x33, 0x00, -/* sc=35 */ '/', '?', NOP, NOP, SET8|'/', SET8|'?', NOP, NOP, 0x33, 0x00, -/* sc=36 */ RSH, RSH, RSH, RSH, RSH, RSH, RSH, RSH, 0xFF, 0x00, -/* sc=37 */ '*', '*', 0x0A, 0x0A, SET8|'*', SET8|'*', SET8|0x0A, SET8|0x0A, 0x00, 0x00, -/* sc=38 */ LALT, LALT, LALT, LALT, LALT, LALT, LALT, LALT, 0xFF, 0x00, -/* sc=39 */ ' ', ' ', 0x00, ' ', SET8|' ', SET8|' ', SUSP, SET8|' ', 0x00, 0x00, -/* sc=3a */ ALK, CLK, CLK, CLK, CLK, CLK, CLK, CLK, 0xFF, 0x00, -/* sc=3b */ F( 1), F(13), F(25), F(37), S( 1), S(11), S( 1), S(11), 0xFF, 0x00, -/* sc=3c */ F( 2), F(14), F(26), F(38), S( 2), S(12), S( 2), S(12), 0xFF, 0x00, -/* sc=3d */ F( 3), F(15), F(27), F(39), S( 3), S(13), S( 3), S(13), 0xFF, 0x00, -/* sc=3e */ F( 4), F(16), F(28), F(40), S( 4), S(14), S( 4), S(14), 0xFF, 0x00, -/* sc=3f */ F( 5), F(17), F(29), F(41), S( 5), S(15), S( 5), S(15), 0xFF, 0x00, -/* sc=40 */ F( 6), F(18), F(30), F(42), S( 6), S(16), S( 6), S(16), 0xFF, 0x00, -/* sc=41 */ F( 7), F(19), F(31), F(43), S( 7), S( 7), S( 7), S( 7), 0xFF, 0x00, -/* sc=42 */ F( 8), F(20), F(32), F(44), S( 8), S( 8), S( 8), S( 8), 0xFF, 0x00, -/* sc=43 */ F( 9), F(21), F(33), F(45), S( 9), S( 9), S( 9), S( 9), 0xFF, 0x00, -/* sc=44 */ F(10), F(22), F(34), F(46), S(10), S(10), S(10), S(10), 0xFF, 0x00, -/* sc=45 */ NLK, NLK, NLK, NLK, NLK, NLK, NLK, NLK, 0xFF, 0x00, -/* sc=46 */ SLK, SLK, SLK, SLK, SLK, SLK, SLK, SLK, 0xFF, 0x00, -/* sc=47 */ F(49), '7', '7', '7', SET8|'7', SET8|'7', SET8|'7', SET8|'7', 0x80, 0x02, -/* sc=48 */ F(50), '8', '8', '8', SET8|'8', SET8|'8', SET8|'8', SET8|'8', 0x80, 0x02, -/* sc=49 */ F(51), '9', '9', '9', SET8|'9', SET8|'9', SET8|'9', SET8|'9', 0x80, 0x02, -/* sc=4a */ F(52), '-', '-', '-', SET8|'-', SET8|'-', SET8|'-', SET8|'-', 0x80, 0x02, -/* sc=4b */ F(53), '4', '4', '4', SET8|'4', SET8|'4', SET8|'4', SET8|'4', 0x80, 0x02, -/* sc=4c */ F(54), '5', '5', '5', SET8|'5', SET8|'5', SET8|'5', SET8|'5', 0x80, 0x02, -/* sc=4d */ F(55), '6', '6', '6', SET8|'6', SET8|'6', SET8|'6', SET8|'6', 0x80, 0x02, -/* sc=4e */ F(56), '+', '+', '+', SET8|'+', SET8|'+', SET8|'+', SET8|'+', 0x80, 0x02, -/* sc=4f */ F(57), '1', '1', '1', SET8|'1', SET8|'1', SET8|'1', SET8|'1', 0x80, 0x02, -/* sc=50 */ F(58), '2', '2', '2', SET8|'2', SET8|'2', SET8|'2', SET8|'2', 0x80, 0x02, -/* sc=51 */ F(59), '3', '3', '3', SET8|'3', SET8|'3', SET8|'3', SET8|'3', 0x80, 0x02, -/* sc=52 */ F(60), '0', '0', '0', SET8|'0', SET8|'0', SET8|'0', SET8|'0', 0x80, 0x02, -/* sc=53 */ 0x7F, '.', '.', '.', SET8|'.', SET8|'.', RBT, RBT, 0x03, 0x02, -/* sc=54 */ ALK, ALK, ALK, ALK, ALK, ALK, ALK, ALK, 0xFF, 0x00, -/* sc=55 */ NOP, NOP, NOP, NOP, NOP, NOP, NOP, NOP, 0xFF, 0x00, -/* sc=56 */ NOP, NOP, NOP, NOP, NOP, NOP, NOP, NOP, 0xFF, 0x00, -/* sc=57 */ F(11), F(23), F(35), F(47), S(11), S(11), S(11), S(11), 0xFF, 0x00, -/* sc=58 */ F(12), F(24), F(36), F(48), S(12), S(12), S(12), S(12), 0xFF, 0x00, -/* sc=59 */ 0x0D, 0x0D, 0x0A, 0x0A, SET8|0x0D, SET8|0x0D, SET8|0x0A, SET8|0x0A, 0x00, 0x00, -/* sc=5a */ RCTR, RCTR, RCTR, RCTR, RCTR, RCTR, RCTR, RCTR, 0xFF, 0x00, -/* sc=5b */ '/', '/', NOP, NOP, SET8|'/', SET8|'/', NOP, NOP, 0x33, 0x00, -/* sc=5c */ NEXT, NEXT, DBG, DBG, NOP, NOP, NOP, NOP, 0xFF, 0x00, -/* sc=5d */ RALT, RALT, RALT, RALT, RALT, RALT, RALT, RALT, 0xFF, 0x00, -/* sc=5e */ F(49), F(49), F(49), F(49), F(49), F(49), F(49), F(49), 0xFF, 0x00, -/* sc=5f */ F(50), F(50), F(50), F(50), F(50), F(50), F(50), F(50), 0xFF, 0x00, -/* sc=60 */ F(51), F(51), F(51), F(51), F(51), F(51), F(51), F(51), 0xFF, 0x00, -/* sc=61 */ F(53), F(53), F(53), F(53), F(53), F(53), F(53), F(53), 0xFF, 0x00, -/* sc=62 */ F(55), F(55), F(55), F(55), F(55), F(55), F(55), F(55), 0xFF, 0x00, -/* sc=63 */ F(57), F(57), F(57), F(57), F(57), F(57), F(57), F(57), 0xFF, 0x00, -/* sc=64 */ F(58), F(58), F(58), F(58), F(58), F(58), F(58), F(58), 0xFF, 0x00, -/* sc=65 */ F(59), F(59), F(59), F(59), F(59), F(59), F(59), F(59), 0xFF, 0x00, -/* sc=66 */ F(60), F(60), F(60), F(60), F(60), F(60), F(60), F(60), 0xFF, 0x00, -/* sc=67 */ F(61), F(61), F(61), F(61), F(61), F(61), RBT, F(61), 0xFF, 0x00, -/* sc=68 */ SLK, SPSC, SLK, SPSC, SUSP, NOP, SUSP, NOP, 0xFF, 0x00, -/* sc=69 */ F(62), F(62), F(62), F(62), F(62), F(62), F(62), F(62), 0xFF, 0x00, -/* sc=6a */ F(63), F(63), F(63), F(63), F(63), F(63), F(63), F(63), 0xFF, 0x00, -/* sc=6b */ F(64), F(64), F(64), F(64), F(64), F(64), F(64), F(64), 0xFF, 0x00, -/* sc=6c */ NOP, NOP, NOP, NOP, NOP, NOP, NOP, NOP, 0xFF, 0x00, -/* sc=6d */ NOP, NOP, NOP, NOP, NOP, NOP, NOP, NOP, 0xFF, 0x00, -/* sc=6e */ NOP, NOP, NOP, NOP, NOP, NOP, NOP, NOP, 0xFF, 0x00, -/* sc=6f */ NOP, NOP, NOP, NOP, NOP, NOP, NOP, NOP, 0xFF, 0x00, -/* sc=70 */ NOP, NOP, NOP, NOP, NOP, NOP, NOP, NOP, 0xFF, 0x00, -/* sc=71 */ NOP, NOP, NOP, NOP, NOP, NOP, NOP, NOP, 0xFF, 0x00, -/* sc=72 */ NOP, NOP, NOP, NOP, NOP, NOP, NOP, NOP, 0xFF, 0x00, -/* sc=73 */ NOP, NOP, NOP, NOP, NOP, NOP, NOP, NOP, 0xFF, 0x00, -/* sc=74 */ NOP, NOP, NOP, NOP, NOP, NOP, NOP, NOP, 0xFF, 0x00, -/* sc=75 */ NOP, NOP, NOP, NOP, NOP, NOP, NOP, NOP, 0xFF, 0x00, -/* sc=76 */ NOP, NOP, NOP, NOP, NOP, NOP, NOP, NOP, 0xFF, 0x00, -/* sc=77 */ NOP, NOP, NOP, NOP, NOP, NOP, NOP, NOP, 0xFF, 0x00, -/* sc=78 */ NOP, NOP, NOP, NOP, NOP, NOP, NOP, NOP, 0xFF, 0x00, -/* sc=79 */ NOP, NOP, NOP, NOP, NOP, NOP, NOP, NOP, 0xFF, 0x00, -/* sc=7a */ NOP, NOP, NOP, NOP, NOP, NOP, NOP, NOP, 0xFF, 0x00, -/* sc=7b */ NOP, NOP, NOP, NOP, NOP, NOP, NOP, NOP, 0xFF, 0x00, -/* sc=7c */ NOP, NOP, NOP, NOP, NOP, NOP, NOP, NOP, 0xFF, 0x00, -/* sc=7d */ NOP, NOP, NOP, NOP, NOP, NOP, NOP, NOP, 0xFF, 0x00, -/* sc=7e */ NOP, NOP, NOP, NOP, NOP, NOP, NOP, NOP, 0xFF, 0x00, -/* sc=7f */ NOP, NOP, NOP, NOP, NOP, NOP, NOP, NOP, 0xFF, 0x00, -/* extended (ALTGR LOCK keys) */ -/* sc=00 */ NOP, NOP, NOP, NOP, NOP, NOP, NOP, NOP, 0xFF, 0x00, -/* sc=01 */ 0x1B, 0x1B, NOP, NOP, SET8|0x1B, SET8|0x1B, DBG, NOP, 0x33, 0x00, -/* sc=02 */ '!', '1', NOP, NOP, SET8|'1', SET8|'!', NOP, NOP, 0x33, 0x00, -/* sc=03 */ '"', '2', 0x00, 0x00, SET8|'2', SET8|'@', SET8|0x00, SET8|0x00, 0x00, 0x00, -/* sc=04 */ '\'', '3', NOP, NOP, SET8|'3', SET8|'#', NOP, NOP, 0x33, 0x00, -/* sc=05 */ '*', '4', NOP, NOP, SET8|'4', SET8|'$', NOP, NOP, 0x33, 0x00, -/* sc=06 */ ':', '5', NOP, NOP, SET8|'5', SET8|'%', NOP, NOP, 0x33, 0x00, -/* sc=07 */ ',', '6', 0x1E, 0x1E, SET8|'6', SET8|'^', SET8|0x1E, SET8|0x1E, 0x00, 0x00, -/* sc=08 */ '.', '7', NOP, NOP, SET8|'7', SET8|'&', NOP, NOP, 0x33, 0x00, -/* sc=09 */ ';', '8', NOP, NOP, SET8|'8', SET8|'*', NOP, NOP, 0x33, 0x00, -/* sc=0a */ '(', '9', NOP, NOP, SET8|'9', SET8|'(', NOP, NOP, 0x33, 0x00, -/* sc=0b */ ')', '0', NOP, NOP, SET8|'0', SET8|')', NOP, NOP, 0x33, 0x00, -/* sc=0c */ '-', '_', 0x1F, 0x1F, SET8|'-', SET8|'_', SET8|0x1F, SET8|0x1F, 0x00, 0x00, -/* sc=0d */ '=', '+', NOP, NOP, SET8|'=', SET8|'+', NOP, NOP, 0x33, 0x00, -/* sc=0e */ 0x08, 0x08, 0x7F, 0x7F, SET8|0x08, SET8|0x08, SET8|0x7F, SET8|0x7F, 0x00, 0x00, -/* sc=0f */ 0x09, BTAB, NOP, NOP, SET8|0x09, BTAB, NOP, NOP, 0x77, 0x00, -/* sc=10 */ 0xca, 0xea, 0x11, 0x11, SET8|'q', SET8|'Q', SET8|0x11, SET8|0x11, 0x00, 0x01, -/* sc=11 */ 0xc3, 0xe3, 0x17, 0x17, SET8|'w', SET8|'W', SET8|0x17, SET8|0x17, 0x00, 0x01, -/* sc=12 */ 0xd5, 0xf5, 0x05, 0x05, SET8|'e', SET8|'E', SET8|0x05, SET8|0x05, 0x00, 0x01, -/* sc=13 */ 0xcb, 0xeb, 0x12, 0x12, SET8|'r', SET8|'R', SET8|0x12, SET8|0x12, 0x00, 0x01, -/* sc=14 */ 0xc5, 0xe5, 0x14, 0x14, SET8|'t', SET8|'T', SET8|0x14, SET8|0x14, 0x00, 0x01, -/* sc=15 */ 0xce, 0xee, 0x19, 0x19, SET8|'y', SET8|'Y', SET8|0x19, SET8|0x19, 0x00, 0x01, -/* sc=16 */ 0xc7, 0xe7, 0x15, 0x15, SET8|'u', SET8|'U', SET8|0x15, SET8|0x15, 0x00, 0x01, -/* sc=17 */ 0xdb, 0xfb, 0x09, 0x09, SET8|'i', SET8|'I', SET8|0x09, SET8|0x09, 0x00, 0x01, -/* sc=18 */ 0xdd, 0xfd, 0x0F, 0x0F, SET8|'o', SET8|'O', SET8|0x0F, SET8|0x0F, 0x00, 0x01, -/* sc=19 */ 0xda, 0xfa, 0x10, 0x10, SET8|'p', SET8|'P', SET8|0x10, SET8|0x10, 0x00, 0x01, -/* sc=1a */ 0xc8, 0xe8, 0x1B, 0x1B, SET8|'[', SET8|'{', SET8|0x1B, SET8|0x1B, 0x00, 0x01, -/* sc=1b */ 0xdf, 0xff, 0x1D, 0x1D, SET8|']', SET8|'}', SET8|0x1D, SET8|0x1D, 0x00, 0x01, -/* sc=1c */ 0x0D, 0x0D, 0x0A, 0x0A, SET8|0x0D, SET8|0x0D, SET8|0x0A, SET8|0x0A, 0x00, 0x00, -/* sc=1d */ LCTR, LCTR, LCTR, LCTR, LCTR, LCTR, LCTR, LCTR, 0xFF, 0x00, -/* sc=1e */ 0xc6, 0xe6, 0x01, 0x01, SET8|'a', SET8|'A', SET8|0x01, SET8|0x01, 0x00, 0x01, -/* sc=1f */ 0xd9, 0xf9, 0x13, 0x13, SET8|'s', SET8|'S', SET8|0x13, SET8|0x13, 0x00, 0x01, -/* sc=20 */ 0xd7, 0xf7, 0x04, 0x04, SET8|'d', SET8|'D', SET8|0x04, SET8|0x04, 0x00, 0x01, -/* sc=21 */ 0xc1, 0xe1, 0x06, 0x06, SET8|'f', SET8|'F', SET8|0x06, SET8|0x06, 0x00, 0x01, -/* sc=22 */ 0xd0, 0xf0, 0x07, 0x07, SET8|'g', SET8|'G', SET8|0x07, SET8|0x07, 0x00, 0x01, -/* sc=23 */ 0xd2, 0xf2, 0x08, 0x08, SET8|'h', SET8|'H', SET8|0x08, SET8|0x08, 0x00, 0x01, -/* sc=24 */ 0xcf, 0xef, 0x0A, 0x0A, SET8|'j', SET8|'J', SET8|0x0A, SET8|0x0A, 0x00, 0x01, -/* sc=25 */ 0xcc, 0xec, 0x0B, 0x0B, SET8|'k', SET8|'K', SET8|0x0B, SET8|0x0B, 0x00, 0x01, -/* sc=26 */ 0xc4, 0xe4, 0x0C, 0x0C, SET8|'l', SET8|'L', SET8|0x0C, SET8|0x0C, 0x00, 0x01, -/* sc=27 */ 0xd6, 0xf6, NOP, NOP, SET8|';', SET8|':', NOP, NOP, 0x33, 0x01, -/* sc=28 */ 0xdc, 0xfc, NOP, NOP, SET8|'\'', SET8|'"', NOP, NOP, 0x33, 0x01, -/* sc=29 */ 0xa3, 0xb3, NOP, NOP, SET8|'`', SET8|'~', NOP, NOP, 0x33, 0x01, -/* sc=2a */ LSH, LSH, LSH, LSH, LSH, LSH, LSH, LSH, 0xFF, 0x00, -/* sc=2b */ '\\', '|', 0x1C, 0x1C, SET8|'\\', SET8|'|', SET8|0x1C, SET8|0x1C, 0x00, 0x00, -/* sc=2c */ 0xd1, 0xf1, 0x1A, 0x1A, SET8|'z', SET8|'Z', SET8|0x1A, SET8|0x1A, 0x00, 0x01, -/* sc=2d */ 0xde, 0xfe, 0x18, 0x18, SET8|'x', SET8|'X', SET8|0x18, SET8|0x18, 0x00, 0x01, -/* sc=2e */ 0xd3, 0xf3, 0x03, 0x03, SET8|'c', SET8|'C', SET8|0x03, SET8|0x03, 0x00, 0x01, -/* sc=2f */ 0xcd, 0xed, 0x16, 0x16, SET8|'v', SET8|'V', SET8|0x16, SET8|0x16, 0x00, 0x01, -/* sc=30 */ 0xc9, 0xe9, 0x02, 0x02, SET8|'b', SET8|'B', SET8|0x02, SET8|0x02, 0x00, 0x01, -/* sc=31 */ 0xd4, 0xf4, 0x0E, 0x0E, SET8|'n', SET8|'N', SET8|0x0E, SET8|0x0E, 0x00, 0x01, -/* sc=32 */ 0xd8, 0xf8, 0x0D, 0x0D, SET8|'m', SET8|'M', SET8|0x0D, SET8|0x0D, 0x00, 0x01, -/* sc=33 */ 0xc2, 0xe2, NOP, NOP, SET8|',', SET8|'<', NOP, NOP, 0x33, 0x01, -/* sc=34 */ 0xc0, 0xe0, NOP, NOP, SET8|'.', SET8|'>', NOP, NOP, 0x33, 0x01, -/* sc=35 */ '/', '?', NOP, NOP, SET8|'/', SET8|'?', NOP, NOP, 0x33, 0x00, -/* sc=36 */ RSH, RSH, RSH, RSH, RSH, RSH, RSH, RSH, 0xFF, 0x00, -/* sc=37 */ '*', '*', 0x0A, 0x0A, SET8|'*', SET8|'*', SET8|0x0A, SET8|0x0A, 0x00, 0x00, -/* sc=38 */ LALT, LALT, LALT, LALT, LALT, LALT, LALT, LALT, 0xFF, 0x00, -/* sc=39 */ ' ', ' ', 0x00, ' ', SET8|' ', SET8|' ', SUSP, SET8|' ', 0x00, 0x00, -/* sc=3a */ ALK, CLK, CLK, CLK, CLK, CLK, CLK, CLK, 0xFF, 0x00, -/* sc=3b */ F( 1), F(13), F(25), F(37), S( 1), S(11), S( 1), S(11), 0xFF, 0x00, -/* sc=3c */ F( 2), F(14), F(26), F(38), S( 2), S(12), S( 2), S(12), 0xFF, 0x00, -/* sc=3d */ F( 3), F(15), F(27), F(39), S( 3), S(13), S( 3), S(13), 0xFF, 0x00, -/* sc=3e */ F( 4), F(16), F(28), F(40), S( 4), S(14), S( 4), S(14), 0xFF, 0x00, -/* sc=3f */ F( 5), F(17), F(29), F(41), S( 5), S(15), S( 5), S(15), 0xFF, 0x00, -/* sc=40 */ F( 6), F(18), F(30), F(42), S( 6), S(16), S( 6), S(16), 0xFF, 0x00, -/* sc=41 */ F( 7), F(19), F(31), F(43), S( 7), S( 7), S( 7), S( 7), 0xFF, 0x00, -/* sc=42 */ F( 8), F(20), F(32), F(44), S( 8), S( 8), S( 8), S( 8), 0xFF, 0x00, -/* sc=43 */ F( 9), F(21), F(33), F(45), S( 9), S( 9), S( 9), S( 9), 0xFF, 0x00, -/* sc=44 */ F(10), F(22), F(34), F(46), S(10), S(10), S(10), S(10), 0xFF, 0x00, -/* sc=45 */ NLK, NLK, NLK, NLK, NLK, NLK, NLK, NLK, 0xFF, 0x00, -/* sc=46 */ SLK, SLK, SLK, SLK, SLK, SLK, SLK, SLK, 0xFF, 0x00, -/* sc=47 */ F(49), '7', '7', '7', SET8|'7', SET8|'7', SET8|'7', SET8|'7', 0x80, 0x02, -/* sc=48 */ F(50), '8', '8', '8', SET8|'8', SET8|'8', SET8|'8', SET8|'8', 0x80, 0x02, -/* sc=49 */ F(51), '9', '9', '9', SET8|'9', SET8|'9', SET8|'9', SET8|'9', 0x80, 0x02, -/* sc=4a */ F(52), '-', '-', '-', SET8|'-', SET8|'-', SET8|'-', SET8|'-', 0x80, 0x02, -/* sc=4b */ F(53), '4', '4', '4', SET8|'4', SET8|'4', SET8|'4', SET8|'4', 0x80, 0x02, -/* sc=4c */ F(54), '5', '5', '5', SET8|'5', SET8|'5', SET8|'5', SET8|'5', 0x80, 0x02, -/* sc=4d */ F(55), '6', '6', '6', SET8|'6', SET8|'6', SET8|'6', SET8|'6', 0x80, 0x02, -/* sc=4e */ F(56), '+', '+', '+', SET8|'+', SET8|'+', SET8|'+', SET8|'+', 0x80, 0x02, -/* sc=4f */ F(57), '1', '1', '1', SET8|'1', SET8|'1', SET8|'1', SET8|'1', 0x80, 0x02, -/* sc=50 */ F(58), '2', '2', '2', SET8|'2', SET8|'2', SET8|'2', SET8|'2', 0x80, 0x02, -/* sc=51 */ F(59), '3', '3', '3', SET8|'3', SET8|'3', SET8|'3', SET8|'3', 0x80, 0x02, -/* sc=52 */ F(60), '0', '0', '0', SET8|'0', SET8|'0', SET8|'0', SET8|'0', 0x80, 0x02, -/* sc=53 */ 0x7F, '.', '.', '.', SET8|'.', SET8|'.', RBT, RBT, 0x03, 0x02, -/* sc=54 */ ALK, ALK, ALK, ALK, ALK, ALK, ALK, ALK, 0xFF, 0x00, -/* sc=55 */ NOP, NOP, NOP, NOP, NOP, NOP, NOP, NOP, 0xFF, 0x00, -/* sc=56 */ NOP, NOP, NOP, NOP, NOP, NOP, NOP, NOP, 0xFF, 0x00, -/* sc=57 */ F(11), F(23), F(35), F(47), S(11), S(11), S(11), S(11), 0xFF, 0x00, -/* sc=58 */ F(12), F(24), F(36), F(48), S(12), S(12), S(12), S(12), 0xFF, 0x00, -/* sc=59 */ 0x0D, 0x0D, 0x0A, 0x0A, SET8|0x0D, SET8|0x0D, SET8|0x0A, SET8|0x0A, 0x00, 0x00, -/* sc=5a */ RCTR, RCTR, RCTR, RCTR, RCTR, RCTR, RCTR, RCTR, 0xFF, 0x00, -/* sc=5b */ '/', '/', NOP, NOP, SET8|'/', SET8|'/', NOP, NOP, 0x33, 0x00, -/* sc=5c */ NEXT, NEXT, DBG, DBG, NOP, NOP, NOP, NOP, 0xFF, 0x00, -/* sc=5d */ RALT, RALT, RALT, RALT, RALT, RALT, RALT, RALT, 0xFF, 0x00, -/* sc=5e */ F(49), F(49), F(49), F(49), F(49), F(49), F(49), F(49), 0xFF, 0x00, -/* sc=5f */ F(50), F(50), F(50), F(50), F(50), F(50), F(50), F(50), 0xFF, 0x00, -/* sc=60 */ F(51), F(51), F(51), F(51), F(51), F(51), F(51), F(51), 0xFF, 0x00, -/* sc=61 */ F(53), F(53), F(53), F(53), F(53), F(53), F(53), F(53), 0xFF, 0x00, -/* sc=62 */ F(55), F(55), F(55), F(55), F(55), F(55), F(55), F(55), 0xFF, 0x00, -/* sc=63 */ F(57), F(57), F(57), F(57), F(57), F(57), F(57), F(57), 0xFF, 0x00, -/* sc=64 */ F(58), F(58), F(58), F(58), F(58), F(58), F(58), F(58), 0xFF, 0x00, -/* sc=65 */ F(59), F(59), F(59), F(59), F(59), F(59), F(59), F(59), 0xFF, 0x00, -/* sc=66 */ F(60), F(60), F(60), F(60), F(60), F(60), F(60), F(60), 0xFF, 0x00, -/* sc=67 */ F(61), F(61), F(61), F(61), F(61), F(61), RBT, F(61), 0xFF, 0x00, -/* sc=68 */ SLK, SPSC, SLK, SPSC, SUSP, NOP, SUSP, NOP, 0xFF, 0x00, -/* sc=69 */ F(62), F(62), F(62), F(62), F(62), F(62), F(62), F(62), 0xFF, 0x00, -/* sc=6a */ F(63), F(63), F(63), F(63), F(63), F(63), F(63), F(63), 0xFF, 0x00, -/* sc=6b */ F(64), F(64), F(64), F(64), F(64), F(64), F(64), F(64), 0xFF, 0x00, -/* sc=6c */ NOP, NOP, NOP, NOP, NOP, NOP, NOP, NOP, 0xFF, 0x00, -} }; - -#endif - -#ifdef ESKEYMAP -#define ISO_ACCENTCHARS -static keymap_t key_map = { 0x6D, { /* spanish iso8859 keymap */ -/* alt - * scan cntrl alt alt cntrl - * code base shift cntrl shift alt shift cntrl shift spcl flgs - * --------------------------------------------------------------------------- - */ -/* sc=00 */ NOP, NOP, NOP, NOP, NOP, NOP, NOP, NOP, 0xFF, 0x00, -/* sc=01 */ 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, DBG, 0x1B, 0x00, 0x00, -/* sc=02 */ '1', '!', NOP, NOP, '|', '|', NOP, NOP, 0x33, 0x00, -/* sc=03 */ '2', '"', 0x00, 0x00, '@', '@', 0x00, 0x00, 0x00, 0x00, -/* sc=04 */ '3', 0xB7, NOP, NOP, '#', '#', NOP, NOP, 0x33, 0x00, -/* sc=05 */ '4', '$', NOP, NOP, '4', '4', NOP, NOP, 0x33, 0x00, -/* sc=06 */ '5', '%', NOP, NOP, '5', '5', NOP, NOP, 0x33, 0x00, -/* sc=07 */ '6', '&', 0x1E, 0x1E, 0xAC, 0xAC, 0x1E, 0x1E, 0x00, 0x00, -/* sc=08 */ '7', '/', 0x1B, 0x1B, '7', '7', 0x1B, 0x1B, 0x00, 0x00, -/* sc=09 */ '8', '(', NOP, NOP, '8', '8', NOP, NOP, 0x33, 0x00, -/* sc=0a */ '9', ')', 0x1D, 0x1D, '8', '8', 0x1D, 0x1D, 0x00, 0x00, -/* sc=0b */ '0', '=', NOP, NOP, '9', '9', NOP, NOP, 0x33, 0x00, -/* sc=0c */ '\'', '?', NOP, NOP, '\'', '\'', NOP, NOP, 0x33, 0x00, -/* sc=0d */ 0xA1, 0xBF, NOP, NOP, '\'', '`', NOP, NOP, 0x33, 0x00, -/* sc=0e */ 0x08, 0x08, 0x7F, 0x7F, 0x08, 0x08, 0x7F, 0x7F, 0x00, 0x00, -/* sc=0f */ 0x09, BTAB, NOP, NOP, 0x09, BTAB, NOP, NOP, 0x77, 0x00, -/* sc=10 */ 'q', 'Q', 0x11, 0x11, 'q', 'Q', 0x11, 0x11, 0x00, 0x01, -/* sc=11 */ 'w', 'W', 0x17, 0x17, 'w', 'W', 0x17, 0x17, 0x00, 0x01, -/* sc=12 */ 'e', 'E', 0x05, 0x05, 0xE9, 0xC9, 0x05, 0x05, 0x00, 0x01, -/* sc=13 */ 'r', 'R', 0x12, 0x12, 'r', 'R', 0x12, 0x12, 0x00, 0x01, -/* sc=14 */ 't', 'T', 0x14, 0x14, 't', 'T', 0x14, 0x14, 0x00, 0x01, -/* sc=15 */ 'y', 'Y', 0x19, 0x19, 'y', 'Y', 0x1A, 0x1A, 0x00, 0x01, -/* sc=16 */ 'u', 'U', 0x15, 0x15, 0xFA, 0xDA, 0x15, 0x15, 0x00, 0x01, -/* sc=17 */ 'i', 'I', 0x09, 0x09, 0xED, 0xCD, 0x09, 0x09, 0x00, 0x01, -/* sc=18 */ 'o', 'O', 0x0F, 0x0F, 0xF3, 0xD3, 0x0F, 0x0F, 0x00, 0x01, -/* sc=19 */ 'p', 'P', 0x10, 0x10, 'p', 'P', 0x10, 0x10, 0x00, 0x01, -/* sc=1a */ DGRA, DCIR, 0x1B, 0x1B, '[', '[', 0x1B, 0x1B, 0xC0, 0x01, -/* sc=1b */ '+', '*', 0x1D, 0x1D, ']', '[', 0x1D, 0x1D, 0x00, 0x00, -/* sc=1c */ 0x0D, 0x0D, 0x0A, 0x0A, 0x0D, 0x0D, 0x0A, 0x0A, 0x00, 0x00, -/* sc=1d */ LCTR, LCTR, LCTR, LCTR, LCTR, LCTR, LCTR, LCTR, 0xFF, 0x00, -/* sc=1e */ 'a', 'A', 0x01, 0x01, 0xE1, 0xC1, 0x01, 0x01, 0x00, 0x01, -/* sc=1f */ 's', 'S', 0x13, 0x13, 's', 'S', 0x13, 0x13, 0x00, 0x01, -/* sc=20 */ 'd', 'D', 0x04, 0x04, 'd', 'D', 0x04, 0x04, 0x00, 0x01, -/* sc=21 */ 'f', 'F', 0x06, 0x06, 'f', 'F', 0x06, 0x06, 0x00, 0x01, -/* sc=22 */ 'g', 'G', 0x07, 0x07, 'g', 'G', 0x07, 0x07, 0x00, 0x01, -/* sc=23 */ 'h', 'H', 0x08, 0x08, 'h', 'H', 0x08, 0x08, 0x00, 0x01, -/* sc=24 */ 'j', 'J', 0x0A, 0x0A, 'j', 'J', 0x0A, 0x0A, 0x00, 0x01, -/* sc=25 */ 'k', 'K', 0x0B, 0x0B, 'k', 'K', 0x0B, 0x0B, 0x00, 0x01, -/* sc=26 */ 'l', 'L', 0x0C, 0x0C, 'l', 'L', 0x0C, 0x0C, 0x00, 0x01, -/* sc=27 */ 0xF1, 0xD1, NOP, NOP, '~', NOP, NOP, NOP, 0x37, 0x01, -/* sc=28 */ DACU, DUML, NOP, NOP, '{', '}', NOP, NOP, 0xF3, 0x01, -/* sc=29 */ 0xBA, 0xAA, 0x1C, 0x1C, '\\', '\\', 0x1C, 0x1C, 0x00, 0x00, -/* sc=2a */ LSH, LSH, LSH, LSH, LSH, LSH, LSH, LSH, 0xFF, 0x00, -/* sc=2b */ 0xE7, 0xC7, 0x1E, 0x1E, '}', '}', 0x1E, 0x1E, 0x00, 0x00, -/* sc=2c */ 'z', 'Z', 0x1A, 0x1A, 'z', 'Z', 0x19, 0x19, 0x00, 0x01, -/* sc=2d */ 'x', 'X', 0x18, 0x18, 'x', 'X', 0x18, 0x18, 0x00, 0x01, -/* sc=2e */ 'c', 'C', 0x03, 0x03, 'c', 'C', 0x03, 0x03, 0x00, 0x01, -/* sc=2f */ 'v', 'V', 0x16, 0x16, 'v', 'V', 0x16, 0x16, 0x00, 0x01, -/* sc=30 */ 'b', 'B', 0x02, 0x02, 'b', 'B', 0x02, 0x02, 0x00, 0x01, -/* sc=31 */ 'n', 'N', 0x0E, 0x0E, 'n', 'N', 0x0E, 0x0E, 0x00, 0x01, -/* sc=32 */ 'm', 'M', 0x0D, 0x0D, 'm', 'M', 0x0D, 0x0D, 0x00, 0x01, -/* sc=33 */ ',', ';', NOP, NOP, ',', ';', NOP, NOP, 0x33, 0x00, -/* sc=34 */ '.', ':', NOP, NOP, '.', ':', NOP, NOP, 0x33, 0x00, -/* sc=35 */ '-', '_', 0x1F, 0x1F, '-', '_', 0x1F, 0x1F, 0x00, 0x00, -/* sc=36 */ RSH, RSH, RSH, RSH, RSH, RSH, RSH, RSH, 0xFF, 0x00, -/* sc=37 */ '*', '*', '*', '*', '*', '*', '*', '*', 0x00, 0x00, -/* sc=38 */ LALT, LALT, LALT, LALT, LALT, LALT, LALT, LALT, 0xFF, 0x00, -/* sc=39 */ ' ', ' ', 0x00, ' ', ' ', ' ', SUSP, ' ', 0x00, 0x00, -/* sc=3a */ CLK, CLK, CLK, CLK, CLK, CLK, CLK, CLK, 0xFF, 0x00, -/* sc=3b */ F( 1), F(13), F(25), F(37), S( 1), S(11), S( 1), S(11), 0xFF, 0x00, -/* sc=3c */ F( 2), F(14), F(26), F(38), S( 2), S(12), S( 2), S(12), 0xFF, 0x00, -/* sc=3d */ F( 3), F(15), F(27), F(39), S( 3), S(13), S( 3), S(13), 0xFF, 0x00, -/* sc=3e */ F( 4), F(16), F(28), F(40), S( 4), S(14), S( 4), S(14), 0xFF, 0x00, -/* sc=3f */ F( 5), F(17), F(29), F(41), S( 5), S(15), S( 5), S(15), 0xFF, 0x00, -/* sc=40 */ F( 6), F(18), F(30), F(42), S( 6), S(16), S( 6), S(16), 0xFF, 0x00, -/* sc=41 */ F( 7), F(19), F(31), F(43), S( 7), S( 7), S( 7), S( 7), 0xFF, 0x00, -/* sc=42 */ F( 8), F(20), F(32), F(44), S( 8), S( 8), S( 8), S( 8), 0xFF, 0x00, -/* sc=43 */ F( 9), F(21), F(33), F(45), S( 9), S( 9), S( 9), S( 9), 0xFF, 0x00, -/* sc=44 */ F(10), F(22), F(34), F(46), S(10), S(10), S(10), S(10), 0xFF, 0x00, -/* sc=45 */ NLK, NLK, NLK, NLK, NLK, NLK, NLK, NLK, 0xFF, 0x00, -/* sc=46 */ SLK, SLK, SLK, SLK, SLK, SLK, SLK, SLK, 0xFF, 0x00, -/* sc=47 */ F(49), '7', '7', '7', '7', '7', '7', '7', 0x80, 0x02, -/* sc=48 */ F(50), '8', '8', '8', '8', '8', '8', '8', 0x80, 0x02, -/* sc=49 */ F(51), '9', '9', '9', '9', '9', '9', '9', 0x80, 0x02, -/* sc=4a */ F(52), '-', '-', '-', '-', '-', '-', '-', 0x80, 0x02, -/* sc=4b */ F(53), '4', '4', '4', '4', '4', '4', '4', 0x80, 0x02, -/* sc=4c */ F(54), '5', '5', '5', '5', '5', '5', '5', 0x80, 0x02, -/* sc=4d */ F(55), '6', '6', '6', '6', '6', '6', '6', 0x80, 0x02, -/* sc=4e */ F(56), '+', '+', '+', '+', '+', '+', '+', 0x80, 0x02, -/* sc=4f */ F(57), '1', '1', '1', '1', '1', '1', '1', 0x80, 0x02, -/* sc=50 */ F(58), '2', '2', '2', '2', '2', '2', '2', 0x80, 0x02, -/* sc=51 */ F(59), '3', '3', '3', '3', '3', '3', '3', 0x80, 0x02, -/* sc=52 */ F(60), '0', '0', '0', '0', '0', '0', '0', 0x80, 0x02, -/* sc=53 */ 0x7F, '.', '.', '.', '.', '.', RBT, RBT, 0x03, 0x02, -/* sc=54 */ NOP, NOP, NOP, NOP, NOP, NOP, NOP, NOP, 0xFF, 0x00, -/* sc=55 */ NOP, NOP, NOP, NOP, NOP, NOP, NOP, NOP, 0xFF, 0x00, -/* sc=56 */ '<', '>', 0x1C, 0x1C, '\\', '>', 0x1C, 0x1C, 0x00, 0x00, -/* sc=57 */ F(11), F(23), F(35), F(47), S(11), S(11), S(11), S(11), 0xFF, 0x00, -/* sc=58 */ F(12), F(24), F(36), F(48), S(12), S(12), S(12), S(12), 0xFF, 0x00, -/* sc=59 */ 0x0D, 0x0D, 0x0A, 0x0A, 0x0D, 0x0D, 0x0A, 0x0A, 0x00, 0x00, -/* sc=5a */ RCTR, RCTR, RCTR, RCTR, RCTR, RCTR, RCTR, RCTR, 0xFF, 0x00, -/* sc=5b */ '/', '/', '/', '/', '/', '/', '/', '/', 0x00, 0x02, -/* sc=5c */ NEXT, NEXT, DBG, DBG, NOP, NOP, NOP, NOP, 0xFF, 0x00, -/* sc=5d */ RALT, RALT, RALT, RALT, RALT, RALT, RALT, RALT, 0xFF, 0x00, -/* sc=5e */ F(49), F(49), F(49), F(49), F(49), F(49), F(49), F(49), 0xFF, 0x00, -/* sc=5f */ F(50), F(50), F(50), F(50), F(50), F(50), F(50), F(50), 0xFF, 0x00, -/* sc=60 */ F(51), F(51), F(51), F(51), F(51), F(51), F(51), F(51), 0xFF, 0x00, -/* sc=61 */ F(53), F(53), F(53), F(53), F(53), F(53), F(53), F(53), 0xFF, 0x00, -/* sc=62 */ F(55), F(55), F(55), F(55), F(55), F(55), F(55), F(55), 0xFF, 0x00, -/* sc=63 */ F(57), F(57), F(57), F(57), F(57), F(57), F(57), F(57), 0xFF, 0x00, -/* sc=64 */ F(58), F(58), F(58), F(58), F(58), F(58), F(58), F(58), 0xFF, 0x00, -/* sc=65 */ F(59), F(59), F(59), F(59), F(59), F(59), F(59), F(59), 0xFF, 0x00, -/* sc=66 */ F(60), F(60), F(60), F(60), F(60), F(60), F(60), F(60), 0xFF, 0x00, -/* sc=67 */ F(61), F(61), F(61), F(61), F(61), F(61), RBT, F(61), 0xFF, 0x00, -/* sc=68 */ SLK, SPSC, SLK, SPSC, SUSP, NOP, SUSP, NOP, 0xFF, 0x00, -/* sc=69 */ F(62), F(62), F(62), F(62), F(62), F(62), F(62), F(62), 0xFF, 0x00, -/* sc=6a */ F(63), F(63), F(63), F(63), F(63), F(63), F(63), F(63), 0xFF, 0x00, -/* sc=6b */ F(64), F(64), F(64), F(64), F(64), F(64), F(64), F(64), 0xFF, 0x00, -/* sc=6c */ NOP, NOP, NOP, NOP, NOP, NOP, NOP, NOP, 0xFF, 0x00, -} }; -#endif - -#ifdef ISKEYMAP -#define ISO_ACCENTCHARS -static keymap_t key_map = { 0x6D, { /* icelandic iso8859 keymap */ -/* alt - * scan cntrl alt alt cntrl - * code base shift cntrl shift alt shift cntrl shift spcl flgs - * --------------------------------------------------------------------------- - */ -/* sc=00 */ NOP, NOP, NOP, NOP, NOP, NOP, NOP, NOP, 0xFF, 0x00, -/* sc=01 */ 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, DBG, 0x1B, 0x02, 0x00, -/* sc=02 */ '1', '!', NOP, NOP, NOP, NOP, NOP, NOP, 0x3F, 0x00, -/* sc=03 */ '2', '"', 0x00, 0x00, NOP, NOP, 0x00, 0x00, 0x0C, 0x00, -/* sc=04 */ '3', '#', NOP, NOP, 0xA3, NOP, NOP, NOP, 0x37, 0x00, -/* sc=05 */ '4', '$', NOP, NOP, 0xA4, NOP, NOP, NOP, 0x37, 0x00, -/* sc=06 */ '5', '%', NOP, NOP, NOP, NOP, NOP, NOP, 0x3F, 0x00, -/* sc=07 */ '6', '&', NOP, NOP, NOP, NOP, NOP, NOP, 0x3F, 0x00, -/* sc=08 */ '7', '/', NOP, NOP, '{', NOP, NOP, NOP, 0x37, 0x00, -/* sc=09 */ '8', '(', NOP, NOP, '[', NOP, NOP, NOP, 0x37, 0x00, -/* sc=0a */ '9', ')', NOP, NOP, ']', NOP, NOP, NOP, 0x37, 0x00, -/* sc=0b */ '0', '=', NOP, NOP, '}', NOP, NOP, NOP, 0x37, 0x00, -/* sc=0c */ 0xF6, 0xD6, NOP, NOP, '\\', NOP, 0x1C, NOP, 0x35, 0x00, -/* sc=0d */ '-', '_', NOP, NOP, NOP, NOP, NOP, NOP, 0x3F, 0x00, -/* sc=0e */ 0x08, 0x08, 0x7F, 0x7F, 0x08, 0x08, 0x7F, 0x7F, 0x00, 0x00, -/* sc=0f */ 0x09, BTAB, NOP, NOP, 0x09, BTAB, NOP, NOP, 0x77, 0x00, -/* sc=10 */ 'q', 'Q', 0x11, 0x11, '@', 'Q', 0x11, 0x11, 0x00, 0x01, -/* sc=11 */ 'w', 'W', 0x17, 0x17, 'w', 'W', 0x17, 0x17, 0x00, 0x01, -/* sc=12 */ 'e', 'E', 0x05, 0x05, 'e', 'E', 0x05, 0x05, 0x00, 0x01, -/* sc=13 */ 'r', 'R', 0x12, 0x12, 'r', 'R', 0x12, 0x12, 0x00, 0x01, -/* sc=14 */ 't', 'T', 0x14, 0x14, 't', 'T', 0x14, 0x14, 0x00, 0x01, -/* sc=15 */ 'y', 'Y', 0x19, 0x19, 'y', 'Y', 0x19, 0x19, 0x00, 0x01, -/* sc=16 */ 'u', 'U', 0x15, 0x15, 'u', 'U', 0x15, 0x15, 0x00, 0x01, -/* sc=17 */ 'i', 'I', 0x09, 0x09, 'i', 'I', 0x09, 0x09, 0x00, 0x01, -/* sc=18 */ 'o', 'O', 0x0F, 0x0F, 'o', 'O', 0x0F, 0x0F, 0x00, 0x01, -/* sc=19 */ 'p', 'P', 0x10, 0x10, 'p', 'P', 0x10, 0x10, 0x00, 0x01, -/* sc=1a */ 0xF0, 0xD0, NOP, NOP, '}', ']', NOP, NOP, 0x33, 0x01, -/* sc=1b */ '\'', '?', NOP, NOP, '~', NOP, NOP, NOP, 0x00, 0x01, -/* sc=1c */ 0x0D, 0x0D, 0x0A, 0x0A, 0x0D, 0x0D, 0x0A, 0x0A, 0x00, 0x00, -/* sc=1d */ LCTR, LCTR, LCTR, LCTR, LCTR, LCTR, LCTR, LCTR, 0xFF, 0x00, -/* sc=1e */ 'a', 'A', 0x01, 0x01, 'a', 'A', 0x01, 0x01, 0x00, 0x01, -/* sc=1f */ 's', 'S', 0x13, 0x13, 0xDF, 'S', 0x13, 0x13, 0x00, 0x01, -/* sc=20 */ 'd', 'D', 0x04, 0x04, 'd', 'D', 0x04, 0x04, 0x00, 0x01, -/* sc=21 */ 'f', 'F', 0x06, 0x06, 'f', 'F', 0x06, 0x06, 0x00, 0x01, -/* sc=22 */ 'g', 'G', 0x07, 0x07, 'g', 'G', 0x07, 0x07, 0x00, 0x01, -/* sc=23 */ 'h', 'H', 0x08, 0x08, 'h', 'H', 0x08, 0x08, 0x00, 0x01, -/* sc=24 */ 'j', 'J', 0x0A, 0x0A, 'j', 'J', 0x0A, 0x0A, 0x00, 0x01, -/* sc=25 */ 'k', 'K', 0x0B, 0x0B, 'k', 'K', 0x0B, 0x0B, 0x00, 0x01, -/* sc=26 */ 'l', 'L', 0x0C, 0x0C, 'l', 'L', 0x0C, 0x0C, 0x00, 0x01, -/* sc=27 */ 0xE6, 0xC6, NOP, NOP, '|', '\\', NOP, NOP, 0x33, 0x01, -/* sc=28 */ DACU, DACU, NOP, NOP, DTIL, '[', NOP, NOP, 0xFB, 0x01, -/* sc=29 */ DRIN, DDIA, NOP, NOP, DCIR, '*', NOP, NOP, 0xFB, 0x00, -/* sc=2a */ LSH, LSH, LSH, LSH, LSH, LSH, LSH, LSH, 0xFF, 0x00, -/* sc=2b */ '+', '*', NOP, NOP, '`', '*', NOP, NOP, 0x00, 0x01, -/* sc=2c */ 'z', 'Z', 0x1A, 0x1A, 'z', 'Z', 0x1A, 0x1A, 0x00, 0x01, -/* sc=2d */ 'x', 'X', 0x18, 0x18, 'x', 'X', 0x18, 0x18, 0x00, 0x01, -/* sc=2e */ 'c', 'C', 0x03, 0x03, 'c', 'C', 0x03, 0x03, 0x00, 0x01, -/* sc=2f */ 'v', 'V', 0x16, 0x16, 'v', 'V', 0x16, 0x16, 0x00, 0x01, -/* sc=30 */ 'b', 'B', 0x02, 0x02, 'b', 'B', 0x02, 0x02, 0x00, 0x01, -/* sc=31 */ 'n', 'N', 0x0E, 0x0E, 'n', 'N', 0x0E, 0x0E, 0x00, 0x01, -/* sc=32 */ 'm', 'M', 0x0D, 0x0D, 'm', 'M', 0x0D, 0x0D, 0x00, 0x01, -/* sc=33 */ ',', ';', NOP, NOP, NOP, '<', NOP, NOP, 0x3B, 0x00, -/* sc=34 */ '.', ':', NOP, NOP, NOP, '>', NOP, NOP, 0x3B, 0x00, -/* sc=35 */ 0xFE, 0xDE, 0x1F, NOP, '/', '?', NOP, NOP, 0x13, 0x00, -/* sc=36 */ RSH, RSH, RSH, RSH, RSH, RSH, RSH, RSH, 0xFF, 0x00, -/* sc=37 */ '*', '*', '*', '*', '*', '*', '*', '*', 0x00, 0x00, -/* sc=38 */ LALT, LALT, LALT, LALT, LALT, LALT, LALT, LALT, 0xFF, 0x00, -/* sc=39 */ ' ', ' ', 0x00, ' ', ' ', ' ', SUSP, ' ', 0x02, 0x00, -/* sc=3a */ CLK, CLK, CLK, CLK, CLK, CLK, CLK, CLK, 0xFF, 0x00, -/* sc=3b */ F( 1), F(13), F(25), F(37), S( 1), S(11), S( 1), S(11), 0xFF, 0x00, -/* sc=3c */ F( 2), F(14), F(26), F(38), S( 2), S(12), S( 2), S(12), 0xFF, 0x00, -/* sc=3d */ F( 3), F(15), F(27), F(39), S( 3), S(13), S( 3), S(13), 0xFF, 0x00, -/* sc=3e */ F( 4), F(16), F(28), F(40), S( 4), S(14), S( 4), S(14), 0xFF, 0x00, -/* sc=3f */ F( 5), F(17), F(29), F(41), S( 5), S(15), S( 5), S(15), 0xFF, 0x00, -/* sc=40 */ F( 6), F(18), F(30), F(42), S( 6), S(16), S( 6), S(16), 0xFF, 0x00, -/* sc=41 */ F( 7), F(19), F(31), F(43), S( 7), S( 7), S( 7), S( 7), 0xFF, 0x00, -/* sc=42 */ F( 8), F(20), F(32), F(44), S( 8), S( 8), S( 8), S( 8), 0xFF, 0x00, -/* sc=43 */ F( 9), F(21), F(33), F(45), S( 9), S( 9), S( 9), S( 9), 0xFF, 0x00, -/* sc=44 */ F(10), F(22), F(34), F(46), S(10), S(10), S(10), S(10), 0xFF, 0x00, -/* sc=45 */ NLK, NLK, NLK, NLK, NLK, NLK, NLK, NLK, 0xFF, 0x00, -/* sc=46 */ SLK, SLK, SLK, SLK, SLK, SLK, SLK, SLK, 0xFF, 0x00, -/* sc=47 */ F(49), '7', '7', '7', '7', '7', '7', '7', 0x80, 0x02, -/* sc=48 */ F(50), '8', '8', '8', '8', '8', '8', '8', 0x80, 0x02, -/* sc=49 */ F(51), '9', '9', '9', '9', '9', '9', '9', 0x80, 0x02, -/* sc=4a */ F(52), '-', '-', '-', '-', '-', '-', '-', 0x80, 0x02, -/* sc=4b */ F(53), '4', '4', '4', '4', '4', '4', '4', 0x80, 0x02, -/* sc=4c */ F(54), '5', '5', '5', '5', '5', '5', '5', 0x80, 0x02, -/* sc=4d */ F(55), '6', '6', '6', '6', '6', '6', '6', 0x80, 0x02, -/* sc=4e */ F(56), '+', '+', '+', '+', '+', '+', '+', 0x80, 0x02, -/* sc=4f */ F(57), '1', '1', '1', '1', '1', '1', '1', 0x80, 0x02, -/* sc=50 */ F(58), '2', '2', '2', '2', '2', '2', '2', 0x80, 0x02, -/* sc=51 */ F(59), '3', '3', '3', '3', '3', '3', '3', 0x80, 0x02, -/* sc=52 */ F(60), '0', '0', '0', '0', '0', '0', '0', 0x80, 0x02, -/* sc=53 */ 0x7F, '.', '.', '.', '.', '.', RBT, RBT, 0x03, 0x02, -/* sc=54 */ NOP, NOP, NOP, NOP, NOP, NOP, NOP, NOP, 0xFF, 0x00, -/* sc=55 */ NOP, NOP, NOP, NOP, NOP, NOP, NOP, NOP, 0xFF, 0x00, -/* sc=56 */ '<', '>', NOP, NOP, '|', NOP, NOP, NOP, 0x37, 0x00, -/* sc=57 */ F(11), F(23), F(35), F(47), S(11), S(11), S(11), S(11), 0xFF, 0x00, -/* sc=58 */ F(12), F(24), F(36), F(48), S(12), S(12), S(12), S(12), 0xFF, 0x00, -/* sc=59 */ 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0xFF, 0x02, -/* sc=5a */ RCTR, RCTR, RCTR, RCTR, RCTR, RCTR, RCTR, RCTR, 0xFF, 0x00, -/* sc=5b */ '/', '/', '/', '/', '/', '/', '/', '/', 0x00, 0x02, -/* sc=5c */ NEXT, NEXT, DBG, DBG, NOP, NOP, NOP, NOP, 0xFF, 0x00, -/* sc=5d */ RALT, RALT, RALT, RALT, RALT, RALT, RALT, RALT, 0xFF, 0x00, -/* sc=5e */ F(49), F(49), F(49), F(49), F(49), F(49), F(49), F(49), 0xFF, 0x00, -/* sc=5f */ F(50), F(50), F(50), F(50), F(50), F(50), F(50), F(50), 0xFF, 0x00, -/* sc=60 */ F(51), F(51), F(51), F(51), F(51), F(51), F(51), F(51), 0xFF, 0x00, -/* sc=61 */ F(53), F(53), F(53), F(53), F(53), F(53), F(53), F(53), 0xFF, 0x00, -/* sc=62 */ F(55), F(55), F(55), F(55), F(55), F(55), F(55), F(55), 0xFF, 0x00, -/* sc=63 */ F(57), F(57), F(57), F(57), F(57), F(57), F(57), F(57), 0xFF, 0x00, -/* sc=64 */ F(58), F(58), F(58), F(58), F(58), F(58), F(58), F(58), 0xFF, 0x00, -/* sc=65 */ F(59), F(59), F(59), F(59), F(59), F(59), F(59), F(59), 0xFF, 0x00, -/* sc=66 */ F(60), F(60), F(60), F(60), F(60), F(60), F(60), F(60), 0xFF, 0x00, -/* sc=67 */ F(61), F(61), F(61), F(61), F(61), F(61), RBT, F(61), 0xFF, 0x00, -/* sc=68 */ SLK, SPSC, SLK, SPSC, SUSP, NOP, SUSP, NOP, 0xFF, 0x00, -/* sc=69 */ F(62), F(62), F(62), F(62), F(62), F(62), F(62), F(62), 0xFF, 0x00, -/* sc=6a */ F(63), F(63), F(63), F(63), F(63), F(63), F(63), F(63), 0xFF, 0x00, -/* sc=6b */ F(64), F(64), F(64), F(64), F(64), F(64), F(64), F(64), 0xFF, 0x00, -/* sc=6c */ NOP, NOP, NOP, NOP, NOP, NOP, NOP, NOP, 0xFF, 0x00, -} }; -#endif - -#if !defined(DKKEYMAP) && !defined(UKKEYMAP) && !defined(GRKEYMAP) && !defined(SWKEYMAP) && !defined(RUKEYMAP) && !defined(ISKEYMAP) && !defined(ESKEYMAP) && !defined(PC98) -#define ISO_ACCENTCHARS -static keymap_t key_map = { 0x6D, { /* US iso8859 keymap */ -/* alt - * scan cntrl alt alt cntrl - * code base shift cntrl shift alt shift cntrl shift spcl flgs - * --------------------------------------------------------------------------- - */ -/* sc=00 */ NOP, NOP, NOP, NOP, NOP, NOP, NOP, NOP, 0xFF, 0x00, -/* sc=01 */ 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, DBG, 0x1B, 0x02, 0x00, -/* sc=02 */ '1', '!', NOP, NOP, '1', '!', NOP, NOP, 0x33, 0x00, -/* sc=03 */ '2', '@', 0x00, 0x00, '2', '@', 0x00, 0x00, 0x00, 0x00, -/* sc=04 */ '3', '#', NOP, NOP, '3', '#', NOP, NOP, 0x33, 0x00, -/* sc=05 */ '4', '$', NOP, NOP, '4', '$', NOP, NOP, 0x33, 0x00, -/* sc=06 */ '5', '%', NOP, NOP, '5', '%', NOP, NOP, 0x33, 0x00, -/* sc=07 */ '6', '^', 0x1E, 0x1E, '6', '^', 0x1E, 0x1E, 0x00, 0x00, -/* sc=08 */ '7', '&', NOP, NOP, '7', '&', NOP, NOP, 0x33, 0x00, -/* sc=09 */ '8', '*', NOP, NOP, '8', '*', NOP, NOP, 0x33, 0x00, -/* sc=0a */ '9', '(', NOP, NOP, '9', '(', NOP, NOP, 0x33, 0x00, -/* sc=0b */ '0', ')', NOP, NOP, '0', ')', NOP, NOP, 0x33, 0x00, -/* sc=0c */ '-', '_', 0x1F, 0x1F, '-', '_', 0x1F, 0x1F, 0x00, 0x00, -/* sc=0d */ '=', '+', NOP, NOP, '=', '+', NOP, NOP, 0x33, 0x00, -/* sc=0e */ 0x08, 0x08, 0x7F, 0x7F, 0x08, 0x08, 0x7F, 0x7F, 0x00, 0x00, -/* sc=0f */ 0x09, BTAB, NOP, NOP, 0x09, BTAB, NOP, NOP, 0x77, 0x00, -/* sc=10 */ 'q', 'Q', 0x11, 0x11, 'q', 'Q', 0x11, 0x11, 0x00, 0x01, -/* sc=11 */ 'w', 'W', 0x17, 0x17, 'w', 'W', 0x17, 0x17, 0x00, 0x01, -/* sc=12 */ 'e', 'E', 0x05, 0x05, 'e', 'E', 0x05, 0x05, 0x00, 0x01, -/* sc=13 */ 'r', 'R', 0x12, 0x12, 'r', 'R', 0x12, 0x12, 0x00, 0x01, -/* sc=14 */ 't', 'T', 0x14, 0x14, 't', 'T', 0x14, 0x14, 0x00, 0x01, -/* sc=15 */ 'y', 'Y', 0x19, 0x19, 'y', 'Y', 0x19, 0x19, 0x00, 0x01, -/* sc=16 */ 'u', 'U', 0x15, 0x15, 'u', 'U', 0x15, 0x15, 0x00, 0x01, -/* sc=17 */ 'i', 'I', 0x09, 0x09, 'i', 'I', 0x09, 0x09, 0x00, 0x01, -/* sc=18 */ 'o', 'O', 0x0F, 0x0F, 'o', 'O', 0x0F, 0x0F, 0x00, 0x01, -/* sc=19 */ 'p', 'P', 0x10, 0x10, 'p', 'P', 0x10, 0x10, 0x00, 0x01, -/* sc=1a */ '[', '{', 0x1B, 0x1B, '[', '{', 0x1B, 0x1B, 0x00, 0x00, -/* sc=1b */ ']', '}', 0x1D, 0x1D, ']', '}', 0x1D, 0x1D, 0x00, 0x00, -/* sc=1c */ 0x0D, 0x0D, 0x0A, 0x0A, 0x0D, 0x0D, 0x0A, 0x0A, 0x00, 0x00, -/* sc=1d */ LCTR, LCTR, LCTR, LCTR, LCTR, LCTR, LCTR, LCTR, 0xFF, 0x00, -/* sc=1e */ 'a', 'A', 0x01, 0x01, 'a', 'A', 0x01, 0x01, 0x00, 0x01, -/* sc=1f */ 's', 'S', 0x13, 0x13, 's', 'S', 0x13, 0x13, 0x00, 0x01, -/* sc=20 */ 'd', 'D', 0x04, 0x04, 'd', 'D', 0x04, 0x04, 0x00, 0x01, -/* sc=21 */ 'f', 'F', 0x06, 0x06, 'f', 'F', 0x06, 0x06, 0x00, 0x01, -/* sc=22 */ 'g', 'G', 0x07, 0x07, 'g', 'G', 0x07, 0x07, 0x00, 0x01, -/* sc=23 */ 'h', 'H', 0x08, 0x08, 'h', 'H', 0x08, 0x08, 0x00, 0x01, -/* sc=24 */ 'j', 'J', 0x0A, 0x0A, 'j', 'J', 0x0A, 0x0A, 0x00, 0x01, -/* sc=25 */ 'k', 'K', 0x0B, 0x0B, 'k', 'K', 0x0B, 0x0B, 0x00, 0x01, -/* sc=26 */ 'l', 'L', 0x0C, 0x0C, 'l', 'L', 0x0C, 0x0C, 0x00, 0x01, -/* sc=27 */ ';', ':', NOP, NOP, ';', ':', NOP, NOP, 0x33, 0x00, -/* sc=28 */ '\'', '"', NOP, NOP, '\'', '"', NOP, NOP, 0x33, 0x00, -/* sc=29 */ '`', '~', NOP, NOP, '`', '~', NOP, NOP, 0x33, 0x00, -/* sc=2a */ LSH, LSH, LSH, LSH, LSH, LSH, LSH, LSH, 0xFF, 0x00, -/* sc=2b */ '\\', '|', 0x1C, 0x1C, '\\', '|', 0x1C, 0x1C, 0x00, 0x00, -/* sc=2c */ 'z', 'Z', 0x1A, 0x1A, 'z', 'Z', 0x1A, 0x1A, 0x00, 0x01, -/* sc=2d */ 'x', 'X', 0x18, 0x18, 'x', 'X', 0x18, 0x18, 0x00, 0x01, -/* sc=2e */ 'c', 'C', 0x03, 0x03, 'c', 'C', 0x03, 0x03, 0x00, 0x01, -/* sc=2f */ 'v', 'V', 0x16, 0x16, 'v', 'V', 0x16, 0x16, 0x00, 0x01, -/* sc=30 */ 'b', 'B', 0x02, 0x02, 'b', 'B', 0x02, 0x02, 0x00, 0x01, -/* sc=31 */ 'n', 'N', 0x0E, 0x0E, 'n', 'N', 0x0E, 0x0E, 0x00, 0x01, -/* sc=32 */ 'm', 'M', 0x0D, 0x0D, 'm', 'M', 0x0D, 0x0D, 0x00, 0x01, -/* sc=33 */ ',', '<', NOP, NOP, ',', '<', NOP, NOP, 0x33, 0x00, -/* sc=34 */ '.', '>', NOP, NOP, '.', '>', NOP, NOP, 0x33, 0x00, -/* sc=35 */ '/', '?', NOP, NOP, '/', '?', NOP, NOP, 0x33, 0x00, -/* sc=36 */ RSH, RSH, RSH, RSH, RSH, RSH, RSH, RSH, 0xFF, 0x00, -/* sc=37 */ '*', '*', '*', '*', '*', '*', '*', '*', 0x00, 0x00, -/* sc=38 */ LALT, LALT, LALT, LALT, LALT, LALT, LALT, LALT, 0xFF, 0x00, -/* sc=39 */ ' ', ' ', 0x00, ' ', ' ', ' ', SUSP, ' ', 0x02, 0x00, -/* sc=3a */ CLK, CLK, CLK, CLK, CLK, CLK, CLK, CLK, 0xFF, 0x00, -/* sc=3b */ F( 1), F(13), F(25), F(37), S( 1), S(11), S( 1), S(11), 0xFF, 0x00, -/* sc=3c */ F( 2), F(14), F(26), F(38), S( 2), S(12), S( 2), S(12), 0xFF, 0x00, -/* sc=3d */ F( 3), F(15), F(27), F(39), S( 3), S(13), S( 3), S(13), 0xFF, 0x00, -/* sc=3e */ F( 4), F(16), F(28), F(40), S( 4), S(14), S( 4), S(14), 0xFF, 0x00, -/* sc=3f */ F( 5), F(17), F(29), F(41), S( 5), S(15), S( 5), S(15), 0xFF, 0x00, -/* sc=40 */ F( 6), F(18), F(30), F(42), S( 6), S(16), S( 6), S(16), 0xFF, 0x00, -/* sc=41 */ F( 7), F(19), F(31), F(43), S( 7), S( 7), S( 7), S( 7), 0xFF, 0x00, -/* sc=42 */ F( 8), F(20), F(32), F(44), S( 8), S( 8), S( 8), S( 8), 0xFF, 0x00, -/* sc=43 */ F( 9), F(21), F(33), F(45), S( 9), S( 9), S( 9), S( 9), 0xFF, 0x00, -/* sc=44 */ F(10), F(22), F(34), F(46), S(10), S(10), S(10), S(10), 0xFF, 0x00, -/* sc=45 */ NLK, NLK, NLK, NLK, NLK, NLK, NLK, NLK, 0xFF, 0x00, -/* sc=46 */ SLK, SLK, SLK, SLK, SLK, SLK, SLK, SLK, 0xFF, 0x00, -/* sc=47 */ F(49), '7', '7', '7', '7', '7', '7', '7', 0x80, 0x02, -/* sc=48 */ F(50), '8', '8', '8', '8', '8', '8', '8', 0x80, 0x02, -/* sc=49 */ F(51), '9', '9', '9', '9', '9', '9', '9', 0x80, 0x02, -/* sc=4a */ F(52), '-', '-', '-', '-', '-', '-', '-', 0x80, 0x02, -/* sc=4b */ F(53), '4', '4', '4', '4', '4', '4', '4', 0x80, 0x02, -/* sc=4c */ F(54), '5', '5', '5', '5', '5', '5', '5', 0x80, 0x02, -/* sc=4d */ F(55), '6', '6', '6', '6', '6', '6', '6', 0x80, 0x02, -/* sc=4e */ F(56), '+', '+', '+', '+', '+', '+', '+', 0x80, 0x02, -/* sc=4f */ F(57), '1', '1', '1', '1', '1', '1', '1', 0x80, 0x02, -/* sc=50 */ F(58), '2', '2', '2', '2', '2', '2', '2', 0x80, 0x02, -/* sc=51 */ F(59), '3', '3', '3', '3', '3', '3', '3', 0x80, 0x02, -/* sc=52 */ F(60), '0', '0', '0', '0', '0', '0', '0', 0x80, 0x02, -/* sc=53 */ 0x7F, '.', '.', '.', '.', '.', RBT, RBT, 0x03, 0x02, -/* sc=54 */ NOP, NOP, NOP, NOP, NOP, NOP, NOP, NOP, 0xFF, 0x00, -/* sc=55 */ NOP, NOP, NOP, NOP, NOP, NOP, NOP, NOP, 0xFF, 0x00, -/* sc=56 */ NOP, NOP, NOP, NOP, NOP, NOP, NOP, NOP, 0xFF, 0x00, -/* sc=57 */ F(11), F(23), F(35), F(47), S(11), S(11), S(11), S(11), 0xFF, 0x00, -/* sc=58 */ F(12), F(24), F(36), F(48), S(12), S(12), S(12), S(12), 0xFF, 0x00, -/* sc=59 */ 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x00, 0x00, -/* sc=5a */ RCTR, RCTR, RCTR, RCTR, RCTR, RCTR, RCTR, RCTR, 0xFF, 0x00, -/* sc=5b */ '/', '/', '/', '/', '/', '/', '/', '/', 0x00, 0x00, -/* sc=5c */ NEXT, NEXT, DBG, DBG, NOP, NOP, NOP, NOP, 0xFF, 0x00, -/* sc=5d */ RALT, RALT, RALT, RALT, RALT, RALT, RALT, RALT, 0xFF, 0x00, -/* sc=5e */ F(49), F(49), F(49), F(49), F(49), F(49), F(49), F(49), 0xFF, 0x00, -/* sc=5f */ F(50), F(50), F(50), F(50), F(50), F(50), F(50), F(50), 0xFF, 0x00, -/* sc=60 */ F(51), F(51), F(51), F(51), F(51), F(51), F(51), F(51), 0xFF, 0x00, -/* sc=61 */ F(53), F(53), F(53), F(53), F(53), F(53), F(53), F(53), 0xFF, 0x00, -/* sc=62 */ F(55), F(55), F(55), F(55), F(55), F(55), F(55), F(55), 0xFF, 0x00, -/* sc=63 */ F(57), F(57), F(57), F(57), F(57), F(57), F(57), F(57), 0xFF, 0x00, -/* sc=64 */ F(58), F(58), F(58), F(58), F(58), F(58), F(58), F(58), 0xFF, 0x00, -/* sc=65 */ F(59), F(59), F(59), F(59), F(59), F(59), F(59), F(59), 0xFF, 0x00, -/* sc=66 */ F(60), F(60), F(60), F(60), F(60), F(60), F(60), F(60), 0xFF, 0x00, -/* sc=67 */ F(61), F(61), F(61), F(61), F(61), F(61), RBT, F(61), 0xFF, 0x00, -/* sc=68 */ SLK, SPSC, SLK, SPSC, SUSP, NOP, SUSP, NOP, 0xFF, 0x00, -/* sc=69 */ F(62), F(62), F(62), F(62), F(62), F(62), F(62), F(62), 0xFF, 0x00, -/* sc=6a */ F(63), F(63), F(63), F(63), F(63), F(63), F(63), F(63), 0xFF, 0x00, -/* sc=6b */ F(64), F(64), F(64), F(64), F(64), F(64), F(64), F(64), 0xFF, 0x00, -/* sc=6c */ NOP, NOP, NOP, NOP, NOP, NOP, NOP, NOP, 0xFF, 0x00, -} }; -#endif - #if defined(NO_ACCENTCHARS) static accentmap_t accent_map = { 0, /* empty accent map */ { { 0 }, { 0 }, { 0 }, { 0 }, { 0 }, { 0 }, { 0 }, { 0 }, { 0 }, { 0 }, { 0 }, { 0 }, { 0 }, { 0 }, { 0 }, } }; #endif #if defined(ISO_ACCENTCHARS) static accentmap_t accent_map = { 15, /* iso8859 accent map */ { /* dgra=0 */ { '`', { { 'a',0xe0 }, { 'A',0xc0 }, { 'e',0xe8 }, { 'E',0xc8 }, { 'i',0xec }, { 'I',0xcc }, { 'o',0xf2 }, { 'O',0xd2 }, { 'u',0xf9 }, { 'U',0xd9 }, }, }, /* dacu=1 */ { 0xb4, { { 'a',0xe1 }, { 'A',0xc1 }, { 'e',0xe9 }, { 'E',0xc9 }, { 'i',0xed }, { 'I',0xcd }, { 'o',0xf3 }, { 'O',0xd3 }, { 'u',0xfa }, { 'U',0xda }, { 'y',0xfd }, { 'Y',0xdd }, }, }, /* dcir=2 */ { '^', { { 'a',0xe2 }, { 'A',0xc2 }, { 'e',0xea }, { 'E',0xca }, { 'i',0xee }, { 'I',0xce }, { 'o',0xf4 }, { 'O',0xd4 }, { 'u',0xfb }, { 'U',0xdb }, }, }, /* dtil=3 */ { '~', { { 'a',0xe3 }, { 'A',0xc3 }, { 'n',0xf1 }, { 'N',0xd1 }, { 'o',0xf5 }, { 'O',0xd5 }, }, }, /* dmac=4 */ { 0 }, /* dbre=5 */ { 0 }, /* ddot=6 */ { 0 }, /* duml=7 */ { 0xa8, { { 'a',0xe4 }, { 'A',0xc4 }, { 'e',0xeb }, { 'E',0xcb }, { 'i',0xef }, { 'I',0xcf }, { 'o',0xf6 }, { 'O',0xd6 }, { 'u',0xfc }, { 'U',0xdc }, { 'y',0xff }, }, }, /* dsla=8 */ { 0 }, /* drin=9 */ { 0xb0, { { 'a',0xe5 }, { 'A',0xc5 }, }, }, /* dced=10 */ { 0xb8, { { 'c',0xe7 }, { 'C',0xc7 }, }, }, /* dapo=11 */ { 0 }, /* ddac=12 */ { 0 }, /* dogo=13 */ { 0 }, /* dcar=14 */ { 0 }, } }; #endif /* ISO_ACCENTCHARS */ + +#endif /* !KBD_DFLT_KEYMAP */ static fkeytab_t fkey_tab[96] = { /* 01-04 */ {"\033[M", 3}, {"\033[N", 3}, {"\033[O", 3}, {"\033[P", 3}, /* 05-08 */ {"\033[Q", 3}, {"\033[R", 3}, {"\033[S", 3}, {"\033[T", 3}, /* 09-12 */ {"\033[U", 3}, {"\033[V", 3}, {"\033[W", 3}, {"\033[X", 3}, /* 13-16 */ {"\033[Y", 3}, {"\033[Z", 3}, {"\033[a", 3}, {"\033[b", 3}, /* 17-20 */ {"\033[c", 3}, {"\033[d", 3}, {"\033[e", 3}, {"\033[f", 3}, /* 21-24 */ {"\033[g", 3}, {"\033[h", 3}, {"\033[i", 3}, {"\033[j", 3}, /* 25-28 */ {"\033[k", 3}, {"\033[l", 3}, {"\033[m", 3}, {"\033[n", 3}, /* 29-32 */ {"\033[o", 3}, {"\033[p", 3}, {"\033[q", 3}, {"\033[r", 3}, /* 33-36 */ {"\033[s", 3}, {"\033[t", 3}, {"\033[u", 3}, {"\033[v", 3}, /* 37-40 */ {"\033[w", 3}, {"\033[x", 3}, {"\033[y", 3}, {"\033[z", 3}, /* 41-44 */ {"\033[@", 3}, {"\033[[", 3}, {"\033[\\",3}, {"\033[]", 3}, /* 45-48 */ {"\033[^", 3}, {"\033[_", 3}, {"\033[`", 3}, {"\033[{", 3}, /* 49-52 */ {"\033[H", 3}, {"\033[A", 3}, {"\033[I", 3}, {"-" , 1}, /* 53-56 */ {"\033[D", 3}, {"\033[E", 3}, {"\033[C", 3}, {"+" , 1}, /* 57-60 */ {"\033[F", 3}, {"\033[B", 3}, {"\033[G", 3}, {"\033[L", 3}, /* 61-64 */ {"\177", 1}, {"\033[J", 3}, {"\033[~", 3}, {"\033[}", 3}, /* 65-68 */ {"", 0} , {"", 0} , {"", 0} , {"", 0} , /* 69-72 */ {"", 0} , {"", 0} , {"", 0} , {"", 0} , /* 73-76 */ {"", 0} , {"", 0} , {"", 0} , {"", 0} , /* 77-80 */ {"", 0} , {"", 0} , {"", 0} , {"", 0} , /* 81-84 */ {"", 0} , {"", 0} , {"", 0} , {"", 0} , /* 85-88 */ {"", 0} , {"", 0} , {"", 0} , {"", 0} , /* 89-92 */ {"", 0} , {"", 0} , {"", 0} , {"", 0} , /* 93-96 */ {"", 0} , {"", 0} , {"", 0} , {"", 0} }; Index: head/sys/dev/syscons/syscons.c =================================================================== --- head/sys/dev/syscons/syscons.c (revision 44627) +++ head/sys/dev/syscons/syscons.c (revision 44628) @@ -1,4526 +1,4536 @@ /*- * Copyright (c) 1992-1998 Søren Schmidt * All rights reserved. * * 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, * without modification, immediately at the beginning of the file. * 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. The name of the author may not be used to endorse or promote products * derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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. * - * $Id: syscons.c,v 1.297 1999/01/30 12:17:30 phk Exp $ + * $Id: syscons.c,v 1.298 1999/02/05 11:52:11 yokota Exp $ */ #include "sc.h" #include "splash.h" #ifdef __i386__ #include "apm.h" #endif #include "opt_ddb.h" #include "opt_devfs.h" #ifdef __i386__ #include "opt_vesa.h" #include "opt_vm86.h" #endif #include "opt_syscons.h" #if NSC > 0 #include #include #include #include #include #include #include #include #include #ifdef DEVFS #include #endif #include #include #include #include #include #include #include #include #include #ifdef __i386__ #include #include #include #endif #include #include #include #include #include #include #include #include #ifndef __i386__ #include #else #include #include #include #endif #if !defined(MAXCONS) #define MAXCONS 16 #endif #if !defined(SC_MAX_HISTORY_SIZE) #define SC_MAX_HISTORY_SIZE (1000 * MAXCONS) #endif #if !defined(SC_HISTORY_SIZE) #define SC_HISTORY_SIZE (ROW * 4) #endif #if (SC_HISTORY_SIZE * MAXCONS) > SC_MAX_HISTORY_SIZE #undef SC_MAX_HISTORY_SIZE #define SC_MAX_HISTORY_SIZE (SC_HISTORY_SIZE * MAXCONS) #endif #if !defined(SC_MOUSE_CHAR) #define SC_MOUSE_CHAR (0xd0) #endif #define COLD 0 #define WARM 1 #define DEFAULT_BLANKTIME (5*60) /* 5 minutes */ #define MAX_BLANKTIME (7*24*60*60) /* 7 days!? */ /* for backward compatibility */ #define OLD_CONS_MOUSECTL _IOWR('c', 10, old_mouse_info_t) typedef struct old_mouse_data { int x; int y; int buttons; } old_mouse_data_t; typedef struct old_mouse_info { int operation; union { struct old_mouse_data data; struct mouse_mode mode; } u; } old_mouse_info_t; static default_attr user_default = { (FG_LIGHTGREY | BG_BLACK) << 8, (FG_BLACK | BG_LIGHTGREY) << 8 }; static default_attr kernel_default = { (FG_WHITE | BG_BLACK) << 8, (FG_BLACK | BG_LIGHTGREY) << 8 }; static scr_stat main_console; static scr_stat *console[MAXCONS]; #ifdef DEVFS static void *sc_devfs_token[MAXCONS]; static void *sc_mouse_devfs_token; static void *sc_console_devfs_token; #endif scr_stat *cur_console; static scr_stat *new_scp, *old_scp; static term_stat kernel_console; static default_attr *current_default; static int sc_flags; static char init_done = COLD; static u_short sc_buffer[ROW*COL]; static char shutdown_in_progress = FALSE; static char font_loading_in_progress = FALSE; static char switch_in_progress = FALSE; static char write_in_progress = FALSE; static char blink_in_progress = FALSE; static int blinkrate = 0; static int adapter = -1; static int keyboard = -1; static keyboard_t *kbd; static int delayed_next_scr = FALSE; static long scrn_blank_time = 0; /* screen saver timeout value */ static int scrn_blanked = FALSE; /* screen saver active flag */ static long scrn_time_stamp; static int saver_mode = CONS_LKM_SAVER; /* LKM/user saver */ static int run_scrn_saver = FALSE; /* should run the saver? */ static int scrn_idle = FALSE; /* about to run the saver */ #if NSPLASH > 0 static int scrn_saver_failed; #endif u_char scr_map[256]; u_char scr_rmap[256]; static int initial_video_mode; /* initial video mode # */ int fonts_loaded = 0 #ifdef STD8X16FONT | FONT_16 #endif ; u_char font_8[256*8]; u_char font_14[256*14]; #ifdef STD8X16FONT extern #endif u_char font_16[256*16]; u_char palette[256*3]; static u_char *cut_buffer; static int cut_buffer_size; static int mouse_level; /* sysmouse protocol level */ static mousestatus_t mouse_status = { 0, 0, 0, 0, 0, 0 }; static u_short mouse_and_mask[16] = { 0xc000, 0xe000, 0xf000, 0xf800, 0xfc00, 0xfe00, 0xff00, 0xff80, 0xfe00, 0x1e00, 0x1f00, 0x0f00, 0x0f00, 0x0000, 0x0000, 0x0000 }; static u_short mouse_or_mask[16] = { 0x0000, 0x4000, 0x6000, 0x7000, 0x7800, 0x7c00, 0x7e00, 0x6800, 0x0c00, 0x0c00, 0x0600, 0x0600, 0x0000, 0x0000, 0x0000, 0x0000 }; int sc_history_size = SC_HISTORY_SIZE; static int extra_history_size = SC_MAX_HISTORY_SIZE - SC_HISTORY_SIZE * MAXCONS; static void none_saver(int blank) { } static void (*current_saver)(int blank) = none_saver; d_ioctl_t *sc_user_ioctl; static int sticky_splash = FALSE; static struct { u_int8_t cursor_start; u_int8_t cursor_end; u_int8_t shift_state; } bios_value; /* OS specific stuff */ #ifdef not_yet_done #define VIRTUAL_TTY(x) (sccons[x] = ttymalloc(sccons[x])) struct CONSOLE_TTY (sccons[MAXCONS] = ttymalloc(sccons[MAXCONS])) struct MOUSE_TTY (sccons[MAXCONS+1] = ttymalloc(sccons[MAXCONS+1])) struct tty *sccons[MAXCONS+2]; #else #define VIRTUAL_TTY(x) &sccons[x] #define CONSOLE_TTY &sccons[MAXCONS] #define MOUSE_TTY &sccons[MAXCONS+1] static struct tty sccons[MAXCONS+2]; #endif #define SC_MOUSE 128 #define SC_CONSOLE 255 vm_offset_t Crtat; static const int nsccons = MAXCONS+2; #define WRAPHIST(scp, pointer, offset)\ ((scp)->history + ((((pointer) - (scp)->history) + (scp)->history_size \ + (offset)) % (scp)->history_size)) #define ISSIGVALID(sig) ((sig) > 0 && (sig) < NSIG) /* some useful macros */ #define kbd_read_char(kbd, wait) \ (*kbdsw[(kbd)->kb_index]->read_char)((kbd), (wait)) #define kbd_check_char(kbd) \ (*kbdsw[(kbd)->kb_index]->check_char)((kbd)) #define kbd_enable(kbd) \ (*kbdsw[(kbd)->kb_index]->enable)((kbd)) #define kbd_disable(kbd) \ (*kbdsw[(kbd)->kb_index]->disable)((kbd)) #define kbd_lock(kbd, lockf) \ (*kbdsw[(kbd)->kb_index]->lock)((kbd), (lockf)) #define kbd_ioctl(kbd, cmd, arg) \ (((kbd) == NULL) ? \ ENODEV : (*kbdsw[(kbd)->kb_index]->ioctl)((kbd), (cmd), (arg))) #define kbd_clear_state(kbd) \ (*kbdsw[(kbd)->kb_index]->clear_state)((kbd)) #define kbd_get_fkeystr(kbd, fkey, len) \ (*kbdsw[(kbd)->kb_index]->get_fkeystr)((kbd), (fkey), (len)) +#define kbd_poll(kbd, on) \ + (*kbdsw[(kbd)->kb_index]->poll)((kbd), (on)) /* prototypes */ static kbd_callback_func_t sckbdevent; static int scparam(struct tty *tp, struct termios *t); static int scvidprobe(int unit, int flags, int cons); static int sckbdprobe(int unit, int flags, int cons); static void scstart(struct tty *tp); static void scmousestart(struct tty *tp); static void scinit(void); static void scshutdown(int howto, void *arg); static u_int scgetc(keyboard_t *kbd, u_int flags); #define SCGETC_CN 1 #define SCGETC_NONBLOCK 2 static int sccngetch(int flags); static void sccnupdate(scr_stat *scp); static scr_stat *alloc_scp(void); static void init_scp(scr_stat *scp); static void get_bios_values(void); static void sc_bcopy(scr_stat *scp, u_short *p, int from, int to, int mark); static int get_scr_num(void); static timeout_t scrn_timer; static void scrn_update(scr_stat *scp, int show_cursor); #if NSPLASH > 0 static int scsplash_callback(int); static void scsplash_saver(int show); static int add_scrn_saver(void (*this_saver)(int)); static int remove_scrn_saver(void (*this_saver)(int)); static int set_scrn_saver_mode(scr_stat *scp, int mode, u_char *pal, int border); static int restore_scrn_saver_mode(scr_stat *scp, int changemode); static void stop_scrn_saver(void (*saver)(int)); static int wait_scrn_saver_stop(void); #define scsplash_stick(stick) (sticky_splash = (stick)) #else /* !NSPLASH */ #define stop_scrn_saver(saver) #define wait_scrn_saver_stop() 0 #define scsplash_stick(stick) #endif /* NSPLASH */ static int switch_scr(scr_stat *scp, u_int next_scr); static void exchange_scr(void); static void scan_esc(scr_stat *scp, u_char c); static void ansi_put(scr_stat *scp, u_char *buf, int len); static void draw_cursor_image(scr_stat *scp); static void remove_cursor_image(scr_stat *scp); static void move_crsr(scr_stat *scp, int x, int y); static void history_to_screen(scr_stat *scp); static int history_up_line(scr_stat *scp); static int history_down_line(scr_stat *scp); static int mask2attr(struct term_stat *term); static int save_kbd_state(scr_stat *scp); static int update_kbd_state(int state, int mask); static int update_kbd_leds(int which); static void set_destructive_cursor(scr_stat *scp); static void set_mouse_pos(scr_stat *scp); static int skip_spc_right(scr_stat *scp, u_short *p); static int skip_spc_left(scr_stat *scp, u_short *p); static void mouse_cut(scr_stat *scp); static void mouse_cut_start(scr_stat *scp); static void mouse_cut_end(scr_stat *scp); static void mouse_cut_word(scr_stat *scp); static void mouse_cut_line(scr_stat *scp); static void mouse_cut_extend(scr_stat *scp); static void mouse_paste(scr_stat *scp); static void draw_mouse_image(scr_stat *scp); static void remove_mouse_image(scr_stat *scp); static void draw_cutmarking(scr_stat *scp); static void remove_cutmarking(scr_stat *scp); static void do_bell(scr_stat *scp, int pitch, int duration); static timeout_t blink_screen; #define CDEV_MAJOR 12 #ifdef __i386__ static cn_probe_t sccnprobe; static cn_init_t sccninit; static cn_getc_t sccngetc; static cn_checkc_t sccncheckc; static cn_putc_t sccnputc; CONS_DRIVER(sc, sccnprobe, sccninit, sccngetc, sccncheckc, sccnputc); #else /* !__i386__ */ static cn_getc_t sccngetc; static cn_checkc_t sccncheckc; static cn_putc_t sccnputc; struct consdev sc_cons = { NULL, NULL, sccngetc, sccncheckc, sccnputc, NULL, makedev(CDEV_MAJOR, 0), CN_NORMAL, }; #endif /* __i386__ */ static d_open_t scopen; static d_close_t scclose; static d_read_t scread; static d_write_t scwrite; static d_ioctl_t scioctl; static d_mmap_t scmmap; struct cdevsw sc_cdevsw = { scopen, scclose, scread, scwrite, scioctl, nullstop, noreset, scdevtotty, ttpoll, scmmap, nostrategy, "sc", NULL, -1, nodump, nopsize, D_TTY, }; #ifdef __i386__ #define fillw_io(p, b, c) fillw((p), (void *)(b), (c)) #endif #ifdef __alpha__ static void fillw(int pat, void *base, size_t cnt) { u_short *sp = base; while (cnt--) *sp++ = pat; } static void fillw_io(int pat, u_int32_t base, size_t cnt) { while (cnt--) { writew(base, pat); base += 2; } } #endif static void draw_cursor_image(scr_stat *scp) { u_short cursor_image; vm_offset_t ptr; u_short prev_image; if (ISPIXELSC(scp)) { sc_bcopy(scp, scp->scr_buf, scp->cursor_pos - scp->scr_buf, scp->cursor_pos - scp->scr_buf, 1); return; } ptr = scp->adp->va_window + 2*(scp->cursor_pos - scp->scr_buf); /* do we have a destructive cursor ? */ if (sc_flags & CHAR_CURSOR) { prev_image = scp->cursor_saveunder; cursor_image = readw(ptr) & 0x00ff; if (cursor_image == DEAD_CHAR) cursor_image = prev_image & 0x00ff; cursor_image |= *(scp->cursor_pos) & 0xff00; scp->cursor_saveunder = cursor_image; /* update the cursor bitmap if the char under the cursor has changed */ if (prev_image != cursor_image) set_destructive_cursor(scp); /* modify cursor_image */ if (!(sc_flags & BLINK_CURSOR)||((sc_flags & BLINK_CURSOR)&&(blinkrate & 4))){ /* * When the mouse pointer is at the same position as the cursor, * the cursor bitmap needs to be updated even if the char under * the cursor hasn't changed, because the mouse pionter may * have moved by a few dots within the cursor cel. */ if ((prev_image == cursor_image) && (cursor_image != *(scp->cursor_pos))) set_destructive_cursor(scp); cursor_image &= 0xff00; cursor_image |= DEAD_CHAR; } } else { cursor_image = (readw(ptr) & 0x00ff) | (*(scp->cursor_pos) & 0xff00); scp->cursor_saveunder = cursor_image; if (!(sc_flags & BLINK_CURSOR)||((sc_flags & BLINK_CURSOR)&&(blinkrate & 4))){ if ((cursor_image & 0x7000) == 0x7000) { cursor_image &= 0x8fff; if(!(cursor_image & 0x0700)) cursor_image |= 0x0700; } else { cursor_image |= 0x7000; if ((cursor_image & 0x0700) == 0x0700) cursor_image &= 0xf0ff; } } } writew(ptr, cursor_image); } static void remove_cursor_image(scr_stat *scp) { if (ISPIXELSC(scp)) sc_bcopy(scp, scp->scr_buf, scp->cursor_oldpos - scp->scr_buf, scp->cursor_oldpos - scp->scr_buf, 0); else writew(scp->adp->va_window + 2*(scp->cursor_oldpos - scp->scr_buf), scp->cursor_saveunder); } static void move_crsr(scr_stat *scp, int x, int y) { if (x < 0) x = 0; if (y < 0) y = 0; if (x >= scp->xsize) x = scp->xsize-1; if (y >= scp->ysize) y = scp->ysize-1; scp->xpos = x; scp->ypos = y; scp->cursor_pos = scp->scr_buf + scp->ypos * scp->xsize + scp->xpos; } int sc_probe_unit(int unit, int flags) { if (!scvidprobe(unit, flags, FALSE)) { if (bootverbose) printf("sc%d: no video adapter is found.\n", unit); return ENXIO; } return ((sckbdprobe(unit, flags, FALSE)) ? 0 : ENXIO); } /* probe video adapters, return TRUE if found */ static int scvidprobe(int unit, int flags, int cons) { video_adapter_t *adp; /* * Access the video adapter driver through the back door! * Video adapter drivers need to be configured before syscons. * However, when syscons is being probed as the low-level console, * they have not been initialized yet. We force them to initialize * themselves here. XXX */ vid_configure(cons ? VIO_PROBE_ONLY : 0); /* allocate a frame buffer */ if (adapter < 0) { adapter = vid_allocate("*", -1, (void *)&adapter); if (adapter < 0) return FALSE; } adp = vid_get_adapter(adapter); /* shouldn't fail */ Crtat = adp->va_window; initial_video_mode = adp->va_initial_mode; return TRUE; } /* probe the keyboard, return TRUE if found */ static int sckbdprobe(int unit, int flags, int cons) { /* access the keyboard driver through the backdoor! */ kbd_configure(cons ? KB_CONF_PROBE_ONLY : 0); /* allocate a keyboard and register the keyboard event handler */ if (keyboard < 0) { keyboard = kbd_allocate("*", -1, (void *)&keyboard, sckbdevent, NULL); if (keyboard < 0) return FALSE; } kbd = kbd_get_keyboard(keyboard); /* shouldn't fail */ return TRUE; } #if NAPM > 0 static int scresume(void *dummy) { if (kbd != NULL) kbd_clear_state(kbd); return 0; } #endif int sc_attach_unit(int unit, int flags) { scr_stat *scp; #if defined(VESA) && defined(VM86) video_info_t info; #endif dev_t cdev = makedev(CDEV_MAJOR, 0); #ifdef DEVFS int vc; #endif scinit(); scp = console[0]; sc_flags = flags; if (!ISFONTAVAIL(scp->adp->va_flags)) sc_flags &= ~CHAR_CURSOR; /* copy temporary buffer to final buffer */ scp->scr_buf = NULL; sc_alloc_scr_buffer(scp, FALSE, FALSE); bcopy(sc_buffer, scp->scr_buf, scp->xsize*scp->ysize*sizeof(u_short)); /* cut buffer is available only when the mouse pointer is used */ if (ISMOUSEAVAIL(scp->adp->va_flags)) sc_alloc_cut_buffer(scp, FALSE); /* initialize history buffer & pointers */ sc_alloc_history_buffer(scp, sc_history_size, 0, FALSE); #if defined(VESA) && defined(VM86) if ((sc_flags & VESA800X600) && ((*vidsw[scp->ad]->get_info)(scp->adp, M_VESA_800x600, &info) == 0)) { #if NSPLASH > 0 splash_term(scp->adp); #endif sc_set_graphics_mode(scp, NULL, M_VESA_800x600); sc_set_pixel_mode(scp, NULL, COL, ROW, 16); initial_video_mode = M_VESA_800x600; #if NSPLASH > 0 /* put up the splash again! */ splash_init(scp->adp, scsplash_callback); #endif } #endif /* VESA && VM86 */ /* initialize cursor stuff */ if (!ISGRAPHSC(scp)) draw_cursor_image(scp); /* get screen update going */ scrn_timer((void *)TRUE); /* set up the keyboard */ kbd_ioctl(kbd, KDSKBMODE, (caddr_t)&scp->kbd_mode); update_kbd_state(scp->status, LOCK_MASK); if (bootverbose) { printf("sc%d:", unit); if (adapter >= 0) printf(" fb%d", adapter); if (keyboard >= 0) printf(" kbd%d", keyboard); printf("\n"); } printf("sc%d: ", unit); switch(scp->adp->va_type) { case KD_VGA: printf("VGA %s", (scp->adp->va_flags & V_ADP_COLOR) ? "color" : "mono"); break; case KD_EGA: printf("EGA %s", (scp->adp->va_flags & V_ADP_COLOR) ? "color" : "mono"); break; case KD_CGA: printf("CGA"); break; case KD_MONO: case KD_HERCULES: default: printf("MDA/Hercules"); break; } printf(" <%d virtual consoles, flags=0x%x>\n", MAXCONS, sc_flags); #if NAPM > 0 scp->r_hook.ah_fun = scresume; scp->r_hook.ah_arg = NULL; scp->r_hook.ah_name = "system keyboard"; scp->r_hook.ah_order = APM_MID_ORDER; apm_hook_establish(APM_HOOK_RESUME , &scp->r_hook); #endif at_shutdown(scshutdown, NULL, SHUTDOWN_PRE_SYNC); cdevsw_add(&cdev, &sc_cdevsw, NULL); #ifdef DEVFS for (vc = 0; vc < MAXCONS; vc++) sc_devfs_token[vc] = devfs_add_devswf(&sc_cdevsw, vc, DV_CHR, UID_ROOT, GID_WHEEL, 0600, "ttyv%r", vc); sc_mouse_devfs_token = devfs_add_devswf(&sc_cdevsw, SC_MOUSE, DV_CHR, UID_ROOT, GID_WHEEL, 0600, "sysmouse"); sc_console_devfs_token = devfs_add_devswf(&sc_cdevsw, SC_CONSOLE, DV_CHR, UID_ROOT, GID_WHEEL, 0600, "consolectl"); #endif return 0; } struct tty *scdevtotty(dev_t dev) { int unit = minor(dev); if (init_done == COLD) return(NULL); if (unit == SC_CONSOLE) return CONSOLE_TTY; if (unit == SC_MOUSE) return MOUSE_TTY; if (unit >= MAXCONS || unit < 0) return(NULL); return VIRTUAL_TTY(unit); } int scopen(dev_t dev, int flag, int mode, struct proc *p) { struct tty *tp = scdevtotty(dev); keyarg_t key; if (!tp) return(ENXIO); tp->t_oproc = (minor(dev) == SC_MOUSE) ? scmousestart : scstart; tp->t_param = scparam; tp->t_dev = dev; if (!(tp->t_state & TS_ISOPEN)) { ttychars(tp); /* Use the current setting of the <-- key as default VERASE. */ /* If the Delete key is preferable, an stty is necessary */ key.keynum = 0x0e; /* how do we know this magic number... XXX */ kbd_ioctl(kbd, GIO_KEYMAPENT, (caddr_t)&key); tp->t_cc[VERASE] = key.key.map[0]; tp->t_iflag = TTYDEF_IFLAG; tp->t_oflag = TTYDEF_OFLAG; tp->t_cflag = TTYDEF_CFLAG; tp->t_lflag = TTYDEF_LFLAG; tp->t_ispeed = tp->t_ospeed = TTYDEF_SPEED; scparam(tp, &tp->t_termios); (*linesw[tp->t_line].l_modem)(tp, 1); if (minor(dev) == SC_MOUSE) mouse_level = 0; /* XXX */ } else if (tp->t_state & TS_XCLUDE && suser(p->p_ucred, &p->p_acflag)) return(EBUSY); if (minor(dev) < MAXCONS && !console[minor(dev)]) { console[minor(dev)] = alloc_scp(); if (ISGRAPHSC(console[minor(dev)])) sc_set_pixel_mode(console[minor(dev)], NULL, COL, ROW, 16); } if (minor(dev)t_winsize.ws_col && !tp->t_winsize.ws_row) { tp->t_winsize.ws_col = console[minor(dev)]->xsize; tp->t_winsize.ws_row = console[minor(dev)]->ysize; } return ((*linesw[tp->t_line].l_open)(dev, tp)); } int scclose(dev_t dev, int flag, int mode, struct proc *p) { struct tty *tp = scdevtotty(dev); struct scr_stat *scp; if (!tp) return(ENXIO); if (minor(dev) < MAXCONS) { scp = sc_get_scr_stat(tp->t_dev); if (scp->status & SWITCH_WAIT_ACQ) wakeup((caddr_t)&scp->smode); #if not_yet_done if (scp == &main_console) { scp->pid = 0; scp->proc = NULL; scp->smode.mode = VT_AUTO; } else { free(scp->scr_buf, M_DEVBUF); if (scp->history != NULL) { free(scp->history, M_DEVBUF); if (scp->history_size / scp->xsize > imax(sc_history_size, scp->ysize)) extra_history_size += scp->history_size / scp->xsize - imax(sc_history_size, scp->ysize); } free(scp, M_DEVBUF); console[minor(dev)] = NULL; } #else scp->pid = 0; scp->proc = NULL; scp->smode.mode = VT_AUTO; #endif } spltty(); (*linesw[tp->t_line].l_close)(tp, flag); ttyclose(tp); spl0(); return(0); } int scread(dev_t dev, struct uio *uio, int flag) { struct tty *tp = scdevtotty(dev); if (!tp) return(ENXIO); sc_touch_scrn_saver(); return((*linesw[tp->t_line].l_read)(tp, uio, flag)); } int scwrite(dev_t dev, struct uio *uio, int flag) { struct tty *tp = scdevtotty(dev); if (!tp) return(ENXIO); return((*linesw[tp->t_line].l_write)(tp, uio, flag)); } static int sckbdevent(keyboard_t *thiskbd, int event, void *arg) { static struct tty *cur_tty; int c; size_t len; u_char *cp; /* assert(thiskbd == kbd) */ switch (event) { case KBDIO_KEYINPUT: break; case KBDIO_UNLOADING: kbd = NULL; kbd_release(thiskbd, (void *)&keyboard); return 0; default: return EINVAL; } /* * Loop while there is still input to get from the keyboard. * I don't think this is nessesary, and it doesn't fix * the Xaccel-2.1 keyboard hang, but it can't hurt. XXX */ while ((c = scgetc(thiskbd, SCGETC_NONBLOCK)) != NOKEY) { cur_tty = VIRTUAL_TTY(get_scr_num()); if (!(cur_tty->t_state & TS_ISOPEN)) if (!((cur_tty = CONSOLE_TTY)->t_state & TS_ISOPEN)) continue; switch (KEYFLAGS(c)) { case 0x0000: /* normal key */ (*linesw[cur_tty->t_line].l_rint)(KEYCHAR(c), cur_tty); break; case FKEY: /* function key, return string */ cp = kbd_get_fkeystr(thiskbd, KEYCHAR(c), &len); if (cp != NULL) { while (len-- > 0) (*linesw[cur_tty->t_line].l_rint)(*cp++, cur_tty); } break; case MKEY: /* meta is active, prepend ESC */ (*linesw[cur_tty->t_line].l_rint)(0x1b, cur_tty); (*linesw[cur_tty->t_line].l_rint)(KEYCHAR(c), cur_tty); break; case BKEY: /* backtab fixed sequence (esc [ Z) */ (*linesw[cur_tty->t_line].l_rint)(0x1b, cur_tty); (*linesw[cur_tty->t_line].l_rint)('[', cur_tty); (*linesw[cur_tty->t_line].l_rint)('Z', cur_tty); break; } } if (cur_console->status & MOUSE_VISIBLE) { remove_mouse_image(cur_console); cur_console->status &= ~MOUSE_VISIBLE; } return 0; } static int scparam(struct tty *tp, struct termios *t) { tp->t_ispeed = t->c_ispeed; tp->t_ospeed = t->c_ospeed; tp->t_cflag = t->c_cflag; return 0; } int scioctl(dev_t dev, u_long cmd, caddr_t data, int flag, struct proc *p) { u_int delta_ehs; int error; int i; struct tty *tp; scr_stat *scp; int s; tp = scdevtotty(dev); if (!tp) return ENXIO; scp = sc_get_scr_stat(tp->t_dev); /* If there is a user_ioctl function call that first */ if (sc_user_ioctl) { error = (*sc_user_ioctl)(dev, cmd, data, flag, p); if (error != ENOIOCTL) return error; } error = sc_vid_ioctl(tp, cmd, data, flag, p); if (error != ENOIOCTL) return error; switch (cmd) { /* process console hardware related ioctl's */ case GIO_ATTR: /* get current attributes */ *(int*)data = (scp->term.cur_attr >> 8) & 0xFF; return 0; case GIO_COLOR: /* is this a color console ? */ *(int *)data = (scp->adp->va_flags & V_ADP_COLOR) ? 1 : 0; return 0; case CONS_BLANKTIME: /* set screen saver timeout (0 = no saver) */ if (*(int *)data < 0 || *(int *)data > MAX_BLANKTIME) return EINVAL; s = spltty(); scrn_blank_time = *(int *)data; run_scrn_saver = (scrn_blank_time != 0); splx(s); return 0; case CONS_CURSORTYPE: /* set cursor type blink/noblink */ if ((*(int*)data) & 0x01) sc_flags |= BLINK_CURSOR; else sc_flags &= ~BLINK_CURSOR; if ((*(int*)data) & 0x02) { if (!ISFONTAVAIL(scp->adp->va_flags)) return ENXIO; sc_flags |= CHAR_CURSOR; } else sc_flags &= ~CHAR_CURSOR; /* * The cursor shape is global property; all virtual consoles * are affected. Update the cursor in the current console... */ if (!ISGRAPHSC(cur_console)) { s = spltty(); remove_cursor_image(cur_console); if (sc_flags & CHAR_CURSOR) set_destructive_cursor(cur_console); draw_cursor_image(cur_console); splx(s); } return 0; case CONS_BELLTYPE: /* set bell type sound/visual */ if ((*(int *)data) & 0x01) sc_flags |= VISUAL_BELL; else sc_flags &= ~VISUAL_BELL; if ((*(int *)data) & 0x02) sc_flags |= QUIET_BELL; else sc_flags &= ~QUIET_BELL; return 0; case CONS_HISTORY: /* set history size */ if (*(int *)data > 0) { int lines; /* buffer size to allocate */ int lines0; /* current buffer size */ lines = imax(*(int *)data, scp->ysize); lines0 = (scp->history != NULL) ? scp->history_size / scp->xsize : scp->ysize; if (lines0 > imax(sc_history_size, scp->ysize)) delta_ehs = lines0 - imax(sc_history_size, scp->ysize); else delta_ehs = 0; /* * syscons unconditionally allocates buffers upto SC_HISTORY_SIZE * lines or scp->ysize lines, whichever is larger. A value * greater than that is allowed, subject to extra_history_size. */ if (lines > imax(sc_history_size, scp->ysize)) if (lines - imax(sc_history_size, scp->ysize) > extra_history_size + delta_ehs) return EINVAL; if (cur_console->status & BUFFER_SAVED) return EBUSY; sc_alloc_history_buffer(scp, lines, delta_ehs, TRUE); return 0; } else return EINVAL; case CONS_MOUSECTL: /* control mouse arrow */ case OLD_CONS_MOUSECTL: { /* MOUSE_BUTTON?DOWN -> MOUSE_MSC_BUTTON?UP */ static int butmap[8] = { MOUSE_MSC_BUTTON1UP | MOUSE_MSC_BUTTON2UP | MOUSE_MSC_BUTTON3UP, MOUSE_MSC_BUTTON2UP | MOUSE_MSC_BUTTON3UP, MOUSE_MSC_BUTTON1UP | MOUSE_MSC_BUTTON3UP, MOUSE_MSC_BUTTON3UP, MOUSE_MSC_BUTTON1UP | MOUSE_MSC_BUTTON2UP, MOUSE_MSC_BUTTON2UP, MOUSE_MSC_BUTTON1UP, 0, }; mouse_info_t *mouse = (mouse_info_t*)data; mouse_info_t buf; /* FIXME: */ if (!ISMOUSEAVAIL(scp->adp->va_flags)) return ENODEV; if (cmd == OLD_CONS_MOUSECTL) { static u_char swapb[] = { 0, 4, 2, 6, 1, 5, 3, 7 }; old_mouse_info_t *old_mouse = (old_mouse_info_t *)data; mouse = &buf; mouse->operation = old_mouse->operation; switch (mouse->operation) { case MOUSE_MODE: mouse->u.mode = old_mouse->u.mode; break; case MOUSE_SHOW: case MOUSE_HIDE: break; case MOUSE_MOVEABS: case MOUSE_MOVEREL: case MOUSE_ACTION: mouse->u.data.x = old_mouse->u.data.x; mouse->u.data.y = old_mouse->u.data.y; mouse->u.data.z = 0; mouse->u.data.buttons = swapb[old_mouse->u.data.buttons & 0x7]; break; case MOUSE_GETINFO: old_mouse->u.data.x = scp->mouse_xpos; old_mouse->u.data.y = scp->mouse_ypos; old_mouse->u.data.buttons = swapb[scp->mouse_buttons & 0x7]; break; default: return EINVAL; } } switch (mouse->operation) { case MOUSE_MODE: if (ISSIGVALID(mouse->u.mode.signal)) { scp->mouse_signal = mouse->u.mode.signal; scp->mouse_proc = p; scp->mouse_pid = p->p_pid; } else { scp->mouse_signal = 0; scp->mouse_proc = NULL; scp->mouse_pid = 0; } return 0; case MOUSE_SHOW: if (ISTEXTSC(scp) && !(scp->status & MOUSE_ENABLED)) { scp->status |= (MOUSE_ENABLED | MOUSE_VISIBLE); scp->mouse_oldpos = scp->mouse_pos; mark_all(scp); return 0; } else return EINVAL; break; case MOUSE_HIDE: if (ISTEXTSC(scp) && (scp->status & MOUSE_ENABLED)) { scp->status &= ~(MOUSE_ENABLED | MOUSE_VISIBLE); mark_all(scp); return 0; } else return EINVAL; break; case MOUSE_MOVEABS: scp->mouse_xpos = mouse->u.data.x; scp->mouse_ypos = mouse->u.data.y; set_mouse_pos(scp); break; case MOUSE_MOVEREL: scp->mouse_xpos += mouse->u.data.x; scp->mouse_ypos += mouse->u.data.y; set_mouse_pos(scp); break; case MOUSE_GETINFO: mouse->u.data.x = scp->mouse_xpos; mouse->u.data.y = scp->mouse_ypos; mouse->u.data.z = 0; mouse->u.data.buttons = scp->mouse_buttons; return 0; case MOUSE_ACTION: case MOUSE_MOTION_EVENT: /* this should maybe only be settable from /dev/consolectl SOS */ /* send out mouse event on /dev/sysmouse */ mouse_status.dx += mouse->u.data.x; mouse_status.dy += mouse->u.data.y; mouse_status.dz += mouse->u.data.z; if (mouse->operation == MOUSE_ACTION) mouse_status.button = mouse->u.data.buttons; mouse_status.flags |= ((mouse->u.data.x || mouse->u.data.y || mouse->u.data.z) ? MOUSE_POSCHANGED : 0) | (mouse_status.obutton ^ mouse_status.button); if (mouse_status.flags == 0) return 0; if (ISTEXTSC(cur_console) && (cur_console->status & MOUSE_ENABLED)) cur_console->status |= MOUSE_VISIBLE; if ((MOUSE_TTY)->t_state & TS_ISOPEN) { u_char buf[MOUSE_SYS_PACKETSIZE]; int j; /* the first five bytes are compatible with MouseSystems' */ buf[0] = MOUSE_MSC_SYNC | butmap[mouse_status.button & MOUSE_STDBUTTONS]; j = imax(imin(mouse->u.data.x, 255), -256); buf[1] = j >> 1; buf[3] = j - buf[1]; j = -imax(imin(mouse->u.data.y, 255), -256); buf[2] = j >> 1; buf[4] = j - buf[2]; for (j = 0; j < MOUSE_MSC_PACKETSIZE; j++) (*linesw[(MOUSE_TTY)->t_line].l_rint)(buf[j],MOUSE_TTY); if (mouse_level >= 1) { /* extended part */ j = imax(imin(mouse->u.data.z, 127), -128); buf[5] = (j >> 1) & 0x7f; buf[6] = (j - (j >> 1)) & 0x7f; /* buttons 4-10 */ buf[7] = (~mouse_status.button >> 3) & 0x7f; for (j = MOUSE_MSC_PACKETSIZE; j < MOUSE_SYS_PACKETSIZE; j++) (*linesw[(MOUSE_TTY)->t_line].l_rint)(buf[j],MOUSE_TTY); } } if (cur_console->mouse_signal) { cur_console->mouse_buttons = mouse->u.data.buttons; /* has controlling process died? */ if (cur_console->mouse_proc && (cur_console->mouse_proc != pfind(cur_console->mouse_pid))){ cur_console->mouse_signal = 0; cur_console->mouse_proc = NULL; cur_console->mouse_pid = 0; } else psignal(cur_console->mouse_proc, cur_console->mouse_signal); } else if (mouse->operation == MOUSE_ACTION && cut_buffer != NULL) { /* process button presses */ if ((cur_console->mouse_buttons ^ mouse->u.data.buttons) && ISTEXTSC(cur_console)) { cur_console->mouse_buttons = mouse->u.data.buttons; if (cur_console->mouse_buttons & MOUSE_BUTTON1DOWN) mouse_cut_start(cur_console); else mouse_cut_end(cur_console); if (cur_console->mouse_buttons & MOUSE_BUTTON2DOWN || cur_console->mouse_buttons & MOUSE_BUTTON3DOWN) mouse_paste(cur_console); } } if (mouse->u.data.x != 0 || mouse->u.data.y != 0) { cur_console->mouse_xpos += mouse->u.data.x; cur_console->mouse_ypos += mouse->u.data.y; set_mouse_pos(cur_console); } break; case MOUSE_BUTTON_EVENT: if ((mouse->u.event.id & MOUSE_BUTTONS) == 0) return EINVAL; if (mouse->u.event.value < 0) return EINVAL; if (mouse->u.event.value > 0) { cur_console->mouse_buttons |= mouse->u.event.id; mouse_status.button |= mouse->u.event.id; } else { cur_console->mouse_buttons &= ~mouse->u.event.id; mouse_status.button &= ~mouse->u.event.id; } mouse_status.flags |= mouse_status.obutton ^ mouse_status.button; if (mouse_status.flags == 0) return 0; if (ISTEXTSC(cur_console) && (cur_console->status & MOUSE_ENABLED)) cur_console->status |= MOUSE_VISIBLE; if ((MOUSE_TTY)->t_state & TS_ISOPEN) { u_char buf[8]; int i; buf[0] = MOUSE_MSC_SYNC | butmap[mouse_status.button & MOUSE_STDBUTTONS]; buf[7] = (~mouse_status.button >> 3) & 0x7f; buf[1] = buf[2] = buf[3] = buf[4] = buf[5] = buf[6] = 0; for (i = 0; i < ((mouse_level >= 1) ? MOUSE_SYS_PACKETSIZE : MOUSE_MSC_PACKETSIZE); i++) (*linesw[(MOUSE_TTY)->t_line].l_rint)(buf[i],MOUSE_TTY); } if (cur_console->mouse_signal) { if (cur_console->mouse_proc && (cur_console->mouse_proc != pfind(cur_console->mouse_pid))){ cur_console->mouse_signal = 0; cur_console->mouse_proc = NULL; cur_console->mouse_pid = 0; } else psignal(cur_console->mouse_proc, cur_console->mouse_signal); break; } if (!ISTEXTSC(cur_console) || (cut_buffer == NULL)) break; switch (mouse->u.event.id) { case MOUSE_BUTTON1DOWN: switch (mouse->u.event.value % 4) { case 0: /* up */ mouse_cut_end(cur_console); break; case 1: mouse_cut_start(cur_console); break; case 2: mouse_cut_word(cur_console); break; case 3: mouse_cut_line(cur_console); break; } break; case MOUSE_BUTTON2DOWN: switch (mouse->u.event.value) { case 0: /* up */ break; default: mouse_paste(cur_console); break; } break; case MOUSE_BUTTON3DOWN: switch (mouse->u.event.value) { case 0: /* up */ if (!(cur_console->mouse_buttons & MOUSE_BUTTON1DOWN)) mouse_cut_end(cur_console); break; default: mouse_cut_extend(cur_console); break; } break; } break; default: return EINVAL; } /* make screensaver happy */ sc_touch_scrn_saver(); return 0; } /* MOUSE_XXX: /dev/sysmouse ioctls */ case MOUSE_GETHWINFO: /* get device information */ { mousehw_t *hw = (mousehw_t *)data; if (tp != MOUSE_TTY) return ENOTTY; hw->buttons = 10; /* XXX unknown */ hw->iftype = MOUSE_IF_SYSMOUSE; hw->type = MOUSE_MOUSE; hw->model = MOUSE_MODEL_GENERIC; hw->hwid = 0; return 0; } case MOUSE_GETMODE: /* get protocol/mode */ { mousemode_t *mode = (mousemode_t *)data; if (tp != MOUSE_TTY) return ENOTTY; mode->level = mouse_level; switch (mode->level) { case 0: /* at this level, sysmouse emulates MouseSystems protocol */ mode->protocol = MOUSE_PROTO_MSC; mode->rate = -1; /* unknown */ mode->resolution = -1; /* unknown */ mode->accelfactor = 0; /* disabled */ mode->packetsize = MOUSE_MSC_PACKETSIZE; mode->syncmask[0] = MOUSE_MSC_SYNCMASK; mode->syncmask[1] = MOUSE_MSC_SYNC; break; case 1: /* at this level, sysmouse uses its own protocol */ mode->protocol = MOUSE_PROTO_SYSMOUSE; mode->rate = -1; mode->resolution = -1; mode->accelfactor = 0; mode->packetsize = MOUSE_SYS_PACKETSIZE; mode->syncmask[0] = MOUSE_SYS_SYNCMASK; mode->syncmask[1] = MOUSE_SYS_SYNC; break; } return 0; } case MOUSE_SETMODE: /* set protocol/mode */ { mousemode_t *mode = (mousemode_t *)data; if (tp != MOUSE_TTY) return ENOTTY; if ((mode->level < 0) || (mode->level > 1)) return EINVAL; mouse_level = mode->level; return 0; } case MOUSE_GETLEVEL: /* get operation level */ if (tp != MOUSE_TTY) return ENOTTY; *(int *)data = mouse_level; return 0; case MOUSE_SETLEVEL: /* set operation level */ if (tp != MOUSE_TTY) return ENOTTY; if ((*(int *)data < 0) || (*(int *)data > 1)) return EINVAL; mouse_level = *(int *)data; return 0; case MOUSE_GETSTATUS: /* get accumulated mouse events */ if (tp != MOUSE_TTY) return ENOTTY; s = spltty(); *(mousestatus_t *)data = mouse_status; mouse_status.flags = 0; mouse_status.obutton = mouse_status.button; mouse_status.dx = 0; mouse_status.dy = 0; mouse_status.dz = 0; splx(s); return 0; #if notyet case MOUSE_GETVARS: /* get internal mouse variables */ case MOUSE_SETVARS: /* set internal mouse variables */ if (tp != MOUSE_TTY) return ENOTTY; return ENODEV; #endif case MOUSE_READSTATE: /* read status from the device */ case MOUSE_READDATA: /* read data from the device */ if (tp != MOUSE_TTY) return ENOTTY; return ENODEV; case CONS_GETINFO: /* get current (virtual) console info */ { vid_info_t *ptr = (vid_info_t*)data; if (ptr->size == sizeof(struct vid_info)) { ptr->m_num = get_scr_num(); ptr->mv_col = scp->xpos; ptr->mv_row = scp->ypos; ptr->mv_csz = scp->xsize; ptr->mv_rsz = scp->ysize; ptr->mv_norm.fore = (scp->term.std_color & 0x0f00)>>8; ptr->mv_norm.back = (scp->term.std_color & 0xf000)>>12; ptr->mv_rev.fore = (scp->term.rev_color & 0x0f00)>>8; ptr->mv_rev.back = (scp->term.rev_color & 0xf000)>>12; ptr->mv_grfc.fore = 0; /* not supported */ ptr->mv_grfc.back = 0; /* not supported */ ptr->mv_ovscan = scp->border; if (scp == cur_console) save_kbd_state(scp); ptr->mk_keylock = scp->status & LOCK_MASK; return 0; } return EINVAL; } case CONS_GETVERS: /* get version number */ *(int*)data = 0x200; /* version 2.0 */ return 0; case CONS_IDLE: /* see if the screen has been idle */ /* * When the screen is in the GRAPHICS_MODE or UNKNOWN_MODE, * the user process may have been writing something on the * screen and syscons is not aware of it. Declare the screen * is NOT idle if it is in one of these modes. But there is * an exception to it; if a screen saver is running in the * graphics mode in the current screen, we should say that the * screen has been idle. */ *(int *)data = scrn_idle && (!ISGRAPHSC(cur_console) || (cur_console->status & SAVER_RUNNING)); return 0; case CONS_SAVERMODE: /* set saver mode */ switch(*(int *)data) { case CONS_USR_SAVER: /* if a LKM screen saver is running, stop it first. */ scsplash_stick(FALSE); saver_mode = *(int *)data; s = spltty(); if ((error = wait_scrn_saver_stop())) { splx(s); return error; } scp->status |= SAVER_RUNNING; scsplash_stick(TRUE); splx(s); break; case CONS_LKM_SAVER: s = spltty(); if ((saver_mode == CONS_USR_SAVER) && (scp->status & SAVER_RUNNING)) scp->status &= ~SAVER_RUNNING; saver_mode = *(int *)data; splx(s); break; default: return EINVAL; } return 0; case CONS_SAVERSTART: /* immediately start/stop the screen saver */ /* * Note that this ioctl does not guarantee the screen saver * actually starts or stops. It merely attempts to do so... */ s = spltty(); run_scrn_saver = (*(int *)data != 0); if (run_scrn_saver) scrn_time_stamp -= scrn_blank_time; splx(s); return 0; case VT_SETMODE: /* set screen switcher mode */ { struct vt_mode *mode; mode = (struct vt_mode *)data; if (ISSIGVALID(mode->relsig) && ISSIGVALID(mode->acqsig) && ISSIGVALID(mode->frsig)) { bcopy(data, &scp->smode, sizeof(struct vt_mode)); if (scp->smode.mode == VT_PROCESS) { scp->proc = p; scp->pid = scp->proc->p_pid; } return 0; } else return EINVAL; } case VT_GETMODE: /* get screen switcher mode */ bcopy(&scp->smode, data, sizeof(struct vt_mode)); return 0; case VT_RELDISP: /* screen switcher ioctl */ switch(*(int *)data) { case VT_FALSE: /* user refuses to release screen, abort */ if (scp == old_scp && (scp->status & SWITCH_WAIT_REL)) { old_scp->status &= ~SWITCH_WAIT_REL; switch_in_progress = FALSE; return 0; } return EINVAL; case VT_TRUE: /* user has released screen, go on */ if (scp == old_scp && (scp->status & SWITCH_WAIT_REL)) { scp->status &= ~SWITCH_WAIT_REL; exchange_scr(); if (new_scp->smode.mode == VT_PROCESS) { new_scp->status |= SWITCH_WAIT_ACQ; psignal(new_scp->proc, new_scp->smode.acqsig); } else switch_in_progress = FALSE; return 0; } return EINVAL; case VT_ACKACQ: /* acquire acknowledged, switch completed */ if (scp == new_scp && (scp->status & SWITCH_WAIT_ACQ)) { scp->status &= ~SWITCH_WAIT_ACQ; switch_in_progress = FALSE; return 0; } return EINVAL; default: return EINVAL; } /* NOT REACHED */ case VT_OPENQRY: /* return free virtual console */ for (i = 0; i < MAXCONS; i++) { tp = VIRTUAL_TTY(i); if (!(tp->t_state & TS_ISOPEN)) { *(int *)data = i + 1; return 0; } } return EINVAL; case VT_ACTIVATE: /* switch to screen *data */ s = spltty(); sc_clean_up(cur_console); splx(s); return switch_scr(scp, *(int *)data - 1); case VT_WAITACTIVE: /* wait for switch to occur */ if (*(int *)data > MAXCONS || *(int *)data < 0) return EINVAL; s = spltty(); error = sc_clean_up(cur_console); splx(s); if (error) return error; if (minor(dev) == *(int *)data - 1) return 0; if (*(int *)data == 0) { if (scp == cur_console) return 0; } else scp = console[*(int *)data - 1]; while ((error=tsleep((caddr_t)&scp->smode, PZERO|PCATCH, "waitvt", 0)) == ERESTART) ; return error; case VT_GETACTIVE: *(int *)data = get_scr_num()+1; return 0; case KDENABIO: /* allow io operations */ error = suser(p->p_ucred, &p->p_acflag); if (error != 0) return error; if (securelevel > 0) return EPERM; #ifdef __i386__ p->p_md.md_regs->tf_eflags |= PSL_IOPL; #endif return 0; case KDDISABIO: /* disallow io operations (default) */ #ifdef __i386__ p->p_md.md_regs->tf_eflags &= ~PSL_IOPL; #endif return 0; case KDSKBSTATE: /* set keyboard state (locks) */ if (*(int *)data & ~LOCK_MASK) return EINVAL; scp->status &= ~LOCK_MASK; scp->status |= *(int *)data; if (scp == cur_console) update_kbd_state(scp->status, LOCK_MASK); return 0; case KDGKBSTATE: /* get keyboard state (locks) */ if (scp == cur_console) save_kbd_state(scp); *(int *)data = scp->status & LOCK_MASK; return 0; - case KDSETRAD: /* set keyboard repeat & delay rates */ + case KDSETREPEAT: /* set keyboard repeat & delay rates (new) */ + error = kbd_ioctl(kbd, cmd, data); + if (error == ENOIOCTL) + error = ENODEV; + return error; + + case KDSETRAD: /* set keyboard repeat & delay rates (old) */ if (*(int *)data & ~0x7f) return EINVAL; - error = kbd_ioctl(kbd, KDSETRAD, data); + error = kbd_ioctl(kbd, cmd, data); if (error == ENOIOCTL) error = ENODEV; return error; case KDSKBMODE: /* set keyboard mode */ switch (*(int *)data) { case K_XLATE: /* switch to XLT ascii mode */ case K_RAW: /* switch to RAW scancode mode */ case K_CODE: /* switch to CODE mode */ scp->kbd_mode = *(int *)data; if (scp == cur_console) kbd_ioctl(kbd, cmd, data); return 0; default: return EINVAL; } /* NOT REACHED */ case KDGKBMODE: /* get keyboard mode */ *(int *)data = scp->kbd_mode; return 0; case KDGKBINFO: error = kbd_ioctl(kbd, cmd, data); if (error == ENOIOCTL) error = ENODEV; return error; case KDMKTONE: /* sound the bell */ if (*(int*)data) do_bell(scp, (*(int*)data)&0xffff, (((*(int*)data)>>16)&0xffff)*hz/1000); else do_bell(scp, scp->bell_pitch, scp->bell_duration); return 0; case KIOCSOUND: /* make tone (*data) hz */ #ifdef __i386__ if (scp == cur_console) { if (*(int*)data) { int pitch = timer_freq / *(int*)data; /* set command for counter 2, 2 byte write */ if (acquire_timer2(TIMER_16BIT|TIMER_SQWAVE)) return EBUSY; /* set pitch */ outb(TIMER_CNTR2, pitch); outb(TIMER_CNTR2, (pitch>>8)); /* enable counter 2 output to speaker */ outb(IO_PPI, inb(IO_PPI) | 3); } else { /* disable counter 2 output to speaker */ outb(IO_PPI, inb(IO_PPI) & 0xFC); release_timer2(); } } #endif /* __i386__ */ return 0; case KDGKBTYPE: /* get keyboard type */ error = kbd_ioctl(kbd, cmd, data); if (error == ENOIOCTL) { /* always return something? XXX */ *(int *)data = 0; } return 0; case KDSETLED: /* set keyboard LED status */ if (*(int *)data & ~LED_MASK) /* FIXME: LOCK_MASK? */ return EINVAL; scp->status &= ~LED_MASK; scp->status |= *(int *)data; if (scp == cur_console) update_kbd_leds(scp->status); return 0; case KDGETLED: /* get keyboard LED status */ if (scp == cur_console) save_kbd_state(scp); *(int *)data = scp->status & LED_MASK; return 0; case CONS_SETKBD: /* set the new keyboard */ { keyboard_t *newkbd; s = spltty(); newkbd = kbd_get_keyboard(*(int *)data); if (newkbd == NULL) { splx(s); return EINVAL; } error = 0; if (kbd != newkbd) { i = kbd_allocate(newkbd->kb_name, newkbd->kb_unit, (void *)&keyboard, sckbdevent, NULL); /* i == newkbd->kb_index */ if (i >= 0) { if (kbd != NULL) { save_kbd_state(cur_console); kbd_release(kbd, (void *)&keyboard); } kbd = kbd_get_keyboard(i); /* kbd == newkbd */ keyboard = i; kbd_ioctl(kbd, KDSKBMODE, (caddr_t)&cur_console->kbd_mode); update_kbd_state(cur_console->status, LOCK_MASK); } else { error = EPERM; /* XXX */ } } splx(s); return error; } case CONS_RELKBD: /* release the current keyboard */ s = spltty(); error = 0; if (kbd != NULL) { save_kbd_state(cur_console); error = kbd_release(kbd, (void *)&keyboard); if (error == 0) { kbd = NULL; keyboard = -1; } } splx(s); return error; case GIO_SCRNMAP: /* get output translation table */ bcopy(&scr_map, data, sizeof(scr_map)); return 0; case PIO_SCRNMAP: /* set output translation table */ bcopy(data, &scr_map, sizeof(scr_map)); for (i=0; iadp->va_flags)) return ENXIO; bcopy(data, font_8, 8*256); fonts_loaded |= FONT_8; /* * FONT KLUDGE * Always use the font page #0. XXX * Don't load if the current font size is not 8x8. */ if (ISTEXTSC(cur_console) && (cur_console->font_size < 14)) copy_font(cur_console, LOAD, 8, font_8); return 0; case GIO_FONT8x8: /* get 8x8 dot font */ if (!ISFONTAVAIL(scp->adp->va_flags)) return ENXIO; if (fonts_loaded & FONT_8) { bcopy(font_8, data, 8*256); return 0; } else return ENXIO; case PIO_FONT8x14: /* set 8x14 dot font */ if (!ISFONTAVAIL(scp->adp->va_flags)) return ENXIO; bcopy(data, font_14, 14*256); fonts_loaded |= FONT_14; /* * FONT KLUDGE * Always use the font page #0. XXX * Don't load if the current font size is not 8x14. */ if (ISTEXTSC(cur_console) && (cur_console->font_size >= 14) && (cur_console->font_size < 16)) copy_font(cur_console, LOAD, 14, font_14); return 0; case GIO_FONT8x14: /* get 8x14 dot font */ if (!ISFONTAVAIL(scp->adp->va_flags)) return ENXIO; if (fonts_loaded & FONT_14) { bcopy(font_14, data, 14*256); return 0; } else return ENXIO; case PIO_FONT8x16: /* set 8x16 dot font */ if (!ISFONTAVAIL(scp->adp->va_flags)) return ENXIO; bcopy(data, font_16, 16*256); fonts_loaded |= FONT_16; /* * FONT KLUDGE * Always use the font page #0. XXX * Don't load if the current font size is not 8x16. */ if (ISTEXTSC(cur_console) && (cur_console->font_size >= 16)) copy_font(cur_console, LOAD, 16, font_16); return 0; case GIO_FONT8x16: /* get 8x16 dot font */ if (!ISFONTAVAIL(scp->adp->va_flags)) return ENXIO; if (fonts_loaded & FONT_16) { bcopy(font_16, data, 16*256); return 0; } else return ENXIO; default: break; } error = (*linesw[tp->t_line].l_ioctl)(tp, cmd, data, flag, p); if (error != ENOIOCTL) return(error); error = ttioctl(tp, cmd, data, flag); if (error != ENOIOCTL) return(error); return(ENOTTY); } static void scstart(struct tty *tp) { struct clist *rbp; int s, len; u_char buf[PCBURST]; scr_stat *scp = sc_get_scr_stat(tp->t_dev); if (scp->status & SLKED || blink_in_progress) return; /* XXX who repeats the call when the above flags are cleared? */ s = spltty(); if (!(tp->t_state & (TS_TIMEOUT | TS_BUSY | TS_TTSTOP))) { tp->t_state |= TS_BUSY; rbp = &tp->t_outq; while (rbp->c_cc) { len = q_to_b(rbp, buf, PCBURST); splx(s); ansi_put(scp, buf, len); s = spltty(); } tp->t_state &= ~TS_BUSY; ttwwakeup(tp); } splx(s); } static void scmousestart(struct tty *tp) { struct clist *rbp; int s; u_char buf[PCBURST]; s = spltty(); if (!(tp->t_state & (TS_TIMEOUT | TS_BUSY | TS_TTSTOP))) { tp->t_state |= TS_BUSY; rbp = &tp->t_outq; while (rbp->c_cc) { q_to_b(rbp, buf, PCBURST); } tp->t_state &= ~TS_BUSY; ttwwakeup(tp); } splx(s); } #if __i386__ /* XXX kludge! */ extern struct isa_driver scdriver; static void sccnprobe(struct consdev *cp) { struct isa_device *dvp; /* * Take control if we are the highest priority enabled display device. */ dvp = find_display(); if (dvp == NULL || dvp->id_driver != &scdriver) { cp->cn_pri = CN_DEAD; return; } if (!scvidprobe(dvp->id_unit, dvp->id_flags, TRUE)) { cp->cn_pri = CN_DEAD; return; } sckbdprobe(dvp->id_unit, dvp->id_flags, TRUE); /* initialize required fields */ cp->cn_dev = makedev(CDEV_MAJOR, SC_CONSOLE); cp->cn_pri = CN_INTERNAL; } static void sccninit(struct consdev *cp) { scinit(); } #else /* !__i386__ */ extern struct consdev *cn_tab; void sccnattach(void) { if (!scvidprobe(0, 0, TRUE) || !sckbdprobe(0, 0, TRUE)) { return; } scinit(); cn_tab = &sc_cons; } #endif /* __i386__ */ static void sccnputc(dev_t dev, int c) { u_char buf[1]; scr_stat *scp = console[0]; term_stat save = scp->term; u_short *p; int s; int i; if (scp == cur_console && scp->status & SLKED) { scp->status &= ~SLKED; update_kbd_state(scp->status, SLKED); if (cur_console->status & BUFFER_SAVED) { p = cur_console->history_save; for (i = 0; i < cur_console->ysize; ++i) { bcopy(p, cur_console->scr_buf + (cur_console->xsize*i), cur_console->xsize*sizeof(u_short)); p += cur_console->xsize; if (p + cur_console->xsize > cur_console->history + cur_console->history_size) p = cur_console->history; } cur_console->status &= ~BUFFER_SAVED; cur_console->history_head = cur_console->history_save; cur_console->status |= CURSOR_ENABLED; mark_all(cur_console); } #if 1 /* XXX */ scstart(VIRTUAL_TTY(get_scr_num())); #endif } scp->term = kernel_console; current_default = &kernel_default; if (scp == cur_console && !ISGRAPHSC(scp)) remove_cursor_image(scp); buf[0] = c; ansi_put(scp, buf, 1); kernel_console = scp->term; current_default = &user_default; scp->term = save; s = spltty(); /* block sckbdevent and scrn_timer */ sccnupdate(scp); splx(s); } static int sccngetc(dev_t dev) { return sccngetch(0); } static int sccncheckc(dev_t dev) { return sccngetch(SCGETC_NONBLOCK); } static int sccngetch(int flags) { int cur_mode; int s = spltty(); /* block sckbdevent and scrn_timer while we poll */ int c; /* * Stop the screen saver and update the screen if necessary. * What if we have been running in the screen saver code... XXX */ sc_touch_scrn_saver(); sccnupdate(cur_console); if (kbd == NULL) { splx(s); return -1; } /* * Make sure the keyboard is accessible even when the kbd device * driver is disabled. */ kbd_enable(kbd); /* we shall always use the keyboard in the XLATE mode here */ cur_mode = cur_console->kbd_mode; cur_console->kbd_mode = K_XLATE; kbd_ioctl(kbd, KDSKBMODE, (caddr_t)&cur_console->kbd_mode); + kbd_poll(kbd, TRUE); c = scgetc(kbd, SCGETC_CN | flags); + kbd_poll(kbd, FALSE); cur_console->kbd_mode = cur_mode; kbd_ioctl(kbd, KDSKBMODE, (caddr_t)&cur_console->kbd_mode); kbd_disable(kbd); splx(s); switch (KEYFLAGS(c)) { case 0: /* normal char */ return KEYCHAR(c); case FKEY: /* function key */ return c; /* XXX */ case NOKEY: case ERRKEY: default: return -1; } /* NOT REACHED */ } static void sccnupdate(scr_stat *scp) { /* this is a cut-down version of scrn_timer()... */ if (font_loading_in_progress) return; if (panicstr || shutdown_in_progress) { sc_touch_scrn_saver(); } else if (scp != cur_console) { return; } if (!run_scrn_saver) scrn_idle = FALSE; if ((saver_mode != CONS_LKM_SAVER) || !scrn_idle) if (scrn_blanked) stop_scrn_saver(current_saver); if (scp != cur_console || blink_in_progress || switch_in_progress) return; if (!ISGRAPHSC(scp) && !(scp->status & SAVER_RUNNING)) scrn_update(scp, TRUE); } scr_stat *sc_get_scr_stat(dev_t dev) { int unit = minor(dev); if (unit == SC_CONSOLE) return console[0]; if (unit >= MAXCONS || unit < 0) return(NULL); return console[unit]; } static int get_scr_num() { int i = 0; while ((i < MAXCONS) && (cur_console != console[i])) i++; return i < MAXCONS ? i : 0; } static void scrn_timer(void *arg) { static int kbd_interval = 0; struct timeval tv; scr_stat *scp; int s; /* don't do anything when we are touching font */ if (font_loading_in_progress) { if (arg) timeout(scrn_timer, (void *)TRUE, hz / 10); return; } s = spltty(); if ((kbd == NULL) && (sc_flags & AUTODETECT_KBD)) { /* try to allocate a keyboard automatically */ if (++kbd_interval >= 25) { keyboard = kbd_allocate("*", -1, (void *)&keyboard, sckbdevent, NULL); if (keyboard >= 0) { kbd = kbd_get_keyboard(keyboard); kbd_ioctl(kbd, KDSKBMODE, (caddr_t)&cur_console->kbd_mode); update_kbd_state(cur_console->status, LOCK_MASK); } kbd_interval = 0; } } /* should we stop the screen saver? */ getmicrouptime(&tv); if (panicstr || shutdown_in_progress) sc_touch_scrn_saver(); if (run_scrn_saver) { scrn_idle = (tv.tv_sec > scrn_time_stamp + scrn_blank_time); } else { scrn_time_stamp = tv.tv_sec; scrn_idle = FALSE; if (scrn_blank_time > 0) run_scrn_saver = TRUE; } if ((saver_mode != CONS_LKM_SAVER) || !scrn_idle) if (scrn_blanked) stop_scrn_saver(current_saver); /* should we just return ? */ if (blink_in_progress || switch_in_progress) { if (arg) timeout(scrn_timer, (void *)TRUE, hz / 10); splx(s); return; } /* Update the screen */ scp = cur_console; if (!ISGRAPHSC(scp) && !(scp->status & SAVER_RUNNING)) scrn_update(scp, TRUE); /* should we activate the screen saver? */ if ((saver_mode == CONS_LKM_SAVER) && scrn_idle) if (!ISGRAPHSC(scp) || scrn_blanked) (*current_saver)(TRUE); if (arg) timeout(scrn_timer, (void *)TRUE, hz / 25); splx(s); } static void scrn_update(scr_stat *scp, int show_cursor) { /* update screen image */ if (scp->start <= scp->end) sc_bcopy(scp, scp->scr_buf, scp->start, scp->end, 0); /* we are not to show the cursor and the mouse pointer... */ if (!show_cursor) { scp->end = 0; scp->start = scp->xsize*scp->ysize - 1; return; } /* update "pseudo" mouse pointer image */ if (scp->status & MOUSE_VISIBLE) { /* did mouse move since last time ? */ if (scp->status & MOUSE_MOVED) { /* do we need to remove old mouse pointer image ? */ if (scp->mouse_cut_start != NULL || (scp->mouse_pos-scp->scr_buf) <= scp->start || (scp->mouse_pos+scp->xsize + 1 - scp->scr_buf) >= scp->end) { remove_mouse_image(scp); } scp->status &= ~MOUSE_MOVED; draw_mouse_image(scp); } else { /* mouse didn't move, has it been overwritten ? */ if ((scp->mouse_pos+scp->xsize + 1 - scp->scr_buf) >= scp->start && (scp->mouse_pos - scp->scr_buf) <= scp->end) { draw_mouse_image(scp); } } } /* update cursor image */ if (scp->status & CURSOR_ENABLED) { /* did cursor move since last time ? */ if (scp->cursor_pos != scp->cursor_oldpos) { /* do we need to remove old cursor image ? */ if ((scp->cursor_oldpos - scp->scr_buf) < scp->start || ((scp->cursor_oldpos - scp->scr_buf) > scp->end)) { remove_cursor_image(scp); } scp->cursor_oldpos = scp->cursor_pos; draw_cursor_image(scp); } else { /* cursor didn't move, has it been overwritten ? */ if (scp->cursor_pos - scp->scr_buf >= scp->start && scp->cursor_pos - scp->scr_buf <= scp->end) { draw_cursor_image(scp); } else { /* if its a blinking cursor, we may have to update it */ if (sc_flags & BLINK_CURSOR) draw_cursor_image(scp); } } blinkrate++; } if (scp->mouse_cut_start != NULL) draw_cutmarking(scp); scp->end = 0; scp->start = scp->xsize*scp->ysize - 1; } #if NSPLASH > 0 static int scsplash_callback(int event) { int error; switch (event) { case SPLASH_INIT: scrn_saver_failed = FALSE; if (add_scrn_saver(scsplash_saver) == 0) { run_scrn_saver = TRUE; if (cold && !(boothowto & (RB_VERBOSE | RB_CONFIG))) { scsplash_stick(TRUE); (*current_saver)(TRUE); } } return 0; case SPLASH_TERM: if (current_saver == scsplash_saver) { scsplash_stick(FALSE); error = remove_scrn_saver(scsplash_saver); if (error) return error; } return 0; default: return EINVAL; } } static void scsplash_saver(int show) { static int busy = FALSE; scr_stat *scp; if (busy) return; busy = TRUE; scp = cur_console; if (show) { if (!scrn_saver_failed) { if (!scrn_blanked) set_scrn_saver_mode(scp, -1, NULL, 0); switch (splash(scp->adp, TRUE)) { case 0: /* succeeded */ scrn_blanked = TRUE; break; case EAGAIN: /* try later */ restore_scrn_saver_mode(scp, FALSE); break; default: scrn_saver_failed = TRUE; scsplash_stick(FALSE); printf("scsplash_saver(): failed to put up the image\n"); restore_scrn_saver_mode(scp, TRUE); break; } } } else if (!sticky_splash) { if (scrn_blanked && (splash(scp->adp, FALSE) == 0)) { restore_scrn_saver_mode(scp, TRUE); scrn_blanked = FALSE; } } busy = FALSE; } static int add_scrn_saver(void (*this_saver)(int)) { int error; if (current_saver != none_saver) { error = remove_scrn_saver(current_saver); if (error) return error; } run_scrn_saver = FALSE; saver_mode = CONS_LKM_SAVER; current_saver = this_saver; return 0; } static int remove_scrn_saver(void (*this_saver)(int)) { if (current_saver != this_saver) return EINVAL; /* * In order to prevent `current_saver' from being called by * the timeout routine `scrn_timer()' while we manipulate * the saver list, we shall set `current_saver' to `none_saver' * before stopping the current saver, rather than blocking by `splXX()'. */ current_saver = none_saver; if (scrn_blanked) stop_scrn_saver(this_saver); return (scrn_blanked ? EBUSY : 0); } static int set_scrn_saver_mode(scr_stat *scp, int mode, u_char *pal, int border) { int s; /* assert(scp == cur_console) */ s = spltty(); scp->splash_save_mode = scp->mode; scp->splash_save_status = scp->status & (GRAPHICS_MODE | PIXEL_MODE); scp->status &= ~(GRAPHICS_MODE | PIXEL_MODE); scp->status |= (UNKNOWN_MODE | SAVER_RUNNING); splx(s); if (mode < 0) return 0; scp->mode = mode; if (set_mode(scp) == 0) { if (scp->adp->va_info.vi_flags & V_INFO_GRAPHICS) scp->status |= GRAPHICS_MODE; if (pal != NULL) load_palette(scp->adp, pal); set_border(scp, border); return 0; } else { s = spltty(); scp->mode = scp->splash_save_mode; scp->status &= ~(UNKNOWN_MODE | SAVER_RUNNING); scp->status |= scp->splash_save_status; splx(s); return 1; } } static int restore_scrn_saver_mode(scr_stat *scp, int changemode) { int mode; int status; int s; /* assert(scp == cur_console) */ s = spltty(); mode = scp->mode; status = scp->status; scp->mode = scp->splash_save_mode; scp->status &= ~(UNKNOWN_MODE | SAVER_RUNNING); scp->status |= scp->splash_save_status; if (!changemode) { splx(s); return 0; } if (set_mode(scp) == 0) { load_palette(scp->adp, palette); splx(s); return 0; } else { scp->mode = mode; scp->status = status; splx(s); return 1; } } static void stop_scrn_saver(void (*saver)(int)) { (*saver)(FALSE); run_scrn_saver = FALSE; /* the screen saver may have chosen not to stop after all... */ if (scrn_blanked) return; mark_all(cur_console); if (delayed_next_scr) switch_scr(cur_console, delayed_next_scr - 1); wakeup((caddr_t)&scrn_blanked); } static int wait_scrn_saver_stop(void) { int error = 0; while (scrn_blanked) { run_scrn_saver = FALSE; error = tsleep((caddr_t)&scrn_blanked, PZERO | PCATCH, "scrsav", 0); run_scrn_saver = FALSE; if (error != ERESTART) break; } return error; } #endif /* NSPLASH */ void sc_touch_scrn_saver(void) { scsplash_stick(FALSE); run_scrn_saver = FALSE; } void sc_clear_screen(scr_stat *scp) { move_crsr(scp, 0, 0); scp->cursor_oldpos = scp->cursor_pos; fillw(scp->term.cur_color | scr_map[0x20], scp->scr_buf, scp->xsize * scp->ysize); mark_all(scp); remove_cutmarking(scp); } static int switch_scr(scr_stat *scp, u_int next_scr) { /* delay switch if actively updating screen */ if (scrn_blanked || write_in_progress || blink_in_progress) { delayed_next_scr = next_scr+1; sc_touch_scrn_saver(); return 0; } if (switch_in_progress && (cur_console->proc != pfind(cur_console->pid))) switch_in_progress = FALSE; if (next_scr >= MAXCONS || switch_in_progress || (cur_console->smode.mode == VT_AUTO && ISGRAPHSC(cur_console))) { do_bell(scp, BELL_PITCH, BELL_DURATION); return EINVAL; } /* is the wanted virtual console open ? */ if (next_scr) { struct tty *tp = VIRTUAL_TTY(next_scr); if (!(tp->t_state & TS_ISOPEN)) { do_bell(scp, BELL_PITCH, BELL_DURATION); return EINVAL; } } switch_in_progress = TRUE; old_scp = cur_console; new_scp = console[next_scr]; wakeup((caddr_t)&new_scp->smode); if (new_scp == old_scp) { switch_in_progress = FALSE; delayed_next_scr = FALSE; return 0; } /* has controlling process died? */ if (old_scp->proc && (old_scp->proc != pfind(old_scp->pid))) old_scp->smode.mode = VT_AUTO; if (new_scp->proc && (new_scp->proc != pfind(new_scp->pid))) new_scp->smode.mode = VT_AUTO; /* check the modes and switch appropriately */ if (old_scp->smode.mode == VT_PROCESS) { old_scp->status |= SWITCH_WAIT_REL; psignal(old_scp->proc, old_scp->smode.relsig); } else { exchange_scr(); if (new_scp->smode.mode == VT_PROCESS) { new_scp->status |= SWITCH_WAIT_ACQ; psignal(new_scp->proc, new_scp->smode.acqsig); } else switch_in_progress = FALSE; } return 0; } static void exchange_scr(void) { /* save the current state of video and keyboard */ move_crsr(old_scp, old_scp->xpos, old_scp->ypos); if (old_scp->kbd_mode == K_XLATE) save_kbd_state(old_scp); /* set up the video for the new screen */ cur_console = new_scp; if (old_scp->mode != new_scp->mode || ISUNKNOWNSC(old_scp)) set_mode(new_scp); move_crsr(new_scp, new_scp->xpos, new_scp->ypos); if (ISTEXTSC(new_scp) && (sc_flags & CHAR_CURSOR)) set_destructive_cursor(new_scp); if (ISGRAPHSC(old_scp)) load_palette(new_scp->adp, palette); set_border(new_scp, new_scp->border); /* set up the keyboard for the new screen */ if (old_scp->kbd_mode != new_scp->kbd_mode) kbd_ioctl(kbd, KDSKBMODE, (caddr_t)&new_scp->kbd_mode); update_kbd_state(new_scp->status, LOCK_MASK); delayed_next_scr = FALSE; mark_all(new_scp); } static void scan_esc(scr_stat *scp, u_char c) { static u_char ansi_col[16] = {0, 4, 2, 6, 1, 5, 3, 7, 8, 12, 10, 14, 9, 13, 11, 15}; int i, n; u_short *src, *dst, count; if (scp->term.esc == 1) { /* seen ESC */ switch (c) { case '7': /* Save cursor position */ scp->saved_xpos = scp->xpos; scp->saved_ypos = scp->ypos; break; case '8': /* Restore saved cursor position */ if (scp->saved_xpos >= 0 && scp->saved_ypos >= 0) move_crsr(scp, scp->saved_xpos, scp->saved_ypos); break; case '[': /* Start ESC [ sequence */ scp->term.esc = 2; scp->term.last_param = -1; for (i = scp->term.num_param; i < MAX_ESC_PAR; i++) scp->term.param[i] = 1; scp->term.num_param = 0; return; case 'M': /* Move cursor up 1 line, scroll if at top */ if (scp->ypos > 0) move_crsr(scp, scp->xpos, scp->ypos - 1); else { bcopy(scp->scr_buf, scp->scr_buf + scp->xsize, (scp->ysize - 1) * scp->xsize * sizeof(u_short)); fillw(scp->term.cur_color | scr_map[0x20], scp->scr_buf, scp->xsize); mark_all(scp); } break; #if notyet case 'Q': scp->term.esc = 4; return; #endif case 'c': /* Clear screen & home */ sc_clear_screen(scp); break; case '(': /* iso-2022: designate 94 character set to G0 */ scp->term.esc = 5; return; } } else if (scp->term.esc == 2) { /* seen ESC [ */ if (c >= '0' && c <= '9') { if (scp->term.num_param < MAX_ESC_PAR) { if (scp->term.last_param != scp->term.num_param) { scp->term.last_param = scp->term.num_param; scp->term.param[scp->term.num_param] = 0; } else scp->term.param[scp->term.num_param] *= 10; scp->term.param[scp->term.num_param] += c - '0'; return; } } scp->term.num_param = scp->term.last_param + 1; switch (c) { case ';': if (scp->term.num_param < MAX_ESC_PAR) return; break; case '=': scp->term.esc = 3; scp->term.last_param = -1; for (i = scp->term.num_param; i < MAX_ESC_PAR; i++) scp->term.param[i] = 1; scp->term.num_param = 0; return; case 'A': /* up n rows */ n = scp->term.param[0]; if (n < 1) n = 1; move_crsr(scp, scp->xpos, scp->ypos - n); break; case 'B': /* down n rows */ n = scp->term.param[0]; if (n < 1) n = 1; move_crsr(scp, scp->xpos, scp->ypos + n); break; case 'C': /* right n columns */ n = scp->term.param[0]; if (n < 1) n = 1; move_crsr(scp, scp->xpos + n, scp->ypos); break; case 'D': /* left n columns */ n = scp->term.param[0]; if (n < 1) n = 1; move_crsr(scp, scp->xpos - n, scp->ypos); break; case 'E': /* cursor to start of line n lines down */ n = scp->term.param[0]; if (n < 1) n = 1; move_crsr(scp, 0, scp->ypos + n); break; case 'F': /* cursor to start of line n lines up */ n = scp->term.param[0]; if (n < 1) n = 1; move_crsr(scp, 0, scp->ypos - n); break; case 'f': /* Cursor move */ case 'H': if (scp->term.num_param == 0) move_crsr(scp, 0, 0); else if (scp->term.num_param == 2) move_crsr(scp, scp->term.param[1] - 1, scp->term.param[0] - 1); break; case 'J': /* Clear all or part of display */ if (scp->term.num_param == 0) n = 0; else n = scp->term.param[0]; switch (n) { case 0: /* clear form cursor to end of display */ fillw(scp->term.cur_color | scr_map[0x20], scp->cursor_pos, scp->scr_buf + scp->xsize * scp->ysize - scp->cursor_pos); mark_for_update(scp, scp->cursor_pos - scp->scr_buf); mark_for_update(scp, scp->xsize * scp->ysize - 1); remove_cutmarking(scp); break; case 1: /* clear from beginning of display to cursor */ fillw(scp->term.cur_color | scr_map[0x20], scp->scr_buf, scp->cursor_pos - scp->scr_buf); mark_for_update(scp, 0); mark_for_update(scp, scp->cursor_pos - scp->scr_buf); remove_cutmarking(scp); break; case 2: /* clear entire display */ fillw(scp->term.cur_color | scr_map[0x20], scp->scr_buf, scp->xsize * scp->ysize); mark_all(scp); remove_cutmarking(scp); break; } break; case 'K': /* Clear all or part of line */ if (scp->term.num_param == 0) n = 0; else n = scp->term.param[0]; switch (n) { case 0: /* clear form cursor to end of line */ fillw(scp->term.cur_color | scr_map[0x20], scp->cursor_pos, scp->xsize - scp->xpos); mark_for_update(scp, scp->cursor_pos - scp->scr_buf); mark_for_update(scp, scp->cursor_pos - scp->scr_buf + scp->xsize - 1 - scp->xpos); break; case 1: /* clear from beginning of line to cursor */ fillw(scp->term.cur_color | scr_map[0x20], scp->cursor_pos - scp->xpos, scp->xpos + 1); mark_for_update(scp, scp->ypos * scp->xsize); mark_for_update(scp, scp->cursor_pos - scp->scr_buf); break; case 2: /* clear entire line */ fillw(scp->term.cur_color | scr_map[0x20], scp->cursor_pos - scp->xpos, scp->xsize); mark_for_update(scp, scp->ypos * scp->xsize); mark_for_update(scp, (scp->ypos + 1) * scp->xsize - 1); break; } break; case 'L': /* Insert n lines */ n = scp->term.param[0]; if (n < 1) n = 1; if (n > scp->ysize - scp->ypos) n = scp->ysize - scp->ypos; src = scp->scr_buf + scp->ypos * scp->xsize; dst = src + n * scp->xsize; count = scp->ysize - (scp->ypos + n); bcopy(src, dst, count * scp->xsize * sizeof(u_short)); fillw(scp->term.cur_color | scr_map[0x20], src, n * scp->xsize); mark_for_update(scp, scp->ypos * scp->xsize); mark_for_update(scp, scp->xsize * scp->ysize - 1); break; case 'M': /* Delete n lines */ n = scp->term.param[0]; if (n < 1) n = 1; if (n > scp->ysize - scp->ypos) n = scp->ysize - scp->ypos; dst = scp->scr_buf + scp->ypos * scp->xsize; src = dst + n * scp->xsize; count = scp->ysize - (scp->ypos + n); bcopy(src, dst, count * scp->xsize * sizeof(u_short)); src = dst + count * scp->xsize; fillw(scp->term.cur_color | scr_map[0x20], src, n * scp->xsize); mark_for_update(scp, scp->ypos * scp->xsize); mark_for_update(scp, scp->xsize * scp->ysize - 1); break; case 'P': /* Delete n chars */ n = scp->term.param[0]; if (n < 1) n = 1; if (n > scp->xsize - scp->xpos) n = scp->xsize - scp->xpos; dst = scp->cursor_pos; src = dst + n; count = scp->xsize - (scp->xpos + n); bcopy(src, dst, count * sizeof(u_short)); src = dst + count; fillw(scp->term.cur_color | scr_map[0x20], src, n); mark_for_update(scp, scp->cursor_pos - scp->scr_buf); mark_for_update(scp, scp->cursor_pos - scp->scr_buf + n + count - 1); break; case '@': /* Insert n chars */ n = scp->term.param[0]; if (n < 1) n = 1; if (n > scp->xsize - scp->xpos) n = scp->xsize - scp->xpos; src = scp->cursor_pos; dst = src + n; count = scp->xsize - (scp->xpos + n); bcopy(src, dst, count * sizeof(u_short)); fillw(scp->term.cur_color | scr_map[0x20], src, n); mark_for_update(scp, scp->cursor_pos - scp->scr_buf); mark_for_update(scp, scp->cursor_pos - scp->scr_buf + n + count - 1); break; case 'S': /* scroll up n lines */ n = scp->term.param[0]; if (n < 1) n = 1; if (n > scp->ysize) n = scp->ysize; bcopy(scp->scr_buf + (scp->xsize * n), scp->scr_buf, scp->xsize * (scp->ysize - n) * sizeof(u_short)); fillw(scp->term.cur_color | scr_map[0x20], scp->scr_buf + scp->xsize * (scp->ysize - n), scp->xsize * n); mark_all(scp); break; case 'T': /* scroll down n lines */ n = scp->term.param[0]; if (n < 1) n = 1; if (n > scp->ysize) n = scp->ysize; bcopy(scp->scr_buf, scp->scr_buf + (scp->xsize * n), scp->xsize * (scp->ysize - n) * sizeof(u_short)); fillw(scp->term.cur_color | scr_map[0x20], scp->scr_buf, scp->xsize * n); mark_all(scp); break; case 'X': /* erase n characters in line */ n = scp->term.param[0]; if (n < 1) n = 1; if (n > scp->xsize - scp->xpos) n = scp->xsize - scp->xpos; fillw(scp->term.cur_color | scr_map[0x20], scp->cursor_pos, n); mark_for_update(scp, scp->cursor_pos - scp->scr_buf); mark_for_update(scp, scp->cursor_pos - scp->scr_buf + n - 1); break; case 'Z': /* move n tabs backwards */ n = scp->term.param[0]; if (n < 1) n = 1; if ((i = scp->xpos & 0xf8) == scp->xpos) i -= 8*n; else i -= 8*(n-1); if (i < 0) i = 0; move_crsr(scp, i, scp->ypos); break; case '`': /* move cursor to column n */ n = scp->term.param[0]; if (n < 1) n = 1; move_crsr(scp, n - 1, scp->ypos); break; case 'a': /* move cursor n columns to the right */ n = scp->term.param[0]; if (n < 1) n = 1; move_crsr(scp, scp->xpos + n, scp->ypos); break; case 'd': /* move cursor to row n */ n = scp->term.param[0]; if (n < 1) n = 1; move_crsr(scp, scp->xpos, n - 1); break; case 'e': /* move cursor n rows down */ n = scp->term.param[0]; if (n < 1) n = 1; move_crsr(scp, scp->xpos, scp->ypos + n); break; case 'm': /* change attribute */ if (scp->term.num_param == 0) { scp->term.attr_mask = NORMAL_ATTR; scp->term.cur_attr = scp->term.cur_color = scp->term.std_color; break; } for (i = 0; i < scp->term.num_param; i++) { switch (n = scp->term.param[i]) { case 0: /* back to normal */ scp->term.attr_mask = NORMAL_ATTR; scp->term.cur_attr = scp->term.cur_color = scp->term.std_color; break; case 1: /* bold */ scp->term.attr_mask |= BOLD_ATTR; scp->term.cur_attr = mask2attr(&scp->term); break; case 4: /* underline */ scp->term.attr_mask |= UNDERLINE_ATTR; scp->term.cur_attr = mask2attr(&scp->term); break; case 5: /* blink */ scp->term.attr_mask |= BLINK_ATTR; scp->term.cur_attr = mask2attr(&scp->term); break; case 7: /* reverse video */ scp->term.attr_mask |= REVERSE_ATTR; scp->term.cur_attr = mask2attr(&scp->term); break; case 30: case 31: /* set fg color */ case 32: case 33: case 34: case 35: case 36: case 37: scp->term.attr_mask |= FOREGROUND_CHANGED; scp->term.cur_color = (scp->term.cur_color&0xF000) | (ansi_col[(n-30)&7]<<8); scp->term.cur_attr = mask2attr(&scp->term); break; case 40: case 41: /* set bg color */ case 42: case 43: case 44: case 45: case 46: case 47: scp->term.attr_mask |= BACKGROUND_CHANGED; scp->term.cur_color = (scp->term.cur_color&0x0F00) | (ansi_col[(n-40)&7]<<12); scp->term.cur_attr = mask2attr(&scp->term); break; } } break; case 's': /* Save cursor position */ scp->saved_xpos = scp->xpos; scp->saved_ypos = scp->ypos; break; case 'u': /* Restore saved cursor position */ if (scp->saved_xpos >= 0 && scp->saved_ypos >= 0) move_crsr(scp, scp->saved_xpos, scp->saved_ypos); break; case 'x': if (scp->term.num_param == 0) n = 0; else n = scp->term.param[0]; switch (n) { case 0: /* reset attributes */ scp->term.attr_mask = NORMAL_ATTR; scp->term.cur_attr = scp->term.cur_color = scp->term.std_color = current_default->std_color; scp->term.rev_color = current_default->rev_color; break; case 1: /* set ansi background */ scp->term.attr_mask &= ~BACKGROUND_CHANGED; scp->term.cur_color = scp->term.std_color = (scp->term.std_color & 0x0F00) | (ansi_col[(scp->term.param[1])&0x0F]<<12); scp->term.cur_attr = mask2attr(&scp->term); break; case 2: /* set ansi foreground */ scp->term.attr_mask &= ~FOREGROUND_CHANGED; scp->term.cur_color = scp->term.std_color = (scp->term.std_color & 0xF000) | (ansi_col[(scp->term.param[1])&0x0F]<<8); scp->term.cur_attr = mask2attr(&scp->term); break; case 3: /* set ansi attribute directly */ scp->term.attr_mask &= ~(FOREGROUND_CHANGED|BACKGROUND_CHANGED); scp->term.cur_color = scp->term.std_color = (scp->term.param[1]&0xFF)<<8; scp->term.cur_attr = mask2attr(&scp->term); break; case 5: /* set ansi reverse video background */ scp->term.rev_color = (scp->term.rev_color & 0x0F00) | (ansi_col[(scp->term.param[1])&0x0F]<<12); scp->term.cur_attr = mask2attr(&scp->term); break; case 6: /* set ansi reverse video foreground */ scp->term.rev_color = (scp->term.rev_color & 0xF000) | (ansi_col[(scp->term.param[1])&0x0F]<<8); scp->term.cur_attr = mask2attr(&scp->term); break; case 7: /* set ansi reverse video directly */ scp->term.rev_color = (scp->term.param[1]&0xFF)<<8; scp->term.cur_attr = mask2attr(&scp->term); break; } break; case 'z': /* switch to (virtual) console n */ if (scp->term.num_param == 1) switch_scr(scp, scp->term.param[0]); break; } } else if (scp->term.esc == 3) { /* seen ESC [0-9]+ = */ if (c >= '0' && c <= '9') { if (scp->term.num_param < MAX_ESC_PAR) { if (scp->term.last_param != scp->term.num_param) { scp->term.last_param = scp->term.num_param; scp->term.param[scp->term.num_param] = 0; } else scp->term.param[scp->term.num_param] *= 10; scp->term.param[scp->term.num_param] += c - '0'; return; } } scp->term.num_param = scp->term.last_param + 1; switch (c) { case ';': if (scp->term.num_param < MAX_ESC_PAR) return; break; case 'A': /* set display border color */ if (scp->term.num_param == 1) { scp->border=scp->term.param[0] & 0xff; if (scp == cur_console) set_border(cur_console, scp->border); } break; case 'B': /* set bell pitch and duration */ if (scp->term.num_param == 2) { scp->bell_pitch = scp->term.param[0]; scp->bell_duration = scp->term.param[1]; } break; case 'C': /* set cursor type & shape */ if (scp->term.num_param == 1) { if (scp->term.param[0] & 0x01) sc_flags |= BLINK_CURSOR; else sc_flags &= ~BLINK_CURSOR; if ((scp->term.param[0] & 0x02) && ISFONTAVAIL(scp->adp->va_flags)) sc_flags |= CHAR_CURSOR; else sc_flags &= ~CHAR_CURSOR; } else if (scp->term.num_param == 2) { scp->cursor_start = scp->term.param[0] & 0x1F; scp->cursor_end = scp->term.param[1] & 0x1F; } /* * The cursor shape is global property; all virtual consoles * are affected. Update the cursor in the current console... */ if (!ISGRAPHSC(cur_console)) { i = spltty(); remove_cursor_image(cur_console); if (sc_flags & CHAR_CURSOR) set_destructive_cursor(cur_console); draw_cursor_image(cur_console); splx(i); } break; case 'F': /* set ansi foreground */ if (scp->term.num_param == 1) { scp->term.attr_mask &= ~FOREGROUND_CHANGED; scp->term.cur_color = scp->term.std_color = (scp->term.std_color & 0xF000) | ((scp->term.param[0] & 0x0F) << 8); scp->term.cur_attr = mask2attr(&scp->term); } break; case 'G': /* set ansi background */ if (scp->term.num_param == 1) { scp->term.attr_mask &= ~BACKGROUND_CHANGED; scp->term.cur_color = scp->term.std_color = (scp->term.std_color & 0x0F00) | ((scp->term.param[0] & 0x0F) << 12); scp->term.cur_attr = mask2attr(&scp->term); } break; case 'H': /* set ansi reverse video foreground */ if (scp->term.num_param == 1) { scp->term.rev_color = (scp->term.rev_color & 0xF000) | ((scp->term.param[0] & 0x0F) << 8); scp->term.cur_attr = mask2attr(&scp->term); } break; case 'I': /* set ansi reverse video background */ if (scp->term.num_param == 1) { scp->term.rev_color = (scp->term.rev_color & 0x0F00) | ((scp->term.param[0] & 0x0F) << 12); scp->term.cur_attr = mask2attr(&scp->term); } break; } } #if notyet else if (scp->term.esc == 4) { /* seen ESC Q */ /* to be filled */ } #endif else if (scp->term.esc == 5) { /* seen ESC ( */ switch (c) { case 'B': /* iso-2022: desginate ASCII into G0 */ break; /* other items to be filled */ default: break; } } scp->term.esc = 0; } static void ansi_put(scr_stat *scp, u_char *buf, int len) { u_char *ptr = buf; /* make screensaver happy */ if (!sticky_splash && scp == cur_console) run_scrn_saver = FALSE; write_in_progress++; outloop: if (scp->term.esc) { scan_esc(scp, *ptr++); len--; } else if (PRINTABLE(*ptr)) { /* Print only printables */ int cnt = len <= (scp->xsize-scp->xpos) ? len : (scp->xsize-scp->xpos); u_short cur_attr = scp->term.cur_attr; u_short *cursor_pos = scp->cursor_pos; do { /* * gcc-2.6.3 generates poor (un)sign extension code. Casting the * pointers in the following to volatile should have no effect, * but in fact speeds up this inner loop from 26 to 18 cycles * (+ cache misses) on i486's. */ #define UCVP(ucp) ((u_char volatile *)(ucp)) *cursor_pos++ = UCVP(scr_map)[*UCVP(ptr)] | cur_attr; ptr++; cnt--; } while (cnt && PRINTABLE(*ptr)); len -= (cursor_pos - scp->cursor_pos); scp->xpos += (cursor_pos - scp->cursor_pos); mark_for_update(scp, scp->cursor_pos - scp->scr_buf); mark_for_update(scp, cursor_pos - scp->scr_buf); scp->cursor_pos = cursor_pos; if (scp->xpos >= scp->xsize) { scp->xpos = 0; scp->ypos++; } } else { switch(*ptr) { case 0x07: do_bell(scp, scp->bell_pitch, scp->bell_duration); break; case 0x08: /* non-destructive backspace */ if (scp->cursor_pos > scp->scr_buf) { mark_for_update(scp, scp->cursor_pos - scp->scr_buf); scp->cursor_pos--; mark_for_update(scp, scp->cursor_pos - scp->scr_buf); if (scp->xpos > 0) scp->xpos--; else { scp->xpos += scp->xsize - 1; scp->ypos--; } } break; case 0x09: /* non-destructive tab */ mark_for_update(scp, scp->cursor_pos - scp->scr_buf); scp->cursor_pos += (8 - scp->xpos % 8u); mark_for_update(scp, scp->cursor_pos - scp->scr_buf); if ((scp->xpos += (8 - scp->xpos % 8u)) >= scp->xsize) { scp->xpos = 0; scp->ypos++; } break; case 0x0a: /* newline, same pos */ mark_for_update(scp, scp->cursor_pos - scp->scr_buf); scp->cursor_pos += scp->xsize; mark_for_update(scp, scp->cursor_pos - scp->scr_buf); scp->ypos++; break; case 0x0c: /* form feed, clears screen */ sc_clear_screen(scp); break; case 0x0d: /* return, return to pos 0 */ mark_for_update(scp, scp->cursor_pos - scp->scr_buf); scp->cursor_pos -= scp->xpos; mark_for_update(scp, scp->cursor_pos - scp->scr_buf); scp->xpos = 0; break; case 0x1b: /* start escape sequence */ scp->term.esc = 1; scp->term.num_param = 0; break; } ptr++; len--; } /* do we have to scroll ?? */ if (scp->cursor_pos >= scp->scr_buf + scp->ysize * scp->xsize) { remove_cutmarking(scp); if (scp->history != NULL) { bcopy(scp->scr_buf, scp->history_head, scp->xsize * sizeof(u_short)); scp->history_head += scp->xsize; if (scp->history_head + scp->xsize > scp->history + scp->history_size) scp->history_head = scp->history; } bcopy(scp->scr_buf + scp->xsize, scp->scr_buf, scp->xsize * (scp->ysize - 1) * sizeof(u_short)); fillw(scp->term.cur_color | scr_map[0x20], scp->scr_buf + scp->xsize * (scp->ysize - 1), scp->xsize); scp->cursor_pos -= scp->xsize; scp->ypos--; mark_all(scp); } if (len) goto outloop; write_in_progress--; if (delayed_next_scr) switch_scr(scp, delayed_next_scr - 1); } static void scinit(void) { video_adapter_t *adp; int col; int row; u_int i; if (init_done != COLD) return; init_done = WARM; get_bios_values(); /* extract the hardware cursor location and hide the cursor for now */ adp = vid_get_adapter(adapter); (*vidsw[adapter]->read_hw_cursor)(adp, &col, &row); (*vidsw[adapter]->set_hw_cursor)(adp, -1, -1); /* set up the first console */ current_default = &user_default; console[0] = &main_console; init_scp(console[0]); cur_console = console[0]; /* copy screen to temporary buffer */ if (ISTEXTSC(console[0])) bcopy_fromio(console[0]->adp->va_window, sc_buffer, console[0]->xsize * console[0]->ysize * sizeof(u_short)); console[0]->scr_buf = console[0]->mouse_pos = console[0]->mouse_oldpos = sc_buffer; if (col >= console[0]->xsize) col = 0; if (row >= console[0]->ysize) row = console[0]->ysize - 1; console[0]->xpos = col; console[0]->ypos = row; console[0]->cursor_pos = console[0]->cursor_oldpos = sc_buffer + row*console[0]->xsize + col; console[0]->cursor_saveunder = *console[0]->cursor_pos; for (i=1; iadp->va_flags)) { if (fonts_loaded & FONT_16) { copy_font(cur_console, LOAD, 16, font_16); } else { copy_font(cur_console, SAVE, 16, font_16); fonts_loaded = FONT_16; set_destructive_cursor(cur_console); } /* * FONT KLUDGE * Always use the font page #0. XXX */ (*vidsw[cur_console->ad]->show_font)(cur_console->adp, 0); } save_palette(cur_console->adp, palette); #if NSPLASH > 0 /* we are ready to put up the splash image! */ splash_init(cur_console->adp, scsplash_callback); #endif } static void scshutdown(int howto, void *arg) { sc_touch_scrn_saver(); if (!cold && cur_console->smode.mode == VT_AUTO && console[0]->smode.mode == VT_AUTO) switch_scr(cur_console, 0); shutdown_in_progress = TRUE; } int sc_clean_up(scr_stat *scp) { int error; sc_touch_scrn_saver(); if ((error = wait_scrn_saver_stop())) return error; scp->status &= ~MOUSE_VISIBLE; remove_cutmarking(scp); return 0; } void sc_alloc_scr_buffer(scr_stat *scp, int wait, int clear) { if (scp->scr_buf) free(scp->scr_buf, M_DEVBUF); scp->scr_buf = (u_short *)malloc(scp->xsize*scp->ysize*sizeof(u_short), M_DEVBUF, (wait) ? M_WAITOK : M_NOWAIT); if (clear) { /* clear the screen and move the text cursor to the top-left position */ sc_clear_screen(scp); } else { /* retain the current cursor position, but adjust pointers */ move_crsr(scp, scp->xpos, scp->ypos); scp->cursor_oldpos = scp->cursor_pos; } /* move the mouse cursor at the center of the screen */ sc_move_mouse(scp, scp->xpixel / 2, scp->ypixel / 2); } void sc_alloc_cut_buffer(scr_stat *scp, int wait) { if ((cut_buffer == NULL) || (cut_buffer_size < scp->xsize * scp->ysize + 1)) { if (cut_buffer != NULL) free(cut_buffer, M_DEVBUF); cut_buffer_size = scp->xsize * scp->ysize + 1; cut_buffer = (u_char *)malloc(cut_buffer_size, M_DEVBUF, (wait) ? M_WAITOK : M_NOWAIT); if (cut_buffer != NULL) cut_buffer[0] = '\0'; } } void sc_alloc_history_buffer(scr_stat *scp, int lines, int extra, int wait) { u_short *usp; if (lines < scp->ysize) lines = scp->ysize; usp = scp->history; scp->history = NULL; if (usp != NULL) { free(usp, M_DEVBUF); if (extra > 0) extra_history_size += extra; } scp->history_size = lines * scp->xsize; if (lines > imax(sc_history_size, scp->ysize)) extra_history_size -= lines - imax(sc_history_size, scp->ysize); usp = (u_short *)malloc(scp->history_size * sizeof(u_short), M_DEVBUF, (wait) ? M_WAITOK : M_NOWAIT); if (usp != NULL) bzero(usp, scp->history_size * sizeof(u_short)); scp->history_head = scp->history_pos = usp; scp->history = usp; } static scr_stat *alloc_scp() { scr_stat *scp; scp = (scr_stat *)malloc(sizeof(scr_stat), M_DEVBUF, M_WAITOK); init_scp(scp); sc_alloc_scr_buffer(scp, TRUE, TRUE); if (ISMOUSEAVAIL(scp->adp->va_flags)) sc_alloc_cut_buffer(scp, TRUE); sc_alloc_history_buffer(scp, sc_history_size, 0, TRUE); /* SOS if (scp->adp->va_flags & V_ADP_MODECHANGE) set_mode(scp); */ sc_clear_screen(scp); scp->cursor_saveunder = *scp->cursor_pos; return scp; } static void init_scp(scr_stat *scp) { video_info_t info; scp->ad = adapter; scp->adp = vid_get_adapter(scp->ad); (*vidsw[scp->ad]->get_info)(scp->adp, initial_video_mode, &info); scp->status = 0; scp->mode = initial_video_mode; scp->scr_buf = NULL; if (info.vi_flags & V_INFO_GRAPHICS) { scp->status |= GRAPHICS_MODE; scp->xpixel = info.vi_width; scp->ypixel = info.vi_height; scp->xsize = info.vi_width/8; scp->ysize = info.vi_height/info.vi_cheight; scp->font_size = FONT_NONE; } else { scp->xsize = info.vi_width; scp->ysize = info.vi_height; scp->xpixel = scp->xsize*8; scp->ypixel = scp->ysize*info.vi_cheight; scp->font_size = info.vi_cheight; } scp->xoff = scp->yoff = 0; scp->xpos = scp->ypos = 0; scp->saved_xpos = scp->saved_ypos = -1; scp->start = scp->xsize * scp->ysize; scp->end = 0; scp->term.esc = 0; scp->term.attr_mask = NORMAL_ATTR; scp->term.cur_attr = scp->term.cur_color = scp->term.std_color = current_default->std_color; scp->term.rev_color = current_default->rev_color; scp->border = BG_BLACK; scp->cursor_start = bios_value.cursor_start; scp->cursor_end = bios_value.cursor_end; scp->mouse_xpos = scp->xsize*8/2; scp->mouse_ypos = scp->ysize*scp->font_size/2; scp->mouse_cut_start = scp->mouse_cut_end = NULL; scp->mouse_signal = 0; scp->mouse_pid = 0; scp->mouse_proc = NULL; scp->kbd_mode = K_XLATE; scp->bell_pitch = BELL_PITCH; scp->bell_duration = BELL_DURATION; scp->status |= (bios_value.shift_state & 0x20) ? NLKED : 0; scp->status |= CURSOR_ENABLED; scp->pid = 0; scp->proc = NULL; scp->smode.mode = VT_AUTO; scp->history_head = scp->history_pos = scp->history = NULL; scp->history_size = imax(sc_history_size, scp->ysize) * scp->xsize; } static void get_bios_values(void) { bios_value.cursor_start = *(u_int8_t *)pa_to_va(0x461); bios_value.cursor_end = *(u_int8_t *)pa_to_va(0x460); bios_value.shift_state = *(u_int8_t *)pa_to_va(0x417); } static void history_to_screen(scr_stat *scp) { int i; for (i=0; iysize; i++) bcopy(scp->history + (((scp->history_pos - scp->history) + scp->history_size-((i+1)*scp->xsize))%scp->history_size), scp->scr_buf + (scp->xsize * (scp->ysize-1 - i)), scp->xsize * sizeof(u_short)); mark_all(scp); } static int history_up_line(scr_stat *scp) { if (WRAPHIST(scp, scp->history_pos, -(scp->xsize*scp->ysize)) != scp->history_head) { scp->history_pos = WRAPHIST(scp, scp->history_pos, -scp->xsize); history_to_screen(scp); return 0; } else return -1; } static int history_down_line(scr_stat *scp) { if (scp->history_pos != scp->history_head) { scp->history_pos = WRAPHIST(scp, scp->history_pos, scp->xsize); history_to_screen(scp); return 0; } else return -1; } /* * scgetc(flags) - get character from keyboard. * If flags & SCGETC_CN, then avoid harmful side effects. * If flags & SCGETC_NONBLOCK, then wait until a key is pressed, else * return NOKEY if there is nothing there. */ static u_int scgetc(keyboard_t *kbd, u_int flags) { u_int c; int this_scr; int f; int i; if (kbd == NULL) return NOKEY; next_code: /* I don't like this, but... XXX */ if (flags & SCGETC_CN) sccnupdate(cur_console); /* first see if there is something in the keyboard port */ for (;;) { c = kbd_read_char(kbd, !(flags & SCGETC_NONBLOCK)); if (c == ERRKEY) { if (!(flags & SCGETC_CN)) do_bell(cur_console, BELL_PITCH, BELL_DURATION); } else if (c == NOKEY) return c; else break; } /* make screensaver happy */ if (!(c & RELKEY)) sc_touch_scrn_saver(); #ifdef __i386__ if (!(flags & SCGETC_CN)) /* do the /dev/random device a favour */ add_keyboard_randomness(c); #endif if (cur_console->kbd_mode != K_XLATE) return KEYCHAR(c); /* if scroll-lock pressed allow history browsing */ if (!ISGRAPHSC(cur_console) && cur_console->history && cur_console->status & SLKED) { cur_console->status &= ~CURSOR_ENABLED; if (!(cur_console->status & BUFFER_SAVED)) { cur_console->status |= BUFFER_SAVED; cur_console->history_save = cur_console->history_head; /* copy screen into top of history buffer */ for (i=0; iysize; i++) { bcopy(cur_console->scr_buf + (cur_console->xsize * i), cur_console->history_head, cur_console->xsize * sizeof(u_short)); cur_console->history_head += cur_console->xsize; if (cur_console->history_head + cur_console->xsize > cur_console->history + cur_console->history_size) cur_console->history_head=cur_console->history; } cur_console->history_pos = cur_console->history_head; history_to_screen(cur_console); } switch (c) { /* FIXME: key codes */ case SPCLKEY | FKEY | F(49): /* home key */ remove_cutmarking(cur_console); cur_console->history_pos = cur_console->history_head; history_to_screen(cur_console); goto next_code; case SPCLKEY | FKEY | F(57): /* end key */ remove_cutmarking(cur_console); cur_console->history_pos = WRAPHIST(cur_console, cur_console->history_head, cur_console->xsize*cur_console->ysize); history_to_screen(cur_console); goto next_code; case SPCLKEY | FKEY | F(50): /* up arrow key */ remove_cutmarking(cur_console); if (history_up_line(cur_console)) if (!(flags & SCGETC_CN)) do_bell(cur_console, BELL_PITCH, BELL_DURATION); goto next_code; case SPCLKEY | FKEY | F(58): /* down arrow key */ remove_cutmarking(cur_console); if (history_down_line(cur_console)) if (!(flags & SCGETC_CN)) do_bell(cur_console, BELL_PITCH, BELL_DURATION); goto next_code; case SPCLKEY | FKEY | F(51): /* page up key */ remove_cutmarking(cur_console); for (i=0; iysize; i++) if (history_up_line(cur_console)) { if (!(flags & SCGETC_CN)) do_bell(cur_console, BELL_PITCH, BELL_DURATION); break; } goto next_code; case SPCLKEY | FKEY | F(59): /* page down key */ remove_cutmarking(cur_console); for (i=0; iysize; i++) if (history_down_line(cur_console)) { if (!(flags & SCGETC_CN)) do_bell(cur_console, BELL_PITCH, BELL_DURATION); break; } goto next_code; } } /* * Process and consume special keys here. Return a plain char code * or a char code with the META flag or a function key code. */ if (c & RELKEY) { /* key released */ /* goto next_code */ } else { /* key pressed */ if (c & SPCLKEY) { c &= ~SPCLKEY; switch (KEYCHAR(c)) { /* LOCKING KEYS */ case NLK: case CLK: case ALK: break; case SLK: kbd_ioctl(kbd, KDGKBSTATE, (caddr_t)&f); if (f & SLKED) { cur_console->status |= SLKED; } else { if (cur_console->status & SLKED) { cur_console->status &= ~SLKED; if (cur_console->status & BUFFER_SAVED) { int i; u_short *ptr = cur_console->history_save; for (i=0; iysize; i++) { bcopy(ptr, cur_console->scr_buf + (cur_console->xsize*i), cur_console->xsize * sizeof(u_short)); ptr += cur_console->xsize; if (ptr + cur_console->xsize > cur_console->history + cur_console->history_size) ptr = cur_console->history; } cur_console->status &= ~BUFFER_SAVED; cur_console->history_head=cur_console->history_save; cur_console->status |= CURSOR_ENABLED; mark_all(cur_console); } scstart(VIRTUAL_TTY(get_scr_num())); } } break; /* NON-LOCKING KEYS */ case NOP: case LSH: case RSH: case LCTR: case RCTR: case LALT: case RALT: case ASH: case META: break; case BTAB: return c; case SPSC: /* force activatation/deactivation of the screen saver */ if (!scrn_blanked) { run_scrn_saver = TRUE; scrn_time_stamp -= scrn_blank_time; } #if NSPLASH > 0 if (cold) { /* * While devices are being probed, the screen saver need * to be invoked explictly. XXX */ if (scrn_blanked) { scsplash_stick(FALSE); stop_scrn_saver(current_saver); } else { if (!ISGRAPHSC(cur_console)) { scsplash_stick(TRUE); (*current_saver)(TRUE); } } } #endif /* NSPLASH */ break; case RBT: #ifndef SC_DISABLE_REBOOT shutdown_nice(); #endif break; #if NAPM > 0 case SUSP: apm_suspend(PMST_SUSPEND); break; case STBY: apm_suspend(PMST_STANDBY); break; #else case SUSP: case STBY: break; #endif case DBG: #ifdef DDB /* try to switch to console 0 */ /* * TRY to make sure the screen saver is stopped, * and the screen is updated before switching to * the vty0. */ scrn_timer((void *)FALSE); if (cur_console->smode.mode == VT_AUTO && console[0]->smode.mode == VT_AUTO) switch_scr(cur_console, 0); Debugger("manual escape to debugger"); #else printf("No debugger in kernel\n"); #endif break; case NEXT: this_scr = get_scr_num(); for (i = this_scr + 1; i != this_scr; i = (i + 1)%MAXCONS) { struct tty *tp = VIRTUAL_TTY(i); if (tp->t_state & TS_ISOPEN) { switch_scr(cur_console, i); break; } } break; default: if (KEYCHAR(c) >= F_SCR && KEYCHAR(c) <= L_SCR) { switch_scr(cur_console, KEYCHAR(c) - F_SCR); break; } /* assert(c & FKEY) */ return c; } /* goto next_code */ } else { /* regular keys (maybe MKEY is set) */ return c; } } goto next_code; } int scmmap(dev_t dev, vm_offset_t offset, int nprot) { struct tty *tp; struct scr_stat *scp; tp = scdevtotty(dev); if (!tp) return ENXIO; scp = sc_get_scr_stat(tp->t_dev); return (*vidsw[scp->ad]->mmap)(scp->adp, offset); } /* * Calculate hardware attributes word using logical attributes mask and * hardware colors */ static int mask2attr(struct term_stat *term) { int attr, mask = term->attr_mask; if (mask & REVERSE_ATTR) { attr = ((mask & FOREGROUND_CHANGED) ? ((term->cur_color & 0xF000) >> 4) : (term->rev_color & 0x0F00)) | ((mask & BACKGROUND_CHANGED) ? ((term->cur_color & 0x0F00) << 4) : (term->rev_color & 0xF000)); } else attr = term->cur_color; /* XXX: underline mapping for Hercules adapter can be better */ if (mask & (BOLD_ATTR | UNDERLINE_ATTR)) attr ^= 0x0800; if (mask & BLINK_ATTR) attr ^= 0x8000; return attr; } static int save_kbd_state(scr_stat *scp) { int state; int error; error = kbd_ioctl(kbd, KDGKBSTATE, (caddr_t)&state); if (error == ENOIOCTL) error = ENODEV; if (error == 0) { scp->status &= ~LOCK_MASK; scp->status |= state; } return error; } static int update_kbd_state(int new_bits, int mask) { int state; int error; if (mask != LOCK_MASK) { error = kbd_ioctl(kbd, KDGKBSTATE, (caddr_t)&state); if (error == ENOIOCTL) error = ENODEV; if (error) return error; state &= ~mask; state |= new_bits & mask; } else { state = new_bits & LOCK_MASK; } error = kbd_ioctl(kbd, KDSKBSTATE, (caddr_t)&state); if (error == ENOIOCTL) error = ENODEV; return error; } static int update_kbd_leds(int which) { int error; which &= LOCK_MASK; error = kbd_ioctl(kbd, KDSETLED, (caddr_t)&which); if (error == ENOIOCTL) error = ENODEV; return error; } int set_mode(scr_stat *scp) { video_info_t info; /* reject unsupported mode */ if ((*vidsw[scp->ad]->get_info)(scp->adp, scp->mode, &info)) return 1; /* if this vty is not currently showing, do nothing */ if (scp != cur_console) return 0; /* setup video hardware for the given mode */ (*vidsw[scp->ad]->set_mode)(scp->adp, scp->mode); Crtat = scp->adp->va_window; if (!(scp->status & GRAPHICS_MODE)) { /* load appropriate font */ if (!(scp->status & PIXEL_MODE) && ISFONTAVAIL(scp->adp->va_flags)) { if (scp->font_size < 14) { if (fonts_loaded & FONT_8) copy_font(scp, LOAD, 8, font_8); } else if (scp->font_size >= 16) { if (fonts_loaded & FONT_16) copy_font(scp, LOAD, 16, font_16); } else { if (fonts_loaded & FONT_14) copy_font(scp, LOAD, 14, font_14); } /* * FONT KLUDGE: * This is an interim kludge to display correct font. * Always use the font page #0 on the video plane 2. * Somehow we cannot show the font in other font pages on * some video cards... XXX */ (*vidsw[scp->ad]->show_font)(scp->adp, 0); } mark_all(scp); } if (scp->status & PIXEL_MODE) bzero_io(scp->adp->va_window, scp->xpixel*scp->ypixel/8); set_border(scp, scp->border); /* move hardware cursor out of the way */ (*vidsw[scp->ad]->set_hw_cursor)(scp->adp, -1, -1); return 0; } void set_border(scr_stat *scp, int color) { vm_offset_t p; int xoff; int yoff; int xlen; int ylen; int i; (*vidsw[scp->ad]->set_border)(scp->adp, color); if (scp->status & PIXEL_MODE) { outw(GDCIDX, 0x0005); /* read mode 0, write mode 0 */ outw(GDCIDX, 0x0003); /* data rotate/function select */ outw(GDCIDX, 0x0f01); /* set/reset enable */ outw(GDCIDX, 0xff08); /* bit mask */ outw(GDCIDX, (color << 8) | 0x00); /* set/reset */ p = scp->adp->va_window; xoff = scp->xoff; yoff = scp->yoff*scp->font_size; xlen = scp->xpixel/8; ylen = scp->ysize*scp->font_size; if (yoff > 0) { bzero_io(p, xlen*yoff); bzero_io(p + xlen*(yoff + ylen), xlen*scp->ypixel - xlen*(yoff + ylen)); } if (xoff > 0) { for (i = 0; i < ylen; ++i) { bzero_io(p + xlen*(yoff + i), xoff); bzero_io(p + xlen*(yoff + i) + xoff + scp->xsize, xlen - xoff - scp->xsize); } } outw(GDCIDX, 0x0000); /* set/reset */ outw(GDCIDX, 0x0001); /* set/reset enable */ } } void copy_font(scr_stat *scp, int operation, int font_size, u_char *buf) { /* * FONT KLUDGE: * This is an interim kludge to display correct font. * Always use the font page #0 on the video plane 2. * Somehow we cannot show the font in other font pages on * some video cards... XXX */ font_loading_in_progress = TRUE; if (operation == LOAD) { (*vidsw[scp->ad]->load_font)(scp->adp, 0, font_size, buf, 0, 256); if (sc_flags & CHAR_CURSOR) set_destructive_cursor(scp); } else if (operation == SAVE) { (*vidsw[scp->ad]->save_font)(scp->adp, 0, font_size, buf, 0, 256); } font_loading_in_progress = FALSE; } static void set_destructive_cursor(scr_stat *scp) { u_char cursor[32]; u_char *font_buffer; int font_size; int crtc_addr; int i; if (!ISFONTAVAIL(scp->adp->va_flags) || (scp->status & (GRAPHICS_MODE | PIXEL_MODE))) return; if (scp->font_size < 14) { font_buffer = font_8; font_size = 8; } else if (scp->font_size >= 16) { font_buffer = font_16; font_size = 16; } else { font_buffer = font_14; font_size = 14; } if (scp->status & MOUSE_VISIBLE) { if ((scp->cursor_saveunder & 0xff) == SC_MOUSE_CHAR) bcopy(&scp->mouse_cursor[0], cursor, scp->font_size); else if ((scp->cursor_saveunder & 0xff) == SC_MOUSE_CHAR + 1) bcopy(&scp->mouse_cursor[32], cursor, scp->font_size); else if ((scp->cursor_saveunder & 0xff) == SC_MOUSE_CHAR + 2) bcopy(&scp->mouse_cursor[64], cursor, scp->font_size); else if ((scp->cursor_saveunder & 0xff) == SC_MOUSE_CHAR + 3) bcopy(&scp->mouse_cursor[96], cursor, scp->font_size); else bcopy(font_buffer+((scp->cursor_saveunder & 0xff)*scp->font_size), cursor, scp->font_size); } else bcopy(font_buffer + ((scp->cursor_saveunder & 0xff) * scp->font_size), cursor, scp->font_size); for (i=0; i<32; i++) if ((i >= scp->cursor_start && i <= scp->cursor_end) || (scp->cursor_start >= scp->font_size && i == scp->font_size - 1)) cursor[i] |= 0xff; #if 1 crtc_addr = scp->adp->va_crtc_addr; while (!(inb(crtc_addr+6) & 0x08)) /* wait for vertical retrace */ ; #endif font_loading_in_progress = TRUE; (*vidsw[scp->ad]->load_font)(scp->adp, 0, font_size, cursor, DEAD_CHAR, 1); font_loading_in_progress = FALSE; } void sc_move_mouse(scr_stat *scp, int x, int y) { scp->mouse_xpos = x; scp->mouse_ypos = y; scp->mouse_pos = scp->mouse_oldpos = scp->scr_buf + (y / scp->font_size) * scp->xsize + x / 8; } static void set_mouse_pos(scr_stat *scp) { static int last_xpos = -1, last_ypos = -1; if (scp->mouse_xpos < 0) scp->mouse_xpos = 0; if (scp->mouse_ypos < 0) scp->mouse_ypos = 0; if (!ISTEXTSC(scp)) { if (scp->mouse_xpos > scp->xpixel-1) scp->mouse_xpos = scp->xpixel-1; if (scp->mouse_ypos > scp->ypixel-1) scp->mouse_ypos = scp->ypixel-1; return; } if (scp->mouse_xpos > (scp->xsize*8)-1) scp->mouse_xpos = (scp->xsize*8)-1; if (scp->mouse_ypos > (scp->ysize*scp->font_size)-1) scp->mouse_ypos = (scp->ysize*scp->font_size)-1; if (scp->mouse_xpos != last_xpos || scp->mouse_ypos != last_ypos) { scp->status |= MOUSE_MOVED; scp->mouse_pos = scp->scr_buf + ((scp->mouse_ypos/scp->font_size)*scp->xsize + scp->mouse_xpos/8); if ((scp->status & MOUSE_VISIBLE) && (scp->status & MOUSE_CUTTING)) mouse_cut(scp); } } #define isspace(c) (((c) & 0xff) == ' ') static int skip_spc_right(scr_stat *scp, u_short *p) { int i; for (i = (p - scp->scr_buf) % scp->xsize; i < scp->xsize; ++i) { if (!isspace(*p)) break; ++p; } return i; } static int skip_spc_left(scr_stat *scp, u_short *p) { int i; for (i = (p-- - scp->scr_buf) % scp->xsize - 1; i >= 0; --i) { if (!isspace(*p)) break; --p; } return i; } static void mouse_cut(scr_stat *scp) { u_short *end; u_short *p; int i = 0; int j = 0; scp->mouse_cut_end = (scp->mouse_pos >= scp->mouse_cut_start) ? scp->mouse_pos + 1 : scp->mouse_pos; end = (scp->mouse_cut_start > scp->mouse_cut_end) ? scp->mouse_cut_start : scp->mouse_cut_end; for (p = (scp->mouse_cut_start > scp->mouse_cut_end) ? scp->mouse_cut_end : scp->mouse_cut_start; p < end; ++p) { cut_buffer[i] = *p & 0xff; /* remember the position of the last non-space char */ if (!isspace(cut_buffer[i++])) j = i; /* trim trailing blank when crossing lines */ if (((p - scp->scr_buf) % scp->xsize) == (scp->xsize - 1)) { cut_buffer[j++] = '\r'; i = j; } } cut_buffer[i] = '\0'; /* scan towards the end of the last line */ --p; for (i = (p - scp->scr_buf) % scp->xsize; i < scp->xsize; ++i) { if (!isspace(*p)) break; ++p; } /* if there is nothing but blank chars, trim them, but mark towards eol */ if (i >= scp->xsize) { if (scp->mouse_cut_start > scp->mouse_cut_end) scp->mouse_cut_start = p; else scp->mouse_cut_end = p; cut_buffer[j++] = '\r'; cut_buffer[j] = '\0'; } mark_for_update(scp, scp->mouse_cut_start - scp->scr_buf); mark_for_update(scp, scp->mouse_cut_end - scp->scr_buf); } static void mouse_cut_start(scr_stat *scp) { int i; if (scp->status & MOUSE_VISIBLE) { if (scp->mouse_pos == scp->mouse_cut_start && scp->mouse_cut_start == scp->mouse_cut_end - 1) { cut_buffer[0] = '\0'; remove_cutmarking(scp); } else if (skip_spc_right(scp, scp->mouse_pos) >= scp->xsize) { /* if the pointer is on trailing blank chars, mark towards eol */ i = skip_spc_left(scp, scp->mouse_pos) + 1; scp->mouse_cut_start = scp->scr_buf + ((scp->mouse_pos - scp->scr_buf) / scp->xsize) * scp->xsize + i; scp->mouse_cut_end = scp->scr_buf + ((scp->mouse_pos - scp->scr_buf) / scp->xsize + 1) * scp->xsize; cut_buffer[0] = '\r'; cut_buffer[1] = '\0'; scp->status |= MOUSE_CUTTING; } else { scp->mouse_cut_start = scp->mouse_pos; scp->mouse_cut_end = scp->mouse_cut_start + 1; cut_buffer[0] = *scp->mouse_cut_start & 0xff; cut_buffer[1] = '\0'; scp->status |= MOUSE_CUTTING; } mark_all(scp); /* delete all other screens cut markings */ for (i=0; istatus & MOUSE_VISIBLE) { scp->status &= ~MOUSE_CUTTING; } } static void mouse_cut_word(scr_stat *scp) { u_short *p; u_short *sol; u_short *eol; int i; /* * Because we don't have locale information in the kernel, * we only distinguish space char and non-space chars. Punctuation * chars, symbols and other regular chars are all treated alike. */ if (scp->status & MOUSE_VISIBLE) { sol = scp->scr_buf + ((scp->mouse_pos - scp->scr_buf) / scp->xsize) * scp->xsize; eol = sol + scp->xsize; if (isspace(*scp->mouse_pos)) { for (p = scp->mouse_pos; p >= sol; --p) if (!isspace(*p)) break; scp->mouse_cut_start = ++p; for (p = scp->mouse_pos; p < eol; ++p) if (!isspace(*p)) break; scp->mouse_cut_end = p; } else { for (p = scp->mouse_pos; p >= sol; --p) if (isspace(*p)) break; scp->mouse_cut_start = ++p; for (p = scp->mouse_pos; p < eol; ++p) if (isspace(*p)) break; scp->mouse_cut_end = p; } for (i = 0, p = scp->mouse_cut_start; p < scp->mouse_cut_end; ++p) cut_buffer[i++] = *p & 0xff; cut_buffer[i] = '\0'; scp->status |= MOUSE_CUTTING; } } static void mouse_cut_line(scr_stat *scp) { u_short *p; int i; if (scp->status & MOUSE_VISIBLE) { scp->mouse_cut_start = scp->scr_buf + ((scp->mouse_pos - scp->scr_buf) / scp->xsize) * scp->xsize; scp->mouse_cut_end = scp->mouse_cut_start + scp->xsize; for (i = 0, p = scp->mouse_cut_start; p < scp->mouse_cut_end; ++p) cut_buffer[i++] = *p & 0xff; cut_buffer[i++] = '\r'; cut_buffer[i] = '\0'; scp->status |= MOUSE_CUTTING; } } static void mouse_cut_extend(scr_stat *scp) { if ((scp->status & MOUSE_VISIBLE) && !(scp->status & MOUSE_CUTTING) && (scp->mouse_cut_start != NULL)) { mouse_cut(scp); scp->status |= MOUSE_CUTTING; } } static void mouse_paste(scr_stat *scp) { if (scp->status & MOUSE_VISIBLE) { struct tty *tp; u_char *ptr = cut_buffer; tp = VIRTUAL_TTY(get_scr_num()); while (*ptr) (*linesw[tp->t_line].l_rint)(scr_rmap[*ptr++], tp); } } static void draw_mouse_image(scr_stat *scp) { u_short buffer[32]; u_short xoffset, yoffset; vm_offset_t crt_pos = scp->adp->va_window + 2*(scp->mouse_pos - scp->scr_buf); u_char *font_buffer; int font_size; int crtc_addr; int i; if (scp->font_size < 14) { font_buffer = font_8; font_size = 8; } else if (scp->font_size >= 16) { font_buffer = font_16; font_size = 16; } else { font_buffer = font_14; font_size = 14; } xoffset = scp->mouse_xpos % 8; yoffset = scp->mouse_ypos % scp->font_size; /* prepare mousepointer char's bitmaps */ bcopy(font_buffer + ((*(scp->mouse_pos) & 0xff) * font_size), &scp->mouse_cursor[0], font_size); bcopy(font_buffer + ((*(scp->mouse_pos+1) & 0xff) * font_size), &scp->mouse_cursor[32], font_size); bcopy(font_buffer + ((*(scp->mouse_pos+scp->xsize) & 0xff) * font_size), &scp->mouse_cursor[64], font_size); bcopy(font_buffer + ((*(scp->mouse_pos+scp->xsize+1) & 0xff) * font_size), &scp->mouse_cursor[96], font_size); for (i=0; imouse_cursor[i]<<8 | scp->mouse_cursor[i+32]; buffer[i+font_size]=scp->mouse_cursor[i+64]<<8|scp->mouse_cursor[i+96]; } /* now and-or in the mousepointer image */ for (i=0; i<16; i++) { buffer[i+yoffset] = ( buffer[i+yoffset] & ~(mouse_and_mask[i] >> xoffset)) | (mouse_or_mask[i] >> xoffset); } for (i=0; imouse_cursor[i] = (buffer[i] & 0xff00) >> 8; scp->mouse_cursor[i+32] = buffer[i] & 0xff; scp->mouse_cursor[i+64] = (buffer[i+font_size] & 0xff00) >> 8; scp->mouse_cursor[i+96] = buffer[i+font_size] & 0xff; } scp->mouse_oldpos = scp->mouse_pos; #if 1 /* wait for vertical retrace to avoid jitter on some videocards */ crtc_addr = scp->adp->va_crtc_addr; while (!(inb(crtc_addr+6) & 0x08)) /* idle */ ; #endif font_loading_in_progress = TRUE; (*vidsw[scp->ad]->load_font)(scp->adp, 0, 32, scp->mouse_cursor, SC_MOUSE_CHAR, 4); font_loading_in_progress = FALSE; writew(crt_pos, (*(scp->mouse_pos) & 0xff00) | SC_MOUSE_CHAR); writew(crt_pos+2*scp->xsize, (*(scp->mouse_pos + scp->xsize) & 0xff00) | (SC_MOUSE_CHAR + 2)); if (scp->mouse_xpos < (scp->xsize-1)*8) { writew(crt_pos + 2, (*(scp->mouse_pos + 1) & 0xff00) | (SC_MOUSE_CHAR + 1)); writew(crt_pos+2*scp->xsize + 2, (*(scp->mouse_pos + scp->xsize + 1) & 0xff00) | (SC_MOUSE_CHAR + 3)); } mark_for_update(scp, scp->mouse_pos - scp->scr_buf); mark_for_update(scp, scp->mouse_pos + scp->xsize + 1 - scp->scr_buf); } static void remove_mouse_image(scr_stat *scp) { vm_offset_t crt_pos; if (!ISTEXTSC(scp)) return; crt_pos = scp->adp->va_window + 2*(scp->mouse_oldpos - scp->scr_buf); writew(crt_pos, *(scp->mouse_oldpos)); writew(crt_pos+2, *(scp->mouse_oldpos+1)); writew(crt_pos+2*scp->xsize, *(scp->mouse_oldpos+scp->xsize)); writew(crt_pos+2*scp->xsize+2, *(scp->mouse_oldpos+scp->xsize+1)); mark_for_update(scp, scp->mouse_oldpos - scp->scr_buf); mark_for_update(scp, scp->mouse_oldpos + scp->xsize + 1 - scp->scr_buf); } static void draw_cutmarking(scr_stat *scp) { vm_offset_t crt_pos; u_short *ptr; u_short och, nch; crt_pos = scp->adp->va_window; for (ptr=scp->scr_buf; ptr<=(scp->scr_buf+(scp->xsize*scp->ysize)); ptr++) { nch = och = readw(crt_pos + 2*(ptr - scp->scr_buf)); /* are we outside the selected area ? */ if ( ptr < (scp->mouse_cut_start > scp->mouse_cut_end ? scp->mouse_cut_end : scp->mouse_cut_start) || ptr >= (scp->mouse_cut_start > scp->mouse_cut_end ? scp->mouse_cut_start : scp->mouse_cut_end)) { if (ptr != scp->cursor_pos) nch = (och & 0xff) | (*ptr & 0xff00); } else { /* are we clear of the cursor image ? */ if (ptr != scp->cursor_pos) nch = (och & 0x88ff) | (*ptr & 0x7000)>>4 | (*ptr & 0x0700)<<4; else { if (sc_flags & CHAR_CURSOR) nch = (och & 0x88ff)|(*ptr & 0x7000)>>4|(*ptr & 0x0700)<<4; else if (!(sc_flags & BLINK_CURSOR)) nch = (och & 0xff) | (*ptr & 0xff00); } } if (nch != och) writew(crt_pos + 2*(ptr - scp->scr_buf), nch); } } static void remove_cutmarking(scr_stat *scp) { scp->mouse_cut_start = scp->mouse_cut_end = NULL; scp->status &= ~MOUSE_CUTTING; mark_all(scp); } static void do_bell(scr_stat *scp, int pitch, int duration) { if (cold || shutdown_in_progress) return; if (scp != cur_console && (sc_flags & QUIET_BELL)) return; if (sc_flags & VISUAL_BELL) { if (blink_in_progress) return; blink_in_progress = 4; if (scp != cur_console) blink_in_progress += 2; blink_screen(cur_console); } else { if (scp != cur_console) pitch *= 2; sysbeep(pitch, duration); } } static void blink_screen(void *arg) { scr_stat *scp = arg; if (!ISTEXTSC(scp) || (blink_in_progress <= 1)) { blink_in_progress = FALSE; mark_all(scp); if (delayed_next_scr) switch_scr(scp, delayed_next_scr - 1); } else { if (blink_in_progress & 1) fillw_io(kernel_default.std_color | scr_map[0x20], scp->adp->va_window, scp->xsize * scp->ysize); else fillw_io(kernel_default.rev_color | scr_map[0x20], scp->adp->va_window, scp->xsize * scp->ysize); blink_in_progress--; timeout(blink_screen, scp, hz / 10); } } void sc_bcopy(scr_stat *scp, u_short *p, int from, int to, int mark) { u_char *font; vm_offset_t d; vm_offset_t e; u_char *f; int font_size; int line_length; int xsize; u_short bg; int i, j; u_char c; if (ISTEXTSC(scp)) { bcopy_toio(p + from, scp->adp->va_window + 2*from, (to - from + 1)*sizeof(u_short)); } else /* if ISPIXELSC(scp) */ { if (mark) mark = 255; font_size = scp->font_size; if (font_size < 14) font = font_8; else if (font_size >= 16) font = font_16; else font = font_14; line_length = scp->xpixel/8; xsize = scp->xsize; d = scp->adp->va_window + scp->xoff + scp->yoff*font_size*line_length + (from%xsize) + font_size*line_length*(from/xsize); outw(GDCIDX, 0x0005); /* read mode 0, write mode 0 */ outw(GDCIDX, 0x0003); /* data rotate/function select */ outw(GDCIDX, 0x0f01); /* set/reset enable */ bg = -1; for (i = from ; i <= to ; i++) { /* set background color in EGA/VGA latch */ if (bg != (p[i] & 0xf000)) { bg = (p[i] & 0xf000); outw(GDCIDX, (bg >> 4) | 0x00); /* set/reset */ outw(GDCIDX, 0xff08); /* bit mask */ writeb(d, 0); c = readb(d); /* set the background color in the latch */ } /* foreground color */ outw(GDCIDX, (p[i] & 0x0f00) | 0x00); /* set/reset */ e = d; f = &font[(p[i] & 0x00ff)*font_size]; for (j = 0 ; j < font_size; j++, f++) { outw(GDCIDX, ((*f^mark) << 8) | 0x08); /* bit mask */ writeb(e, 0); e += line_length; } d++; if ((i % xsize) == xsize - 1) d += scp->xoff*2 + (font_size - 1)*line_length; } outw(GDCIDX, 0x0000); /* set/reset */ outw(GDCIDX, 0x0001); /* set/reset enable */ outw(GDCIDX, 0xff08); /* bit mask */ #if 0 /* VGA only */ outw(GDCIDX, 0x0305); /* read mode 0, write mode 3 */ outw(GDCIDX, 0x0003); /* data rotate/function select */ outw(GDCIDX, 0x0f01); /* set/reset enable */ outw(GDCIDX, 0xff08); /* bit mask */ bg = -1; for (i = from ; i <= to ; i++) { /* set background color in EGA/VGA latch */ if (bg != (p[i] & 0xf000)) { bg = (p[i] & 0xf000); outw(GDCIDX, 0x0005); /* read mode 0, write mode 0 */ outw(GDCIDX, (bg >> 4) | 0x00); /* set/reset */ *d = 0; c = *d; /* set the background color in the latch */ outw(GDCIDX, 0x0305); /* read mode 0, write mode 3 */ } /* foreground color */ outw(GDCIDX, (p[i] & 0x0f00) | 0x00); /* set/reset */ e = (u_char *)d; f = &font[(p[i] & 0x00ff)*font_size]; for (j = 0 ; j < font_size; j++, f++) { *e = *f^mark; e += line_length; } d++; if ((i % xsize) == xsize - 1) d += scp->xoff*2 + (font_size - 1)*line_length; } outw(GDCIDX, 0x0005); /* read mode 0, write mode 0 */ outw(GDCIDX, 0x0000); /* set/reset */ outw(GDCIDX, 0x0001); /* set/reset enable */ #endif /* 0 */ } } #endif /* NSC */ Index: head/sys/i386/conf/files.i386 =================================================================== --- head/sys/i386/conf/files.i386 (revision 44627) +++ head/sys/i386/conf/files.i386 (revision 44628) @@ -1,366 +1,376 @@ # This file tells config what files go into building a kernel, # files marked standard are always included. # -# $Id: files.i386,v 1.226 1999/03/07 16:11:12 hm Exp $ +# $Id: files.i386,v 1.227 1999/03/10 10:11:41 julian Exp $ # # The long compile-with and dependency lines are required because of # limitations in config: backslash-newline doesn't work in strings, and # dependency lines other than the first are silently ignored. # linux_genassym optional compat_linux \ dependency "$S/i386/linux/linux_genassym.c $S/i386/linux/linux.h" \ compile-with "${CC} ${CFLAGS} ${PARAM} -UKERNEL -o $@ $<" \ no-obj no-implicit-rule \ clean "linux_genassym" # linux_assym.h optional compat_linux \ dependency "linux_genassym" \ compile-with "./linux_genassym > $@" \ no-obj no-implicit-rule before-depend \ clean "linux_assym.h" # font8x16.o optional std8x16font \ compile-with "uudecode < /usr/share/syscons/fonts/${STD8X16FONT}-8x16.fnt && file2c 'unsigned char font_16[16*256] = {' '};' < ${STD8X16FONT}-8x16 > font8x16.c && ${CC} -c ${CFLAGS} font8x16.c" \ no-implicit-rule before-depend \ clean "${STD8X16FONT}-8x16 font8x16.c" # +atkbdmap.h optional atkbd_dflt_keymap \ + compile-with "kbdcontrol -L ${ATKBD_DFLT_KEYMAP} | sed -e 's/^static keymap_t.* = /static keymap_t key_map = /' -e 's/^static accentmap_t.* = /static accentmap_t accent_map = /' > atkbdmap.h" \ + no-obj no-implicit-rule before-depend \ + clean "atkbdmap.h" +# +ukbdmap.h optional ukbd_dflt_keymap \ + compile-with "kbdcontrol -L ${UKBD_DFLT_KEYMAP} | sed -e 's/^static keymap_t.* = /static keymap_t key_map = /' -e 's/^static accentmap_t.* = /static accentmap_t accent_map = /' > ukbdmap.h" \ + no-obj no-implicit-rule before-depend \ + clean "ukbdmap.h" +# dev/ata/ata-all.c optional ata device-driver dev/ata/atapi-all.c optional ata device-driver dev/ata/ata-disk.c optional atadisk device-driver dev/ata/atapi-cd.c optional atapicd device-driver dev/ata/atapi-fd.c optional atapifd device-driver dev/ata/atapi-tape.c optional atapist device-driver dev/fb/fb.c optional fb device-driver dev/fb/fb.c optional vga device-driver dev/fb/splash.c optional splash dev/kbd/atkbd.c optional atkbd device-driver dev/kbd/atkbdc.c optional atkbdc device-driver dev/kbd/kbd.c optional atkbd device-driver dev/kbd/kbd.c optional kbd device-driver -#dev/kbd/kbd.c optional ukbd device-driver +dev/kbd/kbd.c optional ukbd device-driver dev/syscons/syscons.c optional sc device-driver dev/syscons/scvidctl.c optional sc device-driver dev/syscons/scvesactl.c optional sc device-driver i386/apm/apm.c optional apm device-driver i386/apm/apm_setup.s optional apm i386/eisa/dpt_eisa.c optional eisa dpt device-driver i386/eisa/3c5x9.c optional ep device-driver i386/eisa/adv_eisa.c optional adv device-driver i386/eisa/ahc_eisa.c optional eisa ahc device-driver \ dependency "aic7xxx_reg.h $S/i386/eisa/ahc_eisa.c" i386/eisa/ahb.c optional ahb device-driver i386/eisa/bt_eisa.c optional bt device-driver i386/eisa/eisaconf.c optional eisa i386/eisa/if_vx_eisa.c optional vx device-driver i386/eisa/if_fea.c optional fea device-driver i386/i386/autoconf.c standard device-driver i386/i386/bios.c standard i386/i386/bioscall.s standard i386/i386/busdma_machdep.c standard i386/i386/cons.c standard i386/i386/db_disasm.c optional ddb i386/i386/db_interface.c optional ddb i386/i386/db_trace.c optional ddb i386/i386/elf_machdep.c standard i386/i386/exception.s standard i386/i386/globals.s standard i386/i386/i386-gdbstub.c optional ddb i386/i386/identcpu.c standard i386/i386/in_cksum.c optional inet i386/i386/initcpu.c standard # locore.s needs to be handled in Makefile to put it first. Otherwise it's # now normal. # i386/i386/locore.s standard i386/i386/machdep.c standard i386/i386/math_emulate.c optional math_emulate i386/i386/mem.c standard i386/i386/mp_machdep.c optional smp i386/i386/mpapic.c optional smp i386/i386/mpboot.s optional smp i386/i386/mplock.s optional smp i386/i386/perfmon.c optional perfmon profiling-routine i386/i386/perfmon.c optional perfmon i386/i386/pmap.c standard i386/i386/procfs_machdep.c standard i386/i386/simplelock.s optional smp i386/i386/support.s standard i386/i386/swtch.s standard i386/i386/sys_machdep.c standard i386/i386/trap.c standard i386/i386/userconfig.c optional userconfig i386/i386/vm_machdep.c standard i386/i386/vm86.c optional vm86 i386/ibcs2/ibcs2_fcntl.c optional ibcs2 i386/ibcs2/ibcs2_stat.c optional ibcs2 i386/ibcs2/ibcs2_ipc.c optional ibcs2 i386/ibcs2/ibcs2_msg.c optional ibcs2 i386/ibcs2/ibcs2_misc.c optional ibcs2 i386/ibcs2/ibcs2_other.c optional ibcs2 i386/ibcs2/ibcs2_signal.c optional ibcs2 i386/ibcs2/ibcs2_ioctl.c optional ibcs2 i386/ibcs2/ibcs2_socksys.c optional ibcs2 i386/ibcs2/ibcs2_sysi86.c optional ibcs2 i386/ibcs2/ibcs2_util.c optional ibcs2 i386/ibcs2/ibcs2_isc.c optional ibcs2 i386/ibcs2/ibcs2_isc_sysent.c optional ibcs2 i386/ibcs2/ibcs2_xenix.c optional ibcs2 i386/ibcs2/ibcs2_xenix_sysent.c optional ibcs2 i386/ibcs2/ibcs2_errno.c optional ibcs2 i386/ibcs2/ibcs2_sysent.c optional ibcs2 i386/ibcs2/ibcs2_sysvec.c optional ibcs2 i386/ibcs2/imgact_coff.c optional ibcs2 i386/isa/adv_isa.c optional adv device-driver #i386/isa/aha1542.c optional aha device-driver i386/isa/aha_isa.c optional aha device-driver #i386/isa/aic6360.c optional aic device-driver i386/isa/aic_isa.c optional aic device-driver i386/isa/atkbd_isa.c optional atkbd device-driver i386/isa/atkbdc_isa.c optional atkbdc device-driver i386/isa/bt_isa.c optional bt device-driver i386/isa/clock.c standard i386/isa/cronyx.c optional cx device-driver i386/isa/ctx.c optional ctx device-driver i386/isa/cx.c optional cx device-driver i386/isa/cy.c optional cy device-driver i386/isa/diskslice_machdep.c standard i386/isa/elink.c optional ep device-driver i386/isa/elink.c optional ie device-driver i386/isa/fd.c optional fd device-driver i386/isa/gpib.c optional gp device-driver i386/isa/asc.c optional asc device-driver i386/isa/gsc.c optional gsc device-driver i386/isa/if_ar.c optional ar device-driver i386/isa/if_cs.c optional cs device-driver i386/isa/if_cx.c optional cx device-driver i386/isa/if_ed.c optional ed device-driver i386/isa/if_el.c optional el device-driver i386/isa/if_ep.c optional ep device-driver i386/isa/if_ex.c optional ex device-driver i386/isa/if_fe.c optional fe device-driver i386/isa/if_ie.c optional ie device-driver i386/isa/if_le.c optional le device-driver i386/isa/if_lnc.c optional lnc device-driver i386/isa/if_rdp.c optional rdp device-driver i386/isa/if_sr.c optional sr device-driver i386/isa/if_wl.c optional wl device-driver i386/isa/if_ze.c optional ze device-driver i386/isa/if_zp.c optional zp device-driver contrib/dev/oltr/if_oltr.c optional oltr device-driver \ dependency "contrib/dev/oltr/trlld.o" contrib/dev/oltr/trlld.o optional oltr device-driver \ dependency "$S/contrib/dev/oltr/i386-${KERNFORMAT}.trlld.o.uu" \ compile-with "uudecode < $S/contrib/dev/oltr/i386-${KERNFORMAT}.trlld.o.uu" \ no-implicit-rule contrib/dev/oltr/trlldmac.c optional oltr device-driver contrib/dev/oltr/trlldhm.c optional oltr device-driver contrib/dev/oltr/trlldbm.c optional oltr device-driver i386/isa/ipl_funcs.c standard \ compile-with "${CC} -c ${CFLAGS} ${DEFINED_PROF:S/^$/-fomit-frame-pointer/} $<" i386/isa/intr_machdep.c standard i386/isa/isa.c optional isa device-driver i386/isa/istallion.c optional stli device-driver i386/isa/joy.c optional joy device-driver i386/isa/loran.c optional loran device-driver i386/isa/labpc.c optional labpc device-driver i386/isa/mcd.c optional mcd device-driver i386/isa/mse.c optional mse device-driver i386/isa/npx.c mandatory npx device-driver i386/isa/pcaudio.c optional pca device-driver i386/isa/matcd/matcd.c optional matcd device-driver i386/isa/pcibus.c optional pci device-driver i386/isa/pcicx.c optional ze device-driver i386/isa/pcicx.c optional zp device-driver i386/isa/pcvt/pcvt_drv.c optional vt device-driver i386/isa/pcvt/pcvt_ext.c optional vt device-driver i386/isa/pcvt/pcvt_kbd.c optional vt device-driver i386/isa/pcvt/pcvt_out.c optional vt device-driver i386/isa/pcvt/pcvt_sup.c optional vt device-driver i386/isa/pcvt/pcvt_vtf.c optional vt device-driver i386/isa/pnp.c optional pnp device-driver i386/isa/prof_machdep.c optional profiling-routine i386/isa/ppc.c optional ppc device-driver i386/isa/pcf.c optional pcf device-driver i386/isa/psm.c optional psm device-driver i386/isa/random_machdep.c standard i386/isa/rc.c optional rc device-driver i386/isa/rp.c optional rp device-driver i386/isa/scd.c optional scd device-driver i386/isa/si.c optional si device-driver i386/isa/si2_z280.c optional si device-driver i386/isa/si3_t225.c optional si device-driver i386/isa/sio.c optional sio device-driver i386/isa/snd/sound.c optional pcm device-driver i386/isa/snd/dmabuf.c optional pcm device-driver i386/isa/snd/ad1848.c optional pcm device-driver i386/isa/snd/sb_dsp.c optional pcm device-driver i386/isa/snd/clones.c optional pcm device-driver i386/isa/sound/dev_table.c optional snd device-driver i386/isa/sound/soundcard.c optional snd device-driver i386/isa/sound/sound_switch.c optional snd device-driver i386/isa/sound/audio.c optional snd device-driver i386/isa/sound/dmabuf.c optional snd device-driver i386/isa/sound/sys_timer.c optional snd device-driver i386/isa/sound/sequencer.c optional snd device-driver i386/isa/sound/patmgr.c optional snd device-driver i386/isa/sound/adlib_card.c optional opl device-driver i386/isa/sound/opl3.c optional opl device-driver i386/isa/sound/gus_card.c optional gus device-driver i386/isa/sound/gus_midi.c optional gus device-driver i386/isa/sound/gus_vol.c optional gus device-driver i386/isa/sound/gus_wave.c optional gus device-driver i386/isa/sound/ics2101.c optional gus device-driver i386/isa/sound/sound_timer.c optional gus device-driver i386/isa/sound/sound_timer.c optional css device-driver i386/isa/sound/sound_timer.c optional mss device-driver i386/isa/sound/midi_synth.c optional gus device-driver i386/isa/sound/midibuf.c optional gus device-driver i386/isa/sound/ad1848.c optional gusxvi device-driver i386/isa/sound/ad1848.c optional gus device-driver i386/isa/sound/ad1848.c optional mss device-driver i386/isa/sound/ad1848.c optional css device-driver i386/isa/sound/sound_timer.c optional mss device-driver i386/isa/sound/midi_synth.c optional mss device-driver i386/isa/sound/midibuf.c optional mss device-driver i386/isa/sound/mpu401.c optional mpu device-driver i386/isa/sound/midi_synth.c optional mpu device-driver i386/isa/sound/midibuf.c optional mpu device-driver i386/isa/sound/pas2_card.c optional pas device-driver i386/isa/sound/pas2_midi.c optional pas device-driver i386/isa/sound/pas2_mixer.c optional pas device-driver i386/isa/sound/pas2_pcm.c optional pas device-driver i386/isa/sound/midi_synth.c optional pas device-driver i386/isa/sound/midibuf.c optional pas device-driver i386/isa/sound/sb_card.c optional sb device-driver i386/isa/sound/sb_dsp.c optional sb device-driver i386/isa/sound/sb_midi.c optional sb device-driver i386/isa/sound/sb_mixer.c optional sb device-driver i386/isa/sound/midi_synth.c optional sb device-driver i386/isa/sound/midibuf.c optional sb device-driver i386/isa/sound/sb16_dsp.c optional sbxvi device-driver i386/isa/sound/sb16_midi.c optional sbmidi device-driver i386/isa/sound/uart6850.c optional uart device-driver i386/isa/sound/midi_synth.c optional uart device-driver i386/isa/sound/midi_synth.c optional css device-driver i386/isa/sound/midibuf.c optional uart device-driver i386/isa/sound/midibuf.c optional css device-driver i386/isa/sound/trix.c optional trix device-driver i386/isa/sound/adlib_card.c optional trix device-driver i386/isa/sound/opl3.c optional trix device-driver i386/isa/sound/ad1848.c optional trix device-driver i386/isa/sound/sound_timer.c optional trix device-driver i386/isa/sound/sscape.c optional sscape device-driver i386/isa/sound/ad1848.c optional sscape device-driver i386/isa/sound/sound_timer.c optional sscape device-driver i386/isa/sound/mpu401.c optional sscape device-driver i386/isa/sound/midi_synth.c optional sscape device-driver i386/isa/sound/midibuf.c optional sscape device-driver i386/isa/sound/cs4232.c optional css device-driver i386/isa/spigot.c optional spigot device-driver i386/isa/spkr.c optional speaker device-driver i386/isa/stallion.c optional stl device-driver i386/isa/syscons_isa.c optional sc device-driver i386/isa/vesa.c optional vga device-driver i386/isa/vga_isa.c optional vga device-driver i386/isa/tw.c optional tw device-driver i386/isa/wd.c optional wdc device-driver i386/isa/wd.c optional wd device-driver i386/isa/atapi.c optional atapi device-driver i386/isa/atapi-cd.c optional acd device-driver i386/isa/wfd.c optional wfd device-driver i386/isa/wst.c optional wst device-driver i386/isa/wt.c optional wt device-driver i386/linux/imgact_linux.c optional compat_linux i386/linux/linux_dummy.c optional compat_linux i386/linux/linux_file.c optional compat_linux i386/linux/linux_ioctl.c optional compat_linux i386/linux/linux_ipc.c optional compat_linux i386/linux/linux_locore.s optional compat_linux \ dependency "linux_assym.h" i386/linux/linux_misc.c optional compat_linux i386/linux/linux_signal.c optional compat_linux i386/linux/linux_socket.c optional compat_linux i386/linux/linux_stats.c optional compat_linux i386/linux/linux_sysent.c optional compat_linux i386/linux/linux_sysvec.c optional compat_linux i386/linux/linux_util.c optional compat_linux i4b/layer1/i4b_isic.c optional isic device-driver i4b/layer1/i4b_isic_isa.c optional isic device-driver i4b/layer1/i4b_isic_pnp.c optional isic device-driver i4b/layer1/i4b_isic_pci.c optional isic device-driver i4b/layer1/i4b_isic_pcmcia.c optional isic device-driver i4b/layer1/i4b_isac.c optional isic device-driver i4b/layer1/i4b_hscx.c optional isic device-driver i4b/layer1/i4b_l1.c optional isic device-driver i4b/layer1/i4b_l1fsm.c optional isic device-driver i4b/layer1/i4b_bchan.c optional isic device-driver i4b/layer1/i4b_tel_s08.c optional isic device-driver i4b/layer1/i4b_tel_s016.c optional isic device-driver i4b/layer1/i4b_tel_s0163.c optional isic device-driver i4b/layer1/i4b_tel_s0P.c optional isic device-driver i4b/layer1/i4b_ctx_s0P.c optional isic device-driver i4b/layer1/i4b_avm_a1.c optional isic device-driver i4b/layer1/i4b_avm_fritz_pci.c optional isic device-driver i4b/layer1/i4b_avm_fritz_pcmcia.c optional isic device-driver i4b/layer1/i4b_usr_sti.c optional isic device-driver i4b/layer1/i4b_itk_ix1.c optional isic device-driver i4b/layer1/i4b_drn_ngo.c optional isic device-driver i4b/layer1/i4b_sws.c optional isic device-driver i4b/layer1/i4b_dynalink.c optional isic device-driver i4b/layer1/i4b_elsa_qs1i.c optional isic device-driver i4b/layer1/i4b_elsa_qs1p.c optional isic device-driver libkern/bcd.c standard libkern/divdi3.c standard libkern/inet_ntoa.c standard libkern/index.c standard libkern/mcount.c optional profiling-routine libkern/moddi3.c standard libkern/qdivrem.c standard libkern/qsort.c standard libkern/random.c standard libkern/rindex.c standard libkern/scanc.c standard libkern/skpc.c standard libkern/strcat.c standard libkern/strcmp.c standard libkern/strcpy.c standard libkern/strlen.c standard libkern/strncmp.c standard libkern/strncpy.c standard libkern/udivdi3.c standard libkern/umoddi3.c standard gnu/i386/fpemul/div_small.s optional gpl_math_emulate gnu/i386/fpemul/errors.c optional gpl_math_emulate gnu/i386/fpemul/fpu_arith.c optional gpl_math_emulate gnu/i386/fpemul/fpu_aux.c optional gpl_math_emulate gnu/i386/fpemul/fpu_entry.c optional gpl_math_emulate gnu/i386/fpemul/fpu_etc.c optional gpl_math_emulate gnu/i386/fpemul/fpu_trig.c optional gpl_math_emulate gnu/i386/fpemul/get_address.c optional gpl_math_emulate gnu/i386/fpemul/load_store.c optional gpl_math_emulate gnu/i386/fpemul/poly_2xm1.c optional gpl_math_emulate gnu/i386/fpemul/poly_atan.c optional gpl_math_emulate gnu/i386/fpemul/poly_div.s optional gpl_math_emulate gnu/i386/fpemul/poly_l2.c optional gpl_math_emulate gnu/i386/fpemul/poly_mul64.s optional gpl_math_emulate gnu/i386/fpemul/poly_sin.c optional gpl_math_emulate gnu/i386/fpemul/poly_tan.c optional gpl_math_emulate gnu/i386/fpemul/polynomial.s optional gpl_math_emulate gnu/i386/fpemul/reg_add_sub.c optional gpl_math_emulate gnu/i386/fpemul/reg_compare.c optional gpl_math_emulate gnu/i386/fpemul/reg_constant.c optional gpl_math_emulate gnu/i386/fpemul/reg_div.s optional gpl_math_emulate gnu/i386/fpemul/reg_ld_str.c optional gpl_math_emulate gnu/i386/fpemul/reg_mul.c optional gpl_math_emulate gnu/i386/fpemul/reg_norm.s optional gpl_math_emulate gnu/i386/fpemul/reg_round.s optional gpl_math_emulate gnu/i386/fpemul/reg_u_add.s optional gpl_math_emulate gnu/i386/fpemul/reg_u_div.s optional gpl_math_emulate gnu/i386/fpemul/reg_u_mul.s optional gpl_math_emulate gnu/i386/fpemul/reg_u_sub.s optional gpl_math_emulate gnu/i386/fpemul/wm_shrx.s optional gpl_math_emulate gnu/i386/fpemul/wm_sqrt.s optional gpl_math_emulate gnu/i386/isa/dgb.c optional dgb device-driver gnu/i386/isa/dgm.c optional dgm device-driver gnu/i386/isa/sound/awe_wave.c optional awe device-driver pci/es1370.c optional pcm device-driver pci/ide_pci.c optional wd device-driver Index: head/sys/i386/conf/options.i386 =================================================================== --- head/sys/i386/conf/options.i386 (revision 44627) +++ head/sys/i386/conf/options.i386 (revision 44628) @@ -1,180 +1,184 @@ -# $Id: options.i386,v 1.107 1999/03/09 20:20:02 phk Exp $ +# $Id: options.i386,v 1.108 1999/03/10 10:11:42 julian Exp $ DISABLE_PSE IDE_DELAY USER_LDT MATH_EMULATE opt_math_emulate.h GPL_MATH_EMULATE opt_math_emulate.h PMAP_SHPGPERPROC opt_pmap.h VM86 opt_vm86.h IBCS2 opt_dontuse.h COMPAT_LINUX opt_dontuse.h LINUX opt_dontuse.h DEBUG_LINUX opt_linux.h PPC_DEBUG opt_ppc.h SHOW_BUSYBUFS TUNE_1542 PANIC_REBOOT_WAIT_TIME opt_panic.h MAXMEM PERFMON opt_perfmon.h POWERFAIL_NMI opt_trap.h AUTO_EOI_1 opt_auto_eoi.h AUTO_EOI_2 opt_auto_eoi.h BREAK_TO_DEBUGGER opt_comconsole.h CONSPEED opt_comconsole.h COM_ESP opt_sio.h COM_MULTIPORT opt_sio.h EXTRA_SIO opt_sio.h I586_PMC_GUPROF opt_i586_guprof.h WLCACHE opt_wavelan.h WLDEBUG opt_wavelan.h # i386 SMP options APIC_IO opt_global.h NAPIC opt_smp.h NINTR opt_smp.h CLK_CALIBRATION_LOOP opt_clock.h CLK_USE_I8254_CALIBRATION opt_clock.h CLK_USE_TSC_CALIBRATION opt_clock.h TIMER_FREQ opt_clock.h NO_F00F_HACK opt_cpu.h CPU_BLUELIGHTNING_FPU_OP_CACHE opt_cpu.h CPU_BLUELIGHTNING_3X opt_cpu.h CPU_BTB_EN opt_cpu.h CPU_DIRECT_MAPPED_CACHE opt_cpu.h CPU_DISABLE_5X86_LSSER opt_cpu.h CPU_FASTER_5X86_FPU opt_cpu.h CPU_I486_ON_386 opt_cpu.h CPU_IORT opt_cpu.h CPU_LOOP_EN opt_cpu.h CPU_RSTK_EN opt_cpu.h CPU_SUSP_HLT opt_cpu.h CPU_UPGRADE_HW_CACHE opt_cpu.h CPU_WT_ALLOC opt_cpu.h CYRIX_CACHE_WORKS opt_cpu.h CYRIX_CACHE_REALLY_WORKS opt_cpu.h NO_MEMORY_HOLE opt_cpu.h # The CPU type affects the endian conversion functions all over the kernel. I386_CPU opt_global.h I486_CPU opt_global.h I586_CPU opt_global.h I686_CPU opt_global.h MAXCONS opt_syscons.h STD8X16FONT opt_syscons.h SC_HISTORY_SIZE opt_syscons.h SC_DISABLE_REBOOT opt_syscons.h SC_MOUSE_CHAR opt_syscons.h FB_INSTALL_CDEV opt_fb.h VGA_ALT_SEQACCESS opt_vga.h VGA_NO_FONT_LOADING opt_vga.h VGA_NO_MODE_CHANGE opt_vga.h VGA_SLOW_IOACCESS opt_vga.h VESA opt_vesa.h VESA_DEBUG opt_vesa.h PSM_HOOKAPM opt_psm.h PSM_RESETAFTERSUSPEND opt_psm.h PSM_DEBUG opt_psm.h PCIC_RESUME_RESET opt_pcic.h +ATKBD_DFLT_KEYMAP opt_atkbd.h +UKBD_DFLT_KEYMAP opt_ukbd.h + +KBD_DISABLE_KEYMAP_LOAD opt_kbd.h KBD_INSTALL_CDEV opt_kbd.h KBD_MAXRETRY opt_kbd.h KBD_MAXWAIT opt_kbd.h KBD_RESETDELAY opt_kbd.h KBDIO_DEBUG opt_kbd.h ATAPI opt_atapi.h ATAPI_STATIC opt_atapi.h CMD640 opt_wd.h USERCONFIG opt_userconfig.h VISUAL_USERCONFIG opt_userconfig.h INTRO_USERCONFIG opt_userconfig.h EISA_SLOTS opt_eisa.h FDC_DEBUG opt_fdc.h FDC_PRINT_BOGUS_CHIPTYPE opt_fdc.h FDC_YE opt_fdc.h FE_8BIT_SUPPORT opt_fe.h # pcvt(4) has a bunch of options FAT_CURSOR opt_pcvt.h XSERVER opt_pcvt.h PCVT_24LINESDEF opt_pcvt.h PCVT_CTRL_ALT_DEL opt_pcvt.h PCVT_EMU_MOUSE opt_pcvt.h PCVT_FREEBSD opt_pcvt.h PCVT_META_ESC opt_pcvt.h PCVT_NSCREENS opt_pcvt.h PCVT_PRETTYSCRNS opt_pcvt.h PCVT_SCANSET opt_pcvt.h PCVT_SCREENSAVER opt_pcvt.h PCVT_USEKBDSEC opt_pcvt.h PCVT_VT220KEYB opt_pcvt.h # voxware options GUS_DMA2 opt_sound.h GUS_DMA opt_sound.h GUS_IRQ opt_sound.h # Video spigot SPIGOT_UNSECURE opt_spigot.h # ------------------------------- # isdn4bsd: passive ISA cards # ------------------------------- TEL_S0_8 opt_i4b.h TEL_S0_16 opt_i4b.h TEL_S0_16_3 opt_i4b.h AVM_A1 opt_i4b.h USR_STI opt_i4b.h ITKIX1 opt_i4b.h # ------------------------------- # isdn4bsd: passive ISA PnP cards # ------------------------------- CRTX_S0_P opt_i4b.h DRN_NGO opt_i4b.h TEL_S0_16_3_P opt_i4b.h SEDLBAUER opt_i4b.h DYNALINK opt_i4b.h ELSA_QS1ISA opt_i4b.h # ------------------------------- # isdn4bsd: passive PCI cards # ------------------------------- ELSA_QS1PCI opt_i4b.h AVM_A1_PCI opt_i4b.h # ------------------------------- # isdn4bsd: passive PCMCIA cards # ------------------------------- AVM_A1_PCMCIA opt_i4b.h # ------------------------------- # isdn4bsd: misc options # ------------------------------- # temporary workaround for SMP machines I4B_SMP_WORKAROUND opt_i4b.h # enable VJ compression code for ipr i/f IPR_VJ opt_i4b.h # ------------------------------- # oltr: build options # ------------------------------- # Exclude microcode options OLTR_NO_TMS_MAC opt_oltr.h OLTR_NO_HAWKEYE_MAC opt_oltr.h OLTR_NO_BULLSEYE_MAC opt_oltr.h # ------------------------------- # EOF # ------------------------------- Index: head/sys/i386/include/console.h =================================================================== --- head/sys/i386/include/console.h (revision 44627) +++ head/sys/i386/include/console.h (revision 44628) @@ -1,633 +1,635 @@ /*- * Copyright (c) 1991-1996 Søren Schmidt * All rights reserved. * * 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 * in this position and unchanged. * 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. The name of the author may not be used to endorse or promote products * derived from this software without specific prior written permission * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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. * - * $Id: console.h,v 1.43 1999/01/11 03:18:04 yokota Exp $ + * $Id: console.h,v 1.44 1999/02/05 11:52:09 yokota Exp $ */ #ifndef _MACHINE_CONSOLE_H_ #define _MACHINE_CONSOLE_H_ #ifndef KERNEL #include #endif #include #define KDGKBMODE _IOR('K', 6, int) #define KDSKBMODE _IO('K', 7 /*, int */) #define KDMKTONE _IO('K', 8 /*, int */) #define KDGETMODE _IOR('K', 9, int) #define KDSETMODE _IO('K', 10 /*, int */) #define KDSBORDER _IO('K', 13 /*, int */) #define KDGKBSTATE _IOR('K', 19, int) #define KDSKBSTATE _IO('K', 20 /*, int */) #define KDENABIO _IO('K', 60) #define KDDISABIO _IO('K', 61) #define KIOCSOUND _IO('K', 63 /*, int */) #define KDGKBTYPE _IOR('K', 64, int) #define KDGETLED _IOR('K', 65, int) #define KDSETLED _IO('K', 66 /*, int */) -#define KDSETRAD _IO('K', 67 /*, int */) +#define KDSETRAD _IO('K', 67 /*, int */) /* obsolete */ #define KDRASTER _IOW('K', 100, scr_size_t) #define KDGKBINFO _IOR('K', 101, keyboard_info_t) +#define KDSETREPEAT _IOW('K', 102, keyboard_delay_t) #define GETFKEY _IOWR('k', 0, fkeyarg_t) #define SETFKEY _IOWR('k', 1, fkeyarg_t) #define GIO_SCRNMAP _IOR('k', 2, scrmap_t) #define PIO_SCRNMAP _IOW('k', 3, scrmap_t) #define GIO_KEYMAP _IOR('k', 6, keymap_t) #define PIO_KEYMAP _IOW('k', 7, keymap_t) #define GIO_DEADKEYMAP _IOR('k', 8, accentmap_t) #define PIO_DEADKEYMAP _IOW('k', 9, accentmap_t) #define GIO_KEYMAPENT _IOWR('k', 10, keyarg_t) #define PIO_KEYMAPENT _IOW('k', 11, keyarg_t) #define GIO_ATTR _IOR('a', 0, int) #define GIO_COLOR _IOR('c', 0, int) #define CONS_CURRENT _IOR('c', 1, int) #define CONS_GET _IOR('c', 2, int) #define CONS_IO _IO('c', 3) #define CONS_BLANKTIME _IOW('c', 4, int) #define CONS_SSAVER _IOW('c', 5, ssaver_t) #define CONS_GSAVER _IOWR('c', 6, ssaver_t) #define CONS_CURSORTYPE _IOW('c', 7, int) #define CONS_BELLTYPE _IOW('c', 8, int) #define CONS_HISTORY _IOW('c', 9, int) #define CONS_MOUSECTL _IOWR('c', 10, mouse_info_t) #define CONS_IDLE _IOR('c', 11, int) #define CONS_SAVERMODE _IOW('c', 12, int) #define CONS_SAVERSTART _IOW('c', 13, int) #define PIO_FONT8x8 _IOW('c', 64, fnt8_t) #define GIO_FONT8x8 _IOR('c', 65, fnt8_t) #define PIO_FONT8x14 _IOW('c', 66, fnt14_t) #define GIO_FONT8x14 _IOR('c', 67, fnt14_t) #define PIO_FONT8x16 _IOW('c', 68, fnt16_t) #define GIO_FONT8x16 _IOR('c', 69, fnt16_t) #define CONS_GETINFO _IOWR('c', 73, vid_info_t) #define CONS_GETVERS _IOR('c', 74, int) #define CONS_CURRENTADP _IOR('c', 100, int) #define CONS_ADPINFO _IOWR('c', 101, video_adapter_info_t) #define CONS_MODEINFO _IOWR('c', 102, video_info_t) #define CONS_FINDMODE _IOWR('c', 103, video_info_t) #define CONS_SETWINORG _IO('c', 104 /* u_int */) #define CONS_SETKBD _IO('c', 110 /* int */) #define CONS_RELKBD _IO('c', 111) /* CONS_SAVERMODE */ #define CONS_LKM_SAVER 0 #define CONS_USR_SAVER 1 #ifdef PC98 #define ADJUST_CLOCK _IO('t',100) /* for 98note resume */ #endif #define VT_OPENQRY _IOR('v', 1, int) #define VT_SETMODE _IOW('v', 2, vtmode_t) #define VT_GETMODE _IOR('v', 3, vtmode_t) #define VT_RELDISP _IO('v', 4 /*, int */) #define VT_ACTIVATE _IO('v', 5 /*, int */) #define VT_WAITACTIVE _IO('v', 6 /*, int */) #define VT_GETACTIVE _IOR('v', 7, int) #define VT_FALSE 0 #define VT_TRUE 1 #define VT_ACKACQ 2 #define VT_AUTO 0 /* switching is automatic */ #define VT_PROCESS 1 /* switching controlled by prog */ #define VT_KERNEL 255 /* switching controlled in kernel */ #ifndef _VT_MODE_DECLARED #define _VT_MODE_DECLARED struct vt_mode { char mode; char waitv; /* not implemented yet SOS */ short relsig; short acqsig; short frsig; /* not implemented yet SOS */ }; typedef struct vt_mode vtmode_t; #endif /* !_VT_MODE_DECLARED */ struct mouse_data { int x; int y; int z; int buttons; }; struct mouse_mode { int mode; int signal; }; struct mouse_event { int id; /* one based */ int value; }; #define MOUSE_SHOW 0x01 #define MOUSE_HIDE 0x02 #define MOUSE_MOVEABS 0x03 #define MOUSE_MOVEREL 0x04 #define MOUSE_GETINFO 0x05 #define MOUSE_MODE 0x06 #define MOUSE_ACTION 0x07 #define MOUSE_MOTION_EVENT 0x08 #define MOUSE_BUTTON_EVENT 0x09 struct mouse_info { int operation; union { struct mouse_data data; struct mouse_mode mode; struct mouse_event event; }u; }; #define KD_MONO 1 /* monochrome adapter */ #define KD_HERCULES 2 /* hercules adapter */ #define KD_CGA 3 /* color graphics adapter */ #define KD_EGA 4 /* enhanced graphics adapter */ #define KD_VGA 5 /* video graphics adapter */ #define KD_PC98 6 /* PC-98 display */ #define KD_TEXT 0 /* set text mode restore fonts */ #define KD_TEXT0 0 /* ditto */ #define KD_TEXT1 2 /* set text mode !restore fonts */ #define KD_GRAPHICS 1 /* set graphics mode */ #define KD_PIXEL 3 /* set pixel mode */ #define K_RAW 0 /* keyboard returns scancodes */ #define K_XLATE 1 /* keyboard returns ascii */ #define K_CODE 2 /* keyboard returns keycodes */ #define KB_84 1 /* 'old' 84 key AT-keyboard */ #define KB_101 2 /* MF-101 or MF-102 keyboard */ #define KB_OTHER 3 /* keyboard not known */ #define CLKED 1 /* Caps locked */ #define NLKED 2 /* Num locked */ #define SLKED 4 /* Scroll locked */ #define ALKED 8 /* AltGr locked */ #define LOCK_MASK (CLKED | NLKED | SLKED | ALKED) #define LED_CAP 1 /* Caps lock LED */ #define LED_NUM 2 /* Num lock LED */ #define LED_SCR 4 /* Scroll lock LED */ #define LED_MASK (LED_CAP | LED_NUM | LED_SCR) /* possible flag values */ #define FLAG_LOCK_O 0 #define FLAG_LOCK_C 1 #define FLAG_LOCK_N 2 #define NUM_KEYS 256 /* number of keys in table */ #define NUM_STATES 8 /* states per key */ #define ALTGR_OFFSET 128 /* offset for altlock keys */ #ifndef _KEYMAP_DECLARED #define _KEYMAP_DECLARED struct keyent_t { u_char map[NUM_STATES]; u_char spcl; u_char flgs; }; struct keymap { u_short n_keys; struct keyent_t key[NUM_KEYS]; }; typedef struct keymap keymap_t; struct keyarg { u_short keynum; struct keyent_t key; }; typedef struct keyarg keyarg_t; #endif /* !_KEYMAP_DECLARED */ #define NUM_DEADKEYS 15 /* number of accent keys */ #define NUM_ACCENTCHARS 52 /* max number of accent chars */ struct acc_t { u_char accchar; u_char map[NUM_ACCENTCHARS][2]; }; struct accentmap { u_short n_accs; struct acc_t acc[NUM_DEADKEYS]; }; #define MAXFK 16 #define NUM_FKEYS 96 struct fkeytab { u_char str[MAXFK]; u_char len; }; struct fkeyarg { u_short keynum; char keydef[MAXFK]; char flen; }; struct colors { char fore; char back; }; struct vid_info { short size; short m_num; u_short mv_row, mv_col; u_short mv_rsz, mv_csz; struct colors mv_norm, mv_rev, mv_grfc; u_char mv_ovscan; u_char mk_keylock; }; #define MAXSSAVER 16 struct ssaver { char name[MAXSSAVER]; int num; long time; }; /* video mode information block */ struct video_info { int vi_mode; int vi_flags; #define V_INFO_COLOR (1<<0) #define V_INFO_GRAPHICS (1<<1) #define V_INFO_LINEAR (1<<2) #define V_INFO_VESA (1<<3) int vi_width; int vi_height; int vi_cwidth; int vi_cheight; int vi_depth; int vi_planes; u_int vi_window; /* physical address */ size_t vi_window_size; size_t vi_window_gran; u_int vi_buffer; /* physical address */ size_t vi_buffer_size; /* XXX pixel format, memory model,... */ }; /* adapter infromation block */ struct video_adapter { int va_index; int va_type; char *va_name; int va_unit; int va_minor; int va_flags; #define V_ADP_COLOR (1<<0) #define V_ADP_MODECHANGE (1<<1) #define V_ADP_STATESAVE (1<<2) #define V_ADP_STATELOAD (1<<3) #define V_ADP_FONT (1<<4) #define V_ADP_PALETTE (1<<5) #define V_ADP_BORDER (1<<6) #define V_ADP_VESA (1<<7) #define V_ADP_PROBED (1<<16) #define V_ADP_INITIALIZED (1<<17) #define V_ADP_REGISTERED (1<<18) int va_io_base; int va_io_size; int va_crtc_addr; int va_mem_base; int va_mem_size; u_int va_window; /* virtual address */ size_t va_window_size; size_t va_window_gran; u_int va_buffer; /* virtual address */ size_t va_buffer_size; int va_initial_mode; int va_initial_bios_mode; int va_mode; struct video_info va_info; int va_line_width; void *va_token; }; struct video_adapter_info { int va_index; int va_type; char va_name[16]; int va_unit; int va_flags; int va_io_base; int va_io_size; int va_crtc_addr; int va_mem_base; int va_mem_size; u_int va_window; /* virtual address */ size_t va_window_size; size_t va_window_gran; u_int va_buffer; /* virtual address */ size_t va_buffer_size; int va_initial_mode; int va_initial_bios_mode; int va_mode; int va_line_width; }; #define V_ADP_PRIMARY 0 #define V_ADP_SECONDARY 1 struct keyboard_info { int kb_index; /* kbdio index# */ char kb_name[16]; /* driver name */ int kb_unit; /* unit# */ int kb_type; /* KB_84, KB_101, KB_OTHER,... */ int kb_config; /* device configuration flags */ int kb_flags; /* internal flags */ }; typedef struct accentmap accentmap_t; typedef struct fkeytab fkeytab_t; typedef struct fkeyarg fkeyarg_t; typedef struct vid_info vid_info_t; typedef struct mouse_info mouse_info_t; typedef struct {char scrmap[256];} scrmap_t; typedef struct {char fnt8x8[8*256];} fnt8_t; typedef struct {char fnt8x14[14*256];} fnt14_t; typedef struct {char fnt8x16[16*256];} fnt16_t; typedef struct ssaver ssaver_t; typedef struct video_adapter video_adapter_t; typedef struct video_adapter_info video_adapter_info_t; typedef struct video_info video_info_t; typedef struct keyboard_info keyboard_info_t; typedef struct {int scr_size[3];} scr_size_t; +typedef struct {int kbd_delay[2];} keyboard_delay_t; /* defines for "special" keys (spcl bit set in keymap) */ #define NOP 0x00 /* nothing (dead key) */ #define LSH 0x02 /* left shift key */ #define RSH 0x03 /* right shift key */ #define CLK 0x04 /* caps lock key */ #define NLK 0x05 /* num lock key */ #define SLK 0x06 /* scroll lock key */ #define LALT 0x07 /* left alt key */ #define BTAB 0x08 /* backwards tab */ #define LCTR 0x09 /* left control key */ #define NEXT 0x0a /* switch to next screen */ #define F_SCR 0x0b /* switch to first screen */ #define L_SCR 0x1a /* switch to last screen */ #define F_FN 0x1b /* first function key */ #define L_FN 0x7a /* last function key */ /* 0x7b-0x7f reserved do not use ! */ #define RCTR 0x80 /* right control key */ #define RALT 0x81 /* right alt (altgr) key */ #define ALK 0x82 /* alt lock key */ #define ASH 0x83 /* alt shift key */ #define META 0x84 /* meta key */ #define RBT 0x85 /* boot machine */ #define DBG 0x86 /* call debugger */ #define SUSP 0x87 /* suspend power (APM) */ #define SPSC 0x88 /* toggle splash/text screen */ #define F_ACC DGRA /* first accent key */ #define DGRA 0x89 /* grave */ #define DACU 0x8a /* acute */ #define DCIR 0x8b /* circumflex */ #define DTIL 0x8c /* tilde */ #define DMAC 0x8d /* macron */ #define DBRE 0x8e /* breve */ #define DDOT 0x8f /* dot */ #define DUML 0x90 /* umlaut/diaresis */ #define DDIA 0x90 /* diaresis */ #define DSLA 0x91 /* slash */ #define DRIN 0x92 /* ring */ #define DCED 0x93 /* cedilla */ #define DAPO 0x94 /* apostrophe */ #define DDAC 0x95 /* double acute */ #define DOGO 0x96 /* ogonek */ #define DCAR 0x97 /* caron */ #define L_ACC DCAR /* last accent key */ #define STBY 0x98 /* Go into standby mode (apm) */ #define F(x) ((x)+F_FN-1) #define S(x) ((x)+F_SCR-1) #define ACC(x) ((x)+F_ACC) #define NOKEY 0x100 /* no key pressed marker */ #define FKEY 0x200 /* function key marker */ #define MKEY 0x400 /* meta key marker (prepend ESC)*/ #define BKEY 0x800 /* backtab (ESC [ Z) */ #define SPCLKEY 0x8000 /* special key */ #define RELKEY 0x4000 /* key released */ #define ERRKEY 0x2000 /* error */ #define KEYCHAR(c) ((c) & 0x00ff) #define KEYFLAGS(c) ((c) & ~0x00ff) /* video mode definitions */ #define M_B40x25 0 /* black & white 40 columns */ #define M_C40x25 1 /* color 40 columns */ #define M_B80x25 2 /* black & white 80 columns */ #define M_C80x25 3 /* color 80 columns */ #define M_BG320 4 /* black & white graphics 320x200 */ #define M_CG320 5 /* color graphics 320x200 */ #define M_BG640 6 /* black & white graphics 640x200 hi-res */ #define M_EGAMONO80x25 7 /* ega-mono 80x25 */ #define M_CG320_D 13 /* ega mode D */ #define M_CG640_E 14 /* ega mode E */ #define M_EGAMONOAPA 15 /* ega mode F */ #define M_CG640x350 16 /* ega mode 10 */ #define M_ENHMONOAPA2 17 /* ega mode F with extended memory */ #define M_ENH_CG640 18 /* ega mode 10* */ #define M_ENH_B40x25 19 /* ega enhanced black & white 40 columns */ #define M_ENH_C40x25 20 /* ega enhanced color 40 columns */ #define M_ENH_B80x25 21 /* ega enhanced black & white 80 columns */ #define M_ENH_C80x25 22 /* ega enhanced color 80 columns */ #define M_VGA_C40x25 23 /* vga 8x16 font on color */ #define M_VGA_C80x25 24 /* vga 8x16 font on color */ #define M_VGA_M80x25 25 /* vga 8x16 font on mono */ #define M_VGA11 26 /* vga 640x480 2 colors */ #define M_BG640x480 26 #define M_VGA12 27 /* vga 640x480 16 colors */ #define M_CG640x480 27 #define M_VGA13 28 /* vga 640x200 256 colors */ #define M_VGA_CG320 28 #define M_VGA_C80x50 30 /* vga 8x8 font on color */ #define M_VGA_M80x50 31 /* vga 8x8 font on color */ #define M_VGA_C80x30 32 /* vga 8x16 font on color */ #define M_VGA_M80x30 33 /* vga 8x16 font on color */ #define M_VGA_C80x60 34 /* vga 8x8 font on color */ #define M_VGA_M80x60 35 /* vga 8x8 font on color */ #define M_VGA_CG640 36 /* vga 640x400 256 color */ #define M_VGA_MODEX 37 /* vga 320x240 256 color */ #define M_ENH_B80x43 0x70 /* ega black & white 80x43 */ #define M_ENH_C80x43 0x71 /* ega color 80x43 */ #define M_PC98_80x25 98 /* PC98 80x25 */ #define M_PC98_80x30 99 /* PC98 80x30 */ #define M_HGC_P0 0xe0 /* hercules graphics - page 0 @ B0000 */ #define M_HGC_P1 0xe1 /* hercules graphics - page 1 @ B8000 */ #define M_MCA_MODE 0xff /* monochrome adapter mode */ #define M_TEXT_80x25 200 /* generic text modes */ #define M_TEXT_80x30 201 #define M_TEXT_80x43 202 #define M_TEXT_80x50 203 #define M_TEXT_80x60 204 #define M_TEXT_132x25 205 #define M_TEXT_132x30 206 #define M_TEXT_132x43 207 #define M_TEXT_132x50 208 #define M_TEXT_132x60 209 #define SW_PC98_80x25 _IO('S', M_PC98_80x25) #define SW_PC98_80x30 _IO('S', M_PC98_80x30) #define SW_B40x25 _IO('S', M_B40x25) #define SW_C40x25 _IO('S', M_C40x25) #define SW_B80x25 _IO('S', M_B80x25) #define SW_C80x25 _IO('S', M_C80x25) #define SW_BG320 _IO('S', M_BG320) #define SW_CG320 _IO('S', M_CG320) #define SW_BG640 _IO('S', M_BG640) #define SW_EGAMONO80x25 _IO('S', M_EGAMONO80x25) #define SW_CG320_D _IO('S', M_CG320_D) #define SW_CG640_E _IO('S', M_CG640_E) #define SW_EGAMONOAPA _IO('S', M_EGAMONOAPA) #define SW_CG640x350 _IO('S', M_CG640x350) #define SW_ENH_MONOAPA2 _IO('S', M_ENHMONOAPA2) #define SW_ENH_CG640 _IO('S', M_ENH_CG640) #define SW_ENH_B40x25 _IO('S', M_ENH_B40x25) #define SW_ENH_C40x25 _IO('S', M_ENH_C40x25) #define SW_ENH_B80x25 _IO('S', M_ENH_B80x25) #define SW_ENH_C80x25 _IO('S', M_ENH_C80x25) #define SW_ENH_B80x43 _IO('S', M_ENH_B80x43) #define SW_ENH_C80x43 _IO('S', M_ENH_C80x43) #define SW_MCAMODE _IO('S', M_MCA_MODE) #define SW_VGA_C40x25 _IO('S', M_VGA_C40x25) #define SW_VGA_C80x25 _IO('S', M_VGA_C80x25) #define SW_VGA_C80x30 _IO('S', M_VGA_C80x30) #define SW_VGA_C80x50 _IO('S', M_VGA_C80x50) #define SW_VGA_C80x60 _IO('S', M_VGA_C80x60) #define SW_VGA_M80x25 _IO('S', M_VGA_M80x25) #define SW_VGA_M80x30 _IO('S', M_VGA_M80x30) #define SW_VGA_M80x50 _IO('S', M_VGA_M80x50) #define SW_VGA_M80x60 _IO('S', M_VGA_M80x60) #define SW_VGA11 _IO('S', M_VGA11) #define SW_BG640x480 _IO('S', M_VGA11) #define SW_VGA12 _IO('S', M_VGA12) #define SW_CG640x480 _IO('S', M_VGA12) #define SW_VGA13 _IO('S', M_VGA13) #define SW_VGA_CG320 _IO('S', M_VGA13) #define SW_VGA_CG640 _IO('S', M_VGA_CG640) #define SW_VGA_MODEX _IO('S', M_VGA_MODEX) #define SW_TEXT_80x25 _IO('S', M_TEXT_80x25) #define SW_TEXT_80x30 _IO('S', M_TEXT_80x30) #define SW_TEXT_80x43 _IO('S', M_TEXT_80x43) #define SW_TEXT_80x50 _IO('S', M_TEXT_80x50) #define SW_TEXT_80x60 _IO('S', M_TEXT_80x60) #define SW_TEXT_132x25 _IO('S', M_TEXT_132x25) #define SW_TEXT_132x30 _IO('S', M_TEXT_132x30) #define SW_TEXT_132x43 _IO('S', M_TEXT_132x43) #define SW_TEXT_132x50 _IO('S', M_TEXT_132x50) #define SW_TEXT_132x60 _IO('S', M_TEXT_132x60) #define M_VESA_BASE 0x100 /* VESA mode number base */ #define M_VESA_CG640x400 0x100 /* 640x400, 256 color */ #define M_VESA_CG640x480 0x101 /* 640x480, 256 color */ #define M_VESA_800x600 0x102 /* 800x600, 16 color */ #define M_VESA_CG800x600 0x103 /* 800x600, 256 color */ #define M_VESA_1024x768 0x104 /* 1024x768, 16 color */ #define M_VESA_CG1024x768 0x105 /* 1024x768, 256 color */ #define M_VESA_1280x1024 0x106 /* 1280x1024, 16 color */ #define M_VESA_CG1280x1024 0x107 /* 1280x1024, 256 color */ #define M_VESA_C80x60 0x108 /* 8x8 font */ #define M_VESA_C132x25 0x109 /* 8x16 font */ #define M_VESA_C132x43 0x10a /* 8x14 font */ #define M_VESA_C132x50 0x10b /* 8x8 font */ #define M_VESA_C132x60 0x10c /* 8x8 font */ #define M_VESA_32K_320 0x10d /* 320x200, 5:5:5 */ #define M_VESA_64K_320 0x10e /* 320x200, 5:6:5 */ #define M_VESA_FULL_320 0x10f /* 320x200, 8:8:8 */ #define M_VESA_32K_640 0x110 /* 640x480, 5:5:5 */ #define M_VESA_64K_640 0x111 /* 640x480, 5:6:5 */ #define M_VESA_FULL_640 0x112 /* 640x480, 8:8:8 */ #define M_VESA_32K_800 0x113 /* 800x600, 5:5:5 */ #define M_VESA_64K_800 0x114 /* 800x600, 5:6:5 */ #define M_VESA_FULL_800 0x115 /* 800x600, 8:8:8 */ #define M_VESA_32K_1024 0x116 /* 1024x768, 5:5:5 */ #define M_VESA_64K_1024 0x117 /* 1024x768, 5:6:5 */ #define M_VESA_FULL_1024 0x118 /* 1024x768, 8:8:8 */ #define M_VESA_32K_1280 0x119 /* 1280x1024, 5:5:5 */ #define M_VESA_64K_1280 0x11a /* 1280x1024, 5:6:5 */ #define M_VESA_FULL_1280 0x11b /* 1280x1024, 8:8:8 */ #define M_VESA_MODE_MAX 0x1ff #define SW_VESA_CG640x400 _IO('V', M_VESA_CG640x400 - M_VESA_BASE) #define SW_VESA_CG640x480 _IO('V', M_VESA_CG640x480 - M_VESA_BASE) #define SW_VESA_800x600 _IO('V', M_VESA_800x600 - M_VESA_BASE) #define SW_VESA_CG800x600 _IO('V', M_VESA_CG800x600 - M_VESA_BASE) #define SW_VESA_1024x768 _IO('V', M_VESA_1024x768 - M_VESA_BASE) #define SW_VESA_CG1024x768 _IO('V', M_VESA_CG1024x768 - M_VESA_BASE) #define SW_VESA_1280x1024 _IO('V', M_VESA_1280x1024 - M_VESA_BASE) #define SW_VESA_CG1280x1024 _IO('V', M_VESA_CG1280x1024 - M_VESA_BASE) #define SW_VESA_C80x60 _IO('V', M_VESA_C80x60 - M_VESA_BASE) #define SW_VESA_C132x25 _IO('V', M_VESA_C132x25 - M_VESA_BASE) #define SW_VESA_C132x43 _IO('V', M_VESA_C132x43 - M_VESA_BASE) #define SW_VESA_C132x50 _IO('V', M_VESA_C132x50 - M_VESA_BASE) #define SW_VESA_C132x60 _IO('V', M_VESA_C132x60 - M_VESA_BASE) #define SW_VESA_32K_320 _IO('V', M_VESA_32K_320 - M_VESA_BASE) #define SW_VESA_64K_320 _IO('V', M_VESA_64K_320 - M_VESA_BASE) #define SW_VESA_FULL_320 _IO('V', M_VESA_FULL_320 - M_VESA_BASE) #define SW_VESA_32K_640 _IO('V', M_VESA_32K_640 - M_VESA_BASE) #define SW_VESA_64K_640 _IO('V', M_VESA_64K_640 - M_VESA_BASE) #define SW_VESA_FULL_640 _IO('V', M_VESA_FULL_640 - M_VESA_BASE) #define SW_VESA_32K_800 _IO('V', M_VESA_32K_800 - M_VESA_BASE) #define SW_VESA_64K_800 _IO('V', M_VESA_64K_800 - M_VESA_BASE) #define SW_VESA_FULL_800 _IO('V', M_VESA_FULL_800 - M_VESA_BASE) #define SW_VESA_32K_1024 _IO('V', M_VESA_32K_1024 - M_VESA_BASE) #define SW_VESA_64K_1024 _IO('V', M_VESA_64K_1024 - M_VESA_BASE) #define SW_VESA_FULL_1024 _IO('V', M_VESA_FULL_1024 - M_VESA_BASE) #define SW_VESA_32K_1280 _IO('V', M_VESA_32K_1280 - M_VESA_BASE) #define SW_VESA_64K_1280 _IO('V', M_VESA_64K_1280 - M_VESA_BASE) #define SW_VESA_FULL_1280 _IO('V', M_VESA_FULL_1280 - M_VESA_BASE) #endif /* !_MACHINE_CONSOLE_H_ */ Index: head/sys/i386/isa/atkbd_isa.c =================================================================== --- head/sys/i386/isa/atkbd_isa.c (revision 44627) +++ head/sys/i386/isa/atkbd_isa.c (revision 44628) @@ -1,100 +1,87 @@ /*- * Copyright (c) 1999 Kazutaka YOKOTA * All rights reserved. * * 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 as * the first lines of this file unmodified. * 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. * * THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``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 AUTHORS 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. * - * $Id: atkbd_isa.c,v 1.1 1999/01/09 02:44:40 yokota Exp $ + * $Id: atkbd_isa.c,v 1.2 1999/01/19 11:30:55 yokota Exp $ */ #include "atkbd.h" #include "opt_kbd.h" #if NATKBD > 0 #include #include #include #include #include #include #include #include #include static int atkbdprobe(struct isa_device *dev); static int atkbdattach(struct isa_device *dev); static ointhand2_t atkbd_isa_intr; struct isa_driver atkbddriver = { atkbdprobe, atkbdattach, ATKBD_DRIVER_NAME, 0, }; static int atkbdprobe(struct isa_device *dev) { - atkbd_softc_t *sc; - int error; - - sc = atkbd_get_softc(dev->id_unit); - if (sc == NULL) - return 0; - - /* try to find a keyboard */ - error = atkbd_probe_unit(dev->id_unit, sc, dev->id_iobase, - dev->id_irq, dev->id_flags); - if (error) - return 0; - - /* declare our interrupt handler */ - dev->id_ointr = atkbd_isa_intr; - - return -1; + return ((atkbd_probe_unit(dev->id_unit, dev->id_iobase, + dev->id_irq, dev->id_flags)) ? 0 : -1); } static int atkbdattach(struct isa_device *dev) { atkbd_softc_t *sc; sc = atkbd_get_softc(dev->id_unit); if (sc == NULL) return 0; - return ((atkbd_attach_unit(dev->id_unit, sc)) ? 0 : 1); + dev->id_ointr = atkbd_isa_intr; + return ((atkbd_attach_unit(dev->id_unit, sc, dev->id_iobase, + dev->id_irq, dev->id_flags)) ? 0 : 1); } static void atkbd_isa_intr(int unit) { keyboard_t *kbd; kbd = atkbd_get_softc(unit)->kbd; - (*kbdsw[kbd->kb_index]->intr)(kbd); + (*kbdsw[kbd->kb_index]->intr)(kbd, NULL); } #endif /* NATKBD > 0 */ Index: head/sys/i386/isa/pcvt/pcvt_kbd.c =================================================================== --- head/sys/i386/isa/pcvt/pcvt_kbd.c (revision 44627) +++ head/sys/i386/isa/pcvt/pcvt_kbd.c (revision 44628) @@ -1,3180 +1,3180 @@ /* * Copyright (c) 1992, 1995 Hellmuth Michaelis and Joerg Wunsch. * * Copyright (c) 1992, 1993 Brian Dunford-Shore and Holger Veit. * * All rights reserved. * * This code is derived from software contributed to Berkeley by * William Jolitz and Don Ahn. * * This code is derived from software contributed to 386BSD by * Holger Veit. * * 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 Hellmuth Michaelis, * Brian Dunford-Shore and Joerg Wunsch. * 4. The name authors may not be used to endorse or promote products * derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``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 AUTHORS 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. * * * @(#)pcvt_kbd.c, 3.20, Last Edit-Date: [Sun Apr 2 18:59:04 1995] * */ /*---------------------------------------------------------------------------* * * pcvt_kbd.c VT220 Driver Keyboard Interface Code * ---------------------------------------------------- * -hm ------------ Release 3.00 -------------- * -hm integrating NetBSD-current patches * -jw introduced kbd_emulate_pc() if scanset > 1 * -hm patch from joerg for timeout in kbd_emulate_pc() * -hm starting to implement alt-shift/ctrl key mappings * -hm Gateway 2000 Keyboard fix from Brian Moore * -hm some #if adjusting for NetBSD 0.9 * -hm split off pcvt_kbd.h * -hm applying Joerg's patches for FreeBSD 2.0 * -hm patch from Martin, PCVT_NO_LED_UPDATE * -hm PCVT_VT220KEYB patches from Lon Willet * -hm PR #399, patch from Bill Sommerfeld: Return with PCVT_META_ESC * -hm allow keyboard-less kernel boot for serial consoles and such .. * -hm patch from Lon Willett for led-update and showkey() * -hm patch from Lon Willett to fix mapping of Control-R scancode * -hm delay patch from Martin Husemann after port-i386 ml-discussion * -hm added PCVT_NONRESP_KEYB_TRY definition to doreset() * *---------------------------------------------------------------------------*/ #include "vt.h" #include "opt_ddb.h" #if NVT > 0 #include /* global include */ #define LEDSTATE_UPDATE_PENDING (1 << 3) static void fkey1(void), fkey2(void), fkey3(void), fkey4(void); static void fkey5(void), fkey6(void), fkey7(void), fkey8(void); static void fkey9(void), fkey10(void), fkey11(void), fkey12(void); static void sfkey1(void), sfkey2(void), sfkey3(void), sfkey4(void); static void sfkey5(void), sfkey6(void), sfkey7(void), sfkey8(void); static void sfkey9(void), sfkey10(void), sfkey11(void), sfkey12(void); static void cfkey1(void), cfkey2(void), cfkey3(void), cfkey4(void); static void cfkey5(void), cfkey6(void), cfkey7(void), cfkey8(void); static void cfkey9(void), cfkey10(void), cfkey11(void), cfkey12(void); static void doreset ( void ); static void ovlinit ( int force ); static void settpmrate ( int rate ); static void setlockkeys ( int snc ); #ifndef _DEV_KBD_KBDREG_H_ static int kbc_8042cmd ( int val ); #endif /* !_DEV_KBD_KBDREG_H_ */ static int getokeydef ( unsigned key, struct kbd_ovlkey *thisdef ); static int getckeydef ( unsigned key, struct kbd_ovlkey *thisdef ); static int rmkeydef ( int key ); static int setkeydef ( struct kbd_ovlkey *data ); static u_char * xlatkey2ascii( U_short key ); static int ledstate = LEDSTATE_UPDATE_PENDING; /* keyboard led's */ static int tpmrate = KBD_TPD500|KBD_TPM100; static u_char altkpflag = 0; static u_short altkpval = 0; #if PCVT_SHOWKEYS u_char rawkeybuf[80]; #endif #include /* tables etc */ #if PCVT_SHOWKEYS /*---------------------------------------------------------------------------* * keyboard debugging: put kbd communication char into some buffer *---------------------------------------------------------------------------*/ static void showkey (char delim, u_char val) { int rki; for(rki = 3; rki < 80; rki++) /* shift left buffer */ rawkeybuf[rki-3] = rawkeybuf[rki]; rawkeybuf[77] = delim; /* delimiter */ rki = (val & 0xf0) >> 4; /* ms nibble */ if(rki <= 9) rki = rki + '0'; else rki = rki - 10 + 'A'; rawkeybuf[78] = rki; rki = val & 0x0f; /* ls nibble */ if(rki <= 9) rki = rki + '0'; else rki = rki - 10 + 'A'; rawkeybuf[79] = rki; } #endif /* PCVT_SHOWKEYS */ /*---------------------------------------------------------------------------* * function to switch to another virtual screen *---------------------------------------------------------------------------*/ static void do_vgapage(int page) { if(critical_scroll) /* executing critical region ? */ switch_page = page; /* yes, auto switch later */ else vgapage(page); /* no, switch now */ } /* * This code from Lon Willett enclosed in #if PCVT_UPDLED_LOSES_INTR is * abled because it crashes FreeBSD 1.1.5.1 at boot time. * The cause is obviously that the timeout queue is not yet initialized * timeout is called from here the first time. * Anyway it is a pointer in the right direction so it is included for * reference here. */ #define PCVT_UPDLED_LOSES_INTR 0 /* disabled for now */ #if PCVT_UPDLED_LOSES_INTR || defined(_DEV_KBD_KBDREG_H_) /*---------------------------------------------------------------------------* * check for lost keyboard interrupts *---------------------------------------------------------------------------*/ /* * The two commands to change the LEDs generate two KEYB_R_ACK responses * from the keyboard, which aren't explicitly checked for (maybe they * should be?). However, when a lot of other I/O is happening, one of * the interrupts sometimes gets lost (I'm not sure of the details of * how and why and what hardware this happens with). * * This may have had something to do with spltty() previously not being * called before the kbd_cmd() calls in update_led(). * * This is a real problem, because normally the keyboard is only polled * by pcrint(), and no more interrupts will be generated until the ACK * has been read. So the keyboard is hung. This code polls a little * while after changing the LEDs to make sure that this hasn't happened. * * XXX Quite possibly we should poll the kbd on a regular basis anyway, * in the interest of robustness. It may be possible that interrupts * get lost other times as well. */ static int lost_intr_timeout_queued = 0; static struct callout_handle lost_intr_ch = CALLOUT_HANDLE_INITIALIZER(&lost_intr_ch); static void check_for_lost_intr (void *arg) { #ifndef _DEV_KBD_KBDREG_H_ lost_intr_timeout_queued = 0; if (inb(CONTROLLER_CTRL) & STATUS_OUTPBF) { int opri = spltty (); pcrint (); splx (opri); } #else int opri; lost_intr_timeout_queued = 0; if ((*kbdsw[kbd->kb_index]->lock)(kbd, TRUE)) { opri = spltty (); (*kbdsw[kbd->kb_index]->lock)(kbd, FALSE); if ((*kbdsw[kbd->kb_index]->check)(kbd)) pcrint (0); splx (opri); } lost_intr_ch = timeout(check_for_lost_intr, (void *)NULL, hz); lost_intr_timeout_queued = 1; #endif /* !_DEV_KBD_KBDREG_H_ */ } #endif /* PCVT_UPDLED_LOSES_INTR || defined(_DEV_KBD_KBDREG_H_) */ /*---------------------------------------------------------------------------* * update keyboard led's *---------------------------------------------------------------------------*/ void update_led(void) { #if !PCVT_NO_LED_UPDATE /* Don't update LED's unless necessary. */ int opri, new_ledstate; opri = spltty(); #ifndef _DEV_KBD_KBDREG_H_ new_ledstate = (vsp->scroll_lock) | (vsp->num_lock * 2) | (vsp->caps_lock * 4); #else new_ledstate = ((vsp->scroll_lock) ? LED_SCR : 0) | ((vsp->num_lock) ? LED_NUM : 0) | ((vsp->caps_lock) ? LED_CAP : 0); #endif /* _DEV_KBD_KBDREG_H_ */ if (new_ledstate != ledstate) { #ifndef _DEV_KBD_KBDREG_H_ int response1, response2; ledstate = LEDSTATE_UPDATE_PENDING; if(kbd_cmd(KEYB_C_LEDS) != 0) { printf("Keyboard LED command timeout\n"); splx(opri); return; } /* * For some keyboards or keyboard controllers, it is an * error to issue a command without waiting long enough * for an ACK for the previous command. The keyboard * gets confused, and responds with KEYB_R_RESEND, but * we ignore that. Wait for the ACK here. The busy * waiting doesn't matter much, since we lose anyway by * busy waiting to send the command. * * XXX actually wait for any response, since we can't * handle normal scancodes here. * * XXX all this should be interrupt driven. Issue only * one command at a time wait for a ACK before proceeding. * Retry after a timeout or on receipt of a KEYB_R_RESEND. * KEYB_R_RESENDs seem to be guaranteed by working * keyboard controllers with broken (or disconnected) * keyboards. There is another code for keyboard * reconnects. The keyboard hardware is very simple and * well designed :-). */ response1 = kbd_response(); if(kbd_cmd(new_ledstate) != 0) { printf("Keyboard LED data timeout\n"); splx(opri); return; } response2 = kbd_response(); if (response1 == KEYB_R_ACK && response2 == KEYB_R_ACK) ledstate = new_ledstate; else printf( "Keyboard LED command not ACKed (responses %#x %#x)\n", response1, response2); #else /* _DEV_KBD_KBDREG_H_ */ if (kbd == NULL) { ledstate = new_ledstate; splx(opri); } else { ledstate = LEDSTATE_UPDATE_PENDING; splx(opri); if ((*kbdsw[kbd->kb_index]->ioctl)(kbd, KDSETLED, (caddr_t)&new_ledstate) == 0) ledstate = new_ledstate; } #endif /* !_DEV_KBD_KBDREG_H_ */ #if PCVT_UPDLED_LOSES_INTR if (lost_intr_timeout_queued) untimeout(check_for_lost_intr, NULL, lost_intr_ch); lost_intr_ch = timeout(check_for_lost_intr, NULL, hz); lost_intr_timeout_queued = 1; #endif /* PCVT_UPDLED_LOSES_INTR */ } #ifndef _DEV_KBD_KBDREG_H_ splx(opri); #endif #endif /* !PCVT_NO_LED_UPDATE */ } /*---------------------------------------------------------------------------* * set typematic rate *---------------------------------------------------------------------------*/ static void settpmrate(int rate) { #ifndef _DEV_KBD_KBDREG_H_ tpmrate = rate & 0x7f; if(kbd_cmd(KEYB_C_TYPEM) != 0) printf("Keyboard TYPEMATIC command timeout\n"); else if(kbd_cmd(tpmrate) != 0) printf("Keyboard TYPEMATIC data timeout\n"); #else if (kbd == NULL) return; tpmrate = rate & 0x7f; if ((*kbdsw[kbd->kb_index]->ioctl)(kbd, KDSETRAD, (caddr_t)&tpmrate)) printf("pcvt: failed to set keyboard TYPEMATIC.\n"); #endif /* !_DEV_KBD_KBDREG_H_ */ } #ifndef _DEV_KBD_KBDREG_H_ /*---------------------------------------------------------------------------* * Pass command to keyboard controller (8042) *---------------------------------------------------------------------------*/ static int kbc_8042cmd(int val) { unsigned timeo; timeo = 100000; /* > 100 msec */ while (inb(CONTROLLER_CTRL) & STATUS_INPBF) if (--timeo == 0) return (-1); outb(CONTROLLER_CTRL, val); return (0); } /*---------------------------------------------------------------------------* * Pass command to keyboard itself *---------------------------------------------------------------------------*/ int kbd_cmd(int val) { unsigned timeo; timeo = 100000; /* > 100 msec */ while (inb(CONTROLLER_CTRL) & STATUS_INPBF) if (--timeo == 0) return (-1); outb(CONTROLLER_DATA, val); #if PCVT_SHOWKEYS showkey ('>', val); #endif /* PCVT_SHOWKEYS */ return (0); } /*---------------------------------------------------------------------------* * Read response from keyboard * NB: make sure to call spltty() before kbd_cmd(), kbd_response(). *---------------------------------------------------------------------------*/ int kbd_response(void) { u_char ch; unsigned timeo; timeo = 500000; /* > 500 msec (KEYB_R_SELFOK requires 87) */ while (!(inb(CONTROLLER_CTRL) & STATUS_OUTPBF)) if (--timeo == 0) return (-1); PCVT_KBD_DELAY(); /* 7 us delay */ ch = inb(CONTROLLER_DATA); #if PCVT_SHOWKEYS showkey ('<', ch); #endif /* PCVT_SHOWKEYS */ return ch; } #endif /* _DEV_KBD_KBDREG_H_ */ #if PCVT_SCANSET > 1 /*---------------------------------------------------------------------------* * switch PC scan code emulation mode *---------------------------------------------------------------------------*/ void kbd_emulate_pc(int do_emulation) { #ifndef _DEV_KBD_KBDREG_H_ int cmd, timeo = 10000; cmd = COMMAND_SYSFLG|COMMAND_IRQEN; /* common base cmd */ #if !PCVT_USEKBDSEC cmd |= COMMAND_INHOVR; #endif if(do_emulation) cmd |= COMMAND_PCSCAN; kbc_8042cmd(CONTR_WRITE); while (inb(CONTROLLER_CTRL) & STATUS_INPBF) if (--timeo == 0) break; outb(CONTROLLER_DATA, cmd); #else set_controller_command_byte(*(KBDC *)kbd->kb_data, KBD_TRANSLATION, (do_emulation) ? KBD_TRANSLATION : 0); #endif /* !_DEV_KBD_KBDREG_H_ */ } #endif /* PCVT_SCANSET > 1 */ #ifndef PCVT_NONRESP_KEYB_TRY #define PCVT_NONRESP_KEYB_TRY 25 /* no of times to try to detect */ #endif /* a nonresponding keyboard */ /*---------------------------------------------------------------------------* * try to force keyboard into a known state .. *---------------------------------------------------------------------------*/ static void doreset(void) { #ifndef _DEV_KBD_KBDREG_H_ int again = 0; int once = 0; int response, opri; /* Enable interrupts and keyboard, etc. */ if (kbc_8042cmd(CONTR_WRITE) != 0) printf("pcvt: doreset() - timeout controller write command\n"); #if PCVT_USEKBDSEC /* security enabled */ # if PCVT_SCANSET == 2 # define KBDINITCMD COMMAND_SYSFLG|COMMAND_IRQEN # else /* PCVT_SCANSET != 2 */ # define KBDINITCMD COMMAND_PCSCAN|COMMAND_SYSFLG|COMMAND_IRQEN # endif /* PCVT_SCANSET == 2 */ #else /* ! PCVT_USEKBDSEC */ /* security disabled */ # if PCVT_SCANSET == 2 # define KBDINITCMD COMMAND_INHOVR|COMMAND_SYSFLG|COMMAND_IRQEN # else /* PCVT_SCANSET != 2 */ # define KBDINITCMD COMMAND_PCSCAN|COMMAND_INHOVR|COMMAND_SYSFLG\ |COMMAND_IRQEN # endif /* PCVT_SCANSET == 2 */ #endif /* PCVT_USEKBDSEC */ if (kbd_cmd(KBDINITCMD) != 0) printf("pcvt: doreset() - timeout writing keyboard init command\n"); /* * Discard any stale keyboard activity. The 0.1 boot code isn't * very careful and sometimes leaves a KEYB_R_RESEND. Versions * between 1992 and Oct 1996 didn't have the delay and sometimes * left a KEYB_R_RESEND. */ while (1) { if (inb(CONTROLLER_CTRL) & STATUS_OUTPBF) kbd_response(); else { DELAY(10000); if (!(inb(CONTROLLER_CTRL) & STATUS_OUTPBF)) break; } } /* Start keyboard reset */ opri = spltty (); if (kbd_cmd(KEYB_C_RESET) != 0) { printf("pcvt: doreset() - timeout for keyboard reset command\n"); outb(CONTROLLER_DATA, KEYB_C_RESET); /* force */ } /* Wait for the first response to reset and handle retries */ while ((response = kbd_response()) != KEYB_R_ACK) { if (response < 0) { if(!again) /* print message only once ! */ printf("pcvt: doreset() - response != ack and response < 0 [one time only msg]\n"); response = KEYB_R_RESEND; } else if (response == KEYB_R_RESEND) { if(!again) /* print message only once ! */ printf("pcvt: doreset() - got KEYB_R_RESEND response ... [one time only msg]\n"); } if (response == KEYB_R_RESEND) { if(++again > PCVT_NONRESP_KEYB_TRY) { printf("pcvt: doreset() - Caution - no PC keyboard detected!\n"); keyboard_type = KB_UNKNOWN; splx(opri); return; } if((kbd_cmd(KEYB_C_RESET) != 0) && (once == 0)) { once++; /* print message only once ! */ printf("pcvt: doreset() - timeout for loop keyboard reset command [one time only msg]\n"); outb(CONTROLLER_DATA, KEYB_C_RESET); /* force */ } } } /* Wait for the second response to reset */ while ((response = kbd_response()) != KEYB_R_SELFOK) { if (response < 0) { printf("pcvt: doreset() - response != OK and resonse < 0\n"); /* * If KEYB_R_SELFOK never arrives, the loop will * finish here unless the keyboard babbles or * STATUS_OUTPBF gets stuck. */ break; } } splx (opri); #if PCVT_KEYBDID opri = spltty (); if(kbd_cmd(KEYB_C_ID) != 0) { printf("pcvt: doreset() - timeout for keyboard ID command\n"); keyboard_type = KB_UNKNOWN; } else { r_entry: if((response = kbd_response()) == KEYB_R_MF2ID1) { if((response = kbd_response()) == KEYB_R_MF2ID2) { keyboard_type = KB_MFII; } else if(response == KEYB_R_MF2ID2HP) { keyboard_type = KB_MFII; } else { printf("\npcvt: doreset() - kbdid, response 2 = [%d]\n", response); keyboard_type = KB_UNKNOWN; } } else if (response == KEYB_R_ACK) { goto r_entry; } else if (response == -1) { keyboard_type = KB_AT; } else { printf("\npcvt: doreset() - kbdid, response 1 = [%d]\n", response); } } splx (opri); #else /* PCVT_KEYBDID */ keyboard_type = KB_MFII; /* force it .. */ #endif /* PCVT_KEYBDID */ #else /* _DEV_KBD_KBDREG_H_ */ int type; if (!reset_keyboard) /* no, we are not ready to reset */ return; if (lost_intr_timeout_queued) { untimeout(check_for_lost_intr, (void *)NULL, lost_intr_ch); lost_intr_timeout_queued = 0; } if (kbd == NULL) return; /* shouldn't happen */ - (*kbdsw[kbd->kb_index]->init)(kbd); + kbd_configure(0); ledstate = LEDSTATE_UPDATE_PENDING; #if PCVT_USEKBDSEC /* security enabled */ # if PCVT_SCANSET == 2 # define KBDINITCMD 0 # else /* PCVT_SCANSET != 2 */ # define KBDINITCMD KBD_TRANSLATION # endif /* PCVT_SCANSET == 2 */ #else /* ! PCVT_USEKBDSEC */ /* security disabled */ # if PCVT_SCANSET == 2 # define KBDINITCMD KBD_OVERRIDE_KBD_LOCK # else /* PCVT_SCANSET != 2 */ # define KBDINITCMD KBD_TRANSLATION | KBD_OVERRIDE_KBD_LOCK # endif /* PCVT_SCANSET == 2 */ #endif /* PCVT_USEKBDSEC */ set_controller_command_byte(*(KBDC *)kbd->kb_data, KBD_OVERRIDE_KBD_LOCK | KBD_TRANSLATION, KBDINITCMD); keyboard_type = KB_MFII; /* force it .. */ #if PCVT_KEYBDID type = KB_101; (*kbdsw[kbd->kb_index]->ioctl)(kbd, KDGKBTYPE, (caddr_t)&type); switch (type) { case KB_84: keyboard_type = KB_AT; break; case KB_101: keyboard_type = KB_MFII; break; default: keyboard_type = KB_UNKNOWN; break; } #endif /* PCVT_KEYBDID */ update_led(); lost_intr_ch = timeout(check_for_lost_intr, (void *)NULL, hz); lost_intr_timeout_queued = 1; #endif /* !_DEV_KBD_KBDREG_H_ */ } /*---------------------------------------------------------------------------* * init keyboard code *---------------------------------------------------------------------------*/ void kbd_code_init(void) { doreset(); ovlinit(0); keyboard_is_initialized = 1; } /*---------------------------------------------------------------------------* * init keyboard code, this initializes the keyboard subsystem * just "a bit" so the very very first ddb session is able to * get proper keystrokes - in other words, it's a hack .... *---------------------------------------------------------------------------*/ void kbd_code_init1(void) { doreset(); keyboard_is_initialized = 1; } /*---------------------------------------------------------------------------* * init keyboard overlay table *---------------------------------------------------------------------------*/ static void ovlinit(int force) { register i; if(force || ovlinitflag==0) { if(ovlinitflag == 0 && (ovltbl = (Ovl_tbl *)malloc(sizeof(Ovl_tbl) * OVLTBL_SIZE, M_DEVBUF, M_WAITOK)) == NULL) panic("pcvt_kbd: malloc of Ovl_tbl failed"); for(i=0; i MAXKEYNUM) return EINVAL; thisdef->keynum = key; thisdef->type = key2ascii[key].type; if(key2ascii[key].unshift.subtype == STR) { bcopy((u_char *)(key2ascii[key].unshift.what.string), thisdef->unshift, CODE_SIZE); thisdef->subu = KBD_SUBT_STR; } else { bcopy("", thisdef->unshift, CODE_SIZE); thisdef->subu = KBD_SUBT_FNC; } if(key2ascii[key].shift.subtype == STR) { bcopy((u_char *)(key2ascii[key].shift.what.string), thisdef->shift, CODE_SIZE); thisdef->subs = KBD_SUBT_STR; } else { bcopy("",thisdef->shift,CODE_SIZE); thisdef->subs = KBD_SUBT_FNC; } if(key2ascii[key].ctrl.subtype == STR) { bcopy((u_char *)(key2ascii[key].ctrl.what.string), thisdef->ctrl, CODE_SIZE); thisdef->subc = KBD_SUBT_STR; } else { bcopy("",thisdef->ctrl,CODE_SIZE); thisdef->subc = KBD_SUBT_FNC; } /* deliver at least anything for ALTGR settings ... */ if(key2ascii[key].unshift.subtype == STR) { bcopy((u_char *)(key2ascii[key].unshift.what.string), thisdef->altgr, CODE_SIZE); thisdef->suba = KBD_SUBT_STR; } else { bcopy("",thisdef->altgr, CODE_SIZE); thisdef->suba = KBD_SUBT_FNC; } return 0; } /*---------------------------------------------------------------------------* * get current key definition *---------------------------------------------------------------------------*/ static int getckeydef(unsigned key, Ovl_tbl *thisdef) { u_short type = key2ascii[key].type; if(key>MAXKEYNUM) return EINVAL; if(type & KBD_OVERLOAD) *thisdef = ovltbl[key2ascii[key].ovlindex]; else getokeydef(key,thisdef); return 0; } /*---------------------------------------------------------------------------* * translate keynumber and returns ptr to associated ascii string * if key is bound to a function, executes it, and ret empty ptr *---------------------------------------------------------------------------*/ static u_char * xlatkey2ascii(U_short key) { static u_char capchar[2] = {0, 0}; #if PCVT_META_ESC static u_char metachar[3] = {0x1b, 0, 0}; #else static u_char metachar[2] = {0, 0}; #endif static Ovl_tbl thisdef; int n; void (*fnc)(void); if(key==0) /* ignore the NON-KEY */ return 0; getckeydef(key&0x7F, &thisdef); /* get the current ASCII value */ thisdef.type &= KBD_MASK; if(key&0x80) /* special handling of ALT-KEYPAD */ { /* is the ALT Key released? */ if(thisdef.type==KBD_META || thisdef.type==KBD_ALTGR) { if(altkpflag) /* have we been in altkp mode? */ { capchar[0] = altkpval; altkpflag = 0; altkpval = 0; return capchar; } } return 0; } switch(thisdef.type) /* convert the keys */ { case KBD_BREAK: case KBD_ASCII: case KBD_FUNC: fnc = NULL; more_chars = NULL; if(altgr_down) { more_chars = (u_char *)thisdef.altgr; } else if(!ctrl_down && (shift_down || vsp->shift_lock)) { if(key2ascii[key].shift.subtype == STR) more_chars = (u_char *)thisdef.shift; else fnc = key2ascii[key].shift.what.func; } else if(ctrl_down) { if(key2ascii[key].ctrl.subtype == STR) more_chars = (u_char *)thisdef.ctrl; else fnc = key2ascii[key].ctrl.what.func; } else { if(key2ascii[key].unshift.subtype == STR) more_chars = (u_char *)thisdef.unshift; else fnc = key2ascii[key].unshift.what.func; } if(fnc) (*fnc)(); /* execute function */ if((more_chars != NULL) && (more_chars[1] == 0)) { if(vsp->caps_lock && more_chars[0] >= 'a' && more_chars[0] <= 'z') { capchar[0] = *more_chars - ('a'-'A'); more_chars = capchar; } if(meta_down) { #if PCVT_META_ESC metachar[1] = *more_chars; #else metachar[0] = *more_chars | 0x80; #endif more_chars = metachar; } } return(more_chars); case KBD_KP: fnc = NULL; more_chars = NULL; if(meta_down) { switch(key) { case 95: /* / */ altkpflag = 0; more_chars = (u_char *)"\033OQ"; return(more_chars); case 100: /* * */ altkpflag = 0; more_chars = (u_char *)"\033OR"; return(more_chars); case 105: /* - */ altkpflag = 0; more_chars = (u_char *)"\033OS"; return(more_chars); } } if(meta_down || altgr_down) { if((n = keypad2num[key-91]) >= 0) { if(!altkpflag) { /* start ALT-KP mode */ altkpflag = 1; altkpval = 0; } altkpval *= 10; altkpval += n; } else altkpflag = 0; return 0; } if(!(vsp->num_lock)) { if(key2ascii[key].shift.subtype == STR) more_chars = (u_char *)thisdef.shift; else fnc = key2ascii[key].shift.what.func; } else { if(key2ascii[key].unshift.subtype == STR) more_chars = (u_char *)thisdef.unshift; else fnc = key2ascii[key].unshift.what.func; } if(fnc) (*fnc)(); /* execute function */ return(more_chars); case KBD_CURSOR: fnc = NULL; more_chars = NULL; if(vsp->ckm) { if(key2ascii[key].shift.subtype == STR) more_chars = (u_char *)thisdef.shift; else fnc = key2ascii[key].shift.what.func; } else { if(key2ascii[key].unshift.subtype == STR) more_chars = (u_char *)thisdef.unshift; else fnc = key2ascii[key].unshift.what.func; } if(fnc) (*fnc)(); /* execute function */ return(more_chars); case KBD_NUM: /* special kp-num handling */ more_chars = NULL; if(meta_down) { more_chars = (u_char *)"\033OP"; /* PF1 */ } else { vsp->num_lock ^= 1; update_led(); } return(more_chars); case KBD_RETURN: more_chars = NULL; if(!(vsp->num_lock)) { more_chars = (u_char *)thisdef.shift; } else { more_chars = (u_char *)thisdef.unshift; } if(vsp->lnm && (*more_chars == '\r')) { more_chars = (u_char *)"\r\n"; /* CR LF */ } if(meta_down) { #if PCVT_META_ESC metachar[1] = *more_chars; #else metachar[0] = *more_chars | 0x80; #endif more_chars = metachar; } return(more_chars); case KBD_META: /* these keys are */ case KBD_ALTGR: /* handled directly */ case KBD_SCROLL: /* by the keyboard */ case KBD_CAPS: /* handler - they are */ case KBD_SHFTLOCK: /* ignored here */ case KBD_CTL: case KBD_NONE: default: return 0; } } /*---------------------------------------------------------------------------* * get keystrokes from the keyboard. * if noblock = 0, wait until a key is pressed. * else return NULL if no characters present. *---------------------------------------------------------------------------*/ #if PCVT_KBD_FIFO extern u_char pcvt_kbd_fifo[]; extern int pcvt_kbd_rptr; extern short pcvt_kbd_count; #endif u_char * sgetc(int noblock) { u_char *cp; u_char dt; u_char key; u_short type; #if PCVT_KBD_FIFO && PCVT_SLOW_INTERRUPT int s; #endif static u_char kbd_lastkey = 0; /* last keystroke */ static struct { u_char extended: 1; /* extended prefix seen */ u_char ext1: 1; /* extended prefix 1 seen */ u_char breakseen: 1; /* break code seen */ u_char vshift: 1; /* virtual shift pending */ u_char vcontrol: 1; /* virtual control pending */ u_char sysrq: 1; /* sysrq pressed */ } kbd_status = {0}; #ifdef XSERVER static char keybuf[2] = {0}; /* the second 0 is a delimiter! */ #endif /* XSERVER */ #ifdef _DEV_KBD_KBDREG_H_ int c; #endif /* _DEV_KBD_KBDREG_H_ */ loop: #ifdef XSERVER #ifndef _DEV_KBD_KBDREG_H_ #if PCVT_KBD_FIFO /* see if there is data from the keyboard available either from */ /* the keyboard fifo or from the 8042 keyboard controller */ if (pcvt_kbd_count || (inb(CONTROLLER_CTRL) & STATUS_OUTPBF)) { if (!pcvt_kbd_count) /* source = 8042 */ { PCVT_KBD_DELAY(); /* 7 us delay */ dt = inb(CONTROLLER_DATA); /* get from obuf */ } else /* source = keyboard fifo */ { dt = pcvt_kbd_fifo[pcvt_kbd_rptr++]; PCVT_DISABLE_INTR(); pcvt_kbd_count--; PCVT_ENABLE_INTR(); if (pcvt_kbd_rptr >= PCVT_KBD_FIFO_SZ) pcvt_kbd_rptr = 0; } #else /* !PCVT_KB_FIFO */ /* see if there is data from the keyboard available from the 8042 */ if (inb(CONTROLLER_CTRL) & STATUS_OUTPBF) { PCVT_KBD_DELAY(); /* 7 us delay */ dt = inb(CONTROLLER_DATA); /* yes, get data */ #endif /* !PCVT_KBD_FIFO */ #else /* _DEV_KBD_KBDREG_H_ */ #if PCVT_KBD_FIFO if (pcvt_kbd_count) { dt = pcvt_kbd_fifo[pcvt_kbd_rptr++]; PCVT_DISABLE_INTR(); pcvt_kbd_count--; PCVT_ENABLE_INTR(); if (pcvt_kbd_rptr >= PCVT_KBD_FIFO_SZ) pcvt_kbd_rptr = 0; } else #endif /* PCVT_KBD_FIFO */ if (!noblock) { while ((c = (*kbdsw[kbd->kb_index]->read)(kbd, TRUE)) == -1) ; dt = c; } else { if ((c = (*kbdsw[kbd->kb_index]->read)(kbd, FALSE)) == -1) return NULL; dt = c; } { #endif /* !_DEV_KBD_KBDREG_H_ */ /* * If x mode is active, only care for locking keys, then * return the scan code instead of any key translation. * Additionally, this prevents us from any attempts to * execute pcvt internal functions caused by keys (such * as screen flipping). * XXX For now, only the default locking key definitions * are recognized (i.e. if you have overloaded you "A" key * as NUMLOCK, that wont effect X mode:-) * Changing this would be nice, but would require modifi- * cations to the X server. After having this, X will * deal with the LEDs itself, so we are committed. */ /* * Iff PCVT_USL_VT_COMPAT is defined, the behaviour has * been fixed. We need not care about any keys here, since * there are ioctls that deal with the lock key / LED stuff. */ if (pcvt_kbd_raw) { keybuf[0] = dt; #if PCVT_FREEBSD > 210 add_keyboard_randomness(dt); #endif /* PCVT_FREEBSD > 210 */ #if !PCVT_USL_VT_COMPAT if ((dt & 0x80) == 0) /* key make */ switch(dt) { case 0x45: /* XXX on which virt screen? */ vsp->num_lock ^= 1; update_led(); break; case 0x3a: vsp->caps_lock ^= 1; update_led(); break; case 0x46: vsp->scroll_lock ^= 1; update_led(); break; } #endif /* !PCVT_USL_VT_COMPAT */ #if PCVT_EMU_MOUSE /* * The (mouse systems) mouse emulator. The mouse * device allocates the first device node that is * not used by a virtual terminal. (E.g., you have * eight vtys, /dev/ttyv0 thru /dev/ttyv7, so the * mouse emulator were /dev/ttyv8.) * Currently the emulator only works if the keyboard * is in raw (PC scan code) mode. This is the typic- * al case when running the X server. * It is activated if the num locks LED is active * for the current vty, and if the mouse device * has been opened by at least one process. It * grabs the numerical keypad events (but only * the "non-extended", so the separate arrow keys * continue to work), and three keys for the "mouse * buttons", preferrably F1 thru F3. Any of the * eight directions (N, NE, E, SE, S, SW, W, NW) * is supported, and frequent key presses (less * than e.g. half a second between key presses) * cause the emulator to accelerate the pointer * movement by 6, while single presses result in * single moves, so each point can be reached. */ /* * NB: the following code is spagghetti. * Only eat it with lotta tomato ketchup and * Parmesan cheese:-) */ /* * look whether we will have to steal the keys * and cook them into mouse events */ if(vsp->num_lock && mouse.opened) { int button, accel, i; enum mouse_dir { MOUSE_NW, MOUSE_N, MOUSE_NE, MOUSE_W, MOUSE_0, MOUSE_E, MOUSE_SW, MOUSE_S, MOUSE_SE } move; struct timeval now; dev_t dummy = makedev(0, mouse.minor); struct tty *mousetty = get_pccons(dummy); /* * strings to send for each mouse event, * indexed by the movement direction and * the "accelerator" value (TRUE for frequent * key presses); note that the first byte * of each string is actually overwritten * by the current button value before sending * the string */ static u_char mousestrings[2][MOUSE_SE+1][5] = { { /* first, the non-accelerated strings*/ {0x87, -1, 1, 0, 0}, /* NW */ {0x87, 0, 1, 0, 0}, /* N */ {0x87, 1, 1, 0, 0}, /* NE */ {0x87, -1, 0, 0, 0}, /* W */ {0x87, 0, 0, 0, 0}, /* 0 */ {0x87, 1, 0, 0, 0}, /* E */ {0x87, -1, -1, 0, 0}, /* SW */ {0x87, 0, -1, 0, 0}, /* S */ {0x87, 1, -1, 0, 0} /* SE */ }, { /* now, 6 steps at once */ {0x87, -4, 4, 0, 0}, /* NW */ {0x87, 0, 6, 0, 0}, /* N */ {0x87, 4, 4, 0, 0}, /* NE */ {0x87, -6, 0, 0, 0}, /* W */ {0x87, 0, 0, 0, 0}, /* 0 */ {0x87, 6, 0, 0, 0}, /* E */ {0x87, -4, -4, 0, 0}, /* SW */ {0x87, 0, -6, 0, 0}, /* S */ {0x87, 4, -4, 0, 0} /* SE */ } }; if(dt == 0xe0) { /* ignore extended scan codes */ mouse.extendedseen = 1; goto no_mouse_event; } if(mouse.extendedseen) { mouse.extendedseen = 0; goto no_mouse_event; } mouse.extendedseen = 0; /* * Note that we cannot use a switch here * since we want to have the keycodes in * a variable */ if((dt & 0x7f) == mousedef.leftbutton) { button = 4; goto do_button; } else if((dt & 0x7f) == mousedef.middlebutton) { button = 2; goto do_button; } else if((dt & 0x7f) == mousedef.rightbutton) { button = 1; do_button: /* * i would really like to give * some acustical support * (pling/plong); i am not sure * whether it is safe to call * sysbeep from within an intr * service, since it calls * timeout in turn which mani- * pulates the spl mask - jw */ # define PLING sysbeep(PCVT_SYSBEEPF / 1500, 2) # define PLONG sysbeep(PCVT_SYSBEEPF / 1200, 2) if(mousedef.stickybuttons) { if(dt & 0x80) { mouse.breakseen = 1; return (u_char *)0; } else if(mouse.buttons == button && !mouse.breakseen) { /* ignore repeats */ return (u_char *)0; } else mouse.breakseen = 0; if(mouse.buttons == button) { /* release it */ mouse.buttons = 0; PLONG; } else { /* * eventually, release * any other button, * and stick this one */ mouse.buttons = button; PLING; } } else { if(dt & 0x80) { mouse.buttons &= ~button; PLONG; } else if((mouse.buttons & button) == 0) { mouse.buttons |= button; PLING; } /*else: ignore same btn press*/ } move = MOUSE_0; accel = 0; } # undef PLING # undef PLONG else switch(dt & 0x7f) { /* the arrow keys - KP 1 thru KP 9 */ case 0x47: move = MOUSE_NW; goto do_move; case 0x48: move = MOUSE_N; goto do_move; case 0x49: move = MOUSE_NE; goto do_move; case 0x4b: move = MOUSE_W; goto do_move; case 0x4c: move = MOUSE_0; goto do_move; case 0x4d: move = MOUSE_E; goto do_move; case 0x4f: move = MOUSE_SW; goto do_move; case 0x50: move = MOUSE_S; goto do_move; case 0x51: move = MOUSE_SE; do_move: if(dt & 0x80) /* * arrow key break events are * of no importance for us */ return (u_char *)0; /* * see whether the last move did * happen "recently", i.e. before * less than half a second */ getmicrotime(&now); timevalsub(&now, &mouse.lastmove); getmicrotime(&mouse.lastmove); accel = (now.tv_sec == 0 && now.tv_usec < mousedef.acceltime); break; default: /* not a mouse-emulating key */ goto no_mouse_event; } mousestrings[accel][move][0] = 0x80 + (~mouse.buttons & 7); /* finally, send the string */ for(i = 0; i < 5; i++) (*linesw[mousetty->t_line].l_rint) (mousestrings[accel][move][i], mousetty); return (u_char *)0; /* not a kbd event */ } no_mouse_event: #endif /* PCVT_EMU_MOUSE */ return ((u_char *)keybuf); } } #else /* !XSERVER */ #ifndef _DEV_KBD_KBDREG_H_ # if PCVT_KBD_FIFO /* see if there is data from the keyboard available either from */ /* the keyboard fifo or from the 8042 keyboard controller */ if (pcvt_kbd_count || (inb(CONTROLLER_CTRL) & STATUS_OUTPBF)) { if (!noblock || kbd_polling) /* source = 8042 */ { PCVT_KBD_DELAY(); /* 7 us delay */ dt = inb(CONTROLLER_DATA); } else /* source = keyboard fifo */ { dt = pcvt_kbd_fifo[pcvt_kbd_rptr++]; /* yes, get it ! */ PCVT_DISABLE_INTR(); pcvt_kbd_count--; PCVT_ENABLE_INTR(); if (pcvt_kbd_rptr >= PCVT_KBD_FIFO_SZ) pcvt_kbd_rptr = 0; } } #else /* !PCVT_KBD_FIFO */ /* see if there is data from the keyboard available from the 8042 */ if(inb(CONTROLLER_CTRL) & STATUS_OUTPBF) { PCVT_KBD_DELAY(); /* 7 us delay */ dt = inb(CONTROLLER_DATA); /* yes, get data ! */ } #endif /* !PCVT_KBD_FIFO */ #else /* _DEV_KBD_KBDREG_H_ */ #if PCVT_KBD_FIFO if (pcvt_kbd_count) { dt = pcvt_kbd_fifo[pcvt_kbd_rptr++]; PCVT_DISABLE_INTR(); pcvt_kbd_count--; PCVT_ENABLE_INTR(); if (pcvt_kbd_rptr >= PCVT_KBD_FIFO_SZ) pcvt_kbd_rptr = 0; } else #endif /* PCVT_KBD_FIFO */ if (!noblock) { while ((c = (*kbdsw[kbd->kb_index]->read)(kbd, TRUE)) == -1) ; dt = c; } else { if ((c = (*kbdsw[kbd->kb_index]->read)(kbd, FALSE)) == -1) return NULL; dt = c; } #endif /* !_DEV_KBD_KBDREG_H_ */ #endif /* !XSERVER */ #ifndef _DEV_KBD_KBDREG_H_ else { if(noblock) return NULL; else goto loop; } #endif /* !_DEV_KBD_KBDREG_H_ */ #if PCVT_SHOWKEYS showkey (' ', dt); #endif /* PCVT_SHOWKEYS */ /* lets look what we got */ switch(dt) { case KEYB_R_OVERRUN0: /* keyboard buffer overflow */ #if PCVT_SCANSET == 2 case KEYB_R_SELFOK: /* keyboard selftest ok */ #endif /* PCVT_SCANSET == 2 */ case KEYB_R_ECHO: /* keyboard response to KEYB_C_ECHO */ case KEYB_R_ACK: /* acknowledge after command has rx'd*/ case KEYB_R_SELFBAD: /* keyboard selftest FAILED */ case KEYB_R_DIAGBAD: /* keyboard self diagnostic failure */ case KEYB_R_RESEND: /* keyboard wants us to resend cmnd */ case KEYB_R_OVERRUN1: /* keyboard buffer overflow */ break; case KEYB_R_EXT1: /* keyboard extended scancode pfx 2 */ kbd_status.ext1 = 1; /* FALLTHROUGH */ case KEYB_R_EXT0: /* keyboard extended scancode pfx 1 */ kbd_status.extended = 1; break; #if PCVT_SCANSET == 2 case KEYB_R_BREAKPFX: /* break code prefix for set 2 and 3 */ kbd_status.breakseen = 1; break; #endif /* PCVT_SCANSET == 2 */ default: goto regular; /* regular key */ } if(noblock) return NULL; else goto loop; /* got a normal scan key */ regular: #if PCVT_FREEBSD > 210 add_keyboard_randomness(dt); #endif /* PCVT_FREEBSD > 210 */ #if PCVT_SCANSET == 1 kbd_status.breakseen = dt & 0x80 ? 1 : 0; dt &= 0x7f; #endif /* PCVT_SCANSET == 1 */ /* make a keycode from scan code */ if(dt >= sizeof scantokey / sizeof(u_char)) key = 0; else key = kbd_status.extended ? extscantokey[dt] : scantokey[dt]; if(kbd_status.ext1 && key == 64) /* virtual control key */ key = 129; kbd_status.extended = kbd_status.ext1 = 0; #if PCVT_CTRL_ALT_DEL /* Check for cntl-alt-del */ if((key == 76) && ctrl_down && (meta_down||altgr_down)) shutdown_nice(); #endif /* PCVT_CTRL_ALT_DEL */ #if !(PCVT_NETBSD || PCVT_FREEBSD >= 200) #include "ddb.h" #endif /* !(PCVT_NETBSD || PCVT_FREEBSD >= 200) */ #if NDDB > 0 || defined(DDB) /* Check for cntl-alt-esc */ if((key == 110) && ctrl_down && (meta_down || altgr_down)) { static u_char in_Debugger; if(!in_Debugger) { in_Debugger = 1; #if PCVT_FREEBSD /* the string is actually not used... */ Debugger("kbd"); #else Debugger(); #endif in_Debugger = 0; if(noblock) return NULL; else goto loop; } } #endif /* NDDB > 0 || defined(DDB) */ /* look for keys with special handling */ if(key == 128) { /* * virtual shift; sent around PrtScr, and around the arrow * keys if the NumLck LED is on */ kbd_status.vshift = !kbd_status.breakseen; key = 0; /* no key */ } else if(key == 129) { /* * virtual control - the most ugly thingie at all * the Pause key sends: * */ if(!kbd_status.breakseen) kbd_status.vcontrol = 1; /* else: let the numlock hook clear this */ key = 0; /* no key */ } else if(key == 90) { /* NumLock, look whether this is rather a Pause */ if(kbd_status.vcontrol) key = 126; /* * if this is the final break code of a Pause key, * clear the virtual control status, too */ if(kbd_status.vcontrol && kbd_status.breakseen) kbd_status.vcontrol = 0; } else if(key == 127) { /* * a SysRq; some keyboards are brain-dead enough to * repeat the SysRq key make code by sending PrtScr * make codes; other keyboards do not repeat SysRq * at all. We keep track of the SysRq state here. */ kbd_status.sysrq = !kbd_status.breakseen; } else if(key == 124) { /* * PrtScr; look whether this is really PrtScr or rather * a silly repeat of a SysRq key */ if(kbd_status.sysrq) /* ignore the garbage */ key = 0; } /* in NOREPEAT MODE ignore the key if it was the same as before */ if(!kbrepflag && key == kbd_lastkey && !kbd_status.breakseen) { if(noblock) return NULL; else goto loop; } type = key2ascii[key].type; if(type & KBD_OVERLOAD) type = ovltbl[key2ascii[key].ovlindex].type; type &= KBD_MASK; switch(type) { case KBD_SHFTLOCK: if(!kbd_status.breakseen && key != kbd_lastkey) { vsp->shift_lock ^= 1; } break; case KBD_CAPS: if(!kbd_status.breakseen && key != kbd_lastkey) { vsp->caps_lock ^= 1; update_led(); } break; case KBD_SCROLL: if(!kbd_status.breakseen && key != kbd_lastkey) { vsp->scroll_lock ^= 1; update_led(); if(!(vsp->scroll_lock)) { /* someone may be sleeping */ wakeup((caddr_t)&(vsp->scroll_lock)); } } break; case KBD_SHIFT: shift_down = kbd_status.breakseen ? 0 : 1; break; case KBD_META: meta_down = kbd_status.breakseen ? 0 : 0x80; break; case KBD_ALTGR: altgr_down = kbd_status.breakseen ? 0 : 1; break; case KBD_CTL: ctrl_down = kbd_status.breakseen ? 0 : 1; break; case KBD_NONE: default: break; /* deliver a key */ } if(kbd_status.breakseen) { key |= 0x80; kbd_status.breakseen = 0; kbd_lastkey = 0; /* -hv- I know this is a bug with */ } /* N-Key-Rollover, but I ignore that */ else /* because avoidance is too complicated */ kbd_lastkey = key; cp = xlatkey2ascii(key); /* have a key */ if(cp == NULL && !noblock) goto loop; return cp; } /*---------------------------------------------------------------------------* * reflect status of locking keys & set led's *---------------------------------------------------------------------------*/ static void setlockkeys(int snc) { vsp->scroll_lock = snc & 1; vsp->num_lock = (snc & 2) ? 1 : 0; vsp->caps_lock = (snc & 4) ? 1 : 0; update_led(); } /*---------------------------------------------------------------------------* * remove a key definition *---------------------------------------------------------------------------*/ static int rmkeydef(int key) { register Ovl_tbl *ref; if(key==0 || key > MAXKEYNUM) return EINVAL; if(key2ascii[key].type & KBD_OVERLOAD) { ref = &ovltbl[key2ascii[key].ovlindex]; ref->keynum = 0; ref->type = 0; ref->unshift[0] = ref->shift[0] = ref->ctrl[0] = ref->altgr[0] = 0; key2ascii[key].type &= KBD_MASK; } return 0; } /*---------------------------------------------------------------------------* * overlay a key *---------------------------------------------------------------------------*/ static int setkeydef(Ovl_tbl *data) { register i; if( data->keynum > MAXKEYNUM || (data->type & KBD_MASK) == KBD_BREAK || (data->type & KBD_MASK) > KBD_SHFTLOCK) return EINVAL; data->unshift[KBDMAXOVLKEYSIZE] = data->shift[KBDMAXOVLKEYSIZE] = data->ctrl[KBDMAXOVLKEYSIZE] = data->altgr[KBDMAXOVLKEYSIZE] = 0; data->subu = data->subs = data->subc = data->suba = KBD_SUBT_STR; /* just strings .. */ data->type |= KBD_OVERLOAD; /* mark overloaded */ /* if key already overloaded, use that slot else find free slot */ if(key2ascii[data->keynum].type & KBD_OVERLOAD) { i = key2ascii[data->keynum].ovlindex; } else { for(i=0; ikeynum].type |= KBD_OVERLOAD; /* mark key */ key2ascii[data->keynum].ovlindex = i; return 0; } /*---------------------------------------------------------------------------* * keyboard ioctl's entry *---------------------------------------------------------------------------*/ int kbdioctl(Dev_t dev, int cmd, caddr_t data, int flag) { int key; switch(cmd) { case KBDRESET: doreset(); ovlinit(1); settpmrate(KBD_TPD500|KBD_TPM100); setlockkeys(0); break; case KBDGTPMAT: *(int *)data = tpmrate; break; case KBDSTPMAT: settpmrate(*(int *)data); break; case KBDGREPSW: *(int *)data = kbrepflag; break; case KBDSREPSW: kbrepflag = (*(int *)data) & 1; break; case KBDGLEDS: *(int *)data = ledstate; break; case KBDSLEDS: update_led(); /* ? */ break; case KBDGLOCK: *(int *)data = ( (vsp->scroll_lock) | (vsp->num_lock * 2) | (vsp->caps_lock * 4)); break; case KBDSLOCK: setlockkeys(*(int *)data); break; case KBDGCKEY: key = ((Ovl_tbl *)data)->keynum; return getckeydef(key,(Ovl_tbl *)data); case KBDSCKEY: key = ((Ovl_tbl *)data)->keynum; return setkeydef((Ovl_tbl *)data); case KBDGOKEY: key = ((Ovl_tbl *)data)->keynum; return getokeydef(key,(Ovl_tbl *)data); case KBDRMKEY: key = *(int *)data; return rmkeydef(key); case KBDDEFAULT: ovlinit(1); break; default: /* proceed with vga ioctls */ return -1; } return 0; } #if PCVT_EMU_MOUSE /*--------------------------------------------------------------------------* * mouse emulator ioctl *--------------------------------------------------------------------------*/ int mouse_ioctl(Dev_t dev, int cmd, caddr_t data) { struct mousedefs *def = (struct mousedefs *)data; switch(cmd) { case KBDMOUSEGET: *def = mousedef; break; case KBDMOUSESET: mousedef = *def; break; default: return -1; } return 0; } #endif /* PCVT_EMU_MOUSE */ #if PCVT_USL_VT_COMPAT /*---------------------------------------------------------------------------* * convert ISO-8859 style keycode into IBM 437 *---------------------------------------------------------------------------*/ static __inline u_char iso2ibm(u_char c) { if(c < 0x80) return c; return iso2ibm437[c - 0x80]; } /*---------------------------------------------------------------------------* * build up a USL style keyboard map *---------------------------------------------------------------------------*/ void get_usl_keymap(keymap_t *map) { int i; bzero((caddr_t)map, sizeof(keymap_t)); map->n_keys = 0x59; /* that many keys we know about */ for(i = 1; i < N_KEYNUMS; i++) { Ovl_tbl kdef; u_char c; int j; int idx = key2scan1[i]; if(idx == 0 || idx >= map->n_keys) continue; getckeydef(i, &kdef); kdef.type &= KBD_MASK; switch(kdef.type) { case KBD_ASCII: case KBD_RETURN: map->key[idx].map[0] = iso2ibm(kdef.unshift[0]); map->key[idx].map[1] = iso2ibm(kdef.shift[0]); map->key[idx].map[2] = map->key[idx].map[3] = iso2ibm(kdef.ctrl[0]); map->key[idx].map[4] = map->key[idx].map[5] = iso2ibm(c = kdef.altgr[0]); /* * XXX this is a hack * since we currently do not map strings to AltGr + * shift, we attempt to use the unshifted AltGr * definition here and try to toggle the case * this should at least work for ISO8859 letters, * but also for (e.g.) russian KOI-8 style */ if((c & 0x7f) >= 0x40) map->key[idx].map[5] = iso2ibm(c ^ 0x20); break; case KBD_FUNC: /* we are only interested in F1 thru F12 here */ if(i >= 112 && i <= 123) { map->key[idx].map[0] = i - 112 + 27; map->key[idx].spcl = 0x80; } break; case KBD_SHIFT: c = i == 44? 2 /* lSh */: 3 /* rSh */; goto special; case KBD_CAPS: c = 4; goto special; case KBD_NUM: c = 5; goto special; case KBD_SCROLL: c = 6; goto special; case KBD_META: c = 7; goto special; case KBD_CTL: c = 9; goto special; special: for(j = 0; j < NUM_STATES; j++) map->key[idx].map[j] = c; map->key[idx].spcl = 0xff; break; default: break; } } } #endif /* PCVT_USL_VT_COMPAT */ /*---------------------------------------------------------------------------* * switch keypad to numeric mode *---------------------------------------------------------------------------*/ void vt_keynum(struct video_state *svsp) { svsp->num_lock = 1; update_led(); } /*---------------------------------------------------------------------------* * switch keypad to application mode *---------------------------------------------------------------------------*/ void vt_keyappl(struct video_state *svsp) { svsp->num_lock = 0; update_led(); } #if !PCVT_VT220KEYB /* !PCVT_VT220KEYB, HP-like Keyboard layout */ /*---------------------------------------------------------------------------* * function bound to function key 1 *---------------------------------------------------------------------------*/ static void fkey1(void) { if(!meta_down) { if((vsp->vt_pure_mode == M_HPVT) && (vsp->which_fkl == SYS_FKL)) toggl_columns(vsp); else more_chars = (u_char *)"\033[17~"; /* F6 */ } else { if(vsp->vt_pure_mode == M_PUREVT || (vsp->which_fkl == USR_FKL)) more_chars = (u_char *)"\033[26~"; /* F14 */ } } /*---------------------------------------------------------------------------* * function bound to function key 2 *---------------------------------------------------------------------------*/ static void fkey2(void) { if(!meta_down) { if((vsp->vt_pure_mode == M_HPVT) && (vsp->which_fkl == SYS_FKL)) vt_ris(vsp); else more_chars = (u_char *)"\033[18~"; /* F7 */ } else { if(vsp->vt_pure_mode == M_PUREVT || (vsp->which_fkl == USR_FKL)) more_chars = (u_char *)"\033[28~"; /* HELP */ } } /*---------------------------------------------------------------------------* * function bound to function key 3 *---------------------------------------------------------------------------*/ static void fkey3(void) { if(!meta_down) { if((vsp->vt_pure_mode == M_HPVT) && (vsp->which_fkl == SYS_FKL)) toggl_24l(vsp); else more_chars = (u_char *)"\033[19~"; /* F8 */ } else { if(vsp->vt_pure_mode == M_PUREVT || (vsp->which_fkl == USR_FKL)) more_chars = (u_char *)"\033[29~"; /* DO */ } } /*---------------------------------------------------------------------------* * function bound to function key 4 *---------------------------------------------------------------------------*/ static void fkey4(void) { if(!meta_down) { #if PCVT_SHOWKEYS if((vsp->vt_pure_mode == M_HPVT) && (vsp->which_fkl == SYS_FKL)) toggl_kbddbg(vsp); else more_chars = (u_char *)"\033[20~"; /* F9 */ #else if(vsp->vt_pure_mode == M_PUREVT || (vsp->which_fkl == USR_FKL)) more_chars = (u_char *)"\033[20~"; /* F9 */ #endif /* PCVT_SHOWKEYS */ } else { if(vsp->vt_pure_mode == M_PUREVT || (vsp->which_fkl == USR_FKL)) more_chars = (u_char *)"\033[31~"; /* F17 */ } } /*---------------------------------------------------------------------------* * function bound to function key 5 *---------------------------------------------------------------------------*/ static void fkey5(void) { if(!meta_down) { if((vsp->vt_pure_mode == M_HPVT) && (vsp->which_fkl == SYS_FKL)) toggl_bell(vsp); else more_chars = (u_char *)"\033[21~"; /* F10 */ } else { if(vsp->vt_pure_mode == M_PUREVT || (vsp->which_fkl == USR_FKL)) more_chars = (u_char *)"\033[32~"; /* F18 */ } } /*---------------------------------------------------------------------------* * function bound to function key 6 *---------------------------------------------------------------------------*/ static void fkey6(void) { if(!meta_down) { if((vsp->vt_pure_mode == M_HPVT) && (vsp->which_fkl == SYS_FKL)) toggl_sevenbit(vsp); else more_chars = (u_char *)"\033[23~"; /* F11 */ } else { if(vsp->vt_pure_mode == M_PUREVT || (vsp->which_fkl == USR_FKL)) more_chars = (u_char *)"\033[33~"; /* F19 */ } } /*---------------------------------------------------------------------------* * function bound to function key 7 *---------------------------------------------------------------------------*/ static void fkey7(void) { if(!meta_down) { if((vsp->vt_pure_mode == M_HPVT) && (vsp->which_fkl == SYS_FKL)) toggl_dspf(vsp); else more_chars = (u_char *)"\033[24~"; /* F12 */ } else { if(vsp->vt_pure_mode == M_PUREVT || (vsp->which_fkl == USR_FKL)) more_chars = (u_char *)"\033[34~"; /* F20 */ } } /*---------------------------------------------------------------------------* * function bound to function key 8 *---------------------------------------------------------------------------*/ static void fkey8(void) { if(!meta_down) { if((vsp->vt_pure_mode == M_HPVT) && (vsp->which_fkl == SYS_FKL)) toggl_awm(vsp); else more_chars = (u_char *)"\033[25~"; /* F13 */ } else { if(vsp->vt_pure_mode == M_PUREVT || (vsp->which_fkl == USR_FKL)) more_chars = (u_char *)"\033[35~"; /* F21 ? !! */ } } /*---------------------------------------------------------------------------* * function bound to function key 9 *---------------------------------------------------------------------------*/ static void fkey9(void) { if(meta_down) { if(vsp->vt_pure_mode == M_PUREVT) return; if(vsp->labels_on) /* toggle label display on/off */ fkl_off(vsp); else fkl_on(vsp); } else { do_vgapage(0); } } /*---------------------------------------------------------------------------* * function bound to function key 10 *---------------------------------------------------------------------------*/ static void fkey10(void) { if(meta_down) { if(vsp->vt_pure_mode != M_PUREVT && vsp->labels_on) { if(vsp->which_fkl == USR_FKL) sw_sfkl(vsp); else if(vsp->which_fkl == SYS_FKL) sw_ufkl(vsp); } } else { do_vgapage(1); } } /*---------------------------------------------------------------------------* * function bound to function key 11 *---------------------------------------------------------------------------*/ static void fkey11(void) { if(meta_down) { if(vsp->vt_pure_mode == M_PUREVT) set_emulation_mode(vsp, M_HPVT); else if(vsp->vt_pure_mode == M_HPVT) set_emulation_mode(vsp, M_PUREVT); } else { do_vgapage(2); } } /*---------------------------------------------------------------------------* * function bound to function key 12 *---------------------------------------------------------------------------*/ static void fkey12(void) { if(meta_down) { if(current_video_screen + 1 > totalscreens-1) do_vgapage(0); else do_vgapage(current_video_screen + 1); } else { do_vgapage(3); } } /*---------------------------------------------------------------------------* * function bound to SHIFTED function key 1 *---------------------------------------------------------------------------*/ static void sfkey1(void) { if(!meta_down) { if(vsp->ukt.length[0]) /* entry available ? */ more_chars = (u_char *) &(vsp->udkbuf[vsp->ukt.first[0]]); } else { if(vsp->ukt.length[9]) /* entry available ? */ more_chars = (u_char *) &(vsp->udkbuf[vsp->ukt.first[9]]); } } /*---------------------------------------------------------------------------* * function bound to SHIFTED function key 2 *---------------------------------------------------------------------------*/ static void sfkey2(void) { if(!meta_down) { if(vsp->ukt.length[1]) /* entry available ? */ more_chars = (u_char *) &(vsp->udkbuf[vsp->ukt.first[1]]); } else { if(vsp->ukt.length[11]) /* entry available ? */ more_chars = (u_char *) &(vsp->udkbuf[vsp->ukt.first[11]]); } } /*---------------------------------------------------------------------------* * function bound to SHIFTED function key 3 *---------------------------------------------------------------------------*/ static void sfkey3(void) { if(!meta_down) { if(vsp->ukt.length[2]) /* entry available ? */ more_chars = (u_char *) &(vsp->udkbuf[vsp->ukt.first[2]]); } else { if(vsp->ukt.length[12]) /* entry available ? */ more_chars = (u_char *) &(vsp->udkbuf[vsp->ukt.first[12]]); } } /*---------------------------------------------------------------------------* * function bound to SHIFTED function key 4 *---------------------------------------------------------------------------*/ static void sfkey4(void) { if(!meta_down) { if(vsp->ukt.length[3]) /* entry available ? */ more_chars = (u_char *) &(vsp->udkbuf[vsp->ukt.first[3]]); } else { if(vsp->ukt.length[13]) /* entry available ? */ more_chars = (u_char *) &(vsp->udkbuf[vsp->ukt.first[13]]); } } /*---------------------------------------------------------------------------* * function bound to SHIFTED function key 5 *---------------------------------------------------------------------------*/ static void sfkey5(void) { if(!meta_down) { if(vsp->ukt.length[4]) /* entry available ? */ more_chars = (u_char *) &(vsp->udkbuf[vsp->ukt.first[4]]); } else { if(vsp->ukt.length[14]) /* entry available ? */ more_chars = (u_char *) &(vsp->udkbuf[vsp->ukt.first[14]]); } } /*---------------------------------------------------------------------------* * function bound to SHIFTED function key 6 *---------------------------------------------------------------------------*/ static void sfkey6(void) { if(!meta_down) { if(vsp->ukt.length[6]) /* entry available ? */ more_chars = (u_char *) &(vsp->udkbuf[vsp->ukt.first[6]]); } else { if(vsp->ukt.length[15]) /* entry available ? */ more_chars = (u_char *) &(vsp->udkbuf[vsp->ukt.first[15]]); } } /*---------------------------------------------------------------------------* * function bound to SHIFTED function key 7 *---------------------------------------------------------------------------*/ static void sfkey7(void) { if(!meta_down) { if(vsp->ukt.length[7]) /* entry available ? */ more_chars = (u_char *) &(vsp->udkbuf[vsp->ukt.first[7]]); } else { if(vsp->ukt.length[16]) /* entry available ? */ more_chars = (u_char *) &(vsp->udkbuf[vsp->ukt.first[16]]); } } /*---------------------------------------------------------------------------* * function bound to SHIFTED function key 8 *---------------------------------------------------------------------------*/ static void sfkey8(void) { if(!meta_down) { if(vsp->ukt.length[8]) /* entry available ? */ more_chars = (u_char *) &(vsp->udkbuf[vsp->ukt.first[8]]); } else { if(vsp->ukt.length[17]) /* entry available ? */ more_chars = (u_char *) &(vsp->udkbuf[vsp->ukt.first[17]]); } } /*---------------------------------------------------------------------------* * function bound to SHIFTED function key 9 *---------------------------------------------------------------------------*/ static void sfkey9(void) { } /*---------------------------------------------------------------------------* * function bound to SHIFTED function key 10 *---------------------------------------------------------------------------*/ static void sfkey10(void) { } /*---------------------------------------------------------------------------* * function bound to SHIFTED function key 11 *---------------------------------------------------------------------------*/ static void sfkey11(void) { } /*---------------------------------------------------------------------------* * function bound to SHIFTED function key 12 *---------------------------------------------------------------------------*/ static void sfkey12(void) { } /*---------------------------------------------------------------------------* * function bound to control function key 1 *---------------------------------------------------------------------------*/ static void cfkey1(void) { if(meta_down) do_vgapage(0); } /*---------------------------------------------------------------------------* * function bound to control function key 2 *---------------------------------------------------------------------------*/ static void cfkey2(void) { if(meta_down) do_vgapage(1); } /*---------------------------------------------------------------------------* * function bound to control function key 3 *---------------------------------------------------------------------------*/ static void cfkey3(void) { if(meta_down) do_vgapage(2); } /*---------------------------------------------------------------------------* * function bound to control function key 4 *---------------------------------------------------------------------------*/ static void cfkey4(void) { if(meta_down) do_vgapage(3); } /*---------------------------------------------------------------------------* * function bound to control function key 5 *---------------------------------------------------------------------------*/ static void cfkey5(void) { if(meta_down) do_vgapage(4); } /*---------------------------------------------------------------------------* * function bound to control function key 6 *---------------------------------------------------------------------------*/ static void cfkey6(void) { if(meta_down) do_vgapage(5); } /*---------------------------------------------------------------------------* * function bound to control function key 7 *---------------------------------------------------------------------------*/ static void cfkey7(void) { if(meta_down) do_vgapage(6); } /*---------------------------------------------------------------------------* * function bound to control function key 8 *---------------------------------------------------------------------------*/ static void cfkey8(void) { if(meta_down) do_vgapage(7); } /*---------------------------------------------------------------------------* * function bound to control function key 9 *---------------------------------------------------------------------------*/ static void cfkey9(void) { if(meta_down) do_vgapage(8); } /*---------------------------------------------------------------------------* * function bound to control function key 10 *---------------------------------------------------------------------------*/ static void cfkey10(void) { if(meta_down) do_vgapage(9); } /*---------------------------------------------------------------------------* * function bound to control function key 11 *---------------------------------------------------------------------------*/ static void cfkey11(void) { if(meta_down) do_vgapage(10); } /*---------------------------------------------------------------------------* * function bound to control function key 12 *---------------------------------------------------------------------------*/ static void cfkey12(void) { if(meta_down) do_vgapage(11); } #else /* PCVT_VT220 - VT220-like Keyboard layout */ /*---------------------------------------------------------------------------* * function bound to function key 1 *---------------------------------------------------------------------------*/ static void fkey1(void) { if(meta_down) more_chars = (u_char *)"\033[23~"; /* F11 */ else do_vgapage(0); } /*---------------------------------------------------------------------------* * function bound to function key 2 *---------------------------------------------------------------------------*/ static void fkey2(void) { if(meta_down) more_chars = (u_char *)"\033[24~"; /* F12 */ else do_vgapage(1); } /*---------------------------------------------------------------------------* * function bound to function key 3 *---------------------------------------------------------------------------*/ static void fkey3(void) { if(meta_down) more_chars = (u_char *)"\033[25~"; /* F13 */ else do_vgapage(2); } /*---------------------------------------------------------------------------* * function bound to function key 4 *---------------------------------------------------------------------------*/ static void fkey4(void) { if(meta_down) more_chars = (u_char *)"\033[26~"; /* F14 */ else do_vgapage(3); } /*---------------------------------------------------------------------------* * function bound to function key 5 *---------------------------------------------------------------------------*/ static void fkey5(void) { if(meta_down) more_chars = (u_char *)"\033[28~"; /* Help */ else { if((current_video_screen + 1) > totalscreens-1) do_vgapage(0); else do_vgapage(current_video_screen + 1); } } /*---------------------------------------------------------------------------* * function bound to function key 6 *---------------------------------------------------------------------------*/ static void fkey6(void) { if(meta_down) more_chars = (u_char *)"\033[29~"; /* DO */ else more_chars = (u_char *)"\033[17~"; /* F6 */ } /*---------------------------------------------------------------------------* * function bound to function key 7 *---------------------------------------------------------------------------*/ static void fkey7(void) { if(meta_down) more_chars = (u_char *)"\033[31~"; /* F17 */ else more_chars = (u_char *)"\033[18~"; /* F7 */ } /*---------------------------------------------------------------------------* * function bound to function key 8 *---------------------------------------------------------------------------*/ static void fkey8(void) { if(meta_down) more_chars = (u_char *)"\033[32~"; /* F18 */ else more_chars = (u_char *)"\033[19~"; /* F8 */ } /*---------------------------------------------------------------------------* * function bound to function key 9 *---------------------------------------------------------------------------*/ static void fkey9(void) { if(meta_down) more_chars = (u_char *)"\033[33~"; /* F19 */ else more_chars = (u_char *)"\033[20~"; /* F9 */ } /*---------------------------------------------------------------------------* * function bound to function key 10 *---------------------------------------------------------------------------*/ static void fkey10(void) { if(meta_down) more_chars = (u_char *)"\033[34~"; /* F20 */ else more_chars = (u_char *)"\033[21~"; /* F10 */ } /*---------------------------------------------------------------------------* * function bound to function key 11 *---------------------------------------------------------------------------*/ static void fkey11(void) { if(meta_down) more_chars = (u_char *)"\0x8FP"; /* PF1 */ else more_chars = (u_char *)"\033[23~"; /* F11 */ } /*---------------------------------------------------------------------------* * function bound to function key 12 *---------------------------------------------------------------------------*/ static void fkey12(void) { if(meta_down) more_chars = (u_char *)"\0x8FQ"; /* PF2 */ else more_chars = (u_char *)"\033[24~"; /* F12 */ } /*---------------------------------------------------------------------------* * function bound to SHIFTED function key 1 *---------------------------------------------------------------------------*/ static void sfkey1(void) { if(meta_down) { if(vsp->ukt.length[6]) /* entry available ? */ more_chars = (u_char *) &(vsp->udkbuf[vsp->ukt.first[6]]); else more_chars = (u_char *)"\033[23~"; /* F11 */ } else { do_vgapage(4); } } /*---------------------------------------------------------------------------* * function bound to SHIFTED function key 2 *---------------------------------------------------------------------------*/ static void sfkey2(void) { if(meta_down) { if(vsp->ukt.length[7]) /* entry available ? */ more_chars = (u_char *) &(vsp->udkbuf[vsp->ukt.first[7]]); else more_chars = (u_char *)"\033[24~"; /* F12 */ } else { do_vgapage(5); } } /*---------------------------------------------------------------------------* * function bound to SHIFTED function key 3 *---------------------------------------------------------------------------*/ static void sfkey3(void) { if(meta_down) { if(vsp->ukt.length[8]) /* entry available ? */ more_chars = (u_char *) &(vsp->udkbuf[vsp->ukt.first[8]]); else more_chars = (u_char *)"\033[25~"; /* F13 */ } else { do_vgapage(6); } } /*---------------------------------------------------------------------------* * function bound to SHIFTED function key 4 *---------------------------------------------------------------------------*/ static void sfkey4(void) { if(meta_down) { if(vsp->ukt.length[9]) /* entry available ? */ more_chars = (u_char *) &(vsp->udkbuf[vsp->ukt.first[9]]); else more_chars = (u_char *)"\033[26~"; /* F14 */ } else { do_vgapage(7); } } /*---------------------------------------------------------------------------* * function bound to SHIFTED function key 5 *---------------------------------------------------------------------------*/ static void sfkey5(void) { if(meta_down) { if(vsp->ukt.length[11]) /* entry available ? */ more_chars = (u_char *) &(vsp->udkbuf[vsp->ukt.first[11]]); else more_chars = (u_char *)"\033[28~"; /* Help */ } else { if(current_video_screen <= 0) do_vgapage(totalscreens-1); else do_vgapage(current_video_screen - 1); } } /*---------------------------------------------------------------------------* * function bound to SHIFTED function key 6 *---------------------------------------------------------------------------*/ static void sfkey6(void) { if(!meta_down) { if(vsp->ukt.length[0]) /* entry available ? */ more_chars = (u_char *) &(vsp->udkbuf[vsp->ukt.first[0]]); else more_chars = (u_char *)"\033[17~"; /* F6 */ } else if(vsp->ukt.length[12]) /* entry available ? */ more_chars = (u_char *) &(vsp->udkbuf[vsp->ukt.first[12]]); else more_chars = (u_char *)"\033[29~"; /* DO */ } /*---------------------------------------------------------------------------* * function bound to SHIFTED function key 7 *---------------------------------------------------------------------------*/ static void sfkey7(void) { if(!meta_down) { if(vsp->ukt.length[1]) /* entry available ? */ more_chars = (u_char *) &(vsp->udkbuf[vsp->ukt.first[1]]); else more_chars = (u_char *)"\033[18~"; /* F7 */ } else if(vsp->ukt.length[14]) /* entry available ? */ more_chars = (u_char *) &(vsp->udkbuf[vsp->ukt.first[14]]); else more_chars = (u_char *)"\033[31~"; /* F17 */ } /*---------------------------------------------------------------------------* * function bound to SHIFTED function key 8 *---------------------------------------------------------------------------*/ static void sfkey8(void) { if(!meta_down) { if(vsp->ukt.length[2]) /* entry available ? */ more_chars = (u_char *) &(vsp->udkbuf[vsp->ukt.first[2]]); else more_chars = (u_char *)"\033[19~"; /* F8 */ } else if(vsp->ukt.length[14]) /* entry available ? */ more_chars = (u_char *) &(vsp->udkbuf[vsp->ukt.first[15]]); else more_chars = (u_char *)"\033[32~"; /* F18 */ } /*---------------------------------------------------------------------------* * function bound to SHIFTED function key 9 *---------------------------------------------------------------------------*/ static void sfkey9(void) { if(!meta_down) { if(vsp->ukt.length[3]) /* entry available ? */ more_chars = (u_char *) &(vsp->udkbuf[vsp->ukt.first[3]]); else more_chars = (u_char *)"\033[20~"; /* F9 */ } else if(vsp->ukt.length[16]) /* entry available ? */ more_chars = (u_char *) &(vsp->udkbuf[vsp->ukt.first[16]]); else more_chars = (u_char *)"\033[33~"; /* F19 */ } /*---------------------------------------------------------------------------* * function bound to SHIFTED function key 10 *---------------------------------------------------------------------------*/ static void sfkey10(void) { if(!meta_down) { if(vsp->ukt.length[4]) /* entry available ? */ more_chars = (u_char *) &(vsp->udkbuf[vsp->ukt.first[4]]); else more_chars = (u_char *)"\033[21~"; /* F10 */ } else if(vsp->ukt.length[17]) /* entry available ? */ more_chars = (u_char *) &(vsp->udkbuf[vsp->ukt.first[17]]); else more_chars = (u_char *)"\033[34~"; /* F20 */ } /*---------------------------------------------------------------------------* * function bound to SHIFTED function key 11 *---------------------------------------------------------------------------*/ static void sfkey11(void) { if(!meta_down) { if(vsp->ukt.length[6]) /* entry available ? */ more_chars = (u_char *) &(vsp->udkbuf[vsp->ukt.first[6]]); else more_chars = (u_char *)"\033[23~"; /* F11 */ } } /*---------------------------------------------------------------------------* * function bound to SHIFTED function key 12 *---------------------------------------------------------------------------*/ static void sfkey12(void) { if(!meta_down) { if(vsp->ukt.length[7]) /* entry available ? */ more_chars = (u_char *) &(vsp->udkbuf[vsp->ukt.first[7]]); else more_chars = (u_char *)"\033[24~"; /* F12 */ } } /*---------------------------------------------------------------------------* * function bound to control function key 1 *---------------------------------------------------------------------------*/ static void cfkey1(void) { if(vsp->which_fkl == SYS_FKL) toggl_columns(vsp); } /*---------------------------------------------------------------------------* * function bound to control function key 2 *---------------------------------------------------------------------------*/ static void cfkey2(void) { if(vsp->which_fkl == SYS_FKL) vt_ris(vsp); } /*---------------------------------------------------------------------------* * function bound to control function key 3 *---------------------------------------------------------------------------*/ static void cfkey3(void) { if(vsp->which_fkl == SYS_FKL) toggl_24l(vsp); } /*---------------------------------------------------------------------------* * function bound to control function key 4 *---------------------------------------------------------------------------*/ static void cfkey4(void) { #if PCVT_SHOWKEYS if(vsp->which_fkl == SYS_FKL) toggl_kbddbg(vsp); #endif /* PCVT_SHOWKEYS */ } /*---------------------------------------------------------------------------* * function bound to control function key 5 *---------------------------------------------------------------------------*/ static void cfkey5(void) { if(vsp->which_fkl == SYS_FKL) toggl_bell(vsp); } /*---------------------------------------------------------------------------* * function bound to control function key 6 *---------------------------------------------------------------------------*/ static void cfkey6(void) { if(vsp->which_fkl == SYS_FKL) toggl_sevenbit(vsp); } /*---------------------------------------------------------------------------* * function bound to control function key 7 *---------------------------------------------------------------------------*/ static void cfkey7(void) { if(vsp->which_fkl == SYS_FKL) toggl_dspf(vsp); } /*---------------------------------------------------------------------------* * function bound to control function key 8 *---------------------------------------------------------------------------*/ static void cfkey8(void) { if(vsp->which_fkl == SYS_FKL) toggl_awm(vsp); } /*---------------------------------------------------------------------------* * function bound to control function key 9 *---------------------------------------------------------------------------*/ static void cfkey9(void) { if(vsp->labels_on) /* toggle label display on/off */ fkl_off(vsp); else fkl_on(vsp); } /*---------------------------------------------------------------------------* * function bound to control function key 10 *---------------------------------------------------------------------------*/ static void cfkey10(void) { if(vsp->labels_on) /* toggle user/system fkey labels */ { if(vsp->which_fkl == USR_FKL) sw_sfkl(vsp); else if(vsp->which_fkl == SYS_FKL) sw_ufkl(vsp); } } /*---------------------------------------------------------------------------* * function bound to control function key 11 *---------------------------------------------------------------------------*/ static void cfkey11(void) { if(vsp->vt_pure_mode == M_PUREVT) set_emulation_mode(vsp, M_HPVT); else if(vsp->vt_pure_mode == M_HPVT) set_emulation_mode(vsp, M_PUREVT); } /*---------------------------------------------------------------------------* * function bound to control function key 12 *---------------------------------------------------------------------------*/ static void cfkey12(void) { } #endif /* PCVT_VT220KEYB */ #endif /* NVT > 0 */ /* ------------------------------- EOF -------------------------------------*/ Index: head/sys/isa/atkbd_isa.c =================================================================== --- head/sys/isa/atkbd_isa.c (revision 44627) +++ head/sys/isa/atkbd_isa.c (revision 44628) @@ -1,119 +1,130 @@ /*- * Copyright (c) 1999 Kazutaka YOKOTA * All rights reserved. * * 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 as * the first lines of this file unmodified. * 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. * * THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``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 AUTHORS 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. * - * $Id: $ + * $Id: atkbd_isa.c,v 1.1 1999/01/23 16:53:27 dfr Exp $ */ #include "atkbd.h" #include "opt_kbd.h" #if NATKBD > 0 #include #include #include #include #include #include #include #include #include #include #include #include #include devclass_t atkbd_devclass; static int atkbdprobe(device_t dev); static int atkbdattach(device_t dev); +static void atkbd_isa_intr(void *arg); static device_method_t atkbd_methods[] = { DEVMETHOD(device_probe, atkbdprobe), DEVMETHOD(device_attach, atkbdattach), { 0, 0 } }; static driver_t atkbd_driver = { ATKBD_DRIVER_NAME, atkbd_methods, DRIVER_TYPE_TTY, sizeof(atkbd_softc_t), }; static int atkbdprobe(device_t dev) { - atkbd_softc_t *sc; u_long port; u_long irq; u_long flags; - sc = (atkbd_softc_t *)device_get_softc(dev); - device_set_desc(dev, "AT Keyboard"); /* obtain parameters */ BUS_READ_IVAR(device_get_parent(dev), dev, KBDC_IVAR_PORT, &port); BUS_READ_IVAR(device_get_parent(dev), dev, KBDC_IVAR_IRQ, &irq); BUS_READ_IVAR(device_get_parent(dev), dev, KBDC_IVAR_FLAGS, &flags); /* probe the device */ - return atkbd_probe_unit(device_get_unit(dev), sc, port, irq, flags); + return atkbd_probe_unit(device_get_unit(dev), port, irq, flags); } static int atkbdattach(device_t dev) { atkbd_softc_t *sc; + u_long port; u_long irq; + u_long flags; struct resource *res; void *ih; int zero = 0; int error; sc = (atkbd_softc_t *)device_get_softc(dev); - error = atkbd_attach_unit(device_get_unit(dev), sc); + BUS_READ_IVAR(device_get_parent(dev), dev, KBDC_IVAR_PORT, &port); + BUS_READ_IVAR(device_get_parent(dev), dev, KBDC_IVAR_IRQ, &irq); + BUS_READ_IVAR(device_get_parent(dev), dev, KBDC_IVAR_FLAGS, &flags); + + error = atkbd_attach_unit(device_get_unit(dev), sc, port, irq, flags); if (error) return error; /* declare our interrupt handler */ - BUS_READ_IVAR(device_get_parent(dev), dev, KBDC_IVAR_IRQ, &irq); res = bus_alloc_resource(dev, SYS_RES_IRQ, &zero, irq, irq, 1, RF_SHAREABLE | RF_ACTIVE); - BUS_SETUP_INTR(device_get_parent(dev), dev, res, - (driver_intr_t *) kbdsw[sc->kbd->kb_index]->intr, sc->kbd, + BUS_SETUP_INTR(device_get_parent(dev), dev, res, atkbd_isa_intr, sc, &ih); return 0; +} + +static void +atkbd_isa_intr(void *arg) +{ + atkbd_softc_t *sc; + + sc = (atkbd_softc_t *)arg; + (*kbdsw[sc->kbd->kb_index]->intr)(sc->kbd, NULL); } DRIVER_MODULE(atkbd, atkbdc, atkbd_driver, atkbd_devclass, 0, 0); #endif /* NATKBD > 0 */ Index: head/usr.sbin/kbdcontrol/kbdcontrol.c =================================================================== --- head/usr.sbin/kbdcontrol/kbdcontrol.c (revision 44627) +++ head/usr.sbin/kbdcontrol/kbdcontrol.c (revision 44628) @@ -1,1041 +1,1020 @@ /*- * Copyright (c) 1994-1995 Søren Schmidt * All rights reserved. * * 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, * in this position and unchanged. * 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. The name of the author may not be used to endorse or promote products * derived from this software withough specific prior written permission * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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. */ #ifndef lint static const char rcsid[] = - "$Id: kbdcontrol.c,v 1.21 1999/01/12 23:06:29 mjacob Exp $"; + "$Id: kbdcontrol.c,v 1.22 1999/01/23 17:04:13 dfr Exp $"; #endif /* not lint */ #include #include #include #include #include #include #include #include #include "path.h" #include "lex.h" char ctrl_names[32][4] = { "nul", "soh", "stx", "etx", "eot", "enq", "ack", "bel", "bs ", "ht ", "nl ", "vt ", "ff ", "cr ", "so ", "si ", "dle", "dc1", "dc2", "dc3", "dc4", "nak", "syn", "etb", "can", "em ", "sub", "esc", "fs ", "gs ", "rs ", "us " }; char acc_names[15][5] = { "dgra", "dacu", "dcir", "dtil", "dmac", "dbre", "ddot", "duml", "dsla", "drin", "dced", "dapo", "ddac", "dogo", "dcar", }; char acc_names_u[15][5] = { "DGRA", "DACU", "DCIR", "DTIL", "DMAC", "DBRE", "DDOT", "DUML", "DSLA", "DRIN", "DCED", "DAPO", "DDAC", "DOGO", "DCAR", }; char fkey_table[96][MAXFK] = { /* 01-04 */ "\033[M", "\033[N", "\033[O", "\033[P", /* 05-08 */ "\033[Q", "\033[R", "\033[S", "\033[T", /* 09-12 */ "\033[U", "\033[V", "\033[W", "\033[X", /* 13-16 */ "\033[Y", "\033[Z", "\033[a", "\033[b", /* 17-20 */ "\033[c", "\033[d", "\033[e", "\033[f", /* 21-24 */ "\033[g", "\033[h", "\033[i", "\033[j", /* 25-28 */ "\033[k", "\033[l", "\033[m", "\033[n", /* 29-32 */ "\033[o", "\033[p", "\033[q", "\033[r", /* 33-36 */ "\033[s", "\033[t", "\033[u", "\033[v", /* 37-40 */ "\033[w", "\033[x", "\033[y", "\033[z", /* 41-44 */ "\033[@", "\033[[", "\033[\\","\033[]", /* 45-48 */ "\033[^", "\033[_", "\033[`", "\033[{", /* 49-52 */ "\033[H", "\033[A", "\033[I", "-" , /* 53-56 */ "\033[D", "\033[E", "\033[C", "+" , /* 57-60 */ "\033[F", "\033[B", "\033[G", "\033[L", /* 61-64 */ "\177", "\033[J", "\033[~", "\033[}", /* 65-68 */ "" , "" , "" , "" , /* 69-72 */ "" , "" , "" , "" , /* 73-76 */ "" , "" , "" , "" , /* 77-80 */ "" , "" , "" , "" , /* 81-84 */ "" , "" , "" , "" , /* 85-88 */ "" , "" , "" , "" , /* 89-92 */ "" , "" , "" , "" , /* 93-96 */ "" , "" , "" , "" , }; -const int delays[] = {250, 500, 750, 1000}; -const int repeats[] = { 34, 38, 42, 46, 50, 55, 59, 63, - 68, 76, 84, 92, 100, 110, 118, 126, - 136, 152, 168, 184, 200, 220, 236, 252, - 272, 304, 336, 368, 400, 440, 472, 504}; -const int ndelays = (sizeof(delays) / sizeof(int)); -const int nrepeats = (sizeof(repeats) / sizeof(int)); int hex = 0; int number; char letter; int token; static void usage __P((void)); char * nextarg(int ac, char **av, int *indp, int oc) { if (*indp < ac) return(av[(*indp)++]); warnx("option requires two arguments -- %c", oc); usage(); return(""); } char * mkfullname(const char *s1, const char *s2, const char *s3) { static char *buf = NULL; static int bufl = 0; int f; f = strlen(s1) + strlen(s2) + strlen(s3) + 1; if (f > bufl) if (buf) buf = (char *)realloc(buf, f); else buf = (char *)malloc(f); if (!buf) { bufl = 0; return(NULL); } bufl = f; strcpy(buf, s1); strcat(buf, s2); strcat(buf, s3); return(buf); } int get_entry() { switch ((token = yylex())) { case TNOP: return NOP | 0x100; case TLSH: return LSH | 0x100; case TRSH: return RSH | 0x100; case TCLK: return CLK | 0x100; case TNLK: return NLK | 0x100; case TSLK: return SLK | 0x100; case TBTAB: return BTAB | 0x100; case TLALT: return LALT | 0x100; case TLCTR: return LCTR | 0x100; case TNEXT: return NEXT | 0x100; case TRCTR: return RCTR | 0x100; case TRALT: return RALT | 0x100; case TALK: return ALK | 0x100; case TASH: return ASH | 0x100; case TMETA: return META | 0x100; case TRBT: return RBT | 0x100; case TDBG: return DBG | 0x100; case TSUSP: return SUSP | 0x100; case TSPSC: return SPSC | 0x100; case TACC: if (ACC(number) > L_ACC) return -1; return ACC(number) | 0x100; case TFUNC: if (F(number) > L_FN) return -1; return F(number) | 0x100; case TSCRN: if (S(number) > L_SCR) return -1; return S(number) | 0x100; case TLET: return (unsigned char)letter; case TNUM: if (number < 0 || number > 255) return -1; return number; default: return -1; } } int get_definition_line(FILE *fd, keymap_t *keymap, accentmap_t *accentmap) { int c; yyin = fd; if (token < 0) token = yylex(); switch (token) { case TNUM: c = get_key_definition_line(keymap); if (c < 0) errx(1, "invalid key definition"); if (c > keymap->n_keys) keymap->n_keys = c; break; case TACC: c = get_accent_definition_line(accentmap); if (c < 0) errx(1, "invalid accent key definition"); if (c > accentmap->n_accs) accentmap->n_accs = c; break; case 0: /* EOF */ return -1; default: errx(1, "illegal definition line"); } return c; } int get_key_definition_line(keymap_t *map) { int i, def, scancode; /* check scancode number */ if (number < 0 || number >= NUM_KEYS) return -1; scancode = number; /* get key definitions */ map->key[scancode].spcl = 0; for (i=0; ikey[scancode].spcl |= (0x80 >> i); map->key[scancode].map[i] = def & 0xFF; } /* get lock state key def */ if ((token = yylex()) != TFLAG) return -1; map->key[scancode].flgs = number; token = yylex(); return (scancode + 1); } int get_accent_definition_line(accentmap_t *map) { int accent; int c1, c2; int i; if (ACC(number) < F_ACC || ACC(number) > L_ACC) /* number out of range */ return -1; accent = number; if (map->acc[accent].accchar != 0) { /* this entry has already been defined before! */ errx(1, "duplicated accent key definition"); } switch ((token = yylex())) { case TLET: map->acc[accent].accchar = letter; break; case TNUM: map->acc[accent].accchar = number; break; default: return -1; } for (i = 0; (token = yylex()) == '(';) { switch ((token = yylex())) { case TLET: c1 = letter; break; case TNUM: c1 = number; break; default: return -1; } switch ((token = yylex())) { case TLET: c2 = letter; break; case TNUM: c2 = number; break; default: return -1; } if ((token = yylex()) != ')') return -1; if (i >= NUM_ACCENTCHARS) { warnx("too many accented characters, ignored"); continue; } map->acc[accent].map[i][0] = c1; map->acc[accent].map[i][1] = c2; ++i; } return (accent + 1); } void print_entry(FILE *fp, int value) { int val = value & 0xFF; switch (value) { case NOP | 0x100: fprintf(fp, " nop "); break; case LSH | 0x100: fprintf(fp, " lshift"); break; case RSH | 0x100: fprintf(fp, " rshift"); break; case CLK | 0x100: fprintf(fp, " clock "); break; case NLK | 0x100: fprintf(fp, " nlock "); break; case SLK | 0x100: fprintf(fp, " slock "); break; case BTAB | 0x100: fprintf(fp, " btab "); break; case LALT | 0x100: fprintf(fp, " lalt "); break; case LCTR | 0x100: fprintf(fp, " lctrl "); break; case NEXT | 0x100: fprintf(fp, " nscr "); break; case RCTR | 0x100: fprintf(fp, " rctrl "); break; case RALT | 0x100: fprintf(fp, " ralt "); break; case ALK | 0x100: fprintf(fp, " alock "); break; case ASH | 0x100: fprintf(fp, " ashift"); break; case META | 0x100: fprintf(fp, " meta "); break; case RBT | 0x100: fprintf(fp, " boot "); break; case DBG | 0x100: fprintf(fp, " debug "); break; case SUSP | 0x100: fprintf(fp, " susp "); break; case SPSC | 0x100: fprintf(fp, " saver "); break; default: if (value & 0x100) { if (val >= F_FN && val <= L_FN) fprintf(fp, " fkey%02d", val - F_FN + 1); else if (val >= F_SCR && val <= L_SCR) fprintf(fp, " scr%02d ", val - F_SCR + 1); else if (val >= F_ACC && val <= L_ACC) fprintf(fp, " %-6s", acc_names[val - F_ACC]); else if (hex) fprintf(fp, " 0x%02x ", val); else fprintf(fp, " %3d ", val); } else { if (val < ' ') fprintf(fp, " %s ", ctrl_names[val]); else if (val == 127) fprintf(fp, " del "); else if (isascii(val) && isprint(val)) fprintf(fp, " '%c' ", val); else if (hex) fprintf(fp, " 0x%02x ", val); else fprintf(fp, " %3d ", val); } } } +#ifdef __i386__ void print_key_definition_line(FILE *fp, int scancode, struct keyent_t *key) +#else +void +print_key_definition_line(FILE *fp, int scancode, struct key_t *key) +#endif { int i; /* print scancode number */ if (hex) fprintf(fp, " 0x%02x ", scancode); else fprintf(fp, " %03d ", scancode); /* print key definitions */ for (i=0; ispcl & (0x80 >> i)) print_entry(fp, key->map[i] | 0x100); else print_entry(fp, key->map[i]); } /* print lock state key def */ switch (key->flgs) { case 0: fprintf(fp, " O\n"); break; case 1: fprintf(fp, " C\n"); break; case 2: fprintf(fp, " N\n"); break; case 3: fprintf(fp, " B\n"); break; } } void print_accent_definition_line(FILE *fp, int accent, struct acc_t *key) { int c; int i; if (key->accchar == 0) return; /* print accent number */ fprintf(fp, " %-6s", acc_names[accent]); if (isascii(key->accchar) && isprint(key->accchar)) fprintf(fp, "'%c' ", key->accchar); else if (hex) fprintf(fp, "0x%02x ", key->accchar); else fprintf(fp, "%03d ", key->accchar); for (i = 0; i < NUM_ACCENTCHARS; ++i) { c = key->map[i][0]; if (c == 0) break; if ((i > 0) && ((i % 4) == 0)) fprintf(fp, "\n "); if (isascii(c) && isprint(c)) fprintf(fp, "( '%c' ", c); else if (hex) fprintf(fp, "(0x%02x ", c); else fprintf(fp, "( %03d ", c); c = key->map[i][1]; if (isascii(c) && isprint(c)) fprintf(fp, "'%c' ) ", c); else if (hex) fprintf(fp, "0x%02x) ", c); else fprintf(fp, "%03d ) ", c); } fprintf(fp, "\n"); } void dump_entry(int value) { if (value & 0x100) { value &= 0x00ff; switch (value) { case NOP: printf(" NOP, "); break; case LSH: printf(" LSH, "); break; case RSH: printf(" RSH, "); break; case CLK: printf(" CLK, "); break; case NLK: printf(" NLK, "); break; case SLK: printf(" SLK, "); break; case BTAB: printf(" BTAB, "); break; case LALT: printf(" LALT, "); break; case LCTR: printf(" LCTR, "); break; case NEXT: printf(" NEXT, "); break; case RCTR: printf(" RCTR, "); break; case RALT: printf(" RALT, "); break; case ALK: printf(" ALK, "); break; case ASH: printf(" ASH, "); break; case META: printf(" META, "); break; case RBT: printf(" RBT, "); break; case DBG: printf(" DBG, "); break; case SUSP: printf(" SUSP, "); break; case SPSC: printf(" SPSC, "); break; default: if (value >= F_FN && value <= L_FN) printf(" F(%2d),", value - F_FN + 1); else if (value >= F_SCR && value <= L_SCR) printf(" S(%2d),", value - F_SCR + 1); else if (value >= F_ACC && value <= L_ACC) printf(" %-4s, ", acc_names_u[value - F_ACC]); else printf(" 0x%02X, ", value); break; } } else if (value == '\'') { printf(" '\\'', "); } else if (value == '\\') { printf(" '\\\\', "); } else if (isascii(value) && isprint(value)) { printf(" '%c', ", value); } else { printf(" 0x%02X, ", value); } } void dump_key_definition(char *name, keymap_t *keymap) { int i, j; printf("static keymap_t keymap_%s = { 0x%02x, {\n", name, (unsigned)keymap->n_keys); printf( "/* alt\n" " * scan cntrl alt alt cntrl\n" " * code base shift cntrl shift alt shift cntrl shift spcl flgs\n" " * ---------------------------------------------------------------------------\n" " */\n"); for (i = 0; i < keymap->n_keys; i++) { printf("/*%02x*/{{", i); for (j = 0; j < NUM_STATES; j++) { if (keymap->key[i].spcl & (0x80 >> j)) dump_entry(keymap->key[i].map[j] | 0x100); else dump_entry(keymap->key[i].map[j]); } printf("}, 0x%02X,0x%02X },\n", (unsigned)keymap->key[i].spcl, (unsigned)keymap->key[i].flgs); } printf("} };\n\n"); } void dump_accent_definition(char *name, accentmap_t *accentmap) { int i, j; int c; printf("static accentmap_t accentmap_%s = { %d", name, accentmap->n_accs); if (accentmap->n_accs <= 0) { printf(" };\n\n"); return; } printf(", {\n"); for (i = 0; i < NUM_DEADKEYS; i++) { printf(" /* %s=%d */\n {", acc_names[i], i); c = accentmap->acc[i].accchar; if (c == '\'') printf(" '\\'', {"); else if (c == '\\') printf(" '\\\\', {"); else if (isascii(c) && isprint(c)) printf(" '%c', {", c); else if (c == 0) { printf(" 0x00 }, \n"); continue; } else printf(" 0x%02x, {", c); for (j = 0; j < NUM_ACCENTCHARS; j++) { c = accentmap->acc[i].map[j][0]; if (c == 0) break; if ((j > 0) && ((j % 4) == 0)) printf("\n\t "); if (isascii(c) && isprint(c)) printf(" { '%c',", c); else printf(" { 0x%02x,", c); printf("0x%02x },", accentmap->acc[i].map[j][1]); } printf(" }, },\n"); } printf("} };\n\n"); } void load_keymap(char *opt, int dumponly) { keymap_t keymap; accentmap_t accentmap; FILE *fd; int i; char *name, *cp; char *prefix[] = {"", "", KEYMAP_PATH, KEYMAP_PATH, NULL}; char *postfix[] = {"", ".kbd", "", ".kbd"}; for (i=0; prefix[i]; i++) { name = mkfullname(prefix[i], opt, postfix[i]); if ((fd = fopen(name, "r"))) break; } if (fd == NULL) { warn("keymap file not found"); return; } memset(&keymap, 0, sizeof(keymap)); memset(&accentmap, 0, sizeof(accentmap)); token = -1; while (1) { if (get_definition_line(fd, &keymap, &accentmap) < 0) break; } if (dumponly) { /* fix up the filename to make it a valid C identifier */ for (cp = opt; *cp; cp++) if (!isalpha(*cp) && !isdigit(*cp)) *cp = '_'; printf("/*\n" " * Automatically generated from %s.\n" " * DO NOT EDIT!\n" " */\n", name); dump_key_definition(opt, &keymap); dump_accent_definition(opt, &accentmap); return; } if ((keymap.n_keys > 0) && (ioctl(0, PIO_KEYMAP, &keymap) < 0)) { warn("setting keymap"); fclose(fd); return; } if ((accentmap.n_accs > 0) && (ioctl(0, PIO_DEADKEYMAP, &accentmap) < 0)) { warn("setting accentmap"); fclose(fd); return; } } void print_keymap() { keymap_t keymap; accentmap_t accentmap; int i; if (ioctl(0, GIO_KEYMAP, &keymap) < 0) err(1, "getting keymap"); if (ioctl(0, GIO_DEADKEYMAP, &accentmap) < 0) memset(&accentmap, 0, sizeof(accentmap)); printf( "# alt\n" "# scan cntrl alt alt cntrl lock\n" "# code base shift cntrl shift alt shift cntrl shift state\n" "# ------------------------------------------------------------------\n" ); for (i=0; i NUM_FKEYS) { warnx("function key number must be between 1 and %d", NUM_FKEYS); return; } if ((fkey.flen = strlen(string)) > MAXFK) { warnx("function key string too long (%d > %d)", fkey.flen, MAXFK); return; } strcpy(fkey.keydef, string); fkey.keynum -= 1; if (ioctl(0, SETFKEY, &fkey) < 0) warn("setting function key"); } void set_bell_values(char *opt) { int bell, duration, pitch; bell = 0; if (!strncmp(opt, "quiet.", 6)) { bell = 2; opt += 6; } if (!strcmp(opt, "visual")) bell |= 1; else if (!strcmp(opt, "normal")) duration = 5, pitch = 800; else { char *v1; bell = 0; duration = strtol(opt, &v1, 0); if ((duration < 0) || (*v1 != '.')) goto badopt; opt = ++v1; pitch = strtol(opt, &v1, 0); if ((pitch < 0) || (*opt == '\0') || (*v1 != '\0')) { badopt: warnx("argument to -b must be DURATION.PITCH"); return; } if (pitch != 0) pitch = 1193182 / pitch; /* in Hz */ duration /= 10; /* in 10 m sec */ } ioctl(0, CONS_BELLTYPE, &bell); if ((bell & ~2) == 0) fprintf(stderr, "[=%d;%dB", pitch, duration); } void set_keyrates(char *opt) { + int arg[2]; int repeat; int delay; if (!strcmp(opt, "slow")) - delay = 3, repeat = 31; + delay = 1000, repeat = 500; else if (!strcmp(opt, "normal")) - delay = 1, repeat = 15; + delay = 500, repeat = 125; else if (!strcmp(opt, "fast")) delay = repeat = 0; else { int n; char *v1; delay = strtol(opt, &v1, 0); if ((delay < 0) || (*v1 != '.')) goto badopt; opt = ++v1; repeat = strtol(opt, &v1, 0); if ((repeat < 0) || (*opt == '\0') || (*v1 != '\0')) { badopt: warnx("argument to -r must be delay.repeat"); return; } - for (n = 0; n < ndelays - 1; n++) - if (delay <= delays[n]) - break; - delay = n; - for (n = 0; n < nrepeats - 1; n++) - if (repeat <= repeats[n]) - break; - repeat = n; } - if (ioctl(0, KDSETRAD, (delay << 5) | repeat) < 0) + arg[0] = delay; + arg[1] = repeat; + if (ioctl(0, KDSETREPEAT, arg)) warn("setting keyboard rate"); } void set_history(char *opt) { int size; size = atoi(opt); if ((*opt == '\0') || size < 0) { warnx("argument must be a positive number"); return; } if (ioctl(0, CONS_HISTORY, &size) == -1) warn("setting history buffer size"); } -#ifdef __i386__ static char *get_kbd_type_name(int type) { static struct { int type; char *name; } name_table[] = { { KB_84, "AT 84" }, { KB_101, "AT 101/102" }, { KB_OTHER, "generic" }, }; int i; for (i = 0; i < sizeof(name_table)/sizeof(name_table[0]); ++i) { if (type == name_table[i].type) return name_table[i].name; } return "unknown"; } void show_kbd_info(void) { keyboard_info_t info; if (ioctl(0, KDGKBINFO, &info) == -1) { warn("unable to obtain keyboard information"); return; } printf("kbd%d:\n", info.kb_index); printf(" %.*s%d, type:%s (%d)\n", sizeof(info.kb_name), info.kb_name, info.kb_unit, get_kbd_type_name(info.kb_type), info.kb_type); } void set_keyboard(char *device) { keyboard_info_t info; int fd; fd = open(device, O_RDONLY); if (fd < 0) { warn("cannot open %s", device); return; } if (ioctl(fd, KDGKBINFO, &info) == -1) { warn("unable to obtain keyboard information"); close(fd); return; } /* * The keyboard device driver won't release the keyboard by * the following ioctl, but it automatically will, when the device * is closed. So, we don't check error here. */ ioctl(fd, CONS_RELKBD, 0); close(fd); #if 1 printf("kbd%d\n", info.kb_index); printf(" %.*s%d, type:%s (%d)\n", sizeof(info.kb_name), info.kb_name, info.kb_unit, get_kbd_type_name(info.kb_type), info.kb_type); #endif if (ioctl(0, CONS_SETKBD, info.kb_index) == -1) warn("unable to set keyboard"); } void release_keyboard(void) { keyboard_info_t info; /* * If stdin is not associated with a keyboard, the following ioctl * will fail. */ if (ioctl(0, KDGKBINFO, &info) == -1) { warn("unable to obtain keyboard information"); return; } #if 1 printf("kbd%d\n", info.kb_index); printf(" %.*s%d, type:%s (%d)\n", sizeof(info.kb_name), info.kb_name, info.kb_unit, get_kbd_type_name(info.kb_type), info.kb_type); #endif if (ioctl(0, CONS_RELKBD, 0) == -1) warn("unable to release the keyboard"); } -#endif /* __i386__ */ static void usage() { fprintf(stderr, "%s\n%s\n%s\n", -#ifdef __i386__ "usage: kbdcontrol [-dFKix] [-b duration.pitch | [quiet.]belltype]", " [-r delay.repeat | speed] [-l mapfile] [-f # string]", " [-h size] [-k device] [-L mapfile]"); -#else -"usage: kbdcontrol [-dFx] [-b duration.pitch | [quiet.]belltype]", -" [-r delay.repeat | speed] [-l mapfile] [-f # string]", -" [-h size] [-L mapfile]"); -#endif exit(1); } void main(int argc, char **argv) { int opt; -#ifdef __i386__ while((opt = getopt(argc, argv, "b:df:h:iKk:Fl:L:r:x")) != -1) -#else - while((opt = getopt(argc, argv, "b:df:h:Fl:L:r:x")) != -1) -#endif switch(opt) { case 'b': set_bell_values(optarg); break; case 'd': print_keymap(); break; case 'l': load_keymap(optarg, 0); break; case 'L': load_keymap(optarg, 1); break; case 'f': set_functionkey(optarg, nextarg(argc, argv, &optind, 'f')); break; case 'F': load_default_functionkeys(); break; case 'h': set_history(optarg); break; -#ifdef __i386__ case 'i': show_kbd_info(); break; case 'K': release_keyboard(); break; case 'k': set_keyboard(optarg); break; -#endif /* __i386__ */ case 'r': set_keyrates(optarg); break; case 'x': hex = 1; break; default: usage(); } if ((optind != argc) || (argc == 1)) usage(); exit(0); }