Path: utzoo!utgpu!water!watmath!clyde!att!osu-cis!tut.cis.ohio-state.edu!mailrus!ames!pasteur!agate!labrea!decwrl!sun!pitstop!sundc!seismo!uunet!steinmetz!ge-dab!peora!rtmvax!johnc From: johnc@rtmvax.UUCP (John Connin) Newsgroups: comp.os.minix Subject: keyboard leds Message-ID: <1997@rtmvax.UUCP> Date: 19 Oct 88 15:12:32 GMT Reply-To: johnc@rtmvax.UUCP (John Connin) Organization: RTmVax Public Unix System, Orlando FL Lines: 63 The function set_leds() within console.c does not work with my AT-clone. More likely than not it will cause the 8042 keyboard controller to reset its self. The net effect is that either the typematic rate will be reset (ie. I have it to 30 char / sec) or more importantly will cause the system reset line to be set -- inturn causing the system to reboot. NB: increasing the delay parmeter 'LED_DELAY' is not enough. The following code, which I believe corresponds to how the 8042 should be programmed, solves the problem -- at least in my machine. However, beware that it does not contain any error recover mechanism. #define KB_DATA 0x60 /* I/O port for keyboard data */ #define KB_STATUS 0x64 /* I/O port for keyboard status */ #define KB_FULL 0x02 /* keyboard full status mask */ #define LED_CODE 0xED /* command to keyboard to set LEDs */ #define KB_ACK 0xFA /* keyboard ack response */ set_leds(leds) int leds; { int data_port, status_port; int dummy; data_port = KB_DATA; status_port = KB_STATUS; kb_ready(status_port); /* wait for buffer empty */ port_out(data_port, LED_CODE); /* prepare keyboard to accept LED values */ kb_ack(data_port); /* wait for ack response */ kb_ready(status_port); /* wait for buffer empty */ port_out(data_port, leds & 0x0007); /* give keyboard LED values */ kb_ack(data_port); /* wait for ack response */ } kb_ready(port) int port; { int status; do { port_in(port,&status); } while (status & KB_FULL); } kb_ack(port) int port; { int response; do { port_in(port,&response); } while (response != KB_ACK); }