On Wed, Feb 11, 2015 at 8:50 PM, Peter Hutterer
<peter.hutte...@who-t.net> wrote:
> Match string is identical to the other tags, but we only append PAD if we have
> at least one button. The kernel enforces the "... Pad" naming so we might as
> well rely on it.
>
> Signed-off-by: Peter Hutterer <peter.hutte...@who-t.net>
> ---
> Changes to v1:
> ATTRS{device/name} match generated warnings about potential issues in future
> kernels. Matching on {name} doesn't work because the ENV matches lock to the
> event device (which doesn't have a name). Swapping the order works -
> move the ATTRS match to be the first match, that applies to the event node's
> parent which also has the ENV{ID_*} bits set. That way we can use {name},
> without warnings.

Actually, this one does not work completely with the Bluetooth devices.

The USB devices gets their tags attached to the event* node. Which
makes it working fine in libinput.
With Bluetooth devices, hidp (the HID over bluetooth module) does not
give us the same amount of information than usbhid, and so we are
tagging the input* node, not the actual event.

So that means that either libinput checks for the parent (like
gnome-settings-daemon does), or we try to finally adapt the rule or
the kernel to apply the tags on the event nodes.

I still think it's safe to apply the current patches. But we need
further work to have the pad part of the bluetooth devices recognized
as buttonset in libinput.

Cheers,
Benjamin

>
>  tools/generate-udev-rules.c | 17 +++++++++++++----
>  1 file changed, 13 insertions(+), 4 deletions(-)
>
> diff --git a/tools/generate-udev-rules.c b/tools/generate-udev-rules.c
> index d40a164..545f663 100644
> --- a/tools/generate-udev-rules.c
> +++ b/tools/generate-udev-rules.c
> @@ -59,7 +59,8 @@ static void print_udev_entry_for_match (WacomDevice 
> *device, const WacomMatch *m
>         int          vendor     = libwacom_match_get_vendor_id (match);
>         int          product    = libwacom_match_get_product_id (match);
>         int          has_touch  = libwacom_has_touch (device);
> -       char         *touchpad;
> +       char         *touchpad,
> +                    *matchstr;
>
>         if (bus_type_filter != type)
>                 return;
> @@ -71,12 +72,14 @@ static void print_udev_entry_for_match (WacomDevice 
> *device, const WacomMatch *m
>
>         switch (type) {
>                 case WBUSTYPE_USB:
> -                       printf ("ENV{ID_BUS}==\"usb\", 
> ENV{ID_VENDOR_ID}==\"%04x\", ENV{ID_MODEL_ID}==\"%04x\", ", vendor, product);
> +                       matchstr = g_strdup_printf ("ENV{ID_BUS}==\"usb\", 
> ENV{ID_VENDOR_ID}==\"%04x\", ENV{ID_MODEL_ID}==\"%04x\", ", vendor, product);
> +                       g_assert(matchstr != NULL);
>                         break;
>                 case WBUSTYPE_BLUETOOTH:
>                         /* Bluetooth tablets do not have 
> ID_VENDOR_ID/ID_MODEL_ID etc set correctly. They
>                          * do have the PRODUCT set though. */
> -                       printf ("ENV{PRODUCT}==\"5/%x/%x/*\", ", vendor, 
> product);
> +                       matchstr = g_strdup_printf 
> ("ENV{PRODUCT}==\"5/%x/%x/*\", ", vendor, product);
> +                       g_assert(matchstr != NULL);
>                         break;
>                 default:
>                         /* Not sure how to deal with serials  */
> @@ -84,7 +87,13 @@ static void print_udev_entry_for_match (WacomDevice 
> *device, const WacomMatch *m
>         }
>
>         /* unset joystick, set tablet and possibly touchpad */
> -       printf("ENV{ID_INPUT}=\"1\", ENV{ID_INPUT_JOYSTICK}=\"\", 
> ENV{ID_INPUT_TABLET}=\"1\"%s\n", touchpad);
> +       printf ("%s ENV{ID_INPUT}=\"1\", ENV{ID_INPUT_JOYSTICK}=\"\", 
> ENV{ID_INPUT_TABLET}=\"1\"%s\n", matchstr, touchpad);
> +
> +       /* set ID_INPUT_TABLET_PAD for pads */
> +       if (libwacom_get_num_buttons (device) > 0)
> +               printf ("ATTRS{name}==\"* Pad\", %s 
> ENV{ID_INPUT_TABLET_PAD}=\"1\"\n", matchstr);
> +
> +       g_free (matchstr);
>  }
>
>  static void print_uinput_entry_for_match (WacomDevice *device, const 
> WacomMatch *match,
> --
> 2.1.0
>
>
> ------------------------------------------------------------------------------
> Dive into the World of Parallel Programming. The Go Parallel Website,
> sponsored by Intel and developed in partnership with Slashdot Media, is your
> hub for all things parallel software development, from weekly thought
> leadership blogs to news, videos, case studies, tutorials and more. Take a
> look and join the conversation now. http://goparallel.sourceforge.net/
> _______________________________________________
> Linuxwacom-devel mailing list
> Linuxwacom-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/linuxwacom-devel

------------------------------------------------------------------------------
Dive into the World of Parallel Programming. The Go Parallel Website,
sponsored by Intel and developed in partnership with Slashdot Media, is your
hub for all things parallel software development, from weekly thought
leadership blogs to news, videos, case studies, tutorials and more. Take a
look and join the conversation now. http://goparallel.sourceforge.net/
_______________________________________________
Linuxwacom-devel mailing list
Linuxwacom-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linuxwacom-devel

Reply via email to