summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJason Gerecke <killertofu@gmail.com>2011-12-21 13:13:11 -0800
committerJason Gerecke <killertofu@gmail.com>2011-12-29 11:23:48 -0800
commit3989bdb4b42cbd44f7dd99b244eeb4d1618a7ff3 (patch)
tree359a68e05fce66aaf64c29278ae5a974655eeede
parent7e3b2b9223629119472469569a2e23150e5c0c68 (diff)
Expose the second touch ring's raw value in a new 7th valuator
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 <killertofu@gmail.com> Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Chris Bagwell <chris@cnpbagwell.com>
-rw-r--r--src/wcmCommon.c11
-rw-r--r--src/xf86Wacom.c28
2 files changed, 33 insertions, 6 deletions
diff --git a/src/wcmCommon.c b/src/wcmCommon.c
index 885b6b9..21afcc5 100644
--- a/src/wcmCommon.c
+++ b/src/wcmCommon.c
@@ -642,6 +642,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 */
@@ -721,7 +722,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)
@@ -771,6 +772,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.
@@ -781,11 +783,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;
@@ -804,9 +806,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, priv->naxes - 3, &valuators[3]); /* pad doesn't post x/y/z */
else
wcmSendNonPadEvents(pInfo, ds, 0, priv->naxes, valuators);
diff --git a/src/xf86Wacom.c b/src/xf86Wacom.c
index 16561b5..d1c149f 100644
--- a/src/xf86Wacom.c
+++ b/src/xf86Wacom.c
@@ -322,6 +322,27 @@ 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;
+
+ 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;
}
@@ -349,6 +370,9 @@ static int wcmDevInit(DeviceIntPtr pWcm)
nbaxes = priv->naxes; /* X, Y, Pressure, Tilt-X, Tilt-Y, Wheel */
nbbuttons = priv->nbuttons; /* Use actual number of buttons, if possible */
+ if (IsPad(priv) && TabletHasFeature(priv->common, WCM_DUALRING))
+ nbaxes = priv->naxes = nbaxes + 1; /* ABS wheel 2 */
+
/* if more than 3 buttons, offset by the four scroll buttons,
* otherwise, alloc 7 buttons for scroll wheel. */
nbbuttons = (nbbuttons > 3) ? nbbuttons + 4 : 7;
@@ -404,8 +428,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 */