4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
22 * Copyright 2007 Sun Microsystems, Inc. All rights reserved.
23 * Use is subject to license terms.
29 #pragma ident "%Z%%M% %I% %E% SMI" /* SunOS4.0 1.23 */
36 * Keyboard related ioctls
40 * See sys/kbd.h for TR_NONE (don't translate) and TR_ASCII
41 * (translate to ASCII) TR_EVENT (translate to virtual input
46 #if defined(__i386) || defined(__i386_COMPAT)
49 * For x86, these numbers conflict with KD "Xenix" ioctl numbers, so each
50 * conflicting command has been offset by 30.
52 #define KIOCTRANS (KIOC|30) /* set keyboard translation */
53 #define KIOCGTRANS (KIOC|35) /* get keyboard translation */
54 #define KIOCTRANSABLE (KIOC|36) /* set keyboard translatability */
55 #define KIOCGTRANSABLE (KIOC|37) /* get keyboard translatability */
57 #else /* __i386 || __i386_COMPAT */
59 #define KIOCTRANS (KIOC|0) /* set keyboard translation */
60 #define KIOCGTRANS (KIOC|5) /* get keyboard translation */
61 #define KIOCTRANSABLE (KIOC|6) /* set keyboard translatability */
62 #define KIOCGTRANSABLE (KIOC|7) /* get keyboard translatability */
64 #endif /* __i386 || __i386_COMPAT */
67 #define TR_CANNOT 0 /* Cannot translate keyboard using tables */
68 #define TR_CAN 1 /* Can translate keyboard using tables */
71 * Old-style keymap entry, for backwards compatibility only.
74 int kio_tablemask
; /* Translation table (one of: 0, CAPSMASK, */
75 /* SHIFTMASK, CTRLMASK, UPMASK, */
76 /* ALTGRAPHMASK, NUMLOCKMASK) */
77 #define KIOCABORT1 -1 /* Special "mask": abort1 keystation */
78 #define KIOCABORT2 -2 /* Special "mask": abort2 keystation */
79 #define KIOCABORT1A -3 /* Special "mask": alt abort1 keystation */
80 uchar_t kio_station
; /* Physical keyboard key station (0-127) */
81 uchar_t kio_entry
; /* Translation table station's entry */
82 char kio_string
[10]; /* Value for STRING entries (null terminated) */
86 * Set kio_tablemask table's kio_station to kio_entry.
87 * Copy kio_string to string table if kio_entry is between STRING and
88 * STRING+15. EINVAL is possible if there are invalid arguments.
90 #if defined(__i386) || defined(__i386_COMPAT)
91 #define KIOCSETKEY (KIOC|31) /* avoid conflict with "SETFKEY" */
93 #define KIOCSETKEY (KIOC|1)
97 * Get kio_tablemask table's kio_station to kio_entry.
98 * Get kio_string from string table if kio_entry is between STRING and
99 * STRING+15. EINVAL is possible if there are invalid arguments.
101 #if defined(__i386) || defined(__i386_COMPAT)
102 #define KIOCGETKEY (KIOC|32) /* avoid conflict with "GIO_SCRNMAP" */
104 #define KIOCGETKEY (KIOC|2)
108 * Send the keyboard device a control command. sys/kbd.h contains
109 * the constants that define the commands. Normal values are:
110 * KBD_CMD_BELL, KBD_CMD_NOBELL, KBD_CMD_CLICK, KBD_CMD_NOCLICK.
111 * Inappropriate commands for particular keyboard types are ignored.
113 * Since there is no reliable way to get the state of the bell or click
114 * or LED (because we can't query the kdb, and also one could do writes
115 * to the appropriate serial driver--thus going around this ioctl)
116 * we don't provide an equivalent state querying ioctl.
118 #define KIOCCMD (KIOC|8)
121 * Get keyboard type. Return values are one of KB_* from sys/kbd.h,
122 * e.g., KB_KLUNK, KB_VT100, KB_SUN2, KB_SUN3, KB_SUN4, KB_ASCII.
123 * -1 means that the type is not known.
125 #define KIOCTYPE (KIOC|9) /* get keyboard type */
128 * Set flag indicating whether keystrokes get routed to /dev/console.
130 #define KIOCSDIRECT (KIOC|10)
133 * Get flag indicating whether keystrokes get routed to /dev/console.
135 #if defined(__i386) || defined(__i386_COMPAT)
136 #define KIOCGDIRECT (KIOC|41) /* avoid conflict with "GIO_STRMAP" */
138 #define KIOCGDIRECT (KIOC|11)
142 * New-style key map entry.
145 int kio_tablemask
; /* Translation table (one of: 0, CAPSMASK, */
146 /* SHIFTMASK, CTRLMASK, UPMASK, */
148 uchar_t kio_station
; /* Physical keyboard key station (0-127) */
149 ushort_t kio_entry
; /* Translation table station's entry */
150 char kio_string
[10]; /* Value for STRING entries (null terminated) */
154 * Set kio_tablemask table's kio_station to kio_entry.
155 * Copy kio_string to string table if kio_entry is between STRING and
156 * STRING+15. EINVAL is possible if there are invalid arguments.
158 #if defined(__i386) || defined(__i386_COMPAT)
159 #define KIOCSKEY (KIOC|42) /* avoid conflict with "PIO_STRMAP" */
161 #define KIOCSKEY (KIOC|12)
165 * Get kio_tablemask table's kio_station to kio_entry.
166 * Get kio_string from string table if kio_entry is between STRING and
167 * STRING+15. EINVAL is possible if there are invalid arguments.
169 #define KIOCGKEY (KIOC|13)
172 * Set and get LED state.
174 #define KIOCSLED (KIOC|14)
175 #define KIOCGLED (KIOC|15)
178 * Set and get compatibility mode.
180 #define KIOCSCOMPAT (KIOC|16)
181 #define KIOCGCOMPAT (KIOC|17)
184 * Set and get keyboard layout.
186 #define KIOCSLAYOUT (KIOC|19)
187 #define KIOCLAYOUT (KIOC|20)
192 * Enable/Disable/Alternate Keyboard abort effect (Stop/A, Break or other seq).
193 * The argument is a pointer to an integer. If the integer is zero,
194 * keyboard abort is disabled, one will enable keyboard abort (hardware BREAK
195 * signal), two will revert to the Alternative Break Sequence. NB: This ioctl
196 * requires root credentials and applies to serial input devices and keyboards.
197 * When the Alternative Break Sequence is enabled it applies to serial input
200 #define KIOCSKABORTEN (KIOC|21)
202 #define KIOCABORTDISABLE 0 /* Disable Aborts */
203 #define KIOCABORTENABLE 1 /* Enable BREAK Signal Aborts */
204 #define KIOCABORTALTERNATE 2 /* Enable Alternative Aborts */
207 * Get/Set Keyboard autorepeat delay/rate.
208 * Use millisecond as unit used by the user-level application
210 #define KIOCGRPTDELAY (KIOC|22)
211 #define KIOCSRPTDELAY (KIOC|23)
212 #define KIOCGRPTRATE (KIOC|24)
213 #define KIOCSRPTRATE (KIOC|25)
215 /* Set keyboard and console beeper frequencies */
216 #define KIOCSETFREQ (KIOC|26)
218 /* Beeper type for struct freq_request */
219 enum fr_beep_type
{CONSOLE_BEEP
= 1, KBD_BEEP
= 2};
221 /* Frequency request structure */
222 struct freq_request
{
223 enum fr_beep_type type
; /* Beeper type */
224 int16_t freq
; /* Frequency */
227 #define KIOCMKTONE (KIOC|27)
230 * For historical reasons, the frequency argument to KIOCMKTONE is
231 * in i8254 clock cycles.
234 #define PIT_HZ 1193182 /* 8254's cycles per second */
236 #define KDMKTONE KIOCMKTONE
238 /* Used to control the AutoRepeat Min-delay and Min-Rate */
239 #define KIOCRPTDELAY_MIN (100)
240 #define KIOCRPTRATE_MIN (1)
246 #endif /* _SYS_KBIO_H */