[PATCH] fix console fifo (and loadb/loady commands)
Alexey Galakhov
agalakhov at gmail.com
Fri May 13 09:53:29 EDT 2011
This patch fixes loadb and loady commands. tstc() should return true if
console_input_buffer is not empty.
diff -udp ./common/console.c.orig ./common/console.c
--- ./common/console.c.orig 2011-05-06 13:30:20.000000000 +0600
+++ ./common/console.c 2011-05-13 19:42:12.000000000 +0600
@@ -195,6 +195,20 @@ static int getc_raw(void)
}
}
+static int tstc_raw(void)
+{
+ struct console_device *cdev;
+
+ for_each_console(cdev) {
+ if (!(cdev->f_active & CONSOLE_STDIN))
+ continue;
+ if (cdev->tstc(cdev))
+ return 1;
+ }
+
+ return 0;
+}
+
int getc(void)
{
unsigned char ch;
@@ -209,7 +223,7 @@ int getc(void)
while (1) {
poller_call();
- if (tstc()) {
+ if (tstc_raw()) {
kfifo_putc(console_input_buffer, getc_raw());
start = get_time_ns();
@@ -236,16 +250,7 @@ EXPORT_SYMBOL(fgetc);
int tstc(void)
{
- struct console_device *cdev;
-
- for_each_console(cdev) {
- if (!(cdev->f_active & CONSOLE_STDIN))
- continue;
- if (cdev->tstc(cdev))
- return 1;
- }
-
- return 0;
+ return kfifo_len(console_input_buffer) || tstc_raw();
}
EXPORT_SYMBOL(tstc);
More information about the barebox
mailing list