public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Wolfgang Denk <wd@denx.de>
To: u-boot@lists.denx.de
Subject: [U-Boot] Sandbox question
Date: Mon, 23 Apr 2012 21:33:42 +0200	[thread overview]
Message-ID: <20120423193342.AF358200261@gemini.denx.de> (raw)
In-Reply-To: <201204231503.08835.vapier@gentoo.org>

Dear Mike Frysinger,

In message <201204231503.08835.vapier@gentoo.org> you wrote:
>
> > I don't see why we cannot simply read from stdin (or rathr from file
> > descriptor 0) as usual?
>
> the "usual" method of reading from stdin involves the tty doing buffering and 
> the application only seeing fully flushed lines.  thus it would not operate the 

That's why I wrote "or rather from fd 0".

> same as the hardware (where u-boot gets every char as you type) and you 
> wouldn't be able to handle things like tab completion.

C'me on.  That's a standard issue.  We know how to handle this, right?

> > You can use standard methods like select() or poll() to wait for input,
> > which will also inform you about events like EOF.
>
> because that isn't how u-boot on the hardware works.  u-boot itself calls 
> tstc() to see if there's any data and does so in a continuous loop.  when 
> there is data, it calls getc().  tstc() should not block, and getc() isn't>  
> call unless u-boot knows there's data.

That's why I suggested to use select() or poll() to poll for available
characters, just like the hardware does.  Only we do NOT want to tun
this in a tight loop.  We will most likely want to add a sufficiently
large delay to keep CPU load in reasonable bounds.

> it is also problematic (currently) to get access to errno from the C library 
> because u-boot itself has a variable called "errno".  so we cannot call the C 

Why invent new methods when we can encapsulate this in the input
interface?

We do not even have to pass EOF on to higher layers in U-Boot - we
could exit directly in the tty interface code.

Best regards,

Wolfgang Denk

-- 
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
As usual, this being a 1.3.x release, I haven't  even  compiled  this
kernel yet. So if it works, you should be doubly impressed.
      - Linus Torvalds in <199506181536.SAA10638@keos.cs.Helsinki.FI>

  reply	other threads:[~2012-04-23 19:33 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-04-23  6:41 [U-Boot] Sandbox question Wolfgang Denk
2012-04-23 15:41 ` Mike Frysinger
2012-04-23 17:32   ` Matthias Weisser
2012-04-23 17:39     ` Wolfgang Denk
2012-04-23 17:49       ` Matthias Weisser
2012-04-23 18:30         ` Wolfgang Denk
2012-04-24  9:25           ` Matthias Weißer
2012-04-23 17:58   ` Simon Glass
2012-04-23 18:39     ` Wolfgang Denk
2012-04-23 18:54       ` Mike Frysinger
2012-04-23 19:03       ` Mike Frysinger
2012-04-23 19:33         ` Wolfgang Denk [this message]
2012-04-23 20:57           ` Mike Frysinger
2012-04-23 21:16             ` Mike Frysinger
2012-04-23 21:17             ` Wolfgang Denk
2012-04-23 21:32               ` Mike Frysinger
2012-04-23 21:51 ` [U-Boot] Sandbox: auto exiting on pipe closure Mike Frysinger
2012-08-09 20:39   ` Wolfgang Denk
2012-08-10  0:47     ` Mike Frysinger
  -- strict thread matches above, loose matches on Subject: below --
2013-12-06 23:36 [U-Boot] [PATCH 0/8] Secure boot improvements and test on Beaglebone Black Simon Glass
2013-12-30  7:40 ` [U-Boot] sandbox question TigerLiu at viatech.com.cn
2013-12-31  0:42   ` TigerLiu at viatech.com.cn
2014-01-07 23:58     ` Simon Glass
2014-01-08  0:52       ` TigerLiu at viatech.com.cn
2014-01-08  3:46         ` Abraham Varricatt
2014-01-08 10:30           ` TigerLiu at viatech.com.cn
2011-12-01 16:35 [U-Boot] Sandbox question Andreas Bießmann
2011-12-01 18:13 ` Simon Glass
2011-12-01 19:21 ` Mike Frysinger

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=20120423193342.AF358200261@gemini.denx.de \
    --to=wd@denx.de \
    --cc=u-boot@lists.denx.de \
    /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