John Griswold
John Griswold

Reputation: 21

Instantaneous keyboard state in Linux

Linux - is there a way to find the instantaneous keyboard state? e.g. is the Enter key currently pressed v. has the Enter key been pressed. I'm trying to process a power-off interrupt on the iMX6 processor - get the interrupt (in user space...), wait 500 or 1000 mS, and check if the key is still pressed. input.c does not seem to have a like-named method. Thanks.

Upvotes: 0

Views: 173

Answers (1)

PokeyBagelHole
PokeyBagelHole

Reputation: 51

It might take a bit of effort on your part, but you can query key states and listen for key press-release events by using the evdev kernel interface.

For an example of how to do this look at evtest.

Or look at my python re-write: https://github.com/naedanger/pyevtest

I've used both of these tools on an iMX28 platform to listen for key-presses from a simple matrix keypad.

Upvotes: 1

Related Questions