[systemd-devel] [PATCH] udev: input_id: tag pointing sticks as ID_INPUT_POINTINGSTICK

David Herrmann dh.herrmann at gmail.com
Tue Apr 7 03:09:03 PDT 2015


Hi

On Thu, Mar 26, 2015 at 7:05 AM, Peter Hutterer
<peter.hutterer at who-t.net> wrote:
> Also referred to as trackpoint, trackstick. These are marked by recent kernels
> through an input prop. Forward that prop as udev property so userspace can
> easily determine whether there is a pointing stick present.
>
> These devices were previously marked as ID_INPUT_MOUSE, for backwards
> compatibility we keep that in place, the new property is an addition.
> ---
>  src/shared/missing.h             | 4 ++++
>  src/udev/udev-builtin-input_id.c | 9 ++++++++-
>  2 files changed, 12 insertions(+), 1 deletion(-)

For the archives: Pushed to -git

Thanks
David

> diff --git a/src/shared/missing.h b/src/shared/missing.h
> index 802b495..ff461a7 100644
> --- a/src/shared/missing.h
> +++ b/src/shared/missing.h
> @@ -789,3 +789,7 @@ static inline int kcmp(pid_t pid1, pid_t pid2, int type, unsigned long idx1, uns
>  #ifndef KCMP_FILE
>  #define KCMP_FILE 0
>  #endif
> +
> +#ifndef INPUT_PROP_POINTING_STICK
> +#define INPUT_PROP_POINTING_STICK 0x05
> +#endif
> diff --git a/src/udev/udev-builtin-input_id.c b/src/udev/udev-builtin-input_id.c
> index aa9bc14..4d619bf 100644
> --- a/src/udev/udev-builtin-input_id.c
> +++ b/src/udev/udev-builtin-input_id.c
> @@ -126,6 +126,7 @@ static void test_pointers (struct udev_device *dev,
>                             const unsigned long* bitmask_abs,
>                             const unsigned long* bitmask_key,
>                             const unsigned long* bitmask_rel,
> +                           const unsigned long* bitmask_props,
>                             bool test) {
>          int is_mouse = 0;
>          int is_touchpad = 0;
> @@ -168,6 +169,9 @@ static void test_pointers (struct udev_device *dev,
>                          udev_builtin_add_property(dev, test, "ID_INPUT_JOYSTICK", "1");
>          }
>
> +        if (test_bit (INPUT_PROP_POINTING_STICK, bitmask_props))
> +                udev_builtin_add_property(dev, test, "ID_INPUT_POINTINGSTICK", "1");
> +
>          if (test_bit (EV_REL, bitmask_ev) &&
>              test_bit (REL_X, bitmask_rel) && test_bit (REL_Y, bitmask_rel) &&
>              test_bit (BTN_MOUSE, bitmask_key))
> @@ -227,6 +231,7 @@ static int builtin_input_id(struct udev_device *dev, int argc, char *argv[], boo
>          unsigned long bitmask_abs[NBITS(ABS_MAX)];
>          unsigned long bitmask_key[NBITS(KEY_MAX)];
>          unsigned long bitmask_rel[NBITS(REL_MAX)];
> +        unsigned long bitmask_props[NBITS(INPUT_PROP_MAX)];
>          const char *sysname, *devnode;
>
>          /* walk up the parental chain until we find the real input device; the
> @@ -243,7 +248,9 @@ static int builtin_input_id(struct udev_device *dev, int argc, char *argv[], boo
>                  get_cap_mask(dev, pdev, "capabilities/abs", bitmask_abs, sizeof(bitmask_abs), test);
>                  get_cap_mask(dev, pdev, "capabilities/rel", bitmask_rel, sizeof(bitmask_rel), test);
>                  get_cap_mask(dev, pdev, "capabilities/key", bitmask_key, sizeof(bitmask_key), test);
> -                test_pointers(dev, bitmask_ev, bitmask_abs, bitmask_key, bitmask_rel, test);
> +                get_cap_mask(dev, pdev, "properties", bitmask_props, sizeof(bitmask_props), test);
> +                test_pointers(dev, bitmask_ev, bitmask_abs, bitmask_key,
> +                              bitmask_rel, bitmask_props, test);
>                  test_key(dev, bitmask_ev, bitmask_key, test);
>          }
>
> --
> 2.3.3
>
> _______________________________________________
> systemd-devel mailing list
> systemd-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/systemd-devel


More information about the systemd-devel mailing list