diff options
author | Jason Wessel <jason.wessel@windriver.com> | 2009-08-20 15:39:49 -0500 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2009-09-23 06:46:38 -0700 |
commit | 87a5d15154ae2389251e6ad99216a846b905375c (patch) | |
tree | 54a546e1f5f393fae70ca80eddf0b38b1ac9b1c0 /drivers | |
parent | df6c516900d48df3581b23d37d6516a22ec4f2ca (diff) | |
download | linux-87a5d15154ae2389251e6ad99216a846b905375c.tar.bz2 |
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>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/usb/early/ehci-dbgp.c | 22 |
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) static void early_dbgp_write(struct console *con, const char *str, u32 n) { int chunk, ret; + char buf[DBGP_MAX_PACKET]; + int use_cr = 0; if (!ehci_debug) return; while (n > 0) { - chunk = n; - if (chunk > DBGP_MAX_PACKET) - chunk = DBGP_MAX_PACKET; + for (chunk = 0; chunk < DBGP_MAX_PACKET && n > 0; + str++, chunk++, n--) { + if (!use_cr && *str == '\n') { + use_cr = 1; + buf[chunk] = '\r'; + str--; + n++; + continue; + } + if (use_cr) + use_cr = 0; + buf[chunk] = *str; + } ret = dbgp_bulk_write(USB_DEBUG_DEVNUM, - dbgp_endpoint_out, str, chunk); - str += chunk; - n -= chunk; + dbgp_endpoint_out, buf, chunk); } } |