xref: /onnv-gate/usr/src/uts/common/sys/kbio.h (revision 0:68f95e015346)
1*0Sstevel@tonic-gate /*
2*0Sstevel@tonic-gate  * CDDL HEADER START
3*0Sstevel@tonic-gate  *
4*0Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
5*0Sstevel@tonic-gate  * Common Development and Distribution License, Version 1.0 only
6*0Sstevel@tonic-gate  * (the "License").  You may not use this file except in compliance
7*0Sstevel@tonic-gate  * with the License.
8*0Sstevel@tonic-gate  *
9*0Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10*0Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
11*0Sstevel@tonic-gate  * See the License for the specific language governing permissions
12*0Sstevel@tonic-gate  * and limitations under the License.
13*0Sstevel@tonic-gate  *
14*0Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
15*0Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16*0Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
17*0Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
18*0Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
19*0Sstevel@tonic-gate  *
20*0Sstevel@tonic-gate  * CDDL HEADER END
21*0Sstevel@tonic-gate  */
22*0Sstevel@tonic-gate /*
23*0Sstevel@tonic-gate  * Copyright 2004 Sun Microsystems, Inc.  All rights reserved.
24*0Sstevel@tonic-gate  * Use is subject to license terms.
25*0Sstevel@tonic-gate  */
26*0Sstevel@tonic-gate 
27*0Sstevel@tonic-gate #ifndef _SYS_KBIO_H
28*0Sstevel@tonic-gate #define	_SYS_KBIO_H
29*0Sstevel@tonic-gate 
30*0Sstevel@tonic-gate #pragma ident	"%Z%%M%	%I%	%E% SMI"	/* SunOS4.0 1.23 */
31*0Sstevel@tonic-gate 
32*0Sstevel@tonic-gate #ifdef	__cplusplus
33*0Sstevel@tonic-gate extern "C" {
34*0Sstevel@tonic-gate #endif
35*0Sstevel@tonic-gate 
36*0Sstevel@tonic-gate /*
37*0Sstevel@tonic-gate  * Keyboard related ioctls
38*0Sstevel@tonic-gate  */
39*0Sstevel@tonic-gate 
40*0Sstevel@tonic-gate /*
41*0Sstevel@tonic-gate  * See sys/kbd.h for TR_NONE (don't translate) and TR_ASCII
42*0Sstevel@tonic-gate  * (translate to ASCII) TR_EVENT (translate to virtual input
43*0Sstevel@tonic-gate  * device codes)
44*0Sstevel@tonic-gate  */
45*0Sstevel@tonic-gate #define	KIOC		('k'<<8)
46*0Sstevel@tonic-gate 
47*0Sstevel@tonic-gate #if defined(__i386) || defined(__i386_COMPAT)
48*0Sstevel@tonic-gate 
49*0Sstevel@tonic-gate /*
50*0Sstevel@tonic-gate  * For x86, these numbers conflict with KD "Xenix" ioctl numbers, so each
51*0Sstevel@tonic-gate  * conflicting command has been offset by 30.
52*0Sstevel@tonic-gate  */
53*0Sstevel@tonic-gate #define	KIOCTRANS	(KIOC|30)	/* set keyboard translation */
54*0Sstevel@tonic-gate #define	KIOCGTRANS	(KIOC|35)	/* get keyboard translation */
55*0Sstevel@tonic-gate #define	KIOCTRANSABLE	(KIOC|36) 	/* set keyboard translatability */
56*0Sstevel@tonic-gate #define	KIOCGTRANSABLE	(KIOC|37)	/* get keyboard translatability */
57*0Sstevel@tonic-gate 
58*0Sstevel@tonic-gate #else	/* __i386 || __i386_COMPAT */
59*0Sstevel@tonic-gate 
60*0Sstevel@tonic-gate #define	KIOCTRANS	(KIOC|0)	/* set keyboard translation */
61*0Sstevel@tonic-gate #define	KIOCGTRANS	(KIOC|5)	/* get keyboard translation */
62*0Sstevel@tonic-gate #define	KIOCTRANSABLE	(KIOC|6) 	/* set keyboard translatability */
63*0Sstevel@tonic-gate #define	KIOCGTRANSABLE	(KIOC|7)	/* get keyboard translatability */
64*0Sstevel@tonic-gate 
65*0Sstevel@tonic-gate #endif	/* __i386 || __i386_COMPAT */
66*0Sstevel@tonic-gate 
67*0Sstevel@tonic-gate 
68*0Sstevel@tonic-gate #define	TR_CANNOT	0	/* Cannot translate keyboard using tables */
69*0Sstevel@tonic-gate #define	TR_CAN		1	/* Can translate keyboard using tables */
70*0Sstevel@tonic-gate 
71*0Sstevel@tonic-gate /*
72*0Sstevel@tonic-gate  * Old-style keymap entry, for backwards compatibility only.
73*0Sstevel@tonic-gate  */
74*0Sstevel@tonic-gate struct	kiockey {
75*0Sstevel@tonic-gate 	int	kio_tablemask;	/* Translation table (one of: 0, CAPSMASK, */
76*0Sstevel@tonic-gate 				/* SHIFTMASK, CTRLMASK, UPMASK, */
77*0Sstevel@tonic-gate 				/* ALTGRAPHMASK, NUMLOCKMASK) */
78*0Sstevel@tonic-gate #define	KIOCABORT1	-1	/* Special "mask": abort1 keystation */
79*0Sstevel@tonic-gate #define	KIOCABORT2	-2	/* Special "mask": abort2 keystation */
80*0Sstevel@tonic-gate #define	KIOCABORT1A	-3	/* Special "mask": alt abort1 keystation */
81*0Sstevel@tonic-gate 	uchar_t	kio_station;	/* Physical keyboard key station (0-127) */
82*0Sstevel@tonic-gate 	uchar_t	kio_entry;	/* Translation table station's entry */
83*0Sstevel@tonic-gate 	char	kio_string[10];	/* Value for STRING entries (null terminated) */
84*0Sstevel@tonic-gate };
85*0Sstevel@tonic-gate 
86*0Sstevel@tonic-gate /*
87*0Sstevel@tonic-gate  * Set kio_tablemask table's kio_station to kio_entry.
88*0Sstevel@tonic-gate  * Copy kio_string to string table if kio_entry is between STRING and
89*0Sstevel@tonic-gate  * STRING+15.  EINVAL is possible if there are invalid arguments.
90*0Sstevel@tonic-gate  */
91*0Sstevel@tonic-gate #if defined(__i386) || defined(__i386_COMPAT)
92*0Sstevel@tonic-gate #define	KIOCSETKEY	(KIOC|31)	/* avoid conflict with "SETFKEY" */
93*0Sstevel@tonic-gate #else
94*0Sstevel@tonic-gate #define	KIOCSETKEY	(KIOC|1)
95*0Sstevel@tonic-gate #endif
96*0Sstevel@tonic-gate 
97*0Sstevel@tonic-gate /*
98*0Sstevel@tonic-gate  * Get kio_tablemask table's kio_station to kio_entry.
99*0Sstevel@tonic-gate  * Get kio_string from string table if kio_entry is between STRING and
100*0Sstevel@tonic-gate  * STRING+15.  EINVAL is possible if there are invalid arguments.
101*0Sstevel@tonic-gate  */
102*0Sstevel@tonic-gate #if defined(__i386) || defined(__i386_COMPAT)
103*0Sstevel@tonic-gate #define	KIOCGETKEY	(KIOC|32)	/* avoid conflict with "GIO_SCRNMAP" */
104*0Sstevel@tonic-gate #else
105*0Sstevel@tonic-gate #define	KIOCGETKEY	(KIOC|2)
106*0Sstevel@tonic-gate #endif
107*0Sstevel@tonic-gate 
108*0Sstevel@tonic-gate /*
109*0Sstevel@tonic-gate  * Send the keyboard device a control command.  sys/kbd.h contains
110*0Sstevel@tonic-gate  * the constants that define the commands.  Normal values are:
111*0Sstevel@tonic-gate  * KBD_CMD_BELL, KBD_CMD_NOBELL, KBD_CMD_CLICK, KBD_CMD_NOCLICK.
112*0Sstevel@tonic-gate  * Inappropriate commands for particular keyboard types are ignored.
113*0Sstevel@tonic-gate  *
114*0Sstevel@tonic-gate  * Since there is no reliable way to get the state of the bell or click
115*0Sstevel@tonic-gate  * or LED (because we can't query the kdb, and also one could do writes
116*0Sstevel@tonic-gate  * to the appropriate serial driver--thus going around this ioctl)
117*0Sstevel@tonic-gate  * we don't provide an equivalent state querying ioctl.
118*0Sstevel@tonic-gate  */
119*0Sstevel@tonic-gate #define	KIOCCMD		(KIOC|8)
120*0Sstevel@tonic-gate 
121*0Sstevel@tonic-gate /*
122*0Sstevel@tonic-gate  * Get keyboard type.  Return values are one of KB_* from sys/kbd.h,
123*0Sstevel@tonic-gate  * e.g., KB_KLUNK, KB_VT100, KB_SUN2, KB_SUN3, KB_SUN4, KB_ASCII.
124*0Sstevel@tonic-gate  * -1 means that the type is not known.
125*0Sstevel@tonic-gate  */
126*0Sstevel@tonic-gate #define	KIOCTYPE	(KIOC|9)	/* get keyboard type */
127*0Sstevel@tonic-gate 
128*0Sstevel@tonic-gate /*
129*0Sstevel@tonic-gate  * Set flag indicating whether keystrokes get routed to /dev/console.
130*0Sstevel@tonic-gate  */
131*0Sstevel@tonic-gate #define	KIOCSDIRECT	(KIOC|10)
132*0Sstevel@tonic-gate 
133*0Sstevel@tonic-gate /*
134*0Sstevel@tonic-gate  * Get flag indicating whether keystrokes get routed to /dev/console.
135*0Sstevel@tonic-gate  */
136*0Sstevel@tonic-gate #if defined(__i386) || defined(__i386_COMPAT)
137*0Sstevel@tonic-gate #define	KIOCGDIRECT	(KIOC|41)	/* avoid conflict with "GIO_STRMAP" */
138*0Sstevel@tonic-gate #else
139*0Sstevel@tonic-gate #define	KIOCGDIRECT	(KIOC|11)
140*0Sstevel@tonic-gate #endif
141*0Sstevel@tonic-gate 
142*0Sstevel@tonic-gate /*
143*0Sstevel@tonic-gate  * New-style key map entry.
144*0Sstevel@tonic-gate  */
145*0Sstevel@tonic-gate struct kiockeymap {
146*0Sstevel@tonic-gate 	int	kio_tablemask;	/* Translation table (one of: 0, CAPSMASK, */
147*0Sstevel@tonic-gate 				/*  SHIFTMASK, CTRLMASK, UPMASK, */
148*0Sstevel@tonic-gate 				/*  ALTGRAPHMASK) */
149*0Sstevel@tonic-gate 	uchar_t	kio_station;	/* Physical keyboard key station (0-127) */
150*0Sstevel@tonic-gate 	ushort_t kio_entry;	/* Translation table station's entry */
151*0Sstevel@tonic-gate 	char	kio_string[10];	/* Value for STRING entries (null terminated) */
152*0Sstevel@tonic-gate };
153*0Sstevel@tonic-gate 
154*0Sstevel@tonic-gate /*
155*0Sstevel@tonic-gate  * Set kio_tablemask table's kio_station to kio_entry.
156*0Sstevel@tonic-gate  * Copy kio_string to string table if kio_entry is between STRING and
157*0Sstevel@tonic-gate  * STRING+15.  EINVAL is possible if there are invalid arguments.
158*0Sstevel@tonic-gate  */
159*0Sstevel@tonic-gate #if defined(__i386) || defined(__i386_COMPAT)
160*0Sstevel@tonic-gate #define	KIOCSKEY	(KIOC|42)	/* avoid conflict with "PIO_STRMAP" */
161*0Sstevel@tonic-gate #else
162*0Sstevel@tonic-gate #define	KIOCSKEY	(KIOC|12)
163*0Sstevel@tonic-gate #endif
164*0Sstevel@tonic-gate 
165*0Sstevel@tonic-gate /*
166*0Sstevel@tonic-gate  * Get kio_tablemask table's kio_station to kio_entry.
167*0Sstevel@tonic-gate  * Get kio_string from string table if kio_entry is between STRING and
168*0Sstevel@tonic-gate  * STRING+15.  EINVAL is possible if there are invalid arguments.
169*0Sstevel@tonic-gate  */
170*0Sstevel@tonic-gate #define	KIOCGKEY	(KIOC|13)
171*0Sstevel@tonic-gate 
172*0Sstevel@tonic-gate /*
173*0Sstevel@tonic-gate  * Set and get LED state.
174*0Sstevel@tonic-gate  */
175*0Sstevel@tonic-gate #define	KIOCSLED	(KIOC|14)
176*0Sstevel@tonic-gate #define	KIOCGLED	(KIOC|15)
177*0Sstevel@tonic-gate 
178*0Sstevel@tonic-gate /*
179*0Sstevel@tonic-gate  * Set and get compatibility mode.
180*0Sstevel@tonic-gate  */
181*0Sstevel@tonic-gate #define	KIOCSCOMPAT	(KIOC|16)
182*0Sstevel@tonic-gate #define	KIOCGCOMPAT	(KIOC|17)
183*0Sstevel@tonic-gate 
184*0Sstevel@tonic-gate /*
185*0Sstevel@tonic-gate  * Set and get keyboard layout.
186*0Sstevel@tonic-gate  */
187*0Sstevel@tonic-gate #define	KIOCSLAYOUT	(KIOC|19)
188*0Sstevel@tonic-gate #define	KIOCLAYOUT	(KIOC|20)
189*0Sstevel@tonic-gate 
190*0Sstevel@tonic-gate /*
191*0Sstevel@tonic-gate  * KIOCSKABORTEN:
192*0Sstevel@tonic-gate  *
193*0Sstevel@tonic-gate  * Enable/Disable/Alternate Keyboard abort effect (Stop/A, Break or other seq).
194*0Sstevel@tonic-gate  * The argument is a pointer to an integer.  If the integer is zero,
195*0Sstevel@tonic-gate  * keyboard abort is disabled, one will enable keyboard abort (hardware BREAK
196*0Sstevel@tonic-gate  * signal), two will revert to the Alternative Break Sequence.  NB: This ioctl
197*0Sstevel@tonic-gate  * requires root credentials and applies to serial input devices and keyboards.
198*0Sstevel@tonic-gate  * When the Alternative Break Sequence is enabled it applies to serial input
199*0Sstevel@tonic-gate  * devices ONLY.
200*0Sstevel@tonic-gate  */
201*0Sstevel@tonic-gate #define	KIOCSKABORTEN	(KIOC|21)
202*0Sstevel@tonic-gate 
203*0Sstevel@tonic-gate #define	KIOCABORTDISABLE	0	/* Disable Aborts  */
204*0Sstevel@tonic-gate #define	KIOCABORTENABLE		1	/* Enable BREAK Signal Aborts  */
205*0Sstevel@tonic-gate #define	KIOCABORTALTERNATE	2	/* Enable Alternative Aborts   */
206*0Sstevel@tonic-gate 
207*0Sstevel@tonic-gate /*
208*0Sstevel@tonic-gate  * Get/Set Keyboard autorepeat delay/rate.
209*0Sstevel@tonic-gate  * Use millisecond as unit used by the user-level application
210*0Sstevel@tonic-gate  */
211*0Sstevel@tonic-gate #define	KIOCGRPTDELAY	(KIOC|22)
212*0Sstevel@tonic-gate #define	KIOCSRPTDELAY	(KIOC|23)
213*0Sstevel@tonic-gate #define	KIOCGRPTRATE	(KIOC|24)
214*0Sstevel@tonic-gate #define	KIOCSRPTRATE	(KIOC|25)
215*0Sstevel@tonic-gate 
216*0Sstevel@tonic-gate /* Used to control the AutoRepeat Min-delay and Min-Rate */
217*0Sstevel@tonic-gate #define	KIOCRPTDELAY_MIN	(300)
218*0Sstevel@tonic-gate #define	KIOCRPTRATE_MIN		(30)
219*0Sstevel@tonic-gate 
220*0Sstevel@tonic-gate #ifdef	__cplusplus
221*0Sstevel@tonic-gate }
222*0Sstevel@tonic-gate #endif
223*0Sstevel@tonic-gate 
224*0Sstevel@tonic-gate #endif	/* _SYS_KBIO_H */
225