This patch expands the number of valuators reported by devices to
seven. The new seventh valuator reports the raw value provided from
the kernel for the second touch ring.

Signed-off-by: Jason Gerecke <killert...@gmail.com>
---
 src/wcmCommon.c |   11 +++++++----
 src/wcmConfig.c |    2 +-
 src/xf86Wacom.c |   33 +++++++++++++++++++++++++++++++--
 3 files changed, 39 insertions(+), 7 deletions(-)

diff --git a/src/wcmCommon.c b/src/wcmCommon.c
index a6c55b9..20cff5f 100644
--- a/src/wcmCommon.c
+++ b/src/wcmCommon.c
@@ -608,6 +608,7 @@ wcmSendNonPadEvents(InputInfoPtr pInfo, const 
WacomDeviceState *ds,
                        valuators[4] -= priv->oldTiltY;
                }
                valuators[5] -= priv->oldWheel;
+               valuators[6] -= priv->oldWheel2;
        }
 
        /* coordinates are ready we can send events */
@@ -687,7 +688,7 @@ void wcmSendEvents(InputInfoPtr pInfo, const 
WacomDeviceState* ds)
        int tx = ds->tiltx;
        int ty = ds->tilty;
        WacomDevicePtr priv = (WacomDevicePtr) pInfo->private;
-       int v3, v4, v5;
+       int v3, v4, v5, v6;
        int valuators[priv->naxes];
 
        if (priv->serial && serial != priv->serial)
@@ -737,6 +738,7 @@ void wcmSendEvents(InputInfoPtr pInfo, const 
WacomDeviceState* ds)
        }
 
        v5 = ds->abswheel;
+       v6 = ds->abswheel2;
        if (IsStylus(priv) && !IsArtPen(ds))
        {
                /* Normalize abswheel airbrush data to Art Pen rotation range.
@@ -747,11 +749,11 @@ void wcmSendEvents(InputInfoPtr pInfo, const 
WacomDeviceState* ds)
        }
 
        DBG(6, priv, "%s prox=%d\tx=%d"
-               "\ty=%d\tz=%d\tv3=%d\tv4=%d\tv5=%d\tid=%d"
+               "\ty=%d\tz=%d\tv3=%d\tv4=%d\tv5=%d\tv6=%d\tid=%d"
                "\tserial=%u\tbutton=%s\tbuttons=%d\n",
                is_absolute(pInfo) ? "abs" : "rel",
                ds->proximity,
-               x, y, z, v3, v4, v5, id, serial,
+               x, y, z, v3, v4, v5, v6, id, serial,
                is_button ? "true" : "false", ds->buttons);
 
        priv->currentX = x;
@@ -770,9 +772,10 @@ void wcmSendEvents(InputInfoPtr pInfo, const 
WacomDeviceState* ds)
        valuators[3] = v3;
        valuators[4] = v4;
        valuators[5] = v5;
+       valuators[6] = v6;
 
        if (type == PAD_ID)
-               wcmSendPadEvents(pInfo, ds, 3, 3, &valuators[3]); /* pad 
doesn't post x/y/z */
+               wcmSendPadEvents(pInfo, ds, 3, 4, &valuators[3]); /* pad 
doesn't post x/y/z */
        else
                wcmSendNonPadEvents(pInfo, ds, 0, priv->naxes, valuators);
 
diff --git a/src/wcmConfig.c b/src/wcmConfig.c
index 567c3e7..f2ee279 100644
--- a/src/wcmConfig.c
+++ b/src/wcmConfig.c
@@ -86,7 +86,7 @@ static int wcmAllocate(InputInfoPtr pInfo)
        priv->stripldn = 5;                     /* Default left strip down 
event */
        priv->striprup = 4;                     /* Default right strip up event 
*/
        priv->striprdn = 5;                     /* Default right strip down 
event */
-       priv->naxes = 6;                        /* Default number of axes */
+       priv->naxes = 7;                        /* Default number of axes */
 
        /* JEJ - throttle sampling code */
        priv->throttleLimit = -1;
diff --git a/src/xf86Wacom.c b/src/xf86Wacom.c
index 16561b5..5f29a41 100644
--- a/src/xf86Wacom.c
+++ b/src/xf86Wacom.c
@@ -322,6 +322,35 @@ wcmInitAxes(DeviceIntPtr pWcm)
 #endif
                               );
 
+       /* seventh valuator: abswheel2 */
+       if ((TabletHasFeature(common, WCM_DUALRING)) && IsPad(priv))
+       {
+               /* Second touch ring */
+               label = None;
+               min = MIN_PAD_RING;
+               max = MAX_PAD_RING;
+               min_res = max_res = res = 1;
+               mode = Absolute;
+       }
+       else
+       {
+               label = None; /* XXX: what is this axis? */
+               min = 0;
+               max = 1; /* dummy value */
+               min_res = max_res = res = 1;
+               mode = Absolute;
+       }
+
+       InitValuatorAxisStruct(pInfo->dev, 6,
+#if GET_ABI_MAJOR(ABI_XINPUT_VERSION) >= 7
+                              label,
+#endif
+                              min, max, res, min_res, max_res
+#if GET_ABI_MAJOR(ABI_XINPUT_VERSION) >= 12
+                              , mode
+#endif
+                              );
+
        return TRUE;
 }
 
@@ -404,8 +433,8 @@ static int wcmDevInit(DeviceIntPtr pWcm)
                        return FALSE;
        }
 
-       if (!nbaxes || nbaxes > 6)
-               nbaxes = priv->naxes = 6;
+       if (!nbaxes || nbaxes > 7)
+               nbaxes = priv->naxes = 7;
 
        /* axis_labels is just zeros, we set up each valuator with the
         * correct property later */
-- 
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