mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@osdl.org>
To: Alan Stern <stern@rowland.harvard.edu>
Cc: dmitry.torokhov@gmail.com, linux-input@atrey.karlin.mff.cuni.cz,
	linux-kernel@vger.kernel.org, Fredrik Roubert <roubert@df.lth.se>
Subject: Re: Magic Alt-SysRq change in 2.6.18-rc1
Date: Sun, 9 Jul 2006 17:22:22 -0700	[thread overview]
Message-ID: <20060709172222.d8c275fd.akpm@osdl.org> (raw)
In-Reply-To: <Pine.LNX.4.44L0.0607091657490.28904-100000@netrider.rowland.org>

On Sun, 9 Jul 2006 17:06:57 -0400 (EDT)
Alan Stern <stern@rowland.harvard.edu> wrote:

> Dmitry:
> 
> Are you the right person to handle changes in the behavior of Alt-SysRq?
> 
> Before 2.6.18-rc1, I used to be able to use it as follows:
> 
> 	Press and hold an Alt key,
> 	Press and hold the SysRq key,
> 	Release the Alt key,
> 	Press and release some hot key like S or T or 7,
> 	Repeat the previous step as many times as desired,
> 	Release the SysRq key.
> 
> This scheme doesn't work any more, or if it does, the timing requirements
> are now much stricter.  In practice I have to hold down all three keys at
> the same time; I can't release the Alt key before pressing the hot key.
> 
> This makes thinks very awkward on my laptop machine.  Its keyboard
> controller doesn't seem to like having three keys pressed simultaneously.  
> Instead of the expected hotkey behavior, I usually got an error message
> from atkbd warning about too many keys being pressed.  Getting it to work
> as desired is hit-and-miss.
> 
> I would really appreciate going back to the old behavior, where only two 
> keys needed to be held down at any time.
> 

I assume reverting the below will fix it?


From: Fredrik Roubert <roubert@df.lth.se>

Magic sysrq fails to work on many keyboards, particulary most of notebook
keyboards.  This patch fixes it.

The idea is quite simple: Discard the SysRq break code if Alt is still being
held down.  This way the broken keyboard can send the break code (or the user
with a normal keyboard can release the SysRq key) and the kernel waits until
the next key is pressed or the Alt key is released.

Signed-off-by: Pavel Machek <pavel@suse.cz>
Signed-off-by: Andrew Morton <akpm@osdl.org>
---

 drivers/char/keyboard.c |   10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff -puN drivers/char/keyboard.c~fix-magic-sysrq-on-strange-keyboards drivers/char/keyboard.c
--- a/drivers/char/keyboard.c~fix-magic-sysrq-on-strange-keyboards
+++ a/drivers/char/keyboard.c
@@ -151,6 +151,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;
 #endif
 static int sysrq_alt;
 
@@ -1143,7 +1144,7 @@ static void kbd_keycode(unsigned int key
 	kbd = kbd_table + fg_console;
 
 	if (keycode == KEY_LEFTALT || keycode == KEY_RIGHTALT)
-		sysrq_alt = down;
+		sysrq_alt = down ? keycode : 0;
 #ifdef CONFIG_SPARC
 	if (keycode == KEY_STOP)
 		sparc_l1_a_state = down;
@@ -1163,9 +1164,14 @@ static void kbd_keycode(unsigned int key
 
 #ifdef CONFIG_MAGIC_SYSRQ	       /* Handle the SysRq Hack */
 	if (keycode == KEY_SYSRQ && (sysrq_down || (down == 1 && sysrq_alt))) {
-		sysrq_down = down;
+		if (!sysrq_down) {
+			sysrq_down = down;
+			sysrq_alt_use = sysrq_alt;
+		}
 		return;
 	}
+	if (sysrq_down && !down && keycode == sysrq_alt_use)
+		sysrq_down = 0;
 	if (sysrq_down && down && !rep) {
 		handle_sysrq(kbd_sysrq_xlate[keycode], regs, tty);
 		return;
_


  reply	other threads:[~2006-07-10  0:22 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-07-09 21:06 Alan Stern
2006-07-10  0:22 ` Andrew Morton [this message]
2006-07-10  1:12 ` H. Peter Anvin
2006-07-10  3:08   ` Joshua Hudson
2006-07-10  9:44 ` Fredrik Roubert
2006-07-10  9:59   ` Michael Buesch
2006-07-10 21:59   ` Roman Zippel
2006-07-11 12:41     ` Pavel Machek
2006-07-11 22:21       ` Roman Zippel
2006-07-11 22:42         ` [patch] " Pavel Machek
2006-07-11 23:33           ` Roman Zippel
2006-07-11 23:50             ` Andrew Morton
2006-07-12  0:16               ` Roman Zippel
2006-07-12  0:37                 ` Andrew Morton
2006-07-12  0:52                   ` Roman Zippel
2006-07-12  1:36                     ` Andrew Morton
2006-07-12  8:08                       ` Pavel Machek
2006-07-12  9:07                       ` Roman Zippel
2006-07-12 13:26                         ` Paulo Marques
2006-07-12 19:42                           ` Paulo Marques
2006-07-12 20:05                             ` Dmitry Torokhov
2006-07-12 22:21                               ` Paulo Marques
2006-07-12 22:44                                 ` Pavel Machek
2006-07-13 18:48                                 ` Dmitry Torokhov
2006-07-12  7:26                 ` Fredrik Roubert
2006-07-12  9:09                   ` Roman Zippel
2006-07-12 15:12                   ` Randy.Dunlap
2006-07-11 12:42     ` Pavel Machek
2006-07-11 13:54     ` Alan Stern
2006-07-10  0:01 Chuck Ebbert

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20060709172222.d8c275fd.akpm@osdl.org \
    --to=akpm@osdl.org \
    --cc=dmitry.torokhov@gmail.com \
    --cc=linux-input@atrey.karlin.mff.cuni.cz \
    --cc=linux-kernel@vger.kernel.org \
    --cc=roubert@df.lth.se \
    --cc=stern@rowland.harvard.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome