[PATCH libevdev 2/6] Add abs setters for changing a single value on an abs axis
Benjamin Tissoires
benjamin.tissoires at gmail.com
Wed Jul 31 04:02:27 PDT 2013
On Mon, Jul 29, 2013 at 7:34 AM, Peter Hutterer
<peter.hutterer at who-t.net> wrote:
> Changing a single value on an abs axis is slightly more common than
> having to enable that axis outright. Provide a set of accessors for
> doing so.
>
> Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
> ---
> libevdev/libevdev.c | 22 ++++++++++++++
> libevdev/libevdev.h | 54 +++++++++++++++++++++++++++++++++++
> test/test-libevdev-has-event.c | 65 ++++++++++++++++++++++++++++++++++++++++++
> 3 files changed, 141 insertions(+)
>
> diff --git a/libevdev/libevdev.c b/libevdev/libevdev.c
> index cd33659..c7f5102 100644
> --- a/libevdev/libevdev.c
> +++ b/libevdev/libevdev.c
> @@ -836,6 +836,28 @@ libevdev_get_abs_resolution(const struct libevdev *dev, unsigned int code)
> return absinfo ? absinfo->resolution : 0;
> }
>
> +#define ABS_SETTER(name, field) \
> +void libevdev_set_abs_##name(struct libevdev *dev, unsigned int code, int val) \
> +{ \
> + if (!libevdev_has_event_code(dev, EV_ABS, code)) \
> + return; \
> + dev->abs_info[code].field = val; \
> +}
> +
> +ABS_SETTER(max, maximum)
> +ABS_SETTER(min, minimum)
I'm a little bit worried of adding the setters now, and deprecating
them right after. Couldn't we deprecate libevdev_get_abs_min before
inserting this patch so that we don't deprecate a non used function?
other than that, the code is clean, as usual :)
Reviewed-by: Benjamin Tissoires <benjamin.tissoires at gmail.com>
Cheers,
Benjamin
More information about the Input-tools
mailing list