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
|
.\"
.\" Copyright (c) 1995 Joerg Wunsch
.\"
.\" All rights reserved.
.\"
.\" This program is free software.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\" notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\" notice, this list of conditions and the following disclaimer in the
.\" documentation and/or other materials provided with the distribution.
.\" 3. All advertising materials mentioning features or use of this software
.\" must display the following acknowledgement:
.\" This product includes software developed by Joerg Wunsch
.\" 4. The name of the developer may not be used to endorse or promote
.\" products derived from this software without specific prior written
.\" permission.
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY EXPRESS OR
.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
.\" IN NO EVENT SHALL THE DEVELOPERS BE LIABLE FOR ANY DIRECT, INDIRECT,
.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
.\"
.\" $Header: /cvs/OpenBSD/src/sys/arch/i386/isa/pcvt/Util/kbdio/Attic/kbdio.8,v 1.1 1995/10/18 08:50:45 deraadt Exp $
.\"
.Dd April 15, 1995
.Dt KBDIO 8
.Sh NAME
.Nm kbdio
.Nd perform input/output on a PC keyboard/keyboard controller
.Sh SYNOPSIS
.Nm kbdio
.Op Fl d
.Op Fl f Ar devname
.Sh DESCRIPTION
.Ss Purpose
.Nm Kbdio
is used to perform input/output on a PC keyboard or the
.Pq motherboard
keyboard controller.
.Nm Kbdio
cares for proper handshaking and necessary IO-ready conditions. It
allows the interpretion of some registers in symbolic form, as well as
to specify symbolic operands for the keyboard command byte. Simple
arithmetic expressions can be formed to set or reset some bits, which
is mostly applicable to the keyboard command byte, too.
.Ss Options
.Bl -tag -width 10n -offset indent -compact
.It Fl d
Turn on the grammar parser debugger.
.It Fl f Ar devname
Operate on device
.Ar devname
instead of the default
.Pa /dev/console .
.El
.Ss Command language
The command language of
.Nm
constitutes of some very simple tokens and rules. Commands are executed
line by line as they are entered. Each line may contain any number of
semicolon-separated statements.
The list of acceptable statements includes:
.Bl -tag -width "TYPEMATIC" -indent offset -compact
.It Li \&?
.It Li help
Give help on the general syntax.
.It Li help expr
Help on expression syntax.
.It Li status \&?
Report keyboard controller status.
.It Li what \&?
Determine
.Tn MCA
type 1 or type 2 keyboard controller.
.It Li data \&?
Fetch keyboard controller data port.
.It Li led \&= Ar number
Set keyboard LEDs.
.Ar Number
is a logical combination of
.Bl -hang -width "4" -compact
.It 1
scroll lock LED
.It 2
num lock LED
.It 4
caps lock LED.
.El
.It Li echo
Send keyboard
.Li ECHO
command.
.It Li scan \&= Ar number
Turn keyboard to generate scan codes according to code set
.Ar number .
Only supported on
.Tn PS/2
style keyboards.
.It Li scan \&?
Report code set keyboard is currently operating in.
.It Li \&id \&?
Ask keyboard to report its identification bytes
.It Xo
.Li typematic \&= Ar number1 Li \&, Ar number2
.Xc
Set keyboard typematic delay and repeat rate to
.Ar number1
milliseconds and
.Ar number2
repeats per second, respectively.
.It Li enable
Enable keyboard.
.It Li defaults
Return customizable parameters to defaults.
.It Li all typematic
Set all keys to
.Em typematic
behaviour. This command as well as the following ones are only
supported on
.Tn PS/2
style keyboards and only while operating in scan code set 3.
.It Li all make release
Turn all keys in generating
.Em make
and
.Em release
events only.
.It Li all make only
Turn all keys in generating
.Em make
codes only.
.It Li all typematic make release
Set all keys to generate
.Em make
and
.Em release
events, as well as perform
.Em typematic
behaviour. This is usually the default.
.It Ar number Li typematic
Set key
.Ar number
to
.Em typematic
behaviour.
.It Ar number Li make release
Turn a single key
.Ar number
to generate
.Em make
and
.Em release
events only.
.It Ar number Li make only
Set key
.Ar number
to return
.Em make
events only.
.It Li resend
Ask the keyboard to retransmit its last character.
.It Li reset
Perform a keyboard
.Li RESET
command.
.It Li cmd \&?
Get the keyboard command byte and interpret it symbolically.
.It Li cmd \&= Ar expr
Set the keyboard command byte to
.Ar expr .
See the next subsection for expression syntax.
.El
Returned data will be printed hexadecimal, but any queued keyboard
control responses will be printed first.
.Ss Expression syntax
Expressions can either consist of a number, possibly followed
by a
.Sq +
or
.Sq \-
sign and bit values in numeric or symbolic form.
Symbolic bit values are
.Pq with their meaning in the keyboard command byte :
.Bl -tag -width "ovrinh" -offset indent -compact
.It Li scconv
value
.Li 0x40 ,
enable PC scan code conversion at
.Em controller
level, as opposed to the different keyboard scan code sets;
.It Li ignpar
value
.Li 0x20 ,
ignore keyboard parity;
.It Li clklow
value
.Li 0x10 ,
hold keyboard clock line low
.Pq disables keyboard ;
.It Li ovrinh
value
.Li 0x08 ,
override keyboard inhibit function -- ignore the keyboard lockout switch,
intented to allow the keyboard self-test;
.It Li test
value
.Li 0x04 ,
controller self-test okay;
.It Li irq
value
.Li 0x01 ,
enable generation of
.Li IRQ1
if output buffer is full.
.El
The operators
.Sq +
and
.Sq \-
perform simple bit-set or bit-clear functionality, respectively. This
is roughly comparable with the operators
.Sq \&|
and
.Sq \&&~
in
.Em C .
Expressions are evaluated left to right and cannot be bracketed.
The special keyword
.Li cmd
is substituted by a read of the current keyboard command byte.
.Ss Access control
The caller must have uid 0 in order to gain the required access to
the IO registers.
.Sh EXAMPLES
.Dl led=3
Turn on num lock and scroll lock LEDs.
.Dl "cmd = cmd - irq; id?; cmd = cmd + irq"
Temporarily suspend keyboard interrupt generation, and ask the
keyboard to return its identification bytes.
.Sh FILES
.Pa /dev/console
is used as the default device to enable access to the IO registers.
.Sh HISTORY
This program is considered
.Dq hackware .
It has been developed in order to simplify the process of developing other
software that needs to handle the PC keyboard, and to give a very basic
aid in debugging keyboard-related problems.
.Sh AUTHOR
The program has been contributed by
.if n Joerg Wunsch,
.if t J\(:org Wunsch,
Dresden
.Aq joerg_wunsch@uriah.heep.sax.de .
.Sh BUGS
No useful diagnostics are printed in case of a syntax error.
Remember, to use this program, your kernel has to be compiled with XSERVER
being defined.
Use of this program might cause grievous harm to your system's sanity,
not only that it might hang your keyboard and/or keyboard controller
indefinitely, it might also hard-reset your system when accidentally
accessing the hardware reset facility of the keyboard controller
.Po
which does not actually belong there, but used to be
.Pc .
It is highly recommended to use this program only when logged into the
machine across a network or on a serial line.
|