2001-10-02 03:44:32

by Crutcher Dunnavant

[permalink] [raw]
Subject: [PATCH] Stateful Magic Sysrq Key

The following patch is a reworked patch which originated from Amazon.
It makes the sysrq key stateful, giving it the following behaviours:

A) If the magic key is pressed and held, every other key pressed will be
handled by the sysrq system. (This is the current behaviour).
B) If the magic key is pressed and released, the next key pressed will
be handled by the sysrq system.
C) If the magic key is pressed twice in series, it is passed through.

In addition, the patch allows registraiton of the the keycode which the
magic key lives on, through a proc entry.


This patch was developed to handle crappy KVM-alikes, which did one key
at a time, and had no SysRq key. However, it gives a good solution to a
common problem. Many keyboards are made cheaply, and do not support
having large numbers of keys pressed simultaneously, making the current
SysRq code almost useless on them.


There are two versions of the patch attached. One is for
linux-2.4.11-pre2, the other is for linux-2.4.10-ac3

--
Crutcher <[email protected]>
GCS d--- s+:>+:- a-- C++++$ UL++++$ L+++$>++++ !E PS+++ PE Y+ PGP+>++++
R-(+++) !tv(+++) b+(++++) G+ e>++++ h+>++ r* y+>*$


Attachments:
(No filename) (1.14 kB)
patch-2.4.11-pre2-stateful_sysrq.patch (5.85 kB)
patch-2.4.11-pre2-stateful_sysrq
patch-2.4.10-ac3-stateful_sysrq.patch (5.87 kB)
patch-2.4.10-ac3-stateful_sysrq
Download all attachments

2001-10-02 04:14:49

by Simon Kirby

[permalink] [raw]
Subject: Re: [PATCH] Stateful Magic Sysrq Key

On Mon, Oct 01, 2001 at 11:44:37PM -0400, Crutcher Dunnavant wrote:

> This patch was developed to handle crappy KVM-alikes, which did one key
> at a time, and had no SysRq key. However, it gives a good solution to a
> common problem. Many keyboards are made cheaply, and do not support
> having large numbers of keys pressed simultaneously, making the current
> SysRq code almost useless on them.

This iss sort of funny...A number of people at the office thought SysRq
was already stateful because there are a number of keyboards that do not
send a release event when alt+sysrq+another key are pressed
simultaneously....It actually makes it look like alt-sysrq is pressed
until alt-sysrq is actually pressed again without any keys following it.
I suppose this patch makes this cheap keyboard flaw transparent. :)

Simon-

[ Stormix Technologies Inc. ][ NetNation Communications Inc. ]
[ [email protected] ][ [email protected] ]
[ Opinions expressed are not necessarily those of my employers. ]

2001-10-02 07:02:54

by Ian Stirling

[permalink] [raw]
Subject: Re: [PATCH] Stateful Magic Sysrq Key

> The following patch is a reworked patch which originated from Amazon.
> It makes the sysrq key stateful, giving it the following behaviours:

IMO, this is needed for broken keyboards, but in this exact form will
cause problems for those without them.
Pressing alt-sysrq accidentally is rare, but happens, typically when
I'm going for vt-12 in a hurry, or cleaning out crumbs.
Normally this is fairly harmless, as most of the dangerous keys are
on a different quadrant.
Making it sticky makes accidents much more likely.

I'd suggest either making this behaviour optional, or making it so that
hitting alt-sysrq twice, without any other keys being pressed makes the
next key stick.

2001-10-02 08:48:02

by willy tarreau

[permalink] [raw]
Subject: Re: [PATCH] Stateful Magic Sysrq Key

> I'd suggest either making this behaviour optional,
or making it
> so that hitting alt-sysrq twice, without any other
keys being
> pressed makes the next key stick.

I agree with you that there's a risk. Mike Harris had
written a
patch for 2.2 which did something similar, but
slightly better
IMO since it avoids risks of mis-press, handles
correctly
broken keyboards and keeps compatible with the
existing
method. Basically, it allows the user to press Alt,
then SysRQ,
release SysRQ then press the desired key, and later
release
Alt. In fact, it only resets the "magic-key-mode" flag
after Alt
has been released, and doesn't bother when SysRq is
released.

I don't remember where it was available, but if
someone needs
it, I still have it here for 2.2.

Willy


___________________________________________________________
Do You Yahoo!? -- Un e-mail gratuit @yahoo.fr !
Yahoo! Courrier : http://fr.mail.yahoo.com

