mirror of
https://gitlab.freedesktop.org/libevdev/libevdev.git
synced 2025-12-24 21:40:05 +01:00
Require data be NULL when enabling a non-EV_ABS axis
In the future this may change, but for now enforce that callers use NULL. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
This commit is contained in:
parent
1baeedc953
commit
5db85056a2
2 changed files with 7 additions and 3 deletions
|
|
@ -813,6 +813,9 @@ libevdev_enable_event_code(struct libevdev *dev, unsigned int type,
|
|||
if (libevdev_enable_event_type(dev, type))
|
||||
return -1;
|
||||
|
||||
if (type != EV_ABS && data != NULL)
|
||||
return -1;
|
||||
|
||||
max = type_to_mask(dev, type, &mask);
|
||||
|
||||
if (code > max)
|
||||
|
|
|
|||
|
|
@ -757,9 +757,9 @@ int libevdev_disable_event_type(struct libevdev *dev, unsigned int type);
|
|||
* report such events, it will now return true for libevdev_has_event_code().
|
||||
*
|
||||
* The last argument depends on the type and code:
|
||||
* - If type is EV_ABS, the vararg must be a pointer to a struct input_absinfo
|
||||
* - If type is EV_ABS, data must be a pointer to a struct input_absinfo
|
||||
* containing the data for this axis.
|
||||
* - For all other types, the argument is ignored.
|
||||
* - For all other types, the argument must be NULL.
|
||||
*
|
||||
* This function calls libevdev_enable_event_type() if necessary.
|
||||
*
|
||||
|
|
@ -769,7 +769,8 @@ int libevdev_disable_event_type(struct libevdev *dev, unsigned int type);
|
|||
* @param dev The evdev device, already initialized with libevdev_set_fd()
|
||||
* @param type The event type to enable (EV_ABS, EV_KEY, ...)
|
||||
* @param code The event code to enable (ABS_X, REL_X, etc.)
|
||||
* @param data Axis/key data, depending on type and code
|
||||
* @param data If type is EV_ABS, data points to a struct input_absinfo. Otherwise, data must be
|
||||
* NULL
|
||||
*
|
||||
* @return 0 on success or -1 otherwise
|
||||
*
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue