aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJason Wessel <jason.wessel@windriver.com>2009-08-20 16:39:49 -0400
committerGreg Kroah-Hartman <gregkh@suse.de>2009-09-23 09:46:38 -0400
commit87a5d15154ae2389251e6ad99216a846b905375c (patch)
tree54a546e1f5f393fae70ca80eddf0b38b1ac9b1c0
parentdf6c516900d48df3581b23d37d6516a22ec4f2ca (diff)
USB: dbgp: insert cr prior to nl as needed
The rs232 drivers send a carriage return prior to a new line in the early printk code. The usb debug driver should do the same because you want to be able to use the same terminal programs and tools for analysis of early printk data. Signed-off-by: Jason Wessel <jason.wessel@windriver.com> Cc: Ingo Molnar <mingo@elte.hu> Cc: Andrew Morton <akpm@linux-foundation.org> Cc: Yinghai Lu <yinghai@kernel.org> Cc: "Eric W. Biederman" <ebiederm@xmission.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
-rw-r--r--drivers/usb/early/ehci-dbgp.c22
1 files changed, 16 insertions, 6 deletions
diff --git a/drivers/usb/early/ehci-dbgp.c b/drivers/usb/early/ehci-dbgp.c
index 821b7b21c29c..8de709ac0f55 100644
--- a/drivers/usb/early/ehci-dbgp.c
+++ b/drivers/usb/early/ehci-dbgp.c
@@ -700,17 +700,27 @@ int __init early_dbgp_init(char *s)
700static void early_dbgp_write(struct console *con, const char *str, u32 n) 700static void early_dbgp_write(struct console *con, const char *str, u32 n)
701{ 701{
702 int chunk, ret; 702 int chunk, ret;
703 char buf[DBGP_MAX_PACKET];
704 int use_cr = 0;
703 705
704 if (!ehci_debug) 706 if (!ehci_debug)
705 return; 707 return;
706 while (n > 0) { 708 while (n > 0) {
707 chunk = n; 709 for (chunk = 0; chunk < DBGP_MAX_PACKET && n > 0;
708 if (chunk > DBGP_MAX_PACKET) 710 str++, chunk++, n--) {
709 chunk = DBGP_MAX_PACKET; 711 if (!use_cr && *str == '\n') {
712 use_cr = 1;
713 buf[chunk] = '\r';
714 str--;
715 n++;
716 continue;
717 }
718 if (use_cr)
719 use_cr = 0;
720 buf[chunk] = *str;
721 }
710 ret = dbgp_bulk_write(USB_DEBUG_DEVNUM, 722 ret = dbgp_bulk_write(USB_DEBUG_DEVNUM,
711 dbgp_endpoint_out, str, chunk); 723 dbgp_endpoint_out, buf, chunk);
712 str += chunk;
713 n -= chunk;
714 } 724 }
715} 725}
716 726