linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* [patch 0/1] hvc_console: send magic sysrq key to terminal
@ 2008-12-16  9:15 Hendrik Brueckner
  2008-12-16  9:15 ` [patch 1/1] hvc_console: escape magic sysrq key Hendrik Brueckner
  0 siblings, 1 reply; 4+ messages in thread
From: Hendrik Brueckner @ 2008-12-16  9:15 UTC (permalink / raw)
  To: Benjamin Herrenschmidt, Paul Mackerras, Linux PPC devel,
	Jeremy Fitzhardinge, Rusty Russell, Ryan S. Arnold
  Cc: Martin Schwidefsky, Christian Borntraeger, Heiko Carstens, LKML

Hello,

the patch allows to send the magic sysrq key to the terminal (if pressed twice),
so that it can be consumed by applications (e.g. ^0 is used by some editors...)


Ben, Paul, could you add the patch to your powerpc tree?

Thanks and regards, 
Hendrik

-- 
Hendrik Brueckner
D/3303 Linux on System z Development
eMail: brueckner@linux.vnet.ibm.com
IBM Deutschland Research & Development GmbH, Schoenaicher Str. 220, 71032 Boeblingen

IBM Deutschland Research & Development GmbH
Vorsitzender des Aufsichtsrats: Martin Jetter
Geschaeftsfuehrung: Erich Baier
Sitz der Gesellschaft: Boeblingen
Registergericht: Amtsgericht Stuttgart, HRB 243294

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [patch 1/1] hvc_console: escape magic sysrq key
  2008-12-16  9:15 [patch 0/1] hvc_console: send magic sysrq key to terminal Hendrik Brueckner
@ 2008-12-16  9:15 ` Hendrik Brueckner
  2008-12-16  9:36   ` Andreas Schwab
  0 siblings, 1 reply; 4+ messages in thread
From: Hendrik Brueckner @ 2008-12-16  9:15 UTC (permalink / raw)
  To: Benjamin Herrenschmidt, Paul Mackerras, Linux PPC devel,
	Jeremy Fitzhardinge, Rusty Russell, Ryan S. Arnold
  Cc: Martin Schwidefsky, Christian Borntraeger, Hendrik Brueckner,
	Heiko Carstens, LKML

From: Hendrik Brueckner <brueckner@linux.vnet.ibm.com>

The ctrl-o (^O) is a common control key used by several applications like vim.

To allow users to send ^O to the terminal, this patch introduces a check
if ^O is pressed again if the sysrq_pressed variable is already set.
In this case, clear sysrq_pressed state and flip the ^O character to the tty.
(The old behavior has always set "sysrq_pressed" if ^0 has been entered, and it
has not flipped the ^O character to the tty.)

Signed-off-by: Hendrik Brueckner <brueckner@linux.vnet.ibm.com>
---
 drivers/char/hvc_console.c |    7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

--- a/drivers/char/hvc_console.c
+++ b/drivers/char/hvc_console.c
@@ -642,8 +642,11 @@ int hvc_poll(struct hvc_struct *hp)
 				/* Handle the SysRq Hack */
 				/* XXX should support a sequence */
 				if (buf[i] == '\x0f') {	/* ^O */
-					sysrq_pressed = 1;
-					continue;
+					/* if ^0 is pressed again, reset
+					 * sysrq_pressed and flip ^0 char */
+					sysrq_pressed = (sysrq_pressed) ? 0 : 1;
+					if (sysrq_pressed)
+						continue;
 				} else if (sysrq_pressed) {
 					handle_sysrq(buf[i], tty);
 					sysrq_pressed = 0;

-- 
Hendrik Brueckner
D/3303 Linux on System z Development
eMail: brueckner@linux.vnet.ibm.com
IBM Deutschland Research & Development GmbH, Schoenaicher Str. 220, 71032 Boeblingen

IBM Deutschland Research & Development GmbH
Vorsitzender des Aufsichtsrats: Martin Jetter
Geschaeftsfuehrung: Erich Baier
Sitz der Gesellschaft: Boeblingen
Registergericht: Amtsgericht Stuttgart, HRB 243294

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [patch 1/1] hvc_console: escape magic sysrq key
  2008-12-16  9:15 ` [patch 1/1] hvc_console: escape magic sysrq key Hendrik Brueckner
