Reviewed-by: Chris Bagwell <ch...@cnpbagwell.com>

On Tue, Dec 13, 2011 at 3:59 PM, Jason Gerecke <killert...@gmail.com> wrote:
> 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/xf86Wacom.c |   28 ++++++++++++++++++++++++++--
>  2 files changed, 33 insertions(+), 6 deletions(-)
>
> diff --git a/src/wcmCommon.c b/src/wcmCommon.c
> index 57a1826..0e719cf 100644
> --- a/src/wcmCommon.c
> +++ b/src/wcmCommon.c
> @@ -606,6 +606,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 */
> @@ -685,7 +686,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)
> @@ -735,6 +736,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.
> @@ -745,11 +747,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;
> @@ -768,9 +770,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 */
> --
> 1.7.7.3
>
>
> ------------------------------------------------------------------------------
> Systems Optimization Self Assessment
> Improve efficiency and utilization of IT resources. Drive out cost and
> improve service delivery. Take 5 minutes to use this Systems Optimization
> Self Assessment. http://www.accelacomm.com/jaw/sdnl/114/51450054/
> _______________________________________________
> Linuxwacom-devel mailing list
> Linuxwacom-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/linuxwacom-devel

------------------------------------------------------------------------------
Learn Windows Azure Live!  Tuesday, Dec 13, 2011
Microsoft is holding a special Learn Windows Azure training event for 
developers. It will provide a great way to learn Windows Azure and what it 
provides. You can attend the event by watching it streamed LIVE online.  
Learn more at http://p.sf.net/sfu/ms-windowsazure
_______________________________________________
Linuxwacom-devel mailing list
Linuxwacom-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linuxwacom-devel

Reply via email to