mirror of
https://gitlab.freedesktop.org/libevdev/libevdev.git
synced 2025-12-20 08:00:09 +01:00
Add libevdev_disable_property
On some devices, a kernel input property has been set in error and we need the ability to disable that property. Signed-off-by: Scott Jann <sjann@knight-rider.org>
This commit is contained in:
parent
8e94375bc6
commit
4226c7801b
4 changed files with 34 additions and 0 deletions
|
|
@ -1318,6 +1318,16 @@ libevdev_enable_property(struct libevdev *dev, unsigned int prop)
|
|||
return 0;
|
||||
}
|
||||
|
||||
LIBEVDEV_EXPORT int
|
||||
libevdev_disable_property(struct libevdev *dev, unsigned int prop)
|
||||
{
|
||||
if (prop > INPUT_PROP_MAX)
|
||||
return -1;
|
||||
|
||||
clear_bit(dev->props, prop);
|
||||
return 0;
|
||||
}
|
||||
|
||||
LIBEVDEV_EXPORT int
|
||||
libevdev_has_event_type(const struct libevdev *dev, unsigned int type)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1388,6 +1388,16 @@ int libevdev_has_property(const struct libevdev *dev, unsigned int prop);
|
|||
*/
|
||||
int libevdev_enable_property(struct libevdev *dev, unsigned int prop);
|
||||
|
||||
/**
|
||||
* @ingroup kernel
|
||||
*
|
||||
* @param dev The evdev device
|
||||
* @param prop The input property to disable, one of INPUT_PROP_...
|
||||
*
|
||||
* @return 0 on success or -1 on failure
|
||||
*/
|
||||
int libevdev_disable_property(struct libevdev *dev, unsigned int prop);
|
||||
|
||||
/**
|
||||
* @ingroup bits
|
||||
*
|
||||
|
|
|
|||
|
|
@ -131,3 +131,10 @@ global:
|
|||
local:
|
||||
*;
|
||||
} LIBEVDEV_1_6;
|
||||
|
||||
LIBEVDEV_1_10 {
|
||||
global:
|
||||
libevdev_disable_property;
|
||||
local:
|
||||
*;
|
||||
} LIBEVDEV_1_7;
|
||||
|
|
|
|||
|
|
@ -313,6 +313,13 @@ START_TEST(test_set_input_props)
|
|||
ck_assert_int_eq(libevdev_has_property(dev, INPUT_PROP_DIRECT), 0);
|
||||
ck_assert_int_eq(libevdev_has_property(dev, INPUT_PROP_BUTTONPAD), 1);
|
||||
|
||||
/* Test disabling the properties too */
|
||||
ck_assert_int_eq(libevdev_disable_property(dev, INPUT_PROP_MAX + 1), -1);
|
||||
ck_assert_int_eq(libevdev_disable_property(dev, INPUT_PROP_DIRECT), 0);
|
||||
ck_assert_int_eq(libevdev_disable_property(dev, INPUT_PROP_BUTTONPAD), 0);
|
||||
ck_assert_int_eq(libevdev_has_property(dev, INPUT_PROP_DIRECT), 0);
|
||||
ck_assert_int_eq(libevdev_has_property(dev, INPUT_PROP_BUTTONPAD), 0);
|
||||
|
||||
uinput_device_free(uidev);
|
||||
libevdev_free(dev);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue