path: root/arch/sandbox/cpu/os.c
diff options
authorTaylor Hutt <>2013-02-24 17:33:13 +0000
committerSimon Glass <>2013-02-28 19:09:21 -0800
commite101550a9a8b956434cf2a73f66afbb42f4654bd (patch)
tree9b3779554981488f9fead9eab91eadfbdc0a1d2d /arch/sandbox/cpu/os.c
parentbda32ffcf712806c7880ded25a012fbeede35e80 (diff)
sandbox: Improve sandbox serial port keyboard interface
Implements the tstc() interface for the serial driver. Multiplexing the console between the serial port and a keyboard uses a polling method of checking if characters are available; this means that the serial console must be non-blocking when attempting to read characters. Signed-off-by: Taylor Hutt <> Signed-off-by: Simon Glass <>
Diffstat (limited to 'arch/sandbox/cpu/os.c')
1 files changed, 8 insertions, 0 deletions
diff --git a/arch/sandbox/cpu/os.c b/arch/sandbox/cpu/os.c
index 36637af6ce..3e37c930b0 100644
--- a/arch/sandbox/cpu/os.c
+++ b/arch/sandbox/cpu/os.c
@@ -44,6 +44,14 @@ ssize_t os_read(int fd, void *buf, size_t count)
return read(fd, buf, count);
+ssize_t os_read_no_block(int fd, void *buf, size_t count)
+ const int flags = fcntl(fd, F_GETFL, 0);
+ fcntl(fd, F_SETFL, flags | O_NONBLOCK);
+ return os_read(fd, buf, count);
ssize_t os_write(int fd, const void *buf, size_t count)
return write(fd, buf, count);
OpenPOWER on IntegriCloud