patch-2.2.7 linux/drivers/char/keyboard.c

Next file: linux/drivers/char/mem.c
Previous file: linux/drivers/char/dn_keyb.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.2.6/linux/drivers/char/keyboard.c linux/drivers/char/keyboard.c
@@ -24,6 +24,7 @@
  */
 
 #include <linux/config.h>
+#include <linux/module.h>
 #include <linux/sched.h>
 #include <linux/tty.h>
 #include <linux/tty_flip.h>
@@ -59,6 +60,8 @@
 #define KBD_DEFLOCK 0
 #endif
 
+EXPORT_SYMBOL(handle_scancode);
+
 extern void ctrl_alt_del(void);
 
 struct wait_queue * keypress_wait = NULL;
@@ -190,15 +193,15 @@
     return kbd_getkeycode(scancode);
 }
 
-void handle_scancode(unsigned char scancode)
+void handle_scancode(unsigned char scancode, int down)
 {
 	unsigned char keycode;
-	char up_flag;				 /* 0 or 0200 */
+	char up_flag = down ? 0 : 0200;
 	char raw_mode;
 
 	do_poke_blanked_console = 1;
 	mark_bh(CONSOLE_BH);
-	add_keyboard_randomness(scancode);
+	add_keyboard_randomness(scancode | up_flag);
 
 	tty = ttytab? ttytab[fg_console]: NULL;
 	if (tty && (!tty->driver_data)) {
@@ -213,20 +216,15 @@
 	}
 	kbd = kbd_table + fg_console;
 	if ((raw_mode = (kbd->kbdmode == VC_RAW))) {
- 		put_queue(scancode);
+		put_queue(scancode | up_flag);
 		/* we do not return yet, because we want to maintain
 		   the key_down array, so that we have the correct
 		   values when finishing RAW mode or when changing VT's */
- 	}
+	}
 
-	if (!kbd_pretranslate(scancode, raw_mode))
-	    return;
- 	/*
+	/*
 	 *  Convert scancode to keycode
- 	 */
-	up_flag = (scancode & 0200);
- 	scancode &= 0x7f;
-
+	 */
 	if (!kbd_translate(scancode, &keycode, raw_mode))
 	    return;
 
@@ -239,10 +237,10 @@
 
 	if (up_flag) {
 		rep = 0;
- 		if(!test_and_clear_bit(keycode, key_down))
+		if(!test_and_clear_bit(keycode, key_down))
 		    up_flag = kbd_unexpected_up(keycode);
 	} else
- 		rep = test_and_set_bit(keycode, key_down);
+		rep = test_and_set_bit(keycode, key_down);
 
 #ifdef CONFIG_MAGIC_SYSRQ		/* Handle the SysRq Hack */
 	if (keycode == SYSRQ_KEY) {
@@ -257,11 +255,11 @@
 
 	if (kbd->kbdmode == VC_MEDIUMRAW) {
 		/* soon keycodes will require more than one byte */
- 		put_queue(keycode + up_flag);
+		put_queue(keycode + up_flag);
 		raw_mode = 1;	/* Most key classes will be ignored */
- 	}
+	}
 
- 	/*
+	/*
 	 * Small change in philosophy: earlier we defined repetition by
 	 *	 rep = keycode == prev_keycode;
 	 *	 prev_keycode = keycode;
@@ -270,9 +268,9 @@
 	 */
 
 	/*
- 	 *  Repeat a key only if the input buffers are empty or the
- 	 *  characters get echoed locally. This makes key repeat usable
- 	 *  with slow applications and under heavy loads.
+	 *  Repeat a key only if the input buffers are empty or the
+	 *  characters get echoed locally. This makes key repeat usable
+	 *  with slow applications and under heavy loads.
 	 */
 	if (!rep ||
 	    (vc_kbd_mode(kbd,VC_REPEAT) && tty &&

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