patch-2.1.43 linux/drivers/char/keyboard.c
Next file: linux/drivers/char/lp_m68k.c
Previous file: linux/drivers/char/kbd_kern.h
Back to the patch index
Back to the overall index
- Lines: 81
- Date:
Thu Jun 12 16:22:06 1997
- Orig file:
v2.1.42/linux/drivers/char/keyboard.c
- Orig date:
Sat May 24 09:10:23 1997
diff -u --recursive --new-file v2.1.42/linux/drivers/char/keyboard.c linux/drivers/char/keyboard.c
@@ -17,8 +17,11 @@
* Modified to provide 'generic' keyboard support by Hamish Macdonald
* Merge with the m68k keyboard driver and split-off of the PC low-level
* parts by Geert Uytterhoeven, May 1997
+ *
+ * 27-05-97: Added support for the Magic SysRq Key (Martin Mares)
*/
+#include <linux/config.h>
#include <linux/sched.h>
#include <linux/tty.h>
#include <linux/tty_flip.h>
@@ -30,9 +33,10 @@
#include <asm/keyboard.h>
#include <asm/bitops.h>
-#include "kbd_kern.h"
-#include "diacr.h"
-#include "vt_kern.h"
+#include <linux/kbd_kern.h>
+#include <linux/kbd_diacr.h>
+#include <linux/vt_kern.h>
+#include <linux/kbd_ll.h>
#define SIZE(x) (sizeof(x)/sizeof((x)[0]))
@@ -82,7 +86,7 @@
* the variable must be global, or a new procedure must be created to
* return the value. I chose the former way.
*/
-/*static*/ int shift_state = 0;
+int shift_state = 0;
static int npadch = -1; /* -1 or number assembled on pad */
static unsigned char diacr = 0;
static char rep = 0; /* flag telling character repeat */
@@ -140,8 +144,14 @@
static void put_queue(int);
static unsigned char handle_diacr(unsigned char);
-/* pt_regs - set by keyboard_interrupt(), used by show_ptregs() */
-struct pt_regs * pt_regs;
+/* kbd_pt_regs - set by keyboard_interrupt(), used by show_ptregs() */
+struct pt_regs * kbd_pt_regs;
+
+#ifdef CONFIG_MAGIC_SYSRQ
+#define SYSRQ_KEY 0x54
+extern void handle_sysrq(int, struct pt_regs *, struct kbd_struct *, struct tty_struct *);
+static int sysrq_pressed;
+#endif
/*
* Many other routines do put_queue, but I think either
@@ -223,6 +233,17 @@
} else
rep = test_and_set_bit(keycode, key_down);
+#ifdef CONFIG_MAGIC_SYSRQ /* Handle the SysRq Hack */
+ if (keycode == SYSRQ_KEY) {
+ sysrq_pressed = !up_flag;
+ return;
+ } else if (sysrq_pressed) {
+ if (!up_flag)
+ handle_sysrq(keycode, kbd_pt_regs, kbd, tty);
+ return;
+ }
+#endif
+
if (kbd->kbdmode == VC_MEDIUMRAW) {
/* soon keycodes will require more than one byte */
put_queue(keycode + up_flag);
@@ -346,8 +367,8 @@
static void show_ptregs(void)
{
- if (pt_regs)
- show_regs(pt_regs);
+ if (kbd_pt_regs)
+ show_regs(kbd_pt_regs);
}
static void hold(void)
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov