summaryrefslogtreecommitdiffstats
path: root/arch/powerpc/kernel/udbg.c
diff options
context:
space:
mode:
authorBenjamin Herrenschmidt <benh@kernel.crashing.org>2005-11-30 16:54:12 +1100
committerPaul Mackerras <paulus@samba.org>2006-01-09 14:51:22 +1100
commitbb6b9b28d6847bc71f910e2e82c9040ff4b97ec0 (patch)
tree97b0acaade2d32ddb37147ff5112318f6c292cf8 /arch/powerpc/kernel/udbg.c
parent54b9a9aedc990dd2aefc45ab16d84f245cb7d8d0 (diff)
downloadlinux-bb6b9b28d6847bc71f910e2e82c9040ff4b97ec0.tar.gz
linux-bb6b9b28d6847bc71f910e2e82c9040ff4b97ec0.tar.bz2
linux-bb6b9b28d6847bc71f910e2e82c9040ff4b97ec0.zip
[PATCH] powerpc: udbg updates
The udbg low level io layer has an issue with udbg_getc() returning a char (unsigned on ppc) instead of an int, thus the -1 if you had no available input device could end up turned into 0xff, filling your display with bogus characters. This fixes it, along with adding a little blob to xmon to do a delay before exiting when getting an EOF and fixing the detection of ADB keyboards in udbg_adb.c Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org> Signed-off-by: Paul Mackerras <paulus@samba.org>
Diffstat (limited to 'arch/powerpc/kernel/udbg.c')
-rw-r--r--arch/powerpc/kernel/udbg.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/arch/powerpc/kernel/udbg.c b/arch/powerpc/kernel/udbg.c
index cc2df5e61bb0..a058285a70e7 100644
--- a/arch/powerpc/kernel/udbg.c
+++ b/arch/powerpc/kernel/udbg.c
@@ -17,7 +17,7 @@
#include <asm/processor.h>
void (*udbg_putc)(char c);
-char (*udbg_getc)(void);
+int (*udbg_getc)(void);
int (*udbg_getc_poll)(void);
/* udbg library, used by xmon et al */
@@ -57,8 +57,8 @@ int udbg_write(const char *s, int n)
int udbg_read(char *buf, int buflen)
{
- char c, *p = buf;
- int i;
+ char *p = buf;
+ int i, c;
if (!udbg_getc)
return 0;
@@ -66,8 +66,11 @@ int udbg_read(char *buf, int buflen)
for (i = 0; i < buflen; ++i) {
do {
c = udbg_getc();
+ if (c == -1 && i == 0)
+ return -1;
+
} while (c == 0x11 || c == 0x13);
- if (c == 0)
+ if (c == 0 || c == -1)
break;
*p++ = c;
}