diff options
author | Hendrik Brueckner <brueckner@linux.vnet.ibm.com> | 2008-12-15 19:09:38 -0500 |
---|---|---|
committer | Paul Mackerras <paulus@samba.org> | 2008-12-20 22:21:15 -0500 |
commit | 368c1e3249afe0e59097e7df664435ae55fb9f8d (patch) | |
tree | bdcfedb358238fa0775b933f7a2393eb3c552a36 /drivers | |
parent | 532774ec7fa396da20ca724c0cf83d93ee76622f (diff) |
hvc_console: Escape magic sysrq key
The ctrl-o (^O) is a common control key used by several applications,
such as vim, but hvc_console uses ^O as the magic-sysrq key. This
commit allows users to send ^O to applications by pressing ^O twice
in succession.
To implement this, this commit 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>
Signed-off-by: Paul Mackerras <paulus@samba.org>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/char/hvc_console.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/drivers/char/hvc_console.c b/drivers/char/hvc_console.c index 74ecb5b2968..fb57f67bb42 100644 --- a/drivers/char/hvc_console.c +++ b/drivers/char/hvc_console.c | |||
@@ -642,8 +642,11 @@ int hvc_poll(struct hvc_struct *hp) | |||
642 | /* Handle the SysRq Hack */ | 642 | /* Handle the SysRq Hack */ |
643 | /* XXX should support a sequence */ | 643 | /* XXX should support a sequence */ |
644 | if (buf[i] == '\x0f') { /* ^O */ | 644 | if (buf[i] == '\x0f') { /* ^O */ |
645 | sysrq_pressed = 1; | 645 | /* if ^O is pressed again, reset |
646 | continue; | 646 | * sysrq_pressed and flip ^O char */ |
647 | sysrq_pressed = !sysrq_pressed; | ||
648 | if (sysrq_pressed) | ||
649 | continue; | ||
647 | } else if (sysrq_pressed) { | 650 | } else if (sysrq_pressed) { |
648 | handle_sysrq(buf[i], tty); | 651 | handle_sysrq(buf[i], tty); |
649 | sysrq_pressed = 0; | 652 | sysrq_pressed = 0; |