From 5a411c4616b1b81f90080b9b0d2943252fc99c52 Mon Sep 17 00:00:00 2001
From: Jesse Barnes <jbarnes@engr.sgi.com>
Date: Thu, 16 Sep 2004 22:09:41 -0700
Subject: [PATCH] [PATCH] fix sysrq handling bug in sn_console.c

Fix a stupid bug in the sysrq handling in sn_console.c.  Instead of eating
all characters in the sysrq string (preventing them from getting to the tty
layer), only eat those following 'ESC' since that's a pretty important
character for various things.  Please apply before 2.6.9 is released as the
console is very unfriendly to use without it.

Signed-off-by: Jesse Barnes <jbarnes@sgi.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
---
 drivers/serial/sn_console.c | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/drivers/serial/sn_console.c b/drivers/serial/sn_console.c
index 14fde042ec51..200bbce42c40 100644
--- a/drivers/serial/sn_console.c
+++ b/drivers/serial/sn_console.c
@@ -596,10 +596,15 @@ sn_receive_chars(struct sn_cons_port *port, struct pt_regs *regs,
                                 sysrq_requested = jiffies;
                                 sysrq_serial_ptr = sysrq_serial_str;
                         }
-			continue; /* ignore the whole sysrq string */
+			/*
+			 * ignore the whole sysrq string except for the
+			 * leading escape
+			 */
+			if (ch != '\e')
+				continue;
                 }
                 else
-                        sysrq_serial_ptr = sysrq_serial_str;
+			sysrq_serial_ptr = sysrq_serial_str;
 #endif /* CONFIG_MAGIC_SYSRQ */
 
 		/* record the character to pass up to the tty layer */
@@ -611,8 +616,6 @@ sn_receive_chars(struct sn_cons_port *port, struct pt_regs *regs,
 			if (tty->flip.count == TTY_FLIPBUF_SIZE)
 				break;
 		}
-		else {
-		}
 		port->sc_port.icount.rx++;
 	}
 
-- 
2.30.9