diff options
author | Peter Hutterer <peter.hutterer@who-t.net> | 2012-03-30 14:02:06 +1000 |
---|---|---|
committer | Peter Hutterer <peter.hutterer@who-t.net> | 2012-03-30 14:52:05 +1000 |
commit | 02e7d27a827c26987580133ec109b2d11f792e31 (patch) | |
tree | 8e5ac0399d19dc95e87c95a575c9bdbdf39e4976 | |
parent | 429f4f71d00c58acb22b88bd46cc56ef2ee693e6 (diff) |
Bluetooth devices tagged with ID_INPUT_TABLET aren't tagged on the device,
but on the parent instead. Match the parent for a tag before bailing out.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
-rw-r--r-- | libwacom/libwacom.c | 21 |
1 files changed, 15 insertions, 6 deletions
diff --git a/libwacom/libwacom.c b/libwacom/libwacom.c index 41acbf6..1c34715 100644 --- a/libwacom/libwacom.c +++ b/libwacom/libwacom.c @@ -50,7 +50,7 @@ get_device_info (const char *path, WacomError *error) { GUdevClient *client; - GUdevDevice *device; + GUdevDevice *device, *parent = NULL; const char * const subsystems[] = { "input", NULL }; gboolean retval; const char *bus_str; @@ -69,10 +69,17 @@ get_device_info (const char *path, /* Touchpads are only for the "Finger" part of Bamboo devices */ if (g_udev_device_get_property_as_boolean (device, "ID_INPUT_TABLET") == FALSE && g_udev_device_get_property_as_boolean (device, "ID_INPUT_TOUCHPAD") == FALSE) { - libwacom_error_set(error, WERROR_INVALID_PATH, "Device '%s' is not a tablet", path); - goto bail; + parent = g_udev_device_get_parent(device); + if (!parent || (g_udev_device_get_property_as_boolean (parent, "ID_INPUT_TABLET") == FALSE && + g_udev_device_get_property_as_boolean (parent, "ID_INPUT_TOUCHPAD") == FALSE)) { + libwacom_error_set(error, WERROR_INVALID_PATH, "Device '%s' is not a tablet", path); + goto bail; + } } + /* FIXME: ID_BUS on the device is usb even for bluetooth devices, + * but ID_BUS on the parent is NULL. + */ bus_str = g_udev_device_get_property (device, "ID_BUS"); /* Serial devices are weird */ if (bus_str == NULL) { @@ -81,12 +88,12 @@ get_device_info (const char *path, } /* Poke the parent device for Bluetooth models */ if (bus_str == NULL) { - GUdevDevice *parent; - - parent = g_udev_device_get_parent (device); + if (!parent) + parent = g_udev_device_get_parent (device); g_object_unref (device); device = parent; + parent = NULL; bus_str = "bluetooth"; } @@ -163,6 +170,8 @@ get_device_info (const char *path, bail: if (retval == FALSE) g_free (*name); + if (parent != NULL) + g_object_unref (parent); if (device != NULL) g_object_unref (device); if (client != NULL) |