patch-2.4.19 linux-2.4.19/drivers/char/q40_keyb.c

Next file: linux-2.4.19/drivers/char/qtronix.c
Previous file: linux-2.4.19/drivers/char/pty.c
Back to the patch index
Back to the overall index

diff -urN linux-2.4.18/drivers/char/q40_keyb.c linux-2.4.19/drivers/char/q40_keyb.c
@@ -31,9 +31,6 @@
 #include <asm/irq.h>
 #include <asm/q40ints.h>
 
-/* Some configuration switches are present in the include file... */
-
-#define KBD_REPORT_ERR
 
 /* Simple translation table for the SysRq keys */
 
@@ -215,7 +212,6 @@
   0, 0, 0, 0, 0, 0, 0, 0			      /* 0x78-0x7f */
 };
 
-static unsigned int prev_scancode = 0;   /* remember E0, E1 */
 
 int q40kbd_setkeycode(unsigned int scancode, unsigned int keycode)
 {
@@ -246,10 +242,21 @@
 int q40kbd_translate(unsigned char scancode, unsigned char *keycode,
 		    char raw_mode)
 {
-  	if (scancode == 0xe0 || scancode == 0xe1) {
+	static int prev_scancode;
+
+	/* special prefix scancodes.. */
+	if (scancode == 0xe0 || scancode == 0xe1) {
 		prev_scancode = scancode;
 		return 0;
- 	}
+	}
+
+	/* 0xFF is sent by a few keyboards, ignore it. 0x00 is error */
+	if (scancode == 0x00 || scancode == 0xff) {
+		prev_scancode = 0;
+		return 0;
+	}
+
+	scancode &= 0x7f;
 
 	if (prev_scancode) {
 	  /*
@@ -347,7 +354,7 @@
 	spin_lock(&kbd_controller_lock);
 	kbd_pt_regs = regs;
 
-	status = IRQ_KEYB_MASK & master_inb(INTERRUPT_REG);
+	status = Q40_IRQ_KEYB_MASK & master_inb(INTERRUPT_REG);
 	if (status ) 
 	  {
 	    unsigned char scancode,qcode;
@@ -398,7 +405,7 @@
 	int retval = KBD_NO_DATA;
 	unsigned char status;
 
-	status = IRQ_KEYB_MASK & master_inb(INTERRUPT_REG);
+	status = Q40_IRQ_KEYB_MASK & master_inb(INTERRUPT_REG);
 	if (status) {
 		unsigned char data = master_inb(KEYCODE_REG);
 
@@ -408,8 +415,6 @@
 	return retval;
 }
 
-extern void q40kbd_leds(unsigned char leds)
-{ /* nothing can be done */ }
 
 static void __init kbd_clear_input(void)
 {
@@ -424,10 +429,7 @@
 
 void __init q40kbd_init_hw(void)
 {
-#if 0
-	/* Get the keyboard controller registers (incomplete decode) */
-	request_region(0x60, 16, "keyboard");
-#endif
+
 	/* Flush any pending input. */
 	kbd_clear_input();
 

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)