Linux Input/HID development
 help / color / mirror / Atom feed
* Query last reported event state
@ 2009-11-24 17:33 Daniel Mack
  2009-11-24 19:57 ` Mika Westerberg
  0 siblings, 1 reply; 3+ messages in thread
From: Daniel Mack @ 2009-11-24 17:33 UTC (permalink / raw)
  To: linux-input

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


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Query last reported event state
  2009-11-24 17:33 Query last reported event state Daniel Mack
@ 2009-11-24 19:57 ` Mika Westerberg
  2009-11-26  3:51   ` Dmitry Torokhov
  0 siblings, 1 reply; 3+ messages in thread
From: Mika Westerberg @ 2009-11-24 19:57 UTC (permalink / raw)
  To: Daniel Mack; +Cc: linux-input

Hi Daniel,

On Tue, Nov 24, 2009 at 06:33:56PM +0100, Daniel Mack wrote:
> 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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Query last reported event state
  2009-11-24 19:57 ` Mika Westerberg
@ 2009-11-26  3:51   ` Dmitry Torokhov
  0 siblings, 0 replies; 3+ messages in thread
From: Dmitry Torokhov @ 2009-11-26  3:51 UTC (permalink / raw)
  To: Mika Westerberg; +Cc: Daniel Mack, linux-input

On Tue, Nov 24, 2009 at 09:57:29PM +0200, Mika Westerberg wrote:
> Hi Daniel,
> 
> On Tue, Nov 24, 2009 at 06:33:56PM +0100, Daniel Mack wrote:
> > 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.

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.

-- 
Dmitry

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2009-11-26  3:51 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-11-24 17:33 Query last reported event state Daniel Mack
2009-11-24 19:57 ` Mika Westerberg
2009-11-26  3:51   ` Dmitry Torokhov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox