kbd
—
Sun workstation keyboard
The kbd
driver provides an interface to the workstation
console keyboard. “type 2”, “type 3”, “type
4”, and “type 5” keyboards are supported. The
“type 5” keyboard is treated as if it were a “type
4”. All types generate keycodes encoding the key identity and motion
(up or down) as the keys are pressed and released. The
kbd
driver either passes the keycodes to an
application as they come in, or translates them into ASCII characters first
according to a set of built-in tables.
If the keyboard is configured as the device to be used for system
console input (see
eeprom(8)), it will be
internally connected to the /dev/console device
special file, which can be used as a
tty(4) device.
The device special file /dev/kbd is used
to get direct access to the keyboard input stream. The following ioctl's are
supported (mostly just enough to keep the X
server
going):
- KIOCTRANS
- Set translation mode. The argument is of type int *,
the only value supported is
TR_UNTRANS_EVENT
.
- KIOCGTRANS
- Get translation mode. The argument is of type int *.
TR_UNTRANS_EVENT
is always returned.
- KIOCGETKEY
- Fill in old-style key station translation. The argument is of type
struct okiockey *.
- KIOCCMD
- Send a command to the keyboard. The argument is of type
int *, and can have one of the following values:
- KBD_CMD_BELL
- Start the keyboard beeper.
- KBD_CMD_NOBELL
- Stop the keyboard beeper.
- KBD_CMD_CLICK
- Instruct the keyboard to make extra noise when touching keys.
- KBD_CMD_NOCLICK
- Instruct the keyboard to stop making extra noise when touching
keys.
- KIOCTYPE
- Get keyboard type. The argument is of type int *, in
which one of the values
KB_SUN2
,
KB_SUN3
or KB_SUN4
will be
returned.
- KIOCSDIRECT
- Route the keyboard input stream through the SunOS compatible event module.
The argument is of type int *, a non-zero value will
put the driver into “event” mode, while a value of zero will
make it return to “ASCII translation” mode.
- KIOCSKEY
- Set key station translation. The argument is of type
struct kiockey * (see
/usr/include/machine/kbio.h for
more details).
- KIOCGKEY
- Get key station translation. The argument is of type
struct kiockey *.
- KIOCLAYOUT
- Get keyboard layout (“type 4” only). The argument is of type
int *, in which the uninterpreted result of the
KBD_CMD_GLAYOUT
keyboard command is returned (on
KBDUN4
type keyboards this will be the setting of
a DIP switch bank).
- KIOCSLED
- Set LED state (“type 4” only). The argument is of type
char *, and is the inclusive OR of the following
flags:
- LED_NUM_LOCK
-
- LED_COMPOSE
-
- LED_SCROLL_LOCK
-
- LED_CAPS_LOCK
-
Each of these flags turn on the LED in the obvious key.
- KIOCGLED
- Get LED state (“type 4” only). The argument is of type
char *, in which the current LED state is
returned.
kbd
is hardwired to the built-in zs1
serial port at 1200 bps.