Re: Magic Alt-SysRq change in 2.6.18-rc1



On Sun, 9 Jul 2006 17:06:57 -0400 (EDT)
Alan Stern <stern@xxxxxxxxxxxxxxxxxxx> 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@xxxxxxxxx>

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@xxxxxxx>
Signed-off-by: Andrew Morton <akpm@xxxxxxxx>
---

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;
_

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/



Relevant Pages

  • Re: Magic Alt-SysRq change in 2.6.18-rc1
    ... Press and hold an Alt key, ... Release the SysRq key. ... Kernel Documentation says to press F13, ... but the PowerBook keyboard does not have F13. ...
    (Linux-Kernel)
  • Re: Macbook pro re-mapping single key
    ... Debian 6 as single boot, ... to has only the left Alt key instead of two. ... I tried to configure the keyboard with the graphical interface but I ... Create keybindings to switch from one to the ...
    (Debian-User)
  • Re: "Sticky" Alt key
    ... You definitely require a visit to your local friendly laptop service ... I wouldn't waste your time with a keyboard cleaning ... 'act' as if the Alt key is permantly 'pressed down'. ... a word doc it does this constantly, it flickers 10-20 times a second...as ...
    (microsoft.public.office.misc)
  • Re: Left-Clicking Misbehavior
    ... keyboard in May. ... Joe Davis ... Options configured for single-click to open) an icon on my desktop: ... the ALT key could manifest itself in the way you've described. ...
    (microsoft.public.windowsxp.basics)
  • Re: change windows shortcut
    ... You may have a stuck key on your keyboard. ... letters for keyboard navigation until I press the Alt key selected here... ... Windows keyboard shortcuts overview ...
    (microsoft.public.windowsxp.general)