The kernel enforces the "... Finger" naming, so we might as well rely on it.

Signed-off-by: Peter Hutterer <peter.hutte...@who-t.net>
---
Changes to v1:
Use ATTRS{name} instead of ATTRS{device/name} and swap order, see patch 1/3 for 
an
explanation

 tools/generate-udev-rules.c | 16 ++++++----------
 1 file changed, 6 insertions(+), 10 deletions(-)

diff --git a/tools/generate-udev-rules.c b/tools/generate-udev-rules.c
index 545f663..afcdeff 100644
--- a/tools/generate-udev-rules.c
+++ b/tools/generate-udev-rules.c
@@ -58,18 +58,11 @@ static void print_udev_entry_for_match (WacomDevice 
*device, const WacomMatch *m
        WacomBusType type       = libwacom_match_get_bustype (match);
        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,
-                    *matchstr;
+       char         *matchstr;
 
        if (bus_type_filter != type)
                return;
 
-       if (has_touch)
-               touchpad = ", ENV{ID_INPUT_TOUCHPAD}=\"1\"";
-       else
-               touchpad = "";
-
        switch (type) {
                case WBUSTYPE_USB:
                        matchstr = g_strdup_printf ("ENV{ID_BUS}==\"usb\", 
ENV{ID_VENDOR_ID}==\"%04x\", ENV{ID_MODEL_ID}==\"%04x\", ", vendor, product);
@@ -86,8 +79,11 @@ static void print_udev_entry_for_match (WacomDevice *device, 
const WacomMatch *m
                        return;
        }
 
-       /* unset joystick, set tablet and possibly touchpad */
-       printf ("%s ENV{ID_INPUT}=\"1\", ENV{ID_INPUT_JOYSTICK}=\"\", 
ENV{ID_INPUT_TABLET}=\"1\"%s\n", matchstr, touchpad);
+       /* unset joystick, set tablet */
+       printf ("%s ENV{ID_INPUT}=\"1\", ENV{ID_INPUT_JOYSTICK}=\"\", 
ENV{ID_INPUT_TABLET}=\"1\"\n", matchstr);
+
+       if (libwacom_has_touch (device))
+               printf( "ATTRS{name}==\"* Finger\", %s 
ENV{ID_INPUT_TOUCHPAD}=\"1\"\n", matchstr);
 
        /* set ID_INPUT_TABLET_PAD for pads */
        if (libwacom_get_num_buttons (device) > 0)
-- 
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

Reply via email to