mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Alexey Galakhov <agalakhov@gmail.com>
To: barebox@lists.infradead.org
Subject: [PATCH] fix console fifo (and loadb/loady commands)
Date: Fri, 13 May 2011 19:53:29 +0600	[thread overview]
Message-ID: <4DCD37D9.5020408@gmail.com> (raw)
In-Reply-To: <4DCD32B4.9090606@yandex-team.ru>

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);
 


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

  reply	other threads:[~2011-05-13 13:53 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-05-13 13:31 loadb and loady do not work Alexey Galakhov
2011-05-13 13:53 ` Alexey Galakhov [this message]
2011-05-16  6:30   ` [PATCH] fix console fifo (and loadb/loady commands) Sascha Hauer
2011-05-16  6:53     ` Alexey Galakhov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4DCD37D9.5020408@gmail.com \
    --to=agalakhov@gmail.com \
    --cc=barebox@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox