]> pilppa.com Git - linux-2.6-omap-h63xx.git/commitdiff
hvc_console: Escape magic sysrq key
authorHendrik Brueckner <brueckner@linux.vnet.ibm.com>
Tue, 16 Dec 2008 00:09:38 +0000 (00:09 +0000)
committerPaul Mackerras <paulus@samba.org>
Sun, 21 Dec 2008 03:21:15 +0000 (14:21 +1100)
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>
drivers/char/hvc_console.c

index 74ecb5b2968e31b8429dae3552c171fd74d76a76..fb57f67bb427fb86e23e9b6c723ba3fcae467ea9 100644 (file)
@@ -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;