From: alexad3 AT uniserve DOT com (Alexander J Russell) Newsgroups: comp.os.msdos.djgpp,comp.os.msdos.programmer,alt.msdos.programmer Subject: Re: Key board LED's Date: 16 May 1997 03:33:25 GMT Organization: Uniserve Lines: 116 Distribution: world Message-ID: <5lgki6$n7k$1@neptune.uniserve.com> References: <5levsd$5la AT lion DOT cs DOT latrobe DOT edu DOT au> NNTP-Posting-Host: dy3-21.van.tvs.net Mime-Version: 1.0 Content-Type: Text/Plain; charset=US-ASCII To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Precedence: bulk In article <5levsd$5la AT lion DOT cs DOT latrobe DOT edu DOT au>, boylesgj AT lion DOT cs DOT latrobe DOT edu DOT au says... > >What is the procedure for changing their state (in intimate detail)? > >I can change them by doing this : outportb(0x60,0xED);delay(50);outportb(0x60,0x >03); >but when I try to do it in a test program for a key board handler it is a >total failure. have your keyboard handler stuff the raw scan codes into a Q and do nothing else. Have a nother routine process scan codes from above Q, including changing LED's, converting to ascii etc... [snip - code close to working] Code below is reliable > [snip] >Is there a way to put the key board into auto with respect to LED's. It >sure would save me a lot of unecessary head aches. > no. /* led.c Internet: alexad3 AT uniserve DOT com Copyright 1995, January 15 by Alex Russell, NO rights reserved Created - 1995/1/15 History: New file code fragments to turn on the LED lights. Your program would have to track the status of all lights and send the correct bits instead of just CAPLOCK ONLY use this code in an int 9 replacement. If the BIOS keyboard handler is running, just set the bit mask in BIOS data area. */ /* keyboard controller and LED lights stuff */ #define KEYSTATUS 0x64 #define KEYDATA 0x60 #define LEDUPDATE 0xed #define OB_FULL 1 #define IB_FULL 2 #define KEY_ACK 0xfa /* bit masks to be sent */ #define SCROLLOCK 1 #define NUMLOCK 2 #define CAPLOCK 4 /* ---------------------- send_keycontrol() ------------ January 15,1995 */ short send_keycontrol(BYTE v) { short count, err=1; BYTE c; for ( count=0; count < 3; count++ ) { do { c=inportb(KEYSTATUS); } while ( c & IB_FULL ); outportb(KEYDATA, v); do { c=inportb(KEYSTATUS); } while ( c & OB_FULL); c=inportb(KEYDATA); if ( c == KEY_ACK ) { err=0; break; } } return err; } /* ---------------------- cap_light_on() --------------- January 15,1995 */ void cap_light_on(void) { if ( !send_keycontrol(LEDUPDATE) ) /* tell keyboard next byte is led bitmask */ send_keycontrol(CAPLOCK); /* the led bitmask */ } -- The AnArChIsT! Anarchy! Not Chaos! aka Alex Russell alexad3 AT uniserve DOT com