Devices with different product ids for pen and touch, such as
Cintiq 24HD and DTH 2242, were added recently. Applying arbitration
only for tools with same product id is not enough.

However, we want to make sure tools with same product id are lined
properly first. That's why the same routine is repeated instead of
combined.

Signed-off-by: Ping Cheng <pi...@wacom.com>
---
 src/wcmConfig.c |   44 +++++++++++++++++++++++++++++++++++++++-----
 1 file changed, 39 insertions(+), 5 deletions(-)

diff --git a/src/wcmConfig.c b/src/wcmConfig.c
index 1c9eae7..b0bf671 100644
--- a/src/wcmConfig.c
+++ b/src/wcmConfig.c
@@ -396,20 +396,21 @@ static void wcmLinkTouchAndPen(InputInfoPtr pInfo)
        InputInfoPtr device = xf86FirstLocalDevice();
        WacomCommonPtr tmpcommon = NULL;
        WacomDevicePtr tmppriv = NULL;
-       Bool touch_device_assigned = FALSE;
 
-       /* Lookup to find the associated pen and touch */
+       /* Lookup to find the associated pen and touch with same product id */
        for (; device != NULL; device = device->next)
        {
+               /* device already linked */
+               if (common->wcmTouchDevice)
+                       break;
+
                if (!strcmp(device->drv->driverName, "wacom"))
                {
                        tmppriv = (WacomDevicePtr) device->private;
                        tmpcommon = tmppriv->common;
-                       touch_device_assigned = (common->wcmTouchDevice ||
-                                               tmpcommon->wcmTouchDevice);
 
                        /* skip the same tool or already linked devices */
-                       if ((tmppriv == priv) || touch_device_assigned)
+                       if ((tmppriv == priv) || tmpcommon->wcmTouchDevice)
                                continue;
 
                        if (tmpcommon->tablet_id == common->tablet_id)
@@ -428,6 +429,39 @@ static void wcmLinkTouchAndPen(InputInfoPtr pInfo)
                        }
                }
        }
+
+       /* Check again for pen and touch supported with different product ids */
+       if (!common->wcmTouchDevice)
+       {
+               for (; device != NULL; device = device->next)
+               {
+                       if (!strcmp(device->drv->driverName, "wacom"))
+                       {
+                               tmppriv = (WacomDevicePtr) device->private;
+                               tmpcommon = tmppriv->common;
+
+                               /* skip the same tool or already linked devices 
*/
+                               if ((tmppriv == priv) || 
tmpcommon->wcmTouchDevice)
+                                       continue;
+
+                               if (IsTouch(tmppriv) && IsTablet(priv))
+                                       common->wcmTouchDevice = tmppriv;
+                               else if (IsTouch(priv) && IsTablet(tmppriv))
+                                       tmpcommon->wcmTouchDevice = priv;
+
+                               if (common->wcmTouchDevice ||
+                                               tmpcommon->wcmTouchDevice)
+                               {
+                                       TabletSetFeature(common, WCM_PENTOUCH);
+                                       TabletSetFeature(tmpcommon, 
WCM_PENTOUCH);
+                               }
+
+                               /* exit if device is linked */
+                               if (common->wcmTouchDevice)
+                                       break;
+                       }
+               }
+       }
 }
 
 /**
-- 
1.7.10.4


------------------------------------------------------------------------------
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_d2d_feb
_______________________________________________
Linuxwacom-devel mailing list
Linuxwacom-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linuxwacom-devel

Reply via email to