On Tue, Dec 13, 2011 at 03:38:27PM -0800, Jason Gerecke wrote:
> 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 <[email protected]>
> ---
> Changes from v3:
>  * Set either abswheel2 or throttle, NOT both (whoops!)

I somewhat weep at the ABS_THROTTLE for the second wheel, but 

Reviewed-by: Peter Hutterer <[email protected]>

Cheers,
  Peter

>  src/wcmCommon.c     |   16 +++++++++-------
>  src/wcmUSB.c        |    6 +++++-
>  src/xf86WacomDefs.h |    2 ++
>  3 files changed, 16 insertions(+), 8 deletions(-)
> 
> diff --git a/src/wcmCommon.c b/src/wcmCommon.c
> index e85c6d8..44e74eb 100644
> --- a/src/wcmCommon.c
> +++ b/src/wcmCommon.c
> @@ -500,6 +500,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))
> @@ -688,11 +689,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);
> @@ -755,6 +756,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;
> @@ -817,9 +819,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;
>  
> @@ -873,7 +875,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,
> @@ -881,7 +883,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 c95895a..8451c25 100644
> --- a/src/wcmUSB.c
> +++ b/src/wcmUSB.c
> @@ -1044,7 +1044,11 @@ static int usbParseAbsEvent(WacomCommonPtr common,
>                       ds->abswheel = event->value;
>                       break;
>               case ABS_THROTTLE:
> -                     ds->throttle = event->value;
> +                     /* 2nd touch ring comes in over ABS_THROTTLE for 24HD */
> +                     if (common->vendor_id == WACOM_VENDOR_ID && 
> common->tablet_id == 0xF4)
> +                             ds->abswheel2 = event->value;
> +                     else
> +                             ds->throttle = event->value;
>                       break;
>               case ABS_MISC:
>                       ds->proximity = (event->value != 0);
> diff --git a/src/xf86WacomDefs.h b/src/xf86WacomDefs.h
> index 9987436..8f06b8d 100644
> --- a/src/xf86WacomDefs.h
> +++ b/src/xf86WacomDefs.h
> @@ -267,6 +267,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 */
> @@ -323,6 +324,7 @@ struct _WacomDeviceState
>       int stripy;
>       int rotation;
>       int abswheel;
> +     int abswheel2;
>       int relwheel;
>       int distance;
>       int throttle;
> -- 
> 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
> [email protected]
> 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
[email protected]
https://lists.sourceforge.net/lists/listinfo/linuxwacom-devel

Reply via email to