ANDROID: input: Add "inhibited" property for input devices
authorCaesar Wang <wxt@rock-chips.com>
Tue, 25 Aug 2015 10:21:42 +0000 (18:21 +0800)
committerCaesar Wang <wxt@rock-chips.com>
Tue, 1 Sep 2015 03:11:46 +0000 (11:11 +0800)
commit2f76476339641da23b156e5546c182e67daa93ab
treed405a99c906765f840c330735db41676382924b1
parentcce63258ecb1950b79f05e70ffc75bd4d3858a07
ANDROID: input: Add "inhibited" property for input devices

Under certain circumstances, we want to disable some input
devices from userspace. In particular, when we detect that the lid of a
laptop is closed, we want to be able to disable touchpad and
touchscreen to avoid bogus input.

To facilitate this, we introduce the "inhibited" sysfs property for
input devices. Using this property, userspace can tell a driver that the
events it can provide are not currently of interest and should be
ignored. We provide hooks so that the driver can take additional
actions, such as powering down the device.

We deliberately keep this limited to input devices for now to keep the
implementation as straightforward as possible.

(cherry-pick from: https://chromium-review.googlesource.com/207989)

verify that touchpad works
echo 1 > /sys/bus/i2c/drivers/elan_i2c/4-0015/input/input0/inhibited
touchpad stops working
echo 0 >  /sys/bus/i2c/drivers/elan_i2c/4-0015/input/input0/inhibited
touchpad works again

Signed-off-by: Patrik Fimml <patrikf@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/207989
Reviewed-by: Dmitry Torokhov <dtor@chromium.org>
Reviewed-by: Benson Leung <bleung@chromium.org>
Change-Id: I889d37ef7ffc49f3c073b1c283d5c3327c263b7f
Signed-off-by: Caesar Wang <wxt@rock-chips.com>
drivers/input/input.c
include/linux/input.h