summaryrefslogtreecommitdiff
path: root/usr/src/man/man7m/kb.7m
blob: fa59d64cbe12577b4f71c88ba2b5afbabea1ffd8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
'\" te
.\"  All Rights Reserved Copyright (c) 2004, Sun Microsystems, Inc.  All Rights Reserved
.\" 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 or http://www.opensolaris.org/os/licensing.  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]
.TH KB 7M "Feb 26, 2004"
.SH NAME
kb \- keyboard STREAMS module
.SH SYNOPSIS
.LP
.nf
#include <sys/types.h>
.fi

.LP
.nf
#include <sys/stream.h>
.fi

.LP
.nf
#include <sys/stropts.h>
.fi

.LP
.nf
#include <sys/vuid_event.h>
.fi

.LP
.nf
#include <sys/kbio.h>
.fi

.LP
.nf
#include <sys/kbd.h>
.fi

.LP
.nf
ioctl(fd, I_PUSH, "kb");
.fi

.SH DESCRIPTION
.sp
.LP
The \fBkb\fR STREAMS module processes byte streams generated by a keyboard
attached to a \fBCPU\fR serial port. Definitions for altering keyboard
translation and reading events from the keyboard are contained in
<\fBsys/kbio.h\fR> and <\fBsys/kbd.h\fR>.
.sp
.LP
The \fBkb\fR STREAMS module utilizes a set of keyboard tables to recognize
which keys have been typed. Each translation table is an array of 128 16-bit
words (\fBunsigned short\fRs). If a table entry is less than 0x100, the entry
is treated as an \fBISO\fR 8859/1 character. Higher values indicate special
characters that invoke more complicated actions.
.SS "Keyboard Translation Mode"
.sp
.LP
The keyboard can be in one of the following translation modes:
.sp
.ne 2
.na
\fB\fBTR_NONE\fR \fR
.ad
.RS 21n
Keyboard translation is turned off and up/down key codes are reported.
.RE

.sp
.ne 2
.na
\fB\fBTR_ASCII\fR \fR
.ad
.RS 21n
\fBISO\fR 8859/1 codes are reported.
.RE

.sp
.ne 2
.na
\fB\fBTR_EVENT\fR \fR
.ad
.RS 21n
\fBfirm_events\fR are reported.
.RE

.sp
.ne 2
.na
\fB\fBTR_UNTRANS_EVENT\fR \fR
.ad
.RS 21n
\fBfirm_events\fR containing unencoded keystation codes are reported for all
input events within the window system.
.RE

.SS "Keyboard Translation-Table Entries"
.sp
.LP
All instances of the \fBkb\fR module share seven translation tables that
convert raw keystation codes to event values. The tables are:
.sp
.ne 2
.na
\fBUnshifted\fR
.ad
.RS 14n
Used when a key is depressed and no shifts are in effect.
.RE

.sp
.ne 2
.na
\fBShifted\fR
.ad
.RS 14n
Used when a key is depressed and a Shift key is held down.
.RE

.sp
.ne 2
.na
\fBCaps Lock\fR
.ad
.RS 14n
Used when a key is depressed and Caps Lock is in effect.
.RE

.sp
.ne 2
.na
\fBAlt Graph\fR
.ad
.RS 14n
Used when a key is depressed and the Alt Graph key is held down.
.RE

.sp
.ne 2
.na
\fBNum Lock\fR
.ad
.RS 14n
Used when a key is depressed and Num Lock is in effect.
.RE

.sp
.ne 2
.na
\fBControlled\fR
.ad
.RS 14n
Used when a key is depressed and the Control key is held down. (Regardless of
whether a Shift key or the Alt Graph is being held down, or whether Caps Lock
or Num Lock is in effect).
.RE

.sp
.ne 2
.na
\fBKey Up\fR
.ad
.RS 14n
Used when a key is released.
.RE

