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);
* 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.
*
* 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.)
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);