On Tue, Apr 16, 2013 at 11:53:11AM +0530, Ritesh Khadgaray wrote:
>  Let me know, if this would work fine ?

close, though I'd like to see few changes here. first, I think
is_supported_device() is a better name, it's more general. 

And the logic should check not just the wacom driver but rather
vendor/product against the db. if we have v/p combination in the database we
explicitly support it, regardless of the ID_INPUT* tags.

so a solution would be to extract product/vendor first; or to use
is_tablet_touchpad() as a quick check and then go into the more extensive db
check if it fails.

so the flow is something like this:

if (!is_tablet_or_touchpad)
   int p, v = get_vendor_product_id();
   if p, v in database
      continue with device

Cheers,
   Peter

> diff --git a/libwacom/libwacom.c b/libwacom/libwacom.c
> index 1b9b398..29ffcc0 100644
> --- a/libwacom/libwacom.c
> +++ b/libwacom/libwacom.c
> @@ -54,10 +54,13 @@ libwacom_get_device(const WacomDeviceDatabase *db, const 
> char *match)
>  }
>  
>  static gboolean
> -is_tablet_or_touchpad (GUdevDevice *device)
> +is_useable_device (GUdevDevice *device)

>  {
> +     gboolean is_wacom = (g_strcmp0 ("wacom", 
> g_udev_device_get_property(device,"ID_USB_DRIVER")) == 0 );
> +     
>       return g_udev_device_get_property_as_boolean (device, 
> "ID_INPUT_TABLET") ||
> -             g_udev_device_get_property_as_boolean (device, 
> "ID_INPUT_TOUCHPAD");
> +             g_udev_device_get_property_as_boolean (device, 
> "ID_INPUT_TOUCHPAD") ||
> +             is_wacom ? g_udev_device_get_property_as_boolean(device, 
> "ID_INPUT_TOUCHSCREEN"): 0 ;
>  }
>  
>  /* Overriding SUBSYSTEM isn't allowed in udev (works sometimes, but not
> @@ -154,11 +157,11 @@ get_device_info (const char            *path,
>       }
>  
>       /* Touchpads are only for the "Finger" part of Bamboo devices */
> -     if (!is_tablet_or_touchpad(device)) {
> +     if (!is_useable_device(device)) {
>               GUdevDevice *parent;
>  
>               parent = g_udev_device_get_parent(device);
> -             if (!parent || !is_tablet_or_touchpad(parent)) {
> +             if (!parent || !is_useable_device(parent)) {
>                       libwacom_error_set(error, WERROR_INVALID_PATH, "Device 
> '%s' is not a tablet", path);
>                       g_object_unref (parent);
>                       goto bail;

------------------------------------------------------------------------------
Precog is a next-generation analytics platform capable of advanced
analytics on semi-structured data. The platform includes APIs for building
apps and a phenomenal toolset for data science. Developers can use
our toolset for easy data analysis & visualization. Get a free account!
http://www2.precog.com/precogplatform/slashdotnewsletter
_______________________________________________
Linuxwacom-devel mailing list
Linuxwacom-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linuxwacom-devel

Reply via email to