[systemd-devel] [PATCH v3 3/3] udev: input_id - use ABS_MT_SLOT{-1} to exclude non touch screen devices

Peter Hutterer peter.hutterer at who-t.net
Sun May 31 18:05:36 PDT 2015


On Fri, May 29, 2015 at 02:54:54PM +0200, Andreas Pokorny wrote:
> Require touch screens to have a ABS_MT_SLOT axis while exclude devices
> that overlap with the MT range of axes.
> ---
>  src/udev/udev-builtin-input_id.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/src/udev/udev-builtin-input_id.c b/src/udev/udev-builtin-input_id.c
> index 0f9f021..59616c8 100644
> --- a/src/udev/udev-builtin-input_id.c
> +++ b/src/udev/udev-builtin-input_id.c
> @@ -170,7 +170,8 @@ static bool test_pointers(struct udev_device *dev,
>          finger_but_no_pen = test_bit(BTN_TOOL_FINGER, bitmask_key) && !test_bit(BTN_TOOL_PEN, bitmask_key);
>          has_mouse_button = test_bit(BTN_LEFT, bitmask_key);
>          has_rel_coordinates = test_bit(EV_REL, bitmask_ev) && test_bit(REL_X, bitmask_rel) && test_bit(REL_Y, bitmask_rel);
> -        has_mt_coordinates = test_bit(ABS_MT_POSITION_X, bitmask_abs) && test_bit(ABS_MT_POSITION_Y, bitmask_abs);
> +        has_mt_coordinates = test_bit(ABS_MT_POSITION_X, bitmask_abs) && test_bit(ABS_MT_POSITION_Y, bitmask_abs) &&
> +                             test_bit(ABS_MT_SLOT, bitmask_abs) && !test_bit(ABS_MT_SLOT - 1, bitmask_abs);

there are still a few devices that use protocol A in the kernel, so slot
missing is fine. you only want to unset this if we have slot set and slot-1
unset. i.e.

    if (has_mt_coords && ABS_MT_SLOT && !(ABS_MT_SLOT -1))
        has_mt_coords = false;

should do the trick.

I've merged the other two patches, if you send me a revised one of this I'll
push them in one lot. thanks

Cheers,
   Peter


>          is_direct = test_bit(INPUT_PROP_DIRECT, bitmask_props);
>          has_touch = test_bit(BTN_TOUCH, bitmask_key);
>          /* joysticks don't necessarily have buttons; e. g.
> -- 
> 2.1.4
> 


More information about the systemd-devel mailing list