On Thu, 2012-04-19 at 13:16 +1000, Peter Hutterer wrote:
> 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 <[email protected]>
> ---
> Changes to v1:
> - localise parent usage
> - use temporary variables for is_tablet/is_touchpad
I thought more:
static gboolean
is_tablet_or_touchpad (GUdevDevice *device)
{
return g_udev_device_get_property_as_boolean (device, "ID_INPUT_TABLET") ||
g_udev_device_get_property_as_boolean (device, "ID_INPUT_TOUCHPAD");
}
And use that in the 2 locations below.
> I'll have another test of this tomorrow, but I do remember it working on th
> e I4 WL.
>
> libwacom/libwacom.c | 18 +++++++++++++++---
> 1 file changed, 15 insertions(+), 3 deletions(-)
>
> diff --git a/libwacom/libwacom.c b/libwacom/libwacom.c
> index dd6ba1c..9e32618 100644
> --- a/libwacom/libwacom.c
> +++ b/libwacom/libwacom.c
> @@ -71,10 +71,23 @@ 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;
> + GUdevDevice *parent;
> + gboolean is_tablet, is_touchpad;
> +
> +
> + parent = g_udev_device_get_parent(device);
> + is_tablet = g_udev_device_get_property_as_boolean (parent,
> "ID_INPUT_TABLET");
> + is_touchpad = g_udev_device_get_property_as_boolean (parent,
> "ID_INPUT_TOUCHPAD");
> + if (!parent || (!is_tablet && !is_touchpad)) {
> + libwacom_error_set(error, WERROR_INVALID_PATH,
> "Device '%s' is not a tablet", path);
> + goto bail;
> + }
> + g_object_unref (parent);
> }
>
> + /* 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) {
> @@ -86,7 +99,6 @@ get_device_info (const char *path,
> GUdevDevice *parent;
>
> parent = g_udev_device_get_parent (device);
> -
> g_object_unref (device);
> device = parent;
> bus_str = "bluetooth";
------------------------------------------------------------------------------
For Developers, A Lot Can Happen In A Second.
Boundary is the first to Know...and Tell You.
Monitor Your Applications in Ultra-Fine Resolution. Try it FREE!
http://p.sf.net/sfu/Boundary-d2dvs2
_______________________________________________
Linuxwacom-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/linuxwacom-devel