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