nanogui: Thread: Re: timer not working fixed, at least for now, I think.


[<<] [<] Page 1 of 1 [>] [>>]
Subject: Re: timer not working fixed, at least for now, I think.
From: "Greg Haerr" ####@####.####
Date: 13 Jun 2004 18:47:59 +0100
Message-Id: <005001c4516e$9813bfa0$3aba46a6@xmission.com>

: TTYKBD = N  // was Y
: NOKBD = Y   // was N
: 
: And now the timer events happen when nano-X is started at boot time. I 
: even start the app at boot time at it gets the timer events.

Amazing.  And I'm glad you've got it working.  This has got to do
with the kbd init code or select() in nanox/srvmain.c I think.


:  I still have a question though. I will be using a keypad hooked to GPIO 
: hardware. I already have the code working to scan it. Right now I run it 
: in a thread. Whenever the thread sees key state changem, it uses 
: GrInjectKeyboardEvent() to get it to the event queue in the main thread. 

This is the right way to do it when you require an external process
to get the keyboard information.  For code that reads a pipe for
kbd input, you can use drivers/kbd_pipe.c (from the external process),
or not change anything.  For instance, the PIXIL PDA handwriting
and on-screen keyboard work as you describe, using a completely
seperate process and GrInjectKeyboardEvent().


:: I see the SCANKBD in config, but what /dev device would it use. Would I 
: need to replace /dev/console with my driver? 

Take a look at it: drivers/kbd_ttyscan.c.  It uses /dev/tty.  You can
just modify it to use whatever device you require.


I wonder how it will effect 
: the starting at boot? Will it re-introduce the timer event problem again 
: now that a keyboard is specified?

Hopefully not.  You know, I'm thinking here what might be the problem.
Since all the keyboard drivers use /dev/tty, perhaps what happens is  that
the device IS opened at boot time, and, instead of waiting in select()
for the keyboard to return a character, the select ALWAYS returns true
for keyboard input on that device.  If that were the case, then select()
would NEVER hang and timeout, producing timeout events.  The
read() in drivers/kbd_tty.c could return 0, meaning no kbd data,
and the cycle continues.  To check this, you could printf() the
return value from read() in TTY_Read.  I'll bet this is the problem.
Also, note that the tty driver uses environ var CONSOLE if
it exists instead of /dev/tty.

Regards,

Greg

Subject: Re: timer not working fixed, at least for now, I think.
From: "Martin Kajdas" ####@####.####
Date: 26 Sep 2007 21:31:00 +0100
Message-Id: <CF2BB830A62F914F848E5AD5FFF57AC24F9919@mkmail.MKPROD.COM>

> : TTYKBD = N  // was Y
> : NOKBD = Y   // was N
> : 
> : And now the timer events happen when nano-X is started at boot time.
I 
> : even start the app at boot time at it gets the timer events.
>
> Amazing.  And I'm glad you've got it working.  This has got to do
> with the kbd init code or select() in nanox/srvmain.c I think.


I have the same problem (timers not working) but in my case the keyboard
is optional.
Because the keyboard is USB, it is hot-plugged and has to work anytime.
It is not required at boot time and without it the problem occurred.
Because nano-X had to be configured with TTYKBD=Y, I fixed it by
changing nanox/srvmain.c
GsSelect(0L);
to:
GsSelect(1L);
inside main().
This way, GsSelect does not hang waiting for keyboard and processes all
timers when needed.
I do not see any reason why the timeout parameter should be zero.
Martin
[<<] [<] Page 1 of 1 [>] [>>]


Powered by ezmlm-browse 0.20.