[RFC libinput 1/2] Add a "buttonset" interface for button-only devices

Hans de Goede hdegoede at redhat.com
Thu Feb 12 03:37:12 PST 2015


Hi,

On 12-02-15 08:33, Peter Hutterer wrote:
> A generic interface for devices that provide buttons and axes, but don't
> control the pointer. This caters for the Pad part of Wacom graphics tablets
> but could eventually also deal with remote controls, 3D mice and other
> devices.
>
> This patch adds a new interface "buttonset" with a new capability and two
> events AXIS and BUTTON. The interface is largely modelled after the
> tablet interface, but with different axes and a few different behaviors.
> The button events do the obvious, axis events provide 5 hooks:
>
> libinput_event_buttonset_get_axis_value() -> axis value in physical dimensions
> libinput_event_buttonset_get_axis_value_transformed()
> libinput_event_buttonset_get_axis_delta() -> axis delta in physical dimensions
> libinput_event_buttonset_get_axis_delta_transformed()
> libinput_event_buttonset_get_axis_delta_discrete() -> axis delta in clicks
>
> The latter is similar after the scroll click counts.
>
> Currently implemented are two ring and two strip axes. The axis use depends a
> lot on the device and is hard to predict. e.g. strips have apparently been
> used for physical positioning (like a sliding actuator) whereas the wheel
> usually only cares about deltas. The above set should cater for the common
> use-cases.
>
> Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>

<snip>

> diff --git a/src/libinput.h b/src/libinput.h
> index a8146c0..d777730 100644
> --- a/src/libinput.h
> +++ b/src/libinput.h
> @@ -55,7 +55,8 @@ enum libinput_device_capability {
>   	LIBINPUT_DEVICE_CAP_KEYBOARD = 0,
>   	LIBINPUT_DEVICE_CAP_POINTER = 1,
>   	LIBINPUT_DEVICE_CAP_TOUCH = 2,
> -	LIBINPUT_DEVICE_CAP_TABLET = 3
> +	LIBINPUT_DEVICE_CAP_TABLET = 3,
> +	LIBINPUT_DEVICE_CAP_BUTTONSET = 4
>   };
>
>   /**
> @@ -148,6 +149,34 @@ enum libinput_tablet_axis {
>   /**
>    * @ingroup device
>    *
> + * Available axis types for a buttonset device. It must have the @ref
> + * LIBINPUT_DEVICE_CAP_BUTTONSET capability.
> + */
> +enum libinput_buttonset_axis {
> +	LIBINPUT_BUTTONSET_AXIS_RING = 1,
> +	LIBINPUT_BUTTONSET_AXIS_RING2 = 2,
> +	LIBINPUT_BUTTONSET_AXIS_STRIP = 3,
> +	LIBINPUT_BUTTONSET_AXIS_STRIP2 = 4,
> +};

Hmm, I thought that the idea was in the end to be able to use the
button set interface with any random input device, with any random
amount of inputs? Limiting things to just 2 of each type sounds wrong
in that light, I think it would be better to just number axis 0 - #
without looking at their type, and add a separate type field, which
can be: RING, STRIP or UNKNOWN. Axis should probably also have flags
to indicate if they generate abs events, deltas or both.

Other then that the proposed API looks good to me.

Regards,

Hans


More information about the wayland-devel mailing list