nanogui: reading the keyboard


Previous by date: 10 Dec 2005 18:44:42 +0000 Re: freetype2 now works, Steven Scholz
Next by date: 10 Dec 2005 18:44:42 +0000 Re: freetype2 now works, Greg Haerr
Previous in thread:
Next in thread: 10 Dec 2005 18:44:42 +0000 Re: reading the keyboard, Greg Haerr

Subject: reading the keyboard
From: Yan Seiner ####@####.####
Date: 10 Dec 2005 18:44:42 +0000
Message-Id: <439B2181.7050705@seiner.com>

I am trying to run nano-X progs from init....

One of the programs needs to read the keyboard.  Here's the code:

          FD_ZERO (&rfds);
          FD_SET (0, &rfds);
          printf ("k0: %d %d %d\n", k, delay, retval);
          retval = select (1, &rfds, NULL, NULL, &tv);
          printf ("k1: %d %d %d\n", k, delay, retval);

          if (retval)
            {
              buffer[0] = '\0';
              printf ("waiting for ch: %d", read (0, buffer, 1));
              .............
             }

What happens is that select returns with a 1, but read() blocks.  If I 
open /dev/stdin O_NONBLOCK, then read() returns -1, signifying an 
interrupted read.

I can hold a key down, and I will occasionally get read() to read the 
correct char....

So, how do I read the keyboard?

Or, how do I automatically start (and restart) nano-X apps so that they 
have access to the keyboard input?

--Yan

Previous by date: 10 Dec 2005 18:44:42 +0000 Re: freetype2 now works, Steven Scholz
Next by date: 10 Dec 2005 18:44:42 +0000 Re: freetype2 now works, Greg Haerr
Previous in thread:
Next in thread: 10 Dec 2005 18:44:42 +0000 Re: reading the keyboard, Greg Haerr


Powered by ezmlm-browse 0.20.