summaryrefslogtreecommitdiffstats
path: root/common/console.c
diff options
context:
space:
mode:
authorAlexey Galakhov <agalakhov@gmail.com>2011-05-13 19:53:29 +0600
committerSascha Hauer <s.hauer@pengutronix.de>2011-05-16 08:28:27 +0200
commit943bf72dc8e0f398c10518aa9289b544fe1570f2 (patch)
tree96b9a8e0721ad310ab59ad82932a718de5109424 /common/console.c
parentde5b1a8ebe715536c4ee5c3d815d7f88dab0bc59 (diff)
downloadbarebox-943bf72dc8e0f398c10518aa9289b544fe1570f2.tar.gz
barebox-943bf72dc8e0f398c10518aa9289b544fe1570f2.tar.xz
fix console fifo (and loadb/loady commands)
This patch fixes loadb and loady commands. tstc() should return true if console_input_buffer is not empty. Signed-off-by: Alexey Galakhov <agalakhov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'common/console.c')
-rw-r--r--common/console.c27
1 files changed, 16 insertions, 11 deletions
diff --git a/common/console.c b/common/console.c
index d33a249c92..d60e57fc42 100644
--- a/common/console.c
+++ b/common/console.c
@@ -189,6 +189,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;
@@ -203,7 +217,7 @@ int getc(void)
while (1) {
poller_call();
- if (tstc()) {
+ if (tstc_raw()) {
kfifo_putc(console_input_buffer, getc_raw());
start = get_time_ns();
@@ -230,16 +244,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);