patch worked out a while back by Erik and myself to ensure numlock is turned off on PC keyboards at boot. This is important for me and my small (numeric keypad free) Qtronics keyboards with a supermicro motherboard who's BIOS doesn't have an "initial numlock status" option. -Steve Reference: /n/sources/patch/applied/numlock-boot Date: Wed Jun 9 12:01:46 CES 2010 Signed-off-by: steve@quintile.net --- /sys/src/9/pc/kbd.c Wed Jun 9 11:52:01 2010 +++ /sys/src/9/pc/kbd.c Wed Jun 9 11:51:58 2010 @@ -318,6 +318,26 @@ Kbscan kbscans[2]; /* kernel and external scan code state */ static int kdebug; + +static void +setleds(Kbscan *kbscan) +{ + int leds; + + leds = 0; + if(kbscan->num) + leds |= 1<<1; + if(0 && kbscan->caps) + leds |= 1<<2; + ilock(&i8042lock); + outready(); + outb(Data, 0xed); /* talk directly to kbd, not ctlr */ + outready(); + outb(Data, leds); + outready(); + iunlock(&i8042lock); +} + /* * Scan code processing */ @@ -436,6 +456,8 @@ return; case Num: kbscan->num ^= 1; + if(!external) + setleds(kbscan); return; case Shift: kbscan->shift = 1; @@ -615,6 +637,9 @@ ioalloc(Cmd, 1, 0, "kbd"); intrenable(IrqKBD, i8042intr, 0, BUSUNKNOWN, "kbd"); + + /* clears num-lock */ + setleds(kbscans + 0); } void