tech-userlevel archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: Detecting keypress on console



Thor Lancelot Simon <tls%panix.com@localhost> wrote:

> > I would like to execute a scipt when a function key is pressed on the
> > console. Is there a mechanism to detect keypresses on wscons?  If I
> > make a daemon that opens /dev/console it will steal the input from
> > getty/login/sh, which is not what I intend.
> > 
> > Any idea?
> 
> Hold your nose and TIOCSTI.

After a few attempts it does not work, not because of TIOCSTI but
because of the reading part. In order to get a keypress, I must disable
terminal canonical mode and set VMIN/VTIME. 

But even if I reinject keypress using TIOCSTI, there are problems
because I interfere with programs that expect other behavior from the
terminal. 

Would it make sense to add a knote in wscons for keypresses, so that
they can be readen using kevent?

-- 
Emmanuel Dreyfus
http://hcpnet.free.fr/pubz
manu%netbsd.org@localhost


Home | Main Index | Thread Index | Old Index