mirror of
https://gitlab.freedesktop.org/libevdev/libevdev.git
synced 2025-12-24 07:40:05 +01:00
Disallow disabling of EV_SYN
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
This commit is contained in:
parent
bed8a95e0a
commit
0aa639b443
3 changed files with 8 additions and 1 deletions
|
|
@ -795,7 +795,7 @@ libevdev_enable_event_type(struct libevdev *dev, unsigned int type)
|
|||
int
|
||||
libevdev_disable_event_type(struct libevdev *dev, unsigned int type)
|
||||
{
|
||||
if (type > EV_MAX)
|
||||
if (type > EV_MAX || type == EV_SYN)
|
||||
return -1;
|
||||
|
||||
clear_bit(dev->bits, type);
|
||||
|
|
|
|||
|
|
@ -736,6 +736,9 @@ int libevdev_enable_event_type(struct libevdev *dev, unsigned int type);
|
|||
* In most cases, a caller likely only wants to disable a single code, not
|
||||
* the whole type. Use libevdev_disable_event_code() for that.
|
||||
*
|
||||
* Disabling EV_SYN will not work. Don't shoot yourself in the foot.
|
||||
* It hurts.
|
||||
*
|
||||
* This is a local modification only affecting only this representation of
|
||||
* this device.
|
||||
*
|
||||
|
|
@ -793,6 +796,9 @@ int libevdev_enable_event_code(struct libevdev *dev, unsigned int type, unsigned
|
|||
* This is a local modification only affecting only this representation of
|
||||
* this device.
|
||||
*
|
||||
* Disabling EV_SYN will not work. Don't shoot yourself in the foot.
|
||||
* It hurts.
|
||||
*
|
||||
* @param dev The evdev device, already initialized with libevdev_set_fd()
|
||||
* @param type The event type to disable (EV_ABS, EV_KEY, ...)
|
||||
* @param code The event code to disable (ABS_X, REL_X, etc.)
|
||||
|
|
|
|||
|
|
@ -563,6 +563,7 @@ START_TEST(test_device_disable_bit_invalid)
|
|||
ck_assert_int_eq(libevdev_disable_event_code(dev, EV_ABS, ABS_MAX + 1), -1);
|
||||
ck_assert_int_eq(libevdev_disable_event_code(dev, EV_MAX + 1, ABS_MAX + 1), -1);
|
||||
ck_assert_int_eq(libevdev_disable_event_type(dev, EV_MAX + 1), -1);
|
||||
ck_assert_int_eq(libevdev_disable_event_type(dev, EV_SYN), -1);
|
||||
|
||||
uinput_device_free(uidev);
|
||||
libevdev_free(dev);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue