about input in hello

Adam Lackorzynski adam at os.inf.tu-dresden.de
Sat Aug 11 19:36:20 CEST 2007

On Fri Aug 10, 2007 at 17:15:58 +0800, huang wrote:
>    if I want to get some input in the "hello" example, what should I do?
> I simply use "scanf()", but it does not work!
>    my main.c is as below:

scanf does not work at this stage. Usually, in such an environment,
getting input to work requires you to write a driver for the device you
want to interact with (e.g. the keyboard). The same actually goes for
output too, so to get something on your screen you would need to have
the device memory mapped and write the proper values to the proper
locations to see something on the screen.
As you see, the printf works without doing this because the kernel
provides such a function as part of its debugging facilities. And it
also offers a possibility for programs to receive from the keyboard:
include <l4/sys/kdebug.h> and use l4kd_inchar() to receive input from
the keyboard. This function is non-blocking and returns -1 if no
character could be read.


Adam                 adam at os.inf.tu-dresden.de
  Lackorzynski         http://os.inf.tu-dresden.de/~adam/

More information about the l4-hackers mailing list