public inbox for linux-ia64@vger.kernel.org
 help / color / mirror / Atom feed
* Fix staircase effect on Altix serial console.
@ 2004-03-02 23:49 Andreas Schwab
  2004-03-03  2:56 ` David Mosberger
                   ` (15 more replies)
  0 siblings, 16 replies; 17+ messages in thread
From: Andreas Schwab @ 2004-03-02 23:49 UTC (permalink / raw)
  To: linux-ia64

Serial console output on Altix didn't convert NL to CRNL.

Andreas.

--- linux-2.6.3/drivers/char/sn_serial.c.~1~	2004-03-02 16:41:09.000000000 +0100
+++ linux-2.6.3/drivers/char/sn_serial.c	2004-03-02 22:51:09.049180364 +0100
@@ -984,6 +984,7 @@ static void
 sn_sal_console_write(struct console *co, const char *s, unsigned count)
 {
 	unsigned long flags;
+	const char *s1;
 
 	BUG_ON(!sn_sal_is_asynch);
 
@@ -991,15 +992,36 @@ sn_sal_console_write(struct console *co,
 	 * oops, kdb, panic, etc.  make sure they get it. */
 	if (spin_is_locked(&sn_sal_lock)) {
 		synch_flush_xmit();
+		/* Output '\r' before each '\n' */
+		while ((s1 = memchr(s, '\n', count)) != NULL) {
+			sn_func->sal_puts(s, s1 - s);
+			sn_func->sal_puts("\r\n", 2);
+			count -= s1 + 1 - s;
+			s = s1 + 1;
+		}
 		sn_func->sal_puts(s, count);
 	}
 	else if (in_interrupt()) {
 		spin_lock_irqsave(&sn_sal_lock, flags);
 		synch_flush_xmit();
 		spin_unlock_irqrestore(&sn_sal_lock, flags);
+		/* Output '\r' before each '\n' */
+		while ((s1 = memchr(s, '\n', count)) != NULL) {
+			sn_func->sal_puts(s, s1 - s);
+			sn_func->sal_puts("\r\n", 2);
+			count -= s1 + 1 - s;
+			s = s1 + 1;
+		}
 		sn_func->sal_puts(s, count);
 	}
 	else
+		/* Output '\r' before each '\n' */
+		while ((s1 = memchr(s, '\n', count)) != NULL) {
+			sn_sal_write(NULL, 0, s, s1 - s);
+			sn_sal_write(NULL, 0, "\r\n", 2);
+			count -= s1 + 1 - s;
+			s = s1 + 1;
+		}
 		sn_sal_write(NULL, 0, s, count);
 }
 

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

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

end of thread, other threads:[~2004-03-04 11:02 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-03-02 23:49 Fix staircase effect on Altix serial console Andreas Schwab
2004-03-03  2:56 ` David Mosberger
2004-03-03  3:31 ` Jesse Barnes
2004-03-03 10:57 ` Andreas Schwab
2004-03-03 12:46 ` Robin Holt
2004-03-03 13:34 ` Andreas Schwab
2004-03-03 13:40 ` Robin Holt
2004-03-03 14:20 ` Andreas Schwab
2004-03-03 15:11 ` Robin Holt
2004-03-03 15:52 ` Andreas Schwab
2004-03-03 17:19 ` Jesse Barnes
2004-03-03 17:27 ` Jesse Barnes
2004-03-03 17:36 ` Andreas Schwab
2004-03-03 20:44 ` Jesse Barnes
2004-03-03 22:21 ` Jesse Barnes
2004-03-03 22:28 ` David Mosberger
2004-03-04 11:02 ` Andreas Schwab

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