.sp
.LP
Each key on the keyboard has a \fBkey station\fR code that represents a number
from 0 to 127. The number is used as an index into the translation table that
is currently in effect. If the corresponding entry in the translation table is
a value from 0 to 255, the value is treated as an \fBISO\fR 8859/1 character,
and the character is the result of the translation.
.sp
.LP
If the entry in the translation table is higher than 255, it is a special
entry. Special entry values are classified according to the value of the
high-order bits. The high-order value for each class is defined as a constant,
as shown below. When added to the constant, the value of the low-order bits
distinguish between keys within each class:
.sp
.ne 2
.na
\fBSHIFTKEYS 0x100 \fR
.ad
.RS 20n
A shift key. The value of the particular shift key is added to determine which
shift mask to apply:
.sp
.ne 2
.na
\fB\fBCAPSLOCK 0\fR \fR
.ad
.RS 17n
Caps Lock key.
.RE

.sp
.ne 2
.na
\fB\fBSHIFTLOCK 1\fR \fR
.ad
.RS 17n
"Shift Lock" key.
.RE

.sp
.ne 2
.na
\fB\fBLEFTSHIFT 2\fR \fR
.ad
.RS 17n
Left-hand Shift key.
.RE

.sp
.ne 2
.na
\fB\fBRIGHTSHIFT 3\fR \fR
.ad
.RS 17n
Right-hand Shift key.
.RE

.sp
.ne 2
.na
\fB\fBLEFTCTRL 4\fR \fR
.ad
.RS 17n
Left-hand (or only) Control key.
.RE

.sp
.ne 2
.na
\fB\fBRIGHTCTRL 5\fR \fR
.ad
.RS 17n
Right-hand Control key.
.RE

.sp
.ne 2
.na
\fB\fBALTGRAPH 9\fR \fR
.ad
.RS 17n
 Alt Graph key.
.RE

.sp
.ne 2
.na
\fB\fBALT 10\fR \fR
.ad
.RS 17n
 Alternate or Alt key.
.RE

.sp
.ne 2
.na
\fB\fBNUMLOCK 11\fR \fR
.ad
.RS 17n
 Num Lock key.
.RE

.RE

.sp
.ne 2
.na
\fB\fBBUCKYBITS 0x200\fR \fR
.ad
.RS 20n
Used to toggle mode-key-up/down status without altering the value of an
accompanying \fBISO\fR 8859/1 character. The actual bit-position value, minus
7, is added.
.sp
.ne 2
.na
\fB\fBMETABIT 0\fR \fR
.ad
.RS 16n
The Meta key was pressed along with the key. This is the only user-accessible
bucky bit. It is ORed in as the 0x80 bit; since this bit is a legitimate bit in
a character, the only way to distinguish between, for example, 0xA0 as
\fBMETA+0x20\fR and 0xA0 as an 8-bit character is to watch for META key up and
META key down events and keep track of whether the \fBMETA\fR key was down.
.RE

.sp
.ne 2
.na
\fB\fBSYSTEMBIT 1\fR \fR
.ad
.RS 16n
The System key was pressed. This is a place holder to indicate which key is the
system-abort key.
.RE

.RE

.sp
.ne 2
.na
\fB\fBFUNNY 0x300\fR \fR
.ad
.RS 20n
Performs various functions depending on the value of the low 4 bits:
.sp
.ne 2
.na
\fB\fBNOP 0x300\fR \fR
.ad
.RS 20n
Does nothing.
.RE

.sp
.ne 2
.na
\fB\fBOOPS 0x301\fR \fR
.ad
.RS 20n
Exists, but is undefined.
.RE

.sp
.ne 2
.na
\fB\fBHOLE 0x302\fR \fR
.ad
.RS 20n
There is no key in this position on the keyboard, and the position-code should
not be used.
.RE

.sp
.ne 2
.na
\fB\fBRESET 0x306\fR \fR
.ad
.RS 20n
Keyboard reset.
.RE

.sp
.ne 2
.na
\fB\fBERROR 0x307\fR \fR
.ad
.RS 20n
The keyboard driver detected an internal error.
.RE

