public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [RFC] [PATCH] Adding ctrl-o sysrq hack support to 8250 driver
@ 2005-11-30 11:17 Sachin Sant
  2005-11-30 12:12 ` Arjan van de Ven
  2005-11-30 13:04 ` Russell King
  0 siblings, 2 replies; 10+ messages in thread
From: Sachin Sant @ 2005-11-30 11:17 UTC (permalink / raw)
  To: lkml; +Cc: ssant

[-- Attachment #1: Type: text/plain, Size: 196 bytes --]

The following patch will allow a user to use sysrq keys over a serial 
console using the ctrl-o key sequence. This is similar to functionality 
provided by the hvc console drivers on PPC boxes.



[-- Attachment #2: 8250-magic-sysrq-support.patch --]
[-- Type: text/plain, Size: 927 bytes --]

Signed-off-by: Sachin Sant <sachinp@in.ibm.com>

diff -Naurp linux-2.6.14.3/drivers/serial/8250.c linux-2.6.14.3-new/drivers/serial/8250.c
--- linux-2.6.14.3/drivers/serial/8250.c	2005-11-11 11:03:12.000000000 +0530
+++ linux-2.6.14.3-new/drivers/serial/8250.c	2005-11-17 15:12:42.000000000 +0530
@@ -1084,6 +1084,23 @@ receive_chars(struct uart_8250_port *up,
 			 */
 		}
 		ch = serial_inp(up, UART_RX);
+
+#if defined(CONFIG_MAGIC_SYSRQ) && defined(CONFIG_SERIAL_CORE_CONSOLE)
+		/* Handle the SysRq ^O Hack */
+		if (ch == '\x0f') {
+			up->port.sysrq = jiffies + HZ*5;
+			goto ignore_char; 
+		}
+		if (up->port.sysrq) {
+			int swallow;
+			spin_unlock(&up->port.lock);
+			swallow = uart_handle_sysrq_char(&up->port, ch, regs);
+			spin_lock(&up->port.lock);
+			if (swallow)
+				goto ignore_char;
+		}
+#endif /* CONFIG_MAGIC_SYSRQ && CONFIG_SERIAL_CORE_CONSOLE */
+
 		flag = TTY_NORMAL;
 		up->port.icount.rx++;
 

^ permalink raw reply	[flat|nested] 10+ messages in thread
* Re: [RFC] [PATCH] Adding ctrl-o sysrq hack support to 8250 driver
@ 2005-12-08  1:38 Milton Miller
  0 siblings, 0 replies; 10+ messages in thread
From: Milton Miller @ 2005-12-08  1:38 UTC (permalink / raw)
  To: LKML; +Cc: Russell King, Olaf Hering, Sachin Sant

On Wed Dec 07 2005 - 18:38:41 EST, Russell King wrote:
> On Wed, Dec 07, 2005 at 11:22:46PM +0100, Olaf Hering wrote:
> > On Tue, Dec 06, Russell King wrote:
> >
> > > I'm still highly concerned about this whole idea. Applying this 
> patch
> > > _will_ without doubt inconvenience a lot of people who expect ^O 
> to be
> > > received as normal.
> >
> > If one boots with 'console=ttyS0', the 'ctrl o' should be handled 
> only
> > on ttyS0. However, I'm not sure if anyone uses ^O in this situation 
> via
> > the system console. In our case, ttyS0 is automatically activated via
> > add_preferred_console in arch/powerpc/kernel/setup-common.c.
> > If there is a clever way to handle ^O only for the system console, 
> would
> > such a patch be accepted? I'm currently looking through the code to 
> see
> > how it could be done.
>
> Easily. Have a look at the internals of uart_handle_break() in
> include/linux/serial_core.h
>
> However, please be aware that ^O is the default control character for
> "flush output" which I think is something you may want to use with a
> serial console. Eg:
>
> speed 38400 baud; rows 0; columns 0; line = 1;
> intr = ^C; quit = ^\; erase = ^?; kill = ^U; eof = ^D; eol = <undef>;
> eol2 = <undef>; start = ^Q; stop = ^S; susp = ^Z; rprnt = ^R; werase = 
> ^W;
> lnext = ^V; flush = ^O; min = 1; time = 0;
> ^^^^^^^^^^^
>
> Hence it's a poor choice. Maybe picking a character which isn't
> already used by default for another purpose would be appropriate?
> '^]', the classic telnet escape character maybe?

Aaarrrrhh NO!

Don't you ever login to a box to telent somewhere else?

I don't want to way 5 seconds to disconnect my telnet from the
hung remote machine (or do a saK either).

If this goes in, perhaps a parameter (which automatically shows
up in sysfs) to change it on the fly?  (ok, something tied to
the class device rather than the serial module would be nicer).

milton

[Hopefully I got all the cc's, I'm not subscribed]


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

end of thread, other threads:[~2005-12-08 14:58 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-11-30 11:17 [RFC] [PATCH] Adding ctrl-o sysrq hack support to 8250 driver Sachin Sant
2005-11-30 12:12 ` Arjan van de Ven
2005-11-30 13:04 ` Russell King
2005-12-06  6:48   ` Sachin Sant
2005-12-06 17:16     ` Russell King
2005-12-07  6:31       ` Sachin Sant
2005-12-07 22:22       ` Olaf Hering
2005-12-07 23:39         ` Russell King
2005-12-08 14:58           ` Olaf Hering
  -- strict thread matches above, loose matches on Subject: below --
2005-12-08  1:38 Milton Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox