On Mon, Nov 29, 2010 at 09:35:43AM -0800, Ping Cheng wrote:
> Due to the limitation of number of valators we can use, Airbrush
> wheel and Art Pen rotation share the same fifth valuator. But
> they do not have the same range of values. So, we normalize the
> airbrush wheel (0, 1023) to the Art Pen rotation (-900, 899).
>
> Signed-off-by: Ping Cheng <[email protected]>
> ---
> src/wcmCommon.c | 16 ++++++++++++++--
> src/wcmUSB.c | 9 ++-------
> 2 files changed, 16 insertions(+), 9 deletions(-)
>
> diff --git a/src/wcmCommon.c b/src/wcmCommon.c
> index 8050600..a006a9a 100644
> --- a/src/wcmCommon.c
> +++ b/src/wcmCommon.c
> @@ -629,7 +629,7 @@ void wcmSendEvents(InputInfoPtr pInfo, const
> WacomDeviceState* ds)
> if (ds->proximity)
> wcmRotateAndScaleCoordinates(pInfo, &x, &y);
>
> - if (IsCursor(priv))
> + if (IsCursor(priv))
> {
> v3 = ds->rotation;
> v4 = ds->throttle;
> @@ -639,8 +639,20 @@ void wcmSendEvents(InputInfoPtr pInfo, const
> WacomDeviceState* ds)
> v3 = tx;
> v4 = ty;
> }
> - v5 = ds->abswheel;
>
> + if (IsStylus(priv))
> + {
> + /* Normalize abswheel airbrush data to Art Pen rotation range.
> + * The test below is for Art Pen. We do not normalize them
> + * since they are already at the range.
> + */
> + if (ds->device_id != 0x885 && ds->device_id != 0x804)
please make a is_artpen() function that collects these IDs in one place so
we only have a single place to update when the IDs change.
Cheers,
Peter
> + v5 = ds->abswheel * MAX_ROTATION_RANGE/
> + (double)MAX_ABS_WHEEL + MIN_ROTATION;
> + }
> + else
> + v5 = ds->abswheel;
> +
> DBG(6, priv, "%s prox=%d\tx=%d"
> "\ty=%d\tz=%d\tv3=%d\tv4=%d\tv5=%d\tid=%d"
> "\tserial=%u\tbutton=%s\tbuttons=%d\n",
> diff --git a/src/wcmUSB.c b/src/wcmUSB.c
> index 90e8cf6..01b34f1 100644
> --- a/src/wcmUSB.c
> +++ b/src/wcmUSB.c
> @@ -816,13 +816,8 @@ static int usbParseAbsEvent(WacomCommonPtr common,
> ds->distance = event->value;
> break;
> case ABS_WHEEL:
> - {
> - double norm = event->value *
> - MAX_ROTATION_RANGE /
> - (double)MAX_ABS_WHEEL;
> - ds->abswheel = (int)norm + MIN_ROTATION;
> - break;
> - }
> + ds->abswheel = event->value;
> + break;
> case ABS_Z:
> ds->abswheel = event->value;
> break;
> --
> 1.7.2.3
>
------------------------------------------------------------------------------
Increase Visibility of Your 3D Game App & Earn a Chance To Win $500!
Tap into the largest installed PC base & get more eyes on your game by
optimizing for Intel(R) Graphics Technology. Get started today with the
Intel(R) Software Partner Program. Five $500 cash prizes are up for grabs.
http://p.sf.net/sfu/intelisp-dev2dev
_______________________________________________
Linuxwacom-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/linuxwacom-devel