Museum

Home

Lab Overview

Retrotechnology Articles

⇒ Online Manual

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

streamio(7)

gin(7)

console(7)

KBD(7)  —  

NAME

kbd − keyboard driver

DESCRIPTION

kbd interfaces to the synchronous serial keyboard (8042).  This driver is a STREAMS driver; thus it can be linked (via I_LINK ioctl) under the gin multiplexor.  kbd can operate in either ASCII or non-ASCII mode.  In the former, each key stroke is represented by a 7-bit ASCII code.  For example, pressing and releasing “a” generates the number 0x61.  In the latter case, each key stroke is represented by the “raw” scan code from the 8042.  For example, pressing and releasing “a” gets 0x1c (scan code for “a”), 0xf0, and 0x1c (break code for “a”).  The scan codes can be found in <machine/kb.h>, or in the IBM PC manual. 

When the system is booted up, the console driver (/dev/console) internally opens this keyboard driver and sets its mode to ASCII.  Thus keyboard input can be read from the console driver.  Later the user (e.g. X11 server) can explicitly open /dev/kbd and link it under the gin(7) multiplexor.  Once this is done, the keyboard is in non-ASCII mode and the data is encapsulated in the form of the structure of gin, which is defined in <machine/gin.h>. 

COMMANDS FUNCTIONS

kbd recognizes the following ioctl commands.  They have to be encoded in I_STR format using the ginioctl structure.  (See gin(7).) 

G_ENABLE Enable the keyboard device. 

G_DISABLE Disable the keyboard device. 

G_KASCII Set to ASCII mode.  This is the default mode when the system is booted up. 

G_KGIN Set to non-ASCII mode.  This is the default mode when the kbd is explicitly opened. 

G_KTYPE Set the typematic rate and delay.  The typematic rate are coded in bits 4, 3, 2, 1, and 0.  Bits 6 and 5 are the delay parameter.  Bit 7 (the most significant bit) is always 0.  The delay is equal to 1 plus the binary value of bits 6 and 5 multiplied by 250 milliseconds ± 20%.  The period (interval from one typematic output to the next) can be calculated from:

period = (8 + ‘bits 2, 1, 0’) ∗ (2 ∗∗ ‘bits 4, 3’) ∗ 0.00417

The typematic rate (scan code per second) is 1/period. 

The default values for the typematic rate is 10 characters per second and the delay is 500 milliseconds ( ± 20%).

G_KWRITE Write the data byte to the keyboard.  This is used to turn on/off the LED on the keyboard.  Writing a “1” turn the LED on.  Note that only the three least significant bits are meaningful: bit 0 for scroll lock, bit 1 for num lock, and bit 2 for Caps lock. 

G_RESET Re-enable the keyboard device and set the parameters to the default value. 

FILES

/dev/kbd − clone device
/dev/kbd0 − keyboard for display 0
/dev/kbd1 − keyboard for display 1

SEE ALSO

streamio(7), gin(7), console(7)
IBM PC AT Technical Reference, IBM Corporation.

September 02, 1992

Typewritten Software • bear@typewritten.org • Edmonds, WA 98026