Query last reported event state
Hi,
is there a way to query the last state an input device reported, preferably even for a special key mask? When a button is pressed and a userspace application is started, it should be able to figure out the current state, especially because those GPIO signals are likely connected to other peripherals to report arbitrary events in the system. Is there any such framework for that purpose?
A somewhat related topic is: Looking at the gpio_keys.c for example, I think there should be code that reports an event from probe() when the configured GPIO is not in its 'inactive' state, otherwise it will loose the first key-up event, right?
Thanks,
Daniel
Hi Daniel,
Quoted 8 lines · Daniel Mack
Hi,
is there a way to query the last state an input device reported, preferably even for a special key mask? When a button is pressed and a userspace application is started, it should be able to figure out the current state, especially because those GPIO signals are likely connected to other peripherals to report arbitrary events in the system. Is there any such framework for that purpose?
Not sure whether this helps, but you can look <linux/input.h> and check what ioctl()s it provides for this purpose. At least there seems to be:
EVIOCGKEY - get global keystate
EVIOCGSW - get all switch states
EVIOCGBIT - get event bits
Maybe you can use some of these to query current status of input events.
MW
Quoted 12 lines · Mika Westerberg
Hi Daniel,
Quoted 8 lines · Daniel Mack
Hi,
is there a way to query the last state an input device reported, preferably even for a special key mask? When a button is pressed and a userspace application is started, it should be able to figure out the current state, especially because those GPIO signals are likely connected to other peripherals to report arbitrary events in the system. Is there any such framework for that purpose?
Quoted 8 lines
Not sure whether this helps, but you can look <
linux/input.h> and check what ioctl()s it provides for this purpose. At least there seems to be:
EVIOCGKEY - get global keystate
EVIOCGSW - get all switch states
EVIOCGBIT - get event bitsMaybe you can use some of these to query current status of input events.
This is correct. The first 2 ioctls are there so userspace can get the current state of input device. The last ioctl is to query capabilities, not the state though.
Signature · 1 line
Dmitry