#ifndef _SYS_KBIO_H_
#define _SYS_KBIO_H_
#ifndef _KERNEL
#include <sys/types.h>
#endif
#include <sys/ioccom.h>
#define K_RAW 0
#define K_XLATE 1
#define K_CODE 2
#define KDGKBMODE _IOR('K', 6, int)
#define KDSKBMODE _IOWINT('K', 7)
#define KDMKTONE _IOWINT('K', 8)
#ifdef notdef
#define KDGETMODE _IOR('K', 9, int)
#define KDSETMODE _IOWINT('K', 10)
#define KDSBORDER _IOWINT('K', 13)
#endif
#define CLKED 1
#define NLKED 2
#define SLKED 4
#define ALKED 8
#define LOCK_MASK (CLKED | NLKED | SLKED | ALKED)
#define KDGKBSTATE _IOR('K', 19, int)
#define KDSKBSTATE _IOWINT('K', 20)
#define KDENABIO _IO('K', 60)
#define KDDISABIO _IO('K', 61)
#define KIOCSOUND _IOWINT('K', 63)
#define KB_OTHER 0
#define KB_84 1
#define KB_101 2
#define KDGKBTYPE _IOR('K', 64, int)
#define LED_CAP 1
#define LED_NUM 2
#define LED_SCR 4
#define LED_MASK (LED_CAP | LED_NUM | LED_SCR)
#define KDGETLED _IOR('K', 65, int)
#define KDSETLED _IOWINT('K', 66)
#define KDSETRAD _IOWINT('K', 67)
struct keyboard_info {
int kb_index;
char kb_name[16];
int kb_unit;
int kb_type;
int kb_config;
int kb_flags;
};
typedef struct keyboard_info keyboard_info_t;
static const int kbdelays[] = { 250, 500, 750, 1000 };
static const int kbrates[] = { 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 };
#define KBADDKBD _IOW('K', 68, keyboard_info_t)
#define KBRELKBD _IOW('K', 69, keyboard_info_t)
#ifdef notdef
#define KDRASTER _IOW('K', 100, scr_size_t)
#endif
#define KDGKBINFO _IOR('K', 101, keyboard_info_t)
struct keyboard_repeat {
int kb_repeat[2];
};
typedef struct keyboard_repeat keyboard_repeat_t;
#define KDSETREPEAT _IOW('K', 102, keyboard_repeat_t)
#define KDGETREPEAT _IOR('K', 103, keyboard_repeat_t)
#define NUM_KEYS 256
#define NUM_STATES 8
#define ALTGR_OFFSET 128
#define NUM_DEADKEYS 15
#define NUM_ACCENTCHARS 52
#define NUM_FKEYS 96
#define MAXFK 16
#ifndef _KEYMAP_DECLARED
#define _KEYMAP_DECLARED
struct keyent_t {
u_int map[NUM_STATES];
u_char spcl;
u_char flgs;
#define FLAG_LOCK_O 0
#define FLAG_LOCK_C 1
#define FLAG_LOCK_N 2
};
struct keymap {
u_short n_keys;
struct keyent_t key[NUM_KEYS];
};
typedef struct keymap keymap_t;
#ifdef COMPAT_FREEBSD13
struct okeyent_t {
u_char map[NUM_STATES];
u_char spcl;
u_char flgs;
};
struct okeymap {
u_short n_keys;
struct okeyent_t key[NUM_KEYS];
};
typedef struct okeymap okeymap_t;
#endif
#endif
#define NOP 0x00
#define LSH 0x02
#define RSH 0x03
#define CLK 0x04
#define NLK 0x05
#define SLK 0x06
#define LALT 0x07
#define BTAB 0x08
#define LCTR 0x09
#define NEXT 0x0a
#define F_SCR 0x0b
#define L_SCR 0x1a
#define F_FN 0x1b
#define L_FN 0x7a
#define RCTR 0x80
#define RALT 0x81
#define ALK 0x82
#define ASH 0x83
#define META 0x84
#define RBT 0x85
#define DBG 0x86
#define SUSP 0x87
#define SPSC 0x88
#define F_ACC DGRA
#define DGRA 0x89
#define DACU 0x8a
#define DCIR 0x8b
#define DTIL 0x8c
#define DMAC 0x8d
#define DBRE 0x8e
#define DDOT 0x8f
#define DUML 0x90
#define DDIA 0x90
#define DSLA 0x91
#define DRIN 0x92
#define DCED 0x93
#define DAPO 0x94
#define DDAC 0x95
#define DOGO 0x96
#define DCAR 0x97
#define L_ACC DCAR
#define STBY 0x98
#define PREV 0x99
#define PNC 0x9a
#define LSHA 0x9b
#define RSHA 0x9c
#define LCTRA 0x9d
#define RCTRA 0x9e
#define LALTA 0x9f
#define RALTA 0xa0
#define HALT 0xa1
#define PDWN 0xa2
#define PASTE 0xa3
#define F(x) ((x)+F_FN-1)
#define S(x) ((x)+F_SCR-1)
#define ACC(x) ((x)+F_ACC)
struct acc_t {
u_int accchar;
u_int map[NUM_ACCENTCHARS][2];
};
struct accentmap {
u_short n_accs;
struct acc_t acc[NUM_DEADKEYS];
};
typedef struct accentmap accentmap_t;
#ifdef COMPAT_FREEBSD13
struct oacc_t {
u_char accchar;
u_char map[NUM_ACCENTCHARS][2];
};
struct oaccentmap {
u_short n_accs;
struct oacc_t acc[NUM_DEADKEYS];
};
typedef struct oaccentmap oaccentmap_t;
#endif
struct keyarg {
u_short keynum;
struct keyent_t key;
};
typedef struct keyarg keyarg_t;
struct fkeytab {
u_char str[MAXFK];
u_char len;
};
typedef struct fkeytab fkeytab_t;
struct fkeyarg {
u_short keynum;
char keydef[MAXFK];
char flen;
};
typedef struct fkeyarg fkeyarg_t;
#define GETFKEY _IOWR('k', 0, fkeyarg_t)
#define SETFKEY _IOWR('k', 1, fkeyarg_t)
#ifdef notdef
#define GIO_SCRNMAP _IOR('k', 2, scrmap_t)
#define PIO_SCRNMAP _IOW('k', 3, scrmap_t)
#endif
#define GIO_KEYMAP _IO('k', 6)
#define PIO_KEYMAP _IO('k', 7)
#ifdef COMPAT_FREEBSD13
#define OGIO_KEYMAP _IOR('k', 6, okeymap_t)
#define OPIO_KEYMAP _IOW('k', 7, okeymap_t)
#endif
#define GIO_DEADKEYMAP _IO('k', 8)
#define PIO_DEADKEYMAP _IO('k', 9)
#ifdef COMPAT_FREEBSD13
#define OGIO_DEADKEYMAP _IOR('k', 8, oaccentmap_t)
#define OPIO_DEADKEYMAP _IOW('k', 9, oaccentmap_t)
#endif
#define GIO_KEYMAPENT _IOWR('k', 10, keyarg_t)
#define PIO_KEYMAPENT _IOW('k', 11, keyarg_t)
#define NOKEY 0x01000000
#define FKEY 0x02000000
#define MKEY 0x04000000
#define BKEY 0x08000000
#define SPCLKEY 0x80000000
#define RELKEY 0x40000000
#define ERRKEY 0x20000000
#define KEYCHAR(c) ((c) & 0x00ffffff)
#define KEYFLAGS(c) ((c) & ~0x00ffffff)
#endif