summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Hutterer <peter.hutterer@who-t.net>2012-03-30 13:36:04 +1000
committerPeter Hutterer <peter.hutterer@who-t.net>2012-03-30 13:36:04 +1000
commit429f4f71d00c58acb22b88bd46cc56ef2ee693e6 (patch)
tree55dd301249a1eff987eb91bc9b637cce6084a266
parentf2b056c4f7f98e0c792ae922c0b9ec7fbf2ab97d (diff)
data: udev rules for bluetooth devices can only match on the PRODUCT
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
-rw-r--r--data/list.c19
1 files changed, 14 insertions, 5 deletions
diff --git a/data/list.c b/data/list.c
index d6a40ad..be8f514 100644
--- a/data/list.c
+++ b/data/list.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;