This patch adds an 'abswheel2' field to the _WacomDeviceState
structure, along with corresponding 'oldWheel2' field to the
_WacomDeviceRec structure. These fields store the state of the
second touch ring on dual-ring devices such as the Cintiq 24HD.

Signed-off-by: Jason Gerecke <killert...@gmail.com>
Reviewed-by: Chris Bagwell <ch...@cnpbagwell.com> 
Reviewed-by: Peter Hutterer <peter.hutte...@who-t.net>

---
 src/wcmCommon.c     |   16 +++++++++-------
 src/wcmUSB.c        |   11 +++++++++--
 src/xf86WacomDefs.h |    2 ++
 3 files changed, 20 insertions(+), 9 deletions(-)

diff --git a/src/wcmCommon.c b/src/wcmCommon.c
index e6eb958..32eb4e4 100644
--- a/src/wcmCommon.c
+++ b/src/wcmCommon.c
@@ -551,6 +551,7 @@ static void wcmUpdateOldState(const InputInfoPtr pInfo,
        int tx, ty;
 
        priv->oldWheel = ds->abswheel;
+       priv->oldWheel2 = ds->abswheel2;
        priv->oldButtons = ds->buttons;
 
        if (IsPad(priv))
@@ -739,11 +740,11 @@ void wcmSendEvents(InputInfoPtr pInfo, const 
WacomDeviceState* ds)
        }
 
        DBG(7, priv, "[%s] o_prox=%s x=%d y=%d z=%d "
-               "b=%s b=%d tx=%d ty=%d wl=%d rot=%d th=%d\n",
+               "b=%s b=%d tx=%d ty=%d wl=%d wl2=%d rot=%d th=%d\n",
                pInfo->type_name,
                priv->oldProximity ? "true" : "false",
                x, y, z, is_button ? "true" : "false", ds->buttons,
-               tx, ty, ds->abswheel, ds->rotation, ds->throttle);
+               tx, ty, ds->abswheel, ds->abswheel2, ds->rotation, 
ds->throttle);
 
        if (ds->proximity)
                wcmRotateAndScaleCoordinates(pInfo, &x, &y);
@@ -806,6 +807,7 @@ void wcmSendEvents(InputInfoPtr pInfo, const 
WacomDeviceState* ds)
        {
                priv->oldButtons = 0;
                priv->oldWheel = MAX_PAD_RING + 1;
+               priv->oldWheel2 = MAX_PAD_RING + 1;
                priv->oldX = 0;
                priv->oldY = 0;
                priv->oldZ = 0;
@@ -868,9 +870,9 @@ wcmCheckSuppress(WacomCommonPtr common,
        /* look for change in absolute wheel position 
         * or any relative wheel movement
         */
-       if ((abs(dsOrig->abswheel - dsNew->abswheel) > suppress) 
-               || (dsNew->relwheel != 0))
-               goto out;
+       if (abs(dsOrig->abswheel  - dsNew->abswheel)  > suppress) goto out;
+       if (abs(dsOrig->abswheel2 - dsNew->abswheel2) > suppress) goto out;
+       if (dsNew->relwheel != 0) goto out;
 
        returnV = SUPPRESS_ALL;
 
@@ -924,7 +926,7 @@ void wcmEvent(WacomCommonPtr common, unsigned int channel,
 
        DBG(10, common,
                "c=%d i=%d t=%d s=%u x=%d y=%d b=%d "
-               "p=%d rz=%d tx=%d ty=%d aw=%d rw=%d "
+               "p=%d rz=%d tx=%d ty=%d aw=%d aw2=%d rw=%d "
                "t=%d px=%d st=%d cs=%d \n",
                channel,
                ds.device_id,
@@ -932,7 +934,7 @@ void wcmEvent(WacomCommonPtr common, unsigned int channel,
                ds.serial_num,
                ds.x, ds.y, ds.buttons,
                ds.pressure, ds.rotation, ds.tiltx,
-               ds.tilty, ds.abswheel, ds.relwheel, ds.throttle,
+               ds.tilty, ds.abswheel, ds.abswheel2, ds.relwheel, ds.throttle,
                ds.proximity, ds.sample,
                pChannel->nSamples);
 
diff --git a/src/wcmUSB.c b/src/wcmUSB.c
index c95895a..f338642 100644
--- a/src/wcmUSB.c
+++ b/src/wcmUSB.c
@@ -1017,7 +1017,10 @@ static int usbParseAbsEvent(WacomCommonPtr common,
                        ds->y = event->value;
                        break;
                case ABS_RX:
-                       ds->stripx = event->value;
+                       if (common->vendor_id == WACOM_VENDOR_ID && 
common->tablet_id != 0x3F)
+                               ds->stripx = event->value;
+                       else
+                               ds->stripy = event->value;
                        break;
                case ABS_RY:
                        ds->stripy = event->value;
@@ -1044,7 +1047,11 @@ static int usbParseAbsEvent(WacomCommonPtr common,
                        ds->abswheel = event->value;
                        break;
                case ABS_THROTTLE:
-                       ds->throttle = event->value;
+                       /* 2nd touch ring comes in over ABS_THROTTLE for 24HD */
+                       if (common->vendor_id == WACOM_VENDOR_ID && 
common->tablet_id == 0xF4)
+                               ds->abswheel2 = event->value;
+                       else
+                               ds->throttle = event->value;
                        break;
                case ABS_MISC:
                        ds->proximity = (event->value != 0);
diff --git a/src/xf86WacomDefs.h b/src/xf86WacomDefs.h
index 72de096..e0e58fe 100644
--- a/src/xf86WacomDefs.h
+++ b/src/xf86WacomDefs.h
@@ -269,6 +269,7 @@ struct _WacomDeviceRec
        int oldTiltX;           /* previous tilt in x direction */
        int oldTiltY;           /* previous tilt in y direction */    
        int oldWheel;           /* previous wheel value */    
+       int oldWheel2;          /* previous wheel2 value */
        int oldRot;             /* previous rotation value */
        int oldStripX;          /* previous left strip value */
        int oldStripY;          /* previous right strip value */
@@ -325,6 +326,7 @@ struct _WacomDeviceState
        int stripy;
        int rotation;
        int abswheel;
+       int abswheel2;
        int relwheel;
        int distance;
        int throttle;
-- 
1.7.7.3


------------------------------------------------------------------------------
Write once. Port to many.
Get the SDK and tools to simplify cross-platform app development. Create 
new or port existing apps to sell to consumers worldwide. Explore the 
Intel AppUpSM program developer opportunity. appdeveloper.intel.com/join
http://p.sf.net/sfu/intel-appdev
_______________________________________________
Linuxwacom-devel mailing list
Linuxwacom-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linuxwacom-devel

Reply via email to