Re: [patch] Re: Magic Alt-SysRq change in 2.6.18-rc1

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Roman Zippel wrote:
On Tue, 11 Jul 2006, Andrew Morton wrote:
[...]
What, actually, is the problem?

It changes the behaviour, it will annoy the hell out of people like me who have to deal with different kernels and expect this to just work. :-( Since then has it been acceptable to just go ahead and break stuff? This problem doesn't really look unsolvable, so why is my request to fix the damn thing so unreasonable?

Ok, what about this one?

I don't have time to test it (it compiles, at least), but it seems the logic is pretty clear: once you have pressed both "Alt" and "SysRq" sysrq mode becomes active until you release *both* keys. In this mode any regular key press triggers handle_sysrq.

This allows for all the combinations mentioned before in this thread and makes the logic simpler, IMHO.

--
Paulo Marques - www.grupopie.com

Pointy-Haired Boss: I don't see anything that could stand in our way.
           Dilbert: Sanity? Reality? The laws of physics?
Subject: allow the old behavior of Alt+SysRq+<key>

This should allow any order of Alt + SysRq press followed by any key
while still holding one of SysRq or Alt.

Signed-off-by: Paulo Marques <[email protected]>

--- ./drivers/char/keyboard.c.orig	2006-07-12 13:03:32.000000000 +0100
+++ ./drivers/char/keyboard.c	2006-07-12 14:18:52.000000000 +0100
@@ -150,7 +150,7 @@ unsigned char kbd_sysrq_xlate[KEY_MAX +
         "230\177\000\000\213\214\000\000\000\000\000\000\000\000\000\000" /* 0x50 - 0x5f */
         "\r\000/";                                      /* 0x60 - 0x6f */
 static int sysrq_down;
-static int sysrq_alt_use;
+static int sysrq_active;
 #endif
 static int sysrq_alt;

@@ -1164,16 +1164,17 @@ static void kbd_keycode(unsigned int key
 				printk(KERN_WARNING "keyboard.c: can't emulate rawmode for keycode %d\n", keycode);

 #ifdef CONFIG_MAGIC_SYSRQ	       /* Handle the SysRq Hack */
-	if (keycode == KEY_SYSRQ && (sysrq_down || (down == 1 && sysrq_alt))) {
-		if (!sysrq_down) {
-			sysrq_down = down;
-			sysrq_alt_use = sysrq_alt;
-		}
+	if (keycode == KEY_SYSRQ) {
+		sysrq_down = down;
 		return;
 	}
-	if (sysrq_down && !down && keycode == sysrq_alt_use)
-		sysrq_down = 0;
-	if (sysrq_down && down && !rep) {
+
+	if (sysrq_down && sysrq_alt)
+		sysrq_active = 1;
+	else if (!sysrq_down && !sysrq_alt)
+		sysrq_active = 0;
+
+	if (sysrq_active && down && !rep) {
 		handle_sysrq(kbd_sysrq_xlate[keycode], regs, tty);
 		return;
 	}

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux