Path: tut!enea!mcvax!uunet!husc6!hao!gatech!uflorida!codas!alxfin!rtmvax!johnc From: johnc@rtmvax.UUCP (John Connin) Newsgroups: comp.os.minix Subject: LED Commands Keywords: Minix Message-ID: <225@rtmvax.UUCP> Date: 27 Jan 88 02:49:29 GMT Organization: AFS, Inc. Remote Site -rtmvax-, Apopka,FL Lines: 162 In article <1832@botter.cs.vu.nl> Andrew Tanenbaum writes: > My tty.c doesn't turn on the keyboard LEDs on the AT because I couldn't > figure out how to do it. If somebody knows how to control these things, > please post it, and maybe Jim can include that in the new one. I presume > there is some I/O port with a 1 bit per LED, but I don't know which. If > somebody has an AT Technical Reference Manual, see if you can figure it > out by looking in the BIOS. If you call up your friendly local IBM dealer > and say "How do I turn on the LED on the Caps Lock key?" He will probably > say "Easy, just depress the Caps Lock key." I think we are going to have > to reverse engineer this one. The follow tidbits are primarily from Compaq's Technical Manual, which generally is an excellent resource for interface details. I am sure this is not the whole story, but at least it does define the LED command and codes. 7 0 +---+---+---+---+---+---+---+---+ | obuff | +---+---+---+---+---+---+---+---+ | ibuff | +---+---+---+---+---+---+---+---+ | cmd port | +---+---+---+---+---+---+---+---+ | status port | +---+---+---+---+---+---+---+---+ | | | | | | | | | | | | | | | +----- obuff full | | | | | | +--------- ibuff full | | | | | +------------- sys flag | | | | +----------------- data / cmd | | | +--------------------- kbd inhibited | | +------------------------- xmit timeout | +----------------------------- recv timeout +--------------------------------- parity even Port 60h, data i/o register Port 64h, commmand/status register bit 8042 Status Register (Input Port 64h) 76543210 ------------------------------------- |||||||| |||||||+-- 0 = No new data in buffer ||||||| 1 = Data in buffer (input port 60h) ||||||+--- 0 = Input buffer empty (Output port 60h or 64h) |||||| 1 = Input buffer full (Output port 60h or 64h) |||||+---- 0 = Power-On reset (cold start) ||||| 1 = Software reset (warm start) ||||+----- 0 = Output buffer has data |||| 1 = Output buffer has command |||+------ 0 = Security lock engaged ||| 1 = Security lock not engaged ||+------- 1 = Transmission time-out error || bit || 567 cause || -------------------------------- || 100 No clock || 110 Clock ok, no response || 101 Clock ok, parity error |+-------- 1 = Receive time-out error. Keyboard data transmission started | but did not finish in 2ms. +--------- 1 = Parity error detected (11-bit format only). If an error is detected, a Resend command is sent to the keyboard once only, as an attempt to recover. bit 8042 Command Byte 76543210 ------------------------------------- |||||||| |||||||+-- 0 = Do not generate interrupt ||||||| 1 = Generate interrupt when output buffer full ||||||+--- 0 (Reserved) |||||| |||||+---- System flag -- the value written to this bit is written ||||| into the corresponding bit of the status register ||||+----- 0 = Obey security lock state |||| 1 = Ignore security lock |||+------ 0 = Enable keyboard ||| 1 = Disable keyboard ||+------- 0 = Use 11-bit keyboard codes (80286 and 80386) || 1 = Use 8088/8086 compatible keyboard codes |+-------- 0 = Do not convert keyboard codes | 1 = Convert keyboard codes to the 8088/8086 scan codes +--------- 0 (Reserved) 8042 Command Codes (Output Port 64h) ------------------------------------------------------------------- 20h Put the current command byte on port 60h 60h Load a new command byte. This is part of a 2-byte operation. To write a new command byte: 1) write 60h to port 64h 2) write the command byte to port 60h ADh Disable Keyboard -- sets bit 4 of the 8042's command byte, which disables the keyboard interface. Data is not sent or received until the keyboard is enabled. AEh Enable Keyboard -- resets bit 4 of the 8042 command byte, which enables the keyboard interface. EDh This is a two-part command to control the state of the Num Lock, Caps Lock, and Scroll Lock LED indicators on the keyboard. The second byte of the command contains the state to which the LED indicators are to be set. Thje second byte is as follows: bit 0 - 0 = Scroll Lock LED indicator off 1 = Scroll Lock LED indicator on bit 1 - 0 = Num Lock LED indicator off 1 = Num Lock LED indicator on bit 2 - 0 = Caps Lock LED indicator off 1 = Caps Lock LED indicator on bits 3 - 7 = reserved, should be set to 0 KB_OBUFF EQU 60h ; controller output buffer KB_IBUFF EQU 60h STATUS_PORT EQU 64h ; KB controller status, RO CMD_PORT EQU 64h ; status register masks OUT_BUF_FULL EQU 01h ; + Output buffer full INP_BUF_FULL EQU 02h ; + Input buffer full SYS_FLAG EQU 04h ; CMD_DATA EQU 08h ; + Data, - command KB_INHIBIT EQU 10h ; + keyboard inhibited XMIT_TMOUT EQU 20h ; + transmit timeout RECV_TMOUT EQU 40h ; + receive timeout PRTY_EVEN EQU 80h ; + parity is even ; keyboard / LED commands DIS_KB EQU 0ADh ; ENA_KB EQU 0AEh ; LED_CMD EQU 0EDh ; ; keyboard responses KB_OVER_RUN EQU 0FFh ; KB_RESEND EQU 0FEh ; KB_ACK EQU 0FAh ; KB_BREAK EQU 0F0h ; I trust the above will be helpful. John L. Connin UUCP: codas!alxfin!rtmvax!johnc