@ 2008-12-16  9:36   ` Andreas Schwab
  2008-12-16 10:09     ` [patch 1/1 v2] " Hendrik Brueckner
  0 siblings, 1 reply; 4+ messages in thread
From: Andreas Schwab @ 2008-12-16  9:36 UTC (permalink / raw)
  To: Hendrik Brueckner
  Cc: Jeremy Fitzhardinge, Christian Borntraeger, Rusty Russell,
	Heiko Carstens, LKML, Linux PPC devel, Paul Mackerras,
	Martin Schwidefsky

Hendrik Brueckner <brueckner@linux.vnet.ibm.com> writes:

> +					/* if ^0 is pressed again, reset
> +					 * sysrq_pressed and flip ^0 char */

The comment says ^0 twice when ^O is meant.

> +					sysrq_pressed = (sysrq_pressed) ? 0 : 1;

                                        sysrq_pressed = !sysrc_pressed;

Andreas.

-- 
Andreas Schwab, SuSE Labs, schwab@suse.de
SuSE Linux Products GmbH, Maxfeldstraße 5, 90409 Nürnberg, Germany
PGP key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [patch 1/1 v2] hvc_console: escape magic sysrq key
  2008-12-16  9:36   ` Andreas Schwab
@ 2008-12-16 10:09     ` Hendrik Brueckner
  0 siblings, 0 replies; 4+ messages in thread
From: Hendrik Brueckner @ 2008-12-16 10:09 UTC (permalink / raw)
  To: Andreas Schwab
  Cc: Jeremy Fitzhardinge, Christian Borntraeger, Rusty Russell,
	Heiko Carstens, LKML, Linux PPC devel, Hendrik Brueckner,
	Paul Mackerras, Martin Schwidefsky

Hello Andreas,

thanks for your comments.

On Tue, Dec 16, 2008 at 10:36:55AM +0100, Andreas Schwab wrote:
> > +					/* if ^0 is pressed again, reset
> > +					 * sysrq_pressed and flip ^0 char */
> The comment says ^0 twice when ^O is meant.
Correct. I have updated the comment.

> > +					sysrq_pressed = (sysrq_pressed) ? 0 : 1;
>                                         sysrq_pressed = !sysrc_pressed;
Ok, it might look better.


[PATCH v2] hvc_console: escape magic sysrq key

From: Hendrik Brueckner <brueckner@linux.vnet.ibm.com>

The ctrl-o (^O) is a common control key used by several applications like vim.

To allow users to send ^O to the terminal, this patch introduces a check
if ^O is pressed again if the sysrq_pressed variable is already set.
In this case, clear sysrq_pressed state and flip the ^O character to the tty.
(The old behavior has always set "sysrq_pressed" if ^O has been entered, and it
has not flipped the ^O character to the tty.)

Signed-off-by: Hendrik Brueckner <brueckner@linux.vnet.ibm.com>
---
 drivers/char/hvc_console.c |    7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

--- a/drivers/char/hvc_console.c
+++ b/drivers/char/hvc_console.c
@@ -642,8 +642,11 @@ int hvc_poll(struct hvc_struct *hp)
 				/* Handle the SysRq Hack */
 				/* XXX should support a sequence */
 				if (buf[i] == '\x0f') {	/* ^O */
-					sysrq_pressed = 1;
-					continue;
+					/* if ^O is pressed again, reset
+					 * sysrq_pressed and flip ^O char */
+					sysrq_pressed = !sysrq_pressed;
+					if (sysrq_pressed)
+						continue;
 				} else if (sysrq_pressed) {
 					handle_sysrq(buf[i], tty);
 					sysrq_pressed = 0;

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2008-12-16 10:09 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-12-16  9:15 [patch 0/1] hvc_console: send magic sysrq key to terminal Hendrik Brueckner
2008-12-16  9:15 ` [patch 1/1] hvc_console: escape magic sysrq key Hendrik Brueckner
2008-12-16  9:36   ` Andreas Schwab
2008-12-16 10:09     ` [patch 1/1 v2] " Hendrik Brueckner

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).