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>
---
 src/wcmCommon.c     |   16 +++++++++-------
 src/wcmUSB.c        |    7 +++++++
 src/xf86WacomDefs.h |    2 ++
 3 files changed, 18 insertions(+), 7 deletions(-)

diff --git a/src/wcmCommon.c b/src/wcmCommon.c
index 6b25101..f6ddf8a 100644
--- a/src/wcmCommon.c
+++ b/src/wcmCommon.c
@@ -502,6 +502,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))
@@ -690,11 +691,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);
@@ -757,6 +758,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;
@@ -819,9 +821,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;
 
@@ -875,7 +877,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,
@@ -883,7 +885,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 0a9ce9b..99368dd 100644
--- a/src/wcmUSB.c
+++ b/src/wcmUSB.c
@@ -30,6 +30,10 @@
 
 #define MAX_USB_EVENTS 32
 
+#ifndef ABS_WHEEL2
+#define ABS_WHEEL2 0x1d
+#endif
+
 typedef struct {
        int wcmLastToolSerial;
        int wcmBTNChannel;
@@ -1041,6 +1045,9 @@ static int usbParseAbsEvent(WacomCommonPtr common,
                case ABS_WHEEL:
                        ds->abswheel = event->value;
                        break;
+               case ABS_WHEEL2:
+                       ds->abswheel2 = event->value;
+                       break;
                case ABS_Z:
                        ds->abswheel = event->value;
                        break;
diff --git a/src/xf86WacomDefs.h b/src/xf86WacomDefs.h
index 72a48d0..72c2bd5 100644
--- a/src/xf86WacomDefs.h
+++ b/src/xf86WacomDefs.h
@@ -266,6 +266,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 */
@@ -322,6 +323,7 @@ struct _WacomDeviceState
        int stripy;
        int rotation;
        int abswheel;
+       int abswheel2;
        int relwheel;
        int distance;
        int throttle;
-- 
1.7.6


------------------------------------------------------------------------------
The demand for IT networking professionals continues to grow, and the
demand for specialized networking skills is growing even more rapidly.
Take a complimentary Learning@Cisco Self-Assessment and learn 
about Cisco certifications, training, and career opportunities. 
http://p.sf.net/sfu/cisco-dev2dev
_______________________________________________
Linuxwacom-devel mailing list
Linuxwacom-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linuxwacom-devel

Reply via email to