Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ kb(4S) — SunOS 3.0

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

kbd(5)

click(1)

KB(4S)  —  SPECIAL FILES

NAME

kb − Sun keyboard

SYNOPSIS

pseudo-device kbnumber

DESCRIPTION

Kb provides access to the Sun workstation keyboard translation.  Definitions for altering keyboard translation are in <sundev/kbio.h> and <sundev/kbd.h>.  The number argument specifies the maximum number of keyboards supported by the system. 

Keyboard Translation State:

The call KIOCTRANS controls the presence of keyboard translation:

 #defineTR_NONE0
#defineTR_ASCII1
#defineTR_EVENT2
 int x;
err = ioctl(fd, KIOCTRANS, &x);

When x is TR_NONE, keyboard translation is turned off and up/down key codes are reported.  Specifying x as TR_ASCII causes ASCII to be reported.  Specifying x as TR_EVENT causes Firm_events to be reported (see below). 

The call KIOCGTRANS determines the current state of keyboard translation. 

 int x;
err = ioctl(fd, KIOCGTRANS, &x);

Keyboard Translation Table Entries:

The call KIOCSETKEY changes a keyboard translation table entry:

 structkiockey {
intkio_tablemask;/∗ Translation table (one of: 0, CAPSMASK,
   SHIFTMASK, CTRLMASK, UPMASK) ∗/
#define KIOCABORT1-1/∗ Special "mask": abort1 keystation ∗/
#define KIOCABORT2-2/∗ Special "mask": abort2 keystation ∗/
u_charkio_station;/∗ Physical keyboard key station (0-127) ∗/
u_charkio_entry;/∗ Translation table station’s entry ∗/
charkio_string[10];/∗ Value for STRING entries (null terminated) ∗/
};
      struct kiockey key;
     err = ioctl(fd, KIOCSETKEY, &key);

Set kio_tablemask table’s kio_station to kio_entry.  Copy kio_string to string table if kio_entry is between STRING and STRING+15.  This call may return EINVAL if there are invalid arguments. 

There are a couple special values of kio_tablemask that affect the two step “break to the prom monitor” sequence.  The usual sequence is <Setup>a.  If kio_tablemask is KIOCABORT1 then the value of kio_station is set to be the first keystation in the sequence.  If kio_tablemask is KIOCABORT2 then the value of kio_station is set to be the second keystation in the sequence. 

The call KIOCGETKEY determines the current value of a keyboard translation table entry:

 struct kiockey key;
err = ioctl(fd, KIOCGETKEY, &key);

Get kio_tablemask table’s kio_station to kio_entry.  Get kio_string from string table if kio_entry is between STRING and STRING+15.  This call may return EINVAL if there are invalid arguments. 

Keyboard Type:

TBD The call KIOCTYPE returns the type of the keyboard:

 #defineKB_KLUNK0x00/∗ Micro Switch 103SD32-2 ∗/
#defineKB_VT1000x01/∗ Keytronics VT100 compatible ∗/
#defineKB_SUN20x02/∗ Sun-2 custom keyboard ∗/
#defineKB_SUN30x03/∗ Sun-3 custom keyboard ∗/
#defineKB_ASCII0x0F/∗ Ascii terminal masquerading as kbd ∗/
 int x;
err = ioctl(fd, KIOCTYPE, &x);

When x is −1, the keyboard type is unknown. 

Keyboard Commands:

The call KIOCCMD sends a command to the keyboard:

 /∗
 ∗ Commands to the Sun-2 keyboard.
 ∗/
#defineKBD_CMD_RESET0x01/∗ Reset keyboard as if power-up ∗/
#defineKBD_CMD_BELL0x02/∗ Turn on the bell ∗/
#defineKBD_CMD_NOBELL0x03/∗ Turn off the bell ∗/
 /∗
 ∗ Commands to the Sun-3 keyboard.  KBD_CMD_BELL & KBD_CMD_NOBELL work
 ∗ as well.
 ∗/
#defineKBD_CMD_CLICK0x0A/∗ Turn on the click annunciator ∗/
#defineKBD_CMD_NOCLICK0x0B/∗ Turn off the click annunciator ∗/
 int x;
err = ioctl(fd, KIOCCMD, &x);

Inappropriate commands for particular keyboard types are ignored.  Since there is no reliable way to get the state of the bell or click (because we can’t query the kdb, and also one could do writes to the appropriate serial driver--thus going around this ioctl) we don’t provide an equivalent state querying ioctl. 

FILES

/dev/kbd

SEE ALSO

kbd(5), click(1)
The SunView System Programmer’s Guide - Appendix: Writing a Virtual User Input Device Driver (describes Firm_event format)

Sun Release 3.0β  —  Last change: 19 December 1985

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