This patch expands the number of valuators reported by pad 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> --- Changes from v1: * Number of axes back to 6 by default * 7th axis only initialized and used for pad device * Number of pad valuators in wcmSendEvents now depends on naxes src/wcmCommon.c | 11 +++++++---- src/xf86Wacom.c | 28 ++++++++++++++++++++++++++-- 2 files changed, 33 insertions(+), 6 deletions(-) diff --git a/src/wcmCommon.c b/src/wcmCommon.c index a6c55b9..729f311 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, 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..c453b24 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)) + 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 */ -- 1.7.7.1 ------------------------------------------------------------------------------ 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