===== include/asm/keyboard.h 1.4 vs edited ===== --- 1.4/include/asm-i386/keyboard.h Tue Feb 5 08:55:11 2002 +++ edited/include/asm/keyboard.h Thu Jul 18 16:56:40 2002 @@ -48,11 +48,26 @@ #define kbd_request_irq(handler) request_irq(KEYBOARD_IRQ, handler, 0, \ "keyboard", NULL) +#define KBD_DATA_REG 0x60 /* Keyboard data register (R/W) */ +#define KBD_STATUS_REG 0x64 /* Status register (R) */ + /* How to access the keyboard macros on this platform. */ -#define kbd_read_input() inb(KBD_DATA_REG) -#define kbd_read_status() inb(KBD_STATUS_REG) -#define kbd_write_output(val) outb(val, KBD_DATA_REG) -#define kbd_write_command(val) outb(val, KBD_CNTL_REG) +static inline char kbd_read_input(void) { + unsigned char tmp = inb(KBD_DATA_REG); + printk("%02x <- KBD.C (input)\n", tmp); + return tmp; +} + +static inline char kbd_read_status(void) { + unsigned char tmp = inb(KBD_STATUS_REG); + printk("%02x <- KBD.C (status)\n", tmp); + return tmp; +} + +#define kbd_write_output(val) \ + { printk("%02x -> KBD.C (output)\n", val); outb(val, KBD_DATA_REG); } +#define kbd_write_command(val) \ + { printk("%02x -> KBD.C (command)\n", val); outb(val, KBD_CNTL_REG); } /* Some stoneage hardware needs delays after some operations. */ #define kbd_pause() do { } while(0) ===== drivers/char/pc_keyb.c 1.16 vs edited ===== --- 1.16/drivers/char/pc_keyb.c Wed Jul 10 02:06:27 2002 +++ edited/drivers/char/pc_keyb.c Thu Jul 18 17:00:42 2002 @@ -70,7 +70,7 @@ #endif static spinlock_t kbd_controller_lock = SPIN_LOCK_UNLOCKED; -static unsigned char handle_kbd_event(void); +static unsigned char handle_kbd_event(int irq); /* used only by send_data - set by keyboard_interrupt */ static volatile unsigned char reply_expected; @@ -122,7 +122,7 @@ * "handle_kbd_event()" will handle any incoming events * while we wait - keypresses or mouse movement. */ - unsigned char status = handle_kbd_event(); + unsigned char status = handle_kbd_event(0); if (! (status & KBD_STAT_IBF)) return; @@ -487,7 +487,7 @@ * It requires that we hold the keyboard controller * spinlock. */ -static unsigned char handle_kbd_event(void) +static unsigned char handle_kbd_event(int irq) { unsigned char status = kbd_read_status(); unsigned int work = 10000; @@ -504,11 +504,16 @@ if (!(status & (KBD_STAT_GTO | KBD_STAT_PERR))) #endif { + printk("%02x <- KBD.C (interrupt, %s, %d)\n", + scancode, (status & KBD_STAT_MOUSE_OBF) ? "aux" : "kbd", irq); if (status & KBD_STAT_MOUSE_OBF) handle_mouse_event(scancode); else handle_keyboard_event(scancode); } + else + printk("%02x <- KBD.C (FAKE interrupt, %s, %d)\n", + scancode, (status & KBD_STAT_MOUSE_OBF) ? "aux" : "kbd", irq); status = kbd_read_status(); } @@ -527,7 +532,7 @@ #endif spin_lock_irq(&kbd_controller_lock); - handle_kbd_event(); + handle_kbd_event(irq); spin_unlock_irq(&kbd_controller_lock); }