.sp
.ne 2
.na
\fB\fBIDLE 0x308\fR \fR
.ad
.RS 20n
The keyboard is idle (no keys down).
.RE

.sp
.ne 2
.na
\fB\fBCOMPOSE 0x309\fR \fR
.ad
.RS 20n
The \fBCOMPOSE\fR key; the next two keys should comprise a two-character
COMPOSE key sequence.
.RE

.sp
.ne 2
.na
\fB\fBNONL 0x30A\fR \fR
.ad
.RS 20n
Used only in the Num Lock table; indicates that this key is not affected by the
Num Lock state, so that the translation table to use to translate this key
should be the one that would have been used had Num Lock not been in effect.
.RE

.sp
.ne 2
.na
\fB0x30B \(em 0x30F\fR
.ad
.RS 20n
Reserved for non-parameterized functions.
.RE

.RE

.sp
.ne 2
.na
\fB\fBFA_CLASS 0x400\fR \fR
.ad
.RS 20n
A floating accent or "dead key." When this key is pressed, the next key
generates an event for an accented character; for example, "floating accent
grave" followed by the "a" key generates an event with the \fBISO\fR 8859/1
code for the "a with grave accent" character. The low-order bits indicate which
accent; the codes for the individual "floating accents" are as follows:
.sp
.ne 2
.na
\fB\fBFA_UMLAUT 0x400\fR \fR
.ad
.RS 21n
umlaut
.RE

.sp
.ne 2
.na
\fB\fBFA_CFLEX 0x401\fR \fR
.ad
.RS 21n
circumflex
.RE

.sp
.ne 2
.na
\fB\fBFA_TILDE 0x402\fR \fR
.ad
.RS 21n
tilde
.RE

.sp
.ne 2
.na
\fB\fBFA_CEDILLA 0x403\fR \fR
.ad
.RS 21n
cedilla
.RE

.sp
.ne 2
.na
\fB\fBFA_ACUTE 0x404\fR \fR
.ad
.RS 21n
acute accent
.RE

.sp
.ne 2
.na
\fB\fBFA_GRAVE 0x405\fR \fR
.ad
.RS 21n
grave accent
.RE

.RE

.sp
.ne 2
.na
\fB\fBSTRING 0x500\fR \fR
.ad
.RS 20n
The low-order bits index a table of strings. When a key with a \fBSTRING\fR
entry is depressed, the characters in the null-terminated string for that key
are sent, character-by-character. The maximum length is defined as:
.sp
.ne 2
.na
\fBKTAB_STRLEN \fR
.ad
.RS 16n
10
.RE

Individual string numbers are defined as:
.sp
.ne 2
.na
\fBHOMEARROW \fR
.ad
.RS 15n
0x00
.RE

.sp
.ne 2
.na
\fB\fBUPARROW\fR \fR
.ad
.RS 15n
0x01
.RE

.sp
.ne 2
.na
\fB\fBDOWNARROW\fR \fR
.ad
.RS 15n
0x02
.RE

.sp
.ne 2
.na
\fB\fBLEFTARROW\fR \fR
.ad
.RS 15n
0x03
.RE

.sp
.ne 2
.na
\fB\fBRIGHTARROW\fR \fR
.ad
.RS 15n
0x04
.RE

String numbers 0x05 \(em 0x0F are available for custom entries.
.RE

.sp
.ne 2
.na
\fB\fBFUNCKEYS 0x600\fR \fR
.ad
.RS 20n
There are 64 keys reserved for function keys. The actual positions are usually
on the left/right/top/bottom of the keyboard.
.sp
The next-to-lowest 4 bits indicate the group of function keys:
.sp
.ne 2
.na
\fB\fBLEFTFUNC \fR \fR
.ad
.RS 18n
0x600
.RE

.sp
.ne 2
.na
\fB\fBRIGHTFUNC \fR \fR
.ad
.RS 18n
0x610
.RE

.sp
.ne 2
.na
\fB\fBTOPFUNC 0x610\fR \fR
.ad
.RS 18n
0x610
.RE

.sp
.ne 2
.na
\fB\fBBOTTOMFUNC \fR \fR
.ad
.RS 18n
0x630
.RE

The low 4 bits indicate the function key number within the group:
.sp
.ne 2
.na
\fBLF(\fIn\fR)\fR
.ad
.RS 10n
(LEFTFUNC+(\fIn\fR)-1)
.RE

.sp
.ne 2
.na
\fBRF(\fIn\fR) \fR
.ad
.RS 10n
(RIGHTFUNC+(\fIn\fR)-1)
.RE

.sp
.ne 2
.na
\fBTF(\fIn\fR) \fR
.ad
.RS 10n
(TOPFUNC+(\fIn\fR)-1)
.RE

.sp
.ne 2
.na
\fBBF(\fIn\fR) \fR
.ad
.RS 10n
(BOTTOMFUNC+(\fIn\fR)-1)
.RE

.RE

.sp
.ne 2
.na
\fB\fBPADKEYS 0x700\fR \fR
.ad
.RS 18n
A "numeric keypad key." These entries should appear only in the Num Lock
translation table; when Num Lock is in effect, these events will be generated
by pressing keys on the right-hand keypad. The low-order bits indicate which
key. The codes for the individual keys are:
.sp
.ne 2
.na
\fB\fBPADEQUAL 0x700\fR \fR
.ad
.RS 19n
"=" key
.RE

.sp
.ne 2
.na
\fB\fBPADSLASH 0x701\fR \fR
.ad
.RS 19n
"/" key
.RE

.sp
.ne 2
.na
\fB\fBPADSTAR 0x702\fR \fR
.ad
.RS 19n
"*" key
.RE

.sp
.ne 2
.na
\fB\fBPADMINUS 0x703\fR \fR
.ad
.RS 19n
"-" key
.RE

.sp
.ne 2
.na
\fB\fBPADSEP 0x704\fR \fR
.ad
.RS 19n
"," key
.RE

.sp
.ne 2
.na
\fB\fBPAD7 0x705\fR \fR
.ad
.RS 19n
"7" key
.RE

.sp
.ne 2
.na
\fB\fBPAD8 0x706\fR \fR
.ad
.RS 19n
"8" key
.RE

.sp
.ne 2
.na
\fB\fBPAD9 0x707\fR \fR
.ad
.RS 19n
"9" key
.RE

.sp
.ne 2
.na
\fB\fBPADPLUS 0x708\fR \fR
.ad
.RS 19n
"+" key
.RE

.sp
.ne 2
.na
\fB\fBPAD4 0x709\fR \fR
.ad
.RS 19n
"4" key
.RE

.sp
.ne 2
.na
\fB\fBPAD5 0x70A\fR \fR
.ad
.RS 19n
"5" key
.RE

.sp
.ne 2
.na
\fB\fBPAD6 0x70B\fR \fR
.ad
.RS 19n
"6" key
.RE

.sp
.ne 2
.na
\fB\fBPAD1 0x70C\fR \fR
.ad
.RS 19n
"1" key
.RE

.sp
.ne 2
.na
\fB\fBPAD2 0x70D\fR \fR
.ad
.RS 19n
"2" key
.RE

.sp
.ne 2
.na
\fB\fBPAD3 0x70E\fR \fR
.ad
.RS 19n
"3" key
.RE

.sp
.ne 2
.na
\fB\fBPAD0 0x70F\fR \fR
.ad
.RS 19n
"0" key
.RE

.sp
.ne 2
.na
\fB\fBPADDOT 0x710\fR \fR
.ad
.RS 19n
"." key
.RE

.sp
.ne 2
.na
\fB\fBPADENTER 0x711\fR \fR
.ad
.RS 19n
"Enter" key
.RE

.RE

.sp
.LP
When a function key is pressed in \fBTR_ASCII\fR mode, the following escape
sequence is sent:
.sp
.LP
\fBESC[0\|.\|.\|..\|9z\fR
.sp
.LP
where  \fBESC\fR is a single escape character and "0\|.\|..\|9" indicates the
decimal representation of the function-key value. For example, function key
\fBR1\fR sends the sequence:
.sp
.LP
\fBESC[208z\fR
.sp
.LP
because the decimal value of RF(1) is 208. In \fBTR_EVENT\fR mode, if there is
a \fBVUID\fR event code for the function key in question, an event with that
event code is generated; otherwise, individual events for the characters of the
escape sequence are generated.
.SS "Keyboard Compatibility Mode"
.sp
.LP
When started, the \fBkb\fR STREAMS module is in the compatibility mode. When
the keyboard is in the \fBTR_EVENT\fR translation mode, \fBISO\fR 8859/1
characters from the upper half of the character set (that is, characters with
the eighth bit set) , are presented as events with codes in the \fBISO_FIRST\fR
range (as defined in <\fB<sys/vuid_event.h>\fR>). For backwards compatibility
with older versions of the keyboard driver, the event code is \fBISO_FIRST\fR
plus the character value. When compatibility mode is turned off, \fBISO\fR
8859/1 characters are presented as events with codes equal to the character
code.
.SH DESCRIPTION
.sp
.LP
The following \fBioctl()\fR requests set and retrieve the current translation
mode of a keyboard:
.sp
.ne 2
.na
\fB\fBKIOCTRANS\fR \fR
.ad
.RS 15n
Pointer to an \fBint\fR. The translation mode is set to the value in the
\fBint\fR pointed to by the argument.
.RE

.sp
.ne 2
.na
\fB\fBKIOCGTRANS\fR \fR
.ad
.RS 15n
Pointer to an \fBint\fR. The current translation mode is stored in the
\fBint\fR pointed to by the argument.
.RE

.sp
.LP
\fBioctl()\fR requests for changing and retrieving entries from the keyboard
translation table use the \fBkiockeymap\fR structure:
.sp
.in +2
.nf
struct kiockeymap {
int	kio_tablemask;	/* Translation table (one of: 0, CAPSMASK,
			 * SHIFTMASK, CTRLMASK, UPMASK,
			 * ALTGRAPHMASK, NUMLOCKMASK)
			 */
#define KIOCABORT1 -1	  /* Special "mask": abort1 keystation */
#define KIOCABORT2 -2	  /* Special "mask": abort2 keystation */
	uchar_t kio_station; /* Physical keyboard key station (0-127) */
	ushort_t kio_entry;	   /* Translation table station's entry */
	char kio_string[10]; /* Value for STRING entries-null terminated */
};
.fi
.in -2

.sp
.ne 2
.na
\fB\fBKIOCSKEY\fR \fR
.ad
.RS 13n
Pointer to a \fBkiockeymap\fR structure. The translation table entry referred
to by the values in that structure is changed. The \fBkio_tablemask\fR request
specifies which of the following translation tables contains the entry to be
modified:
.sp
.ne 2
.na
\fB\fBUPMASK 0x0080\fR \fR
.ad
.sp .6
.RS 4n
"Key Up" translation table.
.RE

.sp
.ne 2
.na
\fB\fBNUMLOCKMASK 0x0800\fR \fR
.ad
.sp .6
.RS 4n
"Num Lock" translation table.
.RE

.sp
.ne 2
.na
\fB\fBCTRLMASK 0x0030\fR \fR
.ad
.sp .6
.RS 4n
"Controlled" translation table.
.RE

.sp
.ne 2
.na
\fB\fBALTGRAPHMASK 0x0200\fR \fR
.ad
.sp .6
.RS 4n
"Alt Graph" translation table.
.RE

.sp
.ne 2
.na
\fB\fBSHIFTMASK 0x000E\fR \fR
.ad
.sp .6
.RS 4n
"Shifted" translation table.
.RE

.sp
.ne 2
.na
\fB\fBCAPSMASK 0x0001\fR \fR
.ad
.sp .6
.RS 4n
"Caps Lock" translation table.
.RE

.sp
.ne 2
.na
\fB(No shift keys pressed or locked)\fR
.ad
.sp .6
.RS 4n
"Unshifted" translation table.
.RE

.RE

.sp
.LP
The \fBkio_station\fR request specifies the keystation code for the entry to be
modified. The value of \fBkio_entry\fR is stored in the entry in question. If
\fBkio_entry\fR is between \fBSTRING\fR and \fBSTRING+15,\fR the string
contained in \fBkio_string\fR is copied to the appropriate string table entry.
This call may return \fBEINVAL\fR if there are invalid arguments.
.sp
.LP
Special values of \fBkio_tablemask\fR can affect the two step "break to the
\fBPROM\fR monitor" sequence. The usual sequence is \fBL1\fR-\fBa\fR or
\fBStop\fR-. If \fBkio_tablemask\fR is \fBKIOCABORT1\fR, then the value of
\fBkio_station\fR is set to be the first keystation in the sequence. If
\fBkio_tablemask\fR, is \fBKIOCABORT2\fR then the value of \fBkio_station\fR is
set to be the second keystation in the sequence. An attempt to change the
"break to the  \fBPROM\fR monitor" sequence without having superuser permission
results in an  \fBEPERM\fR error.
.sp
.ne 2
.na
\fB\fBKIOCGKEY\fR \fR
.ad
.RS 13n
The argument is a pointer to a \fBkiockeymap\fR structure. The current value of
the keyboard translation table entry specified by \fBkio_tablemask\fR and
\fBkio_station\fR is stored in the structure pointed to by the argument. This
call may return \fBEINVAL\fR if there are invalid arguments.
.RE

.sp
.ne 2
.na
\fB\fBKIOCTYPE\fR \fR
.ad
.RS 13n
The argument is a pointer to an \fBint\fR. A code indicating the type of the
keyboard is stored in the \fBint\fR pointed to by the argument:
.sp
.ne 2
.na
\fB\fBKB_SUN3\fR \fR
.ad
.RS 14n
Sun Type 3 keyboard
.RE

.sp
.ne 2
.na
\fB\fBKB_SUN4\fR \fR
.ad
.RS 14n
Sun Type 4 or 5 keyboard, or non-USB Sun Type 6 keyboard
.RE

.sp
.ne 2
.na
\fB\fBKB_USB\fR \fR
.ad
.RS 14n
USB standard HID keyboard, including Sun Type 6 USB keyboards
.RE

.sp
.ne 2
.na
\fB\fBKB_ASCII\fR \fR
.ad
.RS 14n
ASCII terminal masquerading as keyboard
.RE

.sp
.ne 2
.na
\fB\fBKB_PC\fR \fR
.ad
.RS 14n
Type 101 PC keyboard
.RE

.sp
.ne 2
.na
\fB\fBKB_DEFAULT\fR\fR
.ad
.RS 14n
 Stored in the \fBint\fR pointed to by the argument if the keyboard type is
unknown. In case of error, -1 is stored in the \fBint\fR pointed to by the
argument.
.RE

.RE

.sp
.ne 2
.na
\fB\fBKIOCLAYOUT\fR \fR
.ad
.RS 15n
The argument is a pointer to an \fBint\fR. On a Sun Type 4 keyboard, the layout
code specified by the keyboard's \fBDIP\fR switches is stored in the \fBint\fR
pointed to by the argument.
.RE

.sp
.ne 2
.na
\fB\fBKIOCCMD\fR \fR
.ad
.RS 15n
The argument is a pointer to an \fBint\fR. The command specified by the value
of the \fBint\fR pointed to by the argument is sent to the keyboard. The
commands that can be sent are:
.sp
Commands to the Sun Type 3 and Sun Type 4 keyboards:
.sp
.ne 2
.na
\fB\fBKBD_CMD_RESET\fR \fR
.ad
.RS 20n
Reset keyboard as if power-up.
.RE

.sp
.ne 2
.na
\fB\fBKBD_CMD_BELL\fR \fR
.ad
.RS 20n
Turn on the bell.
.RE

.sp
.ne 2
.na
\fB\fBKBD_CMD_NOBELL\fR \fR
.ad
.RS 20n
Turn off the bell.
.RE

.sp
.ne 2
.na
\fB\fBKBD_CMD_CLICK\fR \fR
.ad
.RS 20n
Turn on the click annunciator.
.RE

.sp
.ne 2
.na
\fB\fBKBD_CMD_NOCLICK\fR \fR
.ad
.RS 20n
Turn off the click annunciator.
.RE

Commands to the Sun Type 4 keyboard:
.sp
.ne 2
.na
\fB\fBKBD_CMD_SETLED\fR \fR
.ad
.RS 22n
Set keyboard LEDs.
.RE

.sp
.ne 2
.na
\fB\fBKBD_CMD_GETLAYOUT\fR \fR
.ad
.RS 22n
Request that keyboard indicate layout.
.RE

.RE

.sp
.LP
Inappropriate commands for particular keyboard types are ignored. Since there
is no reliable way to get the state of the bell or click (because the keyboard
cannot be queried and a process could do writes to the appropriate serial
driver \(em circumventing this \fBioctl()\fR request) an equivalent
\fBioctl()\fR to query its state is not provided.
.sp
.ne 2
.na
\fB\fBKIOCSLED\fR \fR
.ad
.RS 13n
The argument is a pointer to an \fBchar\fR. On the Sun Type 4 keyboard, the
\fBLEDs\fR are set to the value specified in that \fBchar\fR. The values for
the four \fBLEDs\fR are:
.sp
.ne 2
.na
\fB\fBLED_CAPS_LOCK\fR \fR
.ad
.RS 20n
"Caps Lock" light.
.RE

.sp
.ne 2
.na
\fB\fBLED_COMPOSE\fR \fR
.ad
.RS 20n
"Compose" light.
.RE

.sp
.ne 2
.na
\fB\fBLED_SCROLL_LOCK\fR \fR
.ad
.RS 20n
"Scroll Lock" light.
.RE

.sp
.ne 2
.na
\fB\fBLED_NUM_LOCK\fR \fR
.ad
.RS 20n
"Num Lock" light.
.RE

On some Japanese layouts, the value for the fifth  \fBLED\fR is:
.sp
.ne 2
.na
\fB\fBLED_KANA\fR \fR
.ad
.RS 13n
"Kana" light.
.RE

.RE

.sp
.ne 2
.na
\fB\fBKIOCGLED\fR \fR
.ad
.RS 16n
Pointer to a \fBchar\fR. The current state of the \fBLEDs\fR is stored in the
\fBchar\fR pointed to by the argument.
.RE

.sp
.ne 2
.na
\fB\fBKIOCSCOMPAT\fR \fR
.ad
.RS 16n
Pointer to an \fBint\fR. "Compatibility mode" is turned on if the \fBint\fR has
a value of 1, and is turned off if the \fBint\fR has a value of 0.
.RE

.sp
.ne 2
.na
\fB\fBKIOCGCOMPAT\fR \fR
.ad
.RS 16n
Pointer to an \fBint\fR. The current state of "compatibility mode" is stored in
the \fBint\fR pointed to by the argument.
.RE

.sp
.LP
The following \fBioctl()\fR request allows the default effect of the keyboard
abort sequence to be changed.
.sp
.ne 2
.na
\fB\fBKIOCSKABORTEN\fR \fR
.ad
.RS 18n
Pointer to an \fBint\fR. The keyboard abort sequence effect (typically L1-A or
Stop-A on the keyboard on SPARC systems, F1-A on x86 systems, and BREAK on the
serial console device) is enabled if the \fBint\fR has a value of
KIOCABORTENABLE(1). If the value is KIOCABORTDISABLE(0) , the keyboard abort
sequence effect is disabled. If the value is KIOCABORTALTERNATE(2), the
Alternate Break sequence is in effect and is defined by the serial console
drivers \fBzs\fR(7D)\fBse\fR(7D) and \fBasy\fR(7D). Any other value of the
parameter for this \fBioctl()\fR is treated as \fBenable\fR. The Alternate
Break sequence is applicable to the serial console devices only.
.sp
Due to a risk of incorrect sequence interpretation, SLIP and certain other
binary protocols should not be run over the serial console port when Alternate
Break sequence is in effect. Although PPP is a binary protocol, it is able to
avoid these sequences using the ACCM feature in \fIRFC 1662\fR. For Solaris PPP
4.0, you do this by adding the following line to the \fB/etc/ppp/options\fR
file (or other configuration files used for the connection; see \fBpppd\fR(1M)
for details):
.sp
.in +2
.nf
asyncmap  0x00002000
.fi
.in -2

SLIP has no comparable capability, and must not be used if the Alternate Break
sequence is in use.
.sp
This \fBioctl()\fR will be active and retain state even if there is no physical
keyboard in the system. The default effect (\fBenable\fR) causes the operating
system to suspend and enter the kernel debugger (if present) or the system prom
(on most systems with OpenBoot proms). The default effect is enabled on most
systems, but may be different on server systems with key switches in
the 'secure' position. On these systems, the effect is always disabled when the key
switch is in the 'secure' position. This \fBioctl()\fRreturns \fBEPERM\fR if
the caller is not the superuser.
.RE

.sp
.LP
These \fBioctl()\fR requests are supported for compatibility with the system
keyboard device \fB/dev/kbd\fR.
.sp
.ne 2
.na
\fB\fBKIOCSDIRECT\fR \fR
.ad
.RS 16n
Has no effect.
.RE

.sp
.ne 2
.na
\fB\fBKIOCGDIRECT\fR \fR
.ad
.RS 16n
Always returns 1.
.RE

.sp
.LP
The following \fBioctl()\fR requests are used to set and get the keyboard
autorepeat delay and rate.
.sp
.ne 2
.na
\fB\fBKIOCSRPTDELAY\fR \fR
.ad
.RS 18n
This argument is a pointer to an int, which is the kb autorepeat delay, unit in
millisecond.
.RE

.sp
.ne 2
.na
\fB\fBKIOCGRPTDELAY\fR \fR
.ad
.RS 18n
This argument is a pointer to an int. The current auto repeat delay setting is
stored in the integer pointed by the argument, unit in millisecond.
.RE

.sp
.ne 2
.na
\fB\fBKIOCSRPTRATE\fR \fR
.ad
.RS 18n
This argument is a pointer to an int, which is the kb autorepeat rate, unit in
millisecond.
.RE

.sp
.ne 2
.na
\fB\fBKIOCGRPTRATE\fR \fR
.ad
.RS 18n
This argument is a pointer to an int. The current auto repeat rate setting is
stored in the integer pointed by the argument, unit in millisecond.
.RE

.SH ATTRIBUTES
.sp
.LP
See \fBattributes\fR(5) for descriptions of the following attributes:
.sp

.sp
.TS
box;
c | c
l | l .
ATTRIBUTE TYPE	ATTRIBUTE VALUE
_
Interface Stability	Stable
.TE

.SH SEE ALSO
.sp
.LP
\fBkbd\fR(1), \fBloadkeys\fR(1), \fBkadb\fR(1M), \fBpppd\fR(1M),
\fBkeytables\fR(4), \fBattributes\fR(5), \fBzs\fR(7D), \fBse\fR(7D),
\fBasy\fR(7D), \fBvirtualkm\fR(7D), \fBtermio\fR(7I), \fBusbkbm\fR(7M)
.SH NOTES
.sp
.LP
Many keyboards released after Sun Type 4 keyboard also report themselves  as
Sun Type 4 keyboards.