KBDIO(8)

NAME
kbdio - perform input/output on a PC keyboard/keyboard controller

SYNOPSIS
kbdio [-d] [-f devname]

DESCRIPTION

  Purpose
Kbdio is used to perform input/output on a PC keyboard or the (motherboard) keyboard controller. 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.

  Options
-d  Turn on the grammar parser debugger.
-f devname
    Operate on device devname instead of the default /dev/console.

  Command language
The command language of kbdio 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:
?
help
    Give help on the general syntax.
help expr
    Help on expression syntax.
status?
    Report keyboard controller status.
what?
    Determine MCA type 1 or type 2 keyboard controller.
data?
    Fetch keyboard controller data port.
led = number
    Set keyboard LEDs. Number is a logical combination of
    1   scroll lock LED
    2   num lock LED
    4   caps lock LED.
echo
    Send keyboard ECHO command.
scan = number
    Turn keyboard to generate scan codes according to code set number. Only supported on PS/2 style keyboards.
scan?
    Report code set keyboard is currently operating in.
id? Ask keyboard to report its identification bytes
    typematic = number1, number2 Set keyboard typematic delay and repeat rate to number1 milliseconds and number2 repeats per second, respectively.
enable
    Enable keyboard.
defaults
    Return customizable parameters to defaults.
all typematic
    Set all keys to typematic behaviour. This command as well as the following ones are only supported on PS/2 style keyboards and only while operating in scan code set 3.
all make release
    Turn all keys in generating make and release events only.
all make only
    Turn all keys in generating make codes only.
all typematic make release
    Set all keys to generate make and release events, as well as perform typematic behaviour. This is usually the default.
number typematic
    Set key number to typematic behaviour.
number make release
    Turn a single key number to generate make and release events only.
number make only
    Set key number to return make events only.
resend
    Ask the keyboard to retransmit its last character.
reset
    Perform a keyboard RESET command.
cmd?
    Get the keyboard command byte and interpret it symbolically.
cmd = expr
    Set the keyboard command byte to expr. See the next subsection for expression syntax.
Returned data will be printed hexadecimal, but any queued keyboard control responses will be printed first.

  Expression syntax
Expressions can either consist of a number, possibly followed by a ‘+’ or ‘-’ sign and bit values in numeric or symbolic form. Symbolic bit values are (with their meaning in the keyboard command byte):
scconv
    value 0x40, enable PC scan code conversion at controller level, as opposed to the different keyboard scan code sets;
ignpar
    value 0x20, ignore keyboard parity;
clklow
    value 0x10, hold keyboard clock line low (disables keyboard);
ovrinh
    value 0x08, override keyboard inhibit function -- ignore the keyboard lockout switch, intented to allow the keyboard self-test;
test
    value 0x04, controller self-test okay;
irq value 0x01, enable generation of IRQ1 if output buffer is full.
The operators ‘+’ and ‘-’ perform simple bit-set or bit-clear functionality, respectively. This is roughly comparable with the operators ‘|’ and ‘&~’ in C. Expressions are evaluated left to right and cannot be bracketed. The special keyword cmd is substituted by a read of the current keyboard command byte.

  Access control
The caller must have uid 0 in order to gain the required access to the IO registers.

EXAMPLES
    led=3
Turn on num lock and scroll lock LEDs.
    cmd = cmd - irq; id?; cmd = cmd + irq
Temporarily suspend keyboard interrupt generation, and ask the keyboard to return its identification bytes.

FILES
/dev/console is used as the default device to enable access to the IO registers.

HISTORY
This program is considered “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.

AUTHOR
The program has been contributed by Joerg Wunsch, Dresden <joerg_wunsch@uriah.heep.sax.de>.

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 ( which does not actually belong there, but used to be). It is highly recommended to use this program only when logged into the machine across a network or on a serial line.