2001-10-02 14:18:45

by Crutcher Dunnavant

[permalink] [raw]
Subject: Re: [PATCH] Stateful Magic Sysrq Key

++ 02/10/01 10:48 +0200 - willy tarreau:
> > I'd suggest either making this behaviour optional,
> or making it
> > so that hitting alt-sysrq twice, without any other
> keys being
> > pressed makes the next key stick.
>
> I agree with you that there's a risk. Mike Harris had
> written a
> patch for 2.2 which did something similar, but
> slightly better
> IMO since it avoids risks of mis-press, handles
> correctly
> broken keyboards and keeps compatible with the
> existing
> method. Basically, it allows the user to press Alt,
> then SysRQ,
> release SysRQ then press the desired key, and later
> release
> Alt. In fact, it only resets the "magic-key-mode" flag
> after Alt
> has been released, and doesn't bother when SysRq is
> released.

But this would require that alt be pressed. This is not acceptable on
exactly the sort of boards which require this patch.

I will look at adding a 'sysrq-sticky' entry to proc, which will do the
obvious thing. I think that this should address everyone's concerns.

--
Crutcher <[email protected]>
GCS d--- s+:>+:- a-- C++++$ UL++++$ L+++$>++++ !E PS+++ PE Y+ PGP+>++++
R-(+++) !tv(+++) b+(++++) G+ e>++++ h+>++ r* y+>*$

2001-10-03 04:24:34

by Ian Stirling

[permalink] [raw]
Subject: Re: [PATCH] Stateful Magic Sysrq Key

>
> On Tuesday 02 October 2001 03:02, Ian Stirling wrote:
> > > The following patch is a reworked patch which originated from Amazon.
> > > It makes the sysrq key stateful, giving it the following behaviours:
> >
> > IMO, this is needed for broken keyboards, but in this exact form will
> > cause problems for those without them.
<snip>
> This behavior *is* optional -- both as a compile-time option and as a
> value in /proc/sys.

Sorry, I diddn't see it, I had a quick scan, and it seemed to me that
it was a replacement for the current magic-sysrq, not an alternative.

2001-10-03 14:05:14

by Crutcher Dunnavant

[permalink] [raw]
Subject: [PATCH] Stateful Magic Sysrq Key + Sticky Tag


This is the previous stateful sysrq patch, plus a 'sysrq-sticky' proc
entry, which defaults to off, that controls whether the stateful mode
will be used or not.

This reworked patch is against 2.4.11-pre2.

++ 02/10/01 10:18 -0400 - Crutcher Dunnavant:
> ++ 02/10/01 10:48 +0200 - willy tarreau:
> > > I'd suggest either making this behaviour optional,
> > or making it
> > > so that hitting alt-sysrq twice, without any other
> > keys being
> > > pressed makes the next key stick.
> >
> > I agree with you that there's a risk. Mike Harris had
> > written a
> > patch for 2.2 which did something similar, but
> > slightly better
> > IMO since it avoids risks of mis-press, handles
> > correctly
> > broken keyboards and keeps compatible with the
> > existing
> > method. Basically, it allows the user to press Alt,
> > then SysRQ,
> > release SysRQ then press the desired key, and later
> > release
> > Alt. In fact, it only resets the "magic-key-mode" flag
> > after Alt
> > has been released, and doesn't bother when SysRq is
> > released.
>
> But this would require that alt be pressed. This is not acceptable on
> exactly the sort of boards which require this patch.
>
> I will look at adding a 'sysrq-sticky' entry to proc, which will do the
> obvious thing. I think that this should address everyone's concerns.
>
> --
> Crutcher <[email protected]>
> GCS d--- s+:>+:- a-- C++++$ UL++++$ L+++$>++++ !E PS+++ PE Y+ PGP+>++++
> R-(+++) !tv(+++) b+(++++) G+ e>++++ h+>++ r* y+>*$
> -
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to [email protected]
> More majordomo info at http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at http://www.tux.org/lkml/

--
Crutcher <[email protected]>
GCS d--- s+:>+:- a-- C++++$ UL++++$ L+++$>++++ !E PS+++ PE Y+ PGP+>++++
R-(+++) !tv(+++) b+(++++) G+ e>++++ h+>++ r* y+>*$


Attachments:
(No filename) (1.89 kB)
patch-2.4.11-pre2-stateful_sysrq.final.2 (6.81 kB)
patch-2.4.11-pre2-stateful_sticky_sysrq
Download all attachments