Signed-off-by: Peter Hutterer <peter.hutte...@who-t.net>
---
 data/generate-udev-rules.c |   19 ++++++++++++++-----
 1 file changed, 14 insertions(+), 5 deletions(-)

diff --git a/data/generate-udev-rules.c b/data/generate-udev-rules.c
index d6a40ad..be8f514 100644
--- a/data/generate-udev-rules.c
+++ b/data/generate-udev-rules.c
@@ -41,7 +41,8 @@ static void print_udev_header (void)
        printf ("\n");
 }
 
-static void print_udev_entry_for_match (WacomDevice *device, const WacomMatch 
*match)
+static void print_udev_entry_for_match (WacomDevice *device, const WacomMatch 
*match,
+                                       WacomBusType bus_type_filter)
 {
        WacomBusType type       = libwacom_match_get_bustype (match);
        int          vendor     = libwacom_match_get_vendor_id (match);
@@ -49,6 +50,9 @@ static void print_udev_entry_for_match (WacomDevice *device, 
const WacomMatch *m
        int          has_touch  = libwacom_has_touch (device);
        static char *touchpad;
 
+       if (bus_type_filter != type)
+               return;
+
        if (has_touch)
                touchpad = ", ENV{ID_INPUT_TOUCHPAD}=\"1\"";
        else
@@ -59,7 +63,9 @@ static void print_udev_entry_for_match (WacomDevice *device, 
const WacomMatch *m
                        printf ("ENV{ID_BUS}==\"usb\", 
ENV{ID_VENDOR_ID}==\"%04x\", ENV{ID_MODEL_ID}==\"%04x\", ENV{ID_INPUT}=\"1\", 
ENV{ID_INPUT_TABLET}=\"1\"%s\n", vendor, product, touchpad);
                        break;
                case WBUSTYPE_BLUETOOTH:
-                       printf ("ENV{ID_BUS}==\"bluetooth\", 
ENV{ID_VENDOR_ID}==\"%04x\", ENV{ID_MODEL_ID}==\"%04x\", ENV{ID_INPUT}=\"1\", 
ENV{ID_INPUT_TABLET}=\"1\"%s\n", vendor, product, touchpad);
+                       /* 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/*\", 
ENV{ID_INPUT}=\"1\", ENV{ID_INPUT_TABLET}=\"1\"%s\n", vendor, product, 
touchpad);
                        break;
                default:
                        /* Not sure how to deal with serials  */
@@ -67,14 +73,14 @@ static void print_udev_entry_for_match (WacomDevice 
*device, const WacomMatch *m
        }
 }
 
-static void print_udev_entry (WacomDevice *device)
+static void print_udev_entry (WacomDevice *device, WacomBusType 
bus_type_filter)
 {
        WacomMatch **matches;
        int nmatches;
 
        matches = libwacom_get_matches(device, &nmatches);
        while(nmatches--)
-               print_udev_entry_for_match(device, matches[nmatches]);
+               print_udev_entry_for_match(device, matches[nmatches], 
bus_type_filter);
 }
 
 static void print_udev_trailer (void)
@@ -103,9 +109,12 @@ int main(int argc, char **argv)
 
        print_udev_header ();
        for (p = list; *p; p++)
-               print_udev_entry ((WacomDevice *) *p);
+               print_udev_entry ((WacomDevice *) *p, WBUSTYPE_USB);
        print_udev_trailer ();
 
+       for (p = list; *p; p++)
+               print_udev_entry ((WacomDevice *) *p, WBUSTYPE_BLUETOOTH);
+
        libwacom_database_destroy (db);
 
        return 0;
-- 
1.7.10


------------------------------------------------------------------------------
Better than sec? Nothing is better than sec when it comes to
monitoring Big Data applications. Try Boundary one-second 
resolution app monitoring today. Free.
http://p.sf.net/sfu/Boundary-dev2dev
_______________________________________________
Linuxwacom-devel mailing list
Linuxwacom-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linuxwacom-devel

Reply via email to