]> git.kernelconcepts.de Git - karo-tx-linux.git/commit
Input: evdev - add event-mask API
authorDavid Herrmann <dh.herrmann@gmail.com>
Sat, 24 Oct 2015 23:20:18 +0000 (16:20 -0700)
committerDmitry Torokhov <dmitry.torokhov@gmail.com>
Tue, 27 Oct 2015 02:06:48 +0000 (19:06 -0700)
commit06a16293f71927f756dcf37558a79c0b05a91641
tree0f3988e430f10e9b4cc78c2cbb8e1c751432cf98
parent9ace41adb46e36e0709983702230d3602210c171
Input: evdev - add event-mask API

Hardware manufacturers group keys in the weirdest way possible. This may
cause a power-key to be grouped together with normal keyboard keys and
thus be reported on the same kernel interface.

However, user-space is often only interested in specific sets of events.
For instance, daemons dealing with system-reboot (like systemd-logind)
listen for KEY_POWER, but are not interested in any main keyboard keys.
Usually, power keys are reported via separate interfaces, however,
some i8042 boards report it in the AT matrix. To avoid waking up those
system daemons on each key-press, we had two ideas:
 - split off KEY_POWER into a separate interface unconditionally
 - allow filtering a specific set of events on evdev FDs

Splitting of KEY_POWER is a rather weird way to deal with this and may
break backwards-compatibility. It is also specific to KEY_POWER and might
be required for other stuff, too. Moreover, we might end up with a huge
set of input-devices just to have them properly split.

Hence, this patchset implements the second idea: An event-mask to specify
which events you're interested in. Two ioctls allow setting this mask for
each event-type. If not set, all events are reported. The type==0 entry is
used same as in EVIOCGBIT to set the actual EV_* mask of filtered events.
This way, you have a two-level filter.

We are heavily forward-compatible to new event-types and event-codes. So
new user-space will be able to run on an old kernel which doesn't know the
given event-codes or event-types.

Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
drivers/input/evdev.c
include/uapi/linux/input.h