/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 2007 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#ifndef _SYS_KBD_H
#define _SYS_KBD_H
#pragma ident "%Z%%M% %I% %E% SMI" /* SunOS4.0 1.18 */
#ifdef __cplusplus
extern "C" {
#endif
/*
* Following #defines are related to the older keyboards which
* are no longer supported by kb module. The #defines ane left
* for older programs to still compile.
*/
/* determines which NOSCROLL sends. */
/*
* Following are the only keyboard types supported by kb module.
* (Type 5, Hobo, US101A are also supported but they report
* themselves as Type 4 keyboard with a different layout id.)
*/
/*
* This structure is used to enumerate the supported keyboard types.
* The array of these is terminated by an entry with a NULL table entry.
* The first entry is used if none match.
*/
struct keyboards {
};
/*
* Various special characters that might show up on the port
*/
/*
* Commands to the Sun-3 keyboard.
*/
/*
* Commands to the Type 4 keyboard, in addition to those above.
*/
/* layout */
/*
* Type 4 keyboard LED masks (used to set LED's)
*/
/*
* Software related definitions
*/
/*
* These are the states that the keyboard scanner can be in.
*
* It starts out in NORMAL state.
*/
/*
* Size of ASCII set as used in compose handling.
*/
/*
* These are how you can have your input translated.
* TR_EVENT means that each keystroke is sent as a firm event.
* TR_UNTRANS_EVENT also sends a firm event for each up / down transition,
* but the value is untranslated: the event id is the key station; the
* value indicates whether the transition was up or down; the value of the
* shift-mask is undefined.
*/
#define TR_NONE 0
/*
* These bits can appear in the result of TR_NONE & TR_UNTRANS_EVENT getkey()s.
*/
/* depressed. They were all elated. */
/*
* "Bucky" bits. These are bits for mode keys. The META bit is ORed into the
* result of TR_ASCII getkey()s, and can be ORed into the result of TR_EVENT
* getkey()s for backwards compatibility.
* (NOKEY can also appear if no keypress was queued up.)
*/
/* other "bucky" bits can be defined at will. See "BUCKYBITS" below. */
/*
* This defines the bit positions used within "shiftmask" to
* indicate the "pressed" (1) or "released" (0) state of shift keys.
* Both the bit numbers, and the aggregate masks, are defined.
*
* The "UPMASK" is a minor kludge. Since whether the key is going
* up or down determines the translation table (just as the shift
* keys' positions do), we OR it with "shiftmask" to get "tempmask",
* which is the mask which is actually used to determine the
* translation table to use. Don't reassign 0x0080 for anything
* else, or we'll have to shift and such to squeeze in UPMASK,
* since it comes in from the hardware as 0x80.
*/
/* META 6 Meta keys */
/* META_SHIFT_MASK 0x0040 reserved */
/* TOP 7 do not use! */
/* TOPMASK 0x0080 UPMASK in keyboard driver */
/* CMD 8 reserved */
/* CMDMASK 0x0100 reserved */
/*
* This defines the format of translation tables.
*
* A translation table is KEYMAP_SIZE "entries", each of which is 2 bytes
* (unsigned shorts). The top 8 bits of each entry are decoded by
* a case statement in getkey.c. If the entry is less than 0x100, it
* is sent out as an EUC character (possibly with bucky bits
* OR-ed in). "Special" entries are 0x100 or greater, and
* invoke more complicated actions.
*
* The KEYMAP_SIZE is dependent upon the keyboard type. For example, the
* Sun Type 4/5 keyboards have a KEYMAP_SIZE of 128 where a USB keyboard
* has a KEYMAP_SIZE of 255. Instead of defining a KEYMAP_SIZE per
* at run time by defining the KEYMAP_SIZE_VARIABLE and filling in the
* keyboard struct appropriately.
*/
#ifdef KEYMAP_SIZE_VARIABLE
typedef unsigned short keymap_entry_t;
#else
struct keymap {
};
#endif
/*
* This structure is used for "exception" cases for key sequences that
* we want to map, that should not be handled by keymap entries (For
* example: using Control-Shift-F1 on PC's for the compose key).
*/
struct exception_map {
/*
* these are the modifier keys that we "care" about
*/
unsigned int exc_care;
/*
* This is the mask of modifier keys that we want to match
*/
unsigned int exc_mask;
/*
* This is the key that we want to match.
*/
int exc_key;
/*
* This is our translated version of the matching sequence.
*/
unsigned short exc_entry;
};
/*
* A keyboard is defined by its keymaps and what state it resets at idle.
*
* The masks k_idleshifts and k_idlebuckys are AND-ed with the current
* state of shiftmask and buckybits when a "keyboard idle" code
* is received. This ensures that where we "think" the shift & bucky
* keys are, more accurately reflects where they really are, since the
* keyboard knows better than us. However, some keyboards don't know
* about shift states that should be remembered across idles. Such
* shifts are described by k_toggleshifts. k_toggleshifts are used to
* identify such shifts. A toggle shift state is maintained separately
* from the general shift state. The toggle shift state is OR-ed
* with the state general shift state when an idle is received.
* k_toggleshifts should not appear in the k_up table.
*/
struct keyboard {
#ifdef KEYMAP_SIZE_VARIABLE
#else
#endif
/* kbd and keep across idle */
};
/*
* Define the compose sequence structure. First and second
* ASCII chars of 0 indicate the end of the table.
*/
struct compose_sequence_t {
};
/*
* Define the floating accent sequence structure.
*/
struct fltaccent_sequence_t {
};
/*
* The "special" entries' top 4 bits are defined below. Generally they are
* used with a 4-bit parameter (such as a bit number) in the low 4 bits.
* The bytes whose top 4 bits are 0x0 thru 0x7 happen to be ascii
* characters. They are not special cased, but just normal cased.
*/
/* the translation table used. The bit */
/* position of its bit in "shiftmask" */
/* is added to the entry, eg */
/* SHIFTKEYS+LEFTCTRL. When this entry is */
/* invoked, the bit in "shiftmask" is */
/* toggled. Depending which tables you put */
/* it in, this works well for hold-down */
/* keys or press-on, press-off keys. */
/* of one of the "bucky" bits above the */
/* returned ASCII character. This is */
/* basically a way to pass mode-key-up/down */
/* information back to the caller with each */
/* "real" key depressed. The concept, and */
/* name "bucky" (derivation unknown) comes */
/* from the MIT/SAIL "TV" system...they had */
/* TOP, META, CTRL, and a few other bucky */
/* bits. The bit position of its bit in */
/* "buckybits", minus 7, is added to the */
/* entry; eg bit 0x00000400 is BUCKYBITS+3. */
/* The "-7" prevents us from messing up the */
/* ASCII char, and gives us 16 useful bucky */
/* bits. When this entry is invoked, */
/* the designated bit in "buckybits" is */
/* toggled. Depending which tables you put */
/* it in, this works well for hold-down */
/* keys or press-on, press-off keys. */
/* things based on the low 4 bits: */
/* Its position code should never be */
/* generated. This indicates a software/ */
/* hardware mismatch, or bugs. */
/* Combinations 0x30B to 0x30F are reserved for non-parameterized functions */
/* accent" characters. The low-order 4 bits */
/* select one of those characters. */
/* Definitions for the individual floating accents: */
/* a table select a string to be returned, */
/* char by char. Each entry the table is */
/* null terminated. */
/* Definitions for the individual string numbers: */
/* string numbers 5 thru F are available to users making custom entries */
/*
* In the following function key groupings, the low-order 4 bits indicate
* the function key number within the group, and the next 4 bits indicate
* the group.
*/
/*
* of the physical keyboard (although they usually are).
* What is important is that we have reserved 64 keys for function keys.
*
* Normally, striking a function key will cause the following escape sequence
* to be sent through the character stream:
* ESC[0..9z
* where ESC is a single escape character and 0..9 indicate some number of
* digits needed to encode the function key as a decimal number.
*/
#ifdef __cplusplus
}
#endif
#endif /* _SYS_KBD_H */