mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* loadb and loady do not work
@ 2011-05-13 13:31 Alexey Galakhov
  2011-05-13 13:53 ` [PATCH] fix console fifo (and loadb/loady commands) Alexey Galakhov
  0 siblings, 1 reply; 4+ messages in thread
From: Alexey Galakhov @ 2011-05-13 13:31 UTC (permalink / raw)
  To: barebox

Hi,

I just switched from u-boot to barebox on a MINI2440 board and found
that I'm unable to use both loadb and loady. I used loady with u-boot
and it worked fine. Looks like barebox does not listen to the incoming data.

mini2440:/ loady -c
## Ready for binary (ymodem) download to 0x00000000 offset on image.bin
device at 115200 bps...
C
*** file: uImage
sb -vv uImage
Sending: uImage
Ymodem sectors/kbytes sent:   0/ 0kRetry 0: NAK on sector
Retry 0: NAK on sector
Retry 0: NAK on sector
Retry 0: NAK on sector
(etc up to timeout)

mini2440:/ loadb -c
## Ready for binary (kermit) download to 0x00000000 offset on image.bin
device at 115200 bps...

*** file: uImage
gkermit -iXvs uImage
G-Kermit CU-1.00, Columbia University, 1999-12-25
Escape back to your local Kermit and give a RECEIVE command.

KERMIT READY TO SEND...
-
*** exit status: 1

I tried to debug it by adding a simple echo test and I think I found the
problem. tstc() may return false even if there are bytes in input
buffer. Thus getc() may sleep even if the buffer is full!

--
Alex

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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH] fix console fifo (and loadb/loady commands)
  2011-05-13 13:31 loadb and loady do not work Alexey Galakhov
@ 2011-05-13 13:53 ` Alexey Galakhov
  2011-05-16  6:30   ` Sascha Hauer
  0 siblings, 1 reply; 4+ messages in thread
From: Alexey Galakhov @ 2011-05-13 13:53 UTC (permalink / raw)
  To: barebox

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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] fix console fifo (and loadb/loady commands)
  2011-05-13 13:53 ` [PATCH] fix console fifo (and loadb/loady commands) Alexey Galakhov
@ 2011-05-16  6:30   ` Sascha Hauer
  2011-05-16  6:53     ` Alexey Galakhov
  0 siblings, 1 reply; 4+ messages in thread
From: Sascha Hauer @ 2011-05-16  6:30 UTC (permalink / raw)
  To: Alexey Galakhov; +Cc: barebox

Hi Alexey,

On Fri, May 13, 2011 at 07:53:29PM +0600, Alexey Galakhov wrote:
> This patch fixes loadb and loady commands. tstc() should return true if
> console_input_buffer is not empty.

The patch is fine, thanks.

Your mailer converts tabs into whitespaces. Also you forgot to add a
signed-off-by to your patch. I fixed this up manually this time.

Sascha

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

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] fix console fifo (and loadb/loady commands)
  2011-05-16  6:30   ` Sascha Hauer
@ 2011-05-16  6:53     ` Alexey Galakhov
  0 siblings, 0 replies; 4+ messages in thread
From: Alexey Galakhov @ 2011-05-16  6:53 UTC (permalink / raw)
  To: Sascha Hauer; +Cc: barebox

On 05/16/2011 12:30 PM, Sascha Hauer wrote:
> Hi Alexey,
>
> On Fri, May 13, 2011 at 07:53:29PM +0600, Alexey Galakhov wrote:
>> This patch fixes loadb and loady commands. tstc() should return true if
>> console_input_buffer is not empty.
> The patch is fine, thanks.
>
> Your mailer converts tabs into whitespaces. Also you forgot to add a
> signed-off-by to your patch. I fixed this up manually this time.
>
> Sascha
Thank you! I'll check my mailer.

I'm preparing some more patches: s3c framebuffer support (originally
written by Juergen Beisert but broken and outdated), mini2440
framebuffer support and JPEG image decoding (takes about 20kB of space
by itself but reduces overall size significantly due to smaller image
files).

--
Alex

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

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2011-05-16  6:53 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-05-13 13:31 loadb and loady do not work Alexey Galakhov
2011-05-13 13:53 ` [PATCH] fix console fifo (and loadb/loady commands) Alexey Galakhov
2011-05-16  6:30   ` Sascha Hauer
2011-05-16  6:53     ` Alexey Galakhov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox