On Wed, Mar 17, 2010 at 05:58:48PM -0700, Ping Cheng wrote:
> From: Ping Cheng <[email protected]>
> Date: Wed, 17 Mar 2010 17:50:31 -0700
> Subject: [PATCH 2/2] xf86-input-wacom: use wcmKeys to check tool type
> 
> Since wcmKeys can be accessed from usbWcmGetRanges, we retrieve
> the supported tool types instead of product ID for touch devices
> that also report pad data. This change makes the code generic to
> all touch devices that report pad data.
> 
> Ping Cheng <[email protected]>
> ---
>  src/wcmUSB.c |   14 ++++++--------
>  1 files changed, 6 insertions(+), 8 deletions(-)
> 
> diff --git a/src/wcmUSB.c b/src/wcmUSB.c
> index 503052a..84bf2c4 100644
> --- a/src/wcmUSB.c
> +++ b/src/wcmUSB.c
> @@ -528,16 +528,14 @@ int usbWcmGetRanges(LocalDevicePtr local)
>       unsigned long abs[NBITS(ABS_MAX)] = {0};
>       WacomDevicePtr priv = (WacomDevicePtr)local->private;
>       WacomCommonPtr common = priv->common;
> -     int is_touch;
> +     int is_touch = IsTouch(priv);
> 
> -     is_touch = IsTouch(priv);
> -     /* Bamboo P&T have both Touch and Pad types on same
> -      * device.  Its normal for this to be called for pad
> -      * case and logic requires it to act same as Touch
> -      * case.
> +     /* Devices, such as Bamboo P&T, may have Pad data reported in the same

nitpick: no commas needed here

> +      * packet as Touch.  Its normal for Pad to be called first but logic
> +      * requires it to act the same as Touch.
>        */
> -     if (IsPad(priv) &&
> -         common->tablet_id >= 0xd0 && common->tablet_id <= 0xd3)
> +     if ((common->wcmKeys[LONG(BTN_TOOL_DOUBLETAP)] & 
> BIT(BTN_TOOL_DOUBLETAP))
> +          && (common->wcmKeys[LONG(BTN_TOOL_FINGER)] & BIT(BTN_TOOL_FINGER)))

I think using ISBITSET(common->wcmKeys, BTN_TOOL_FOO) from xf86WacomDefs.h
is easier to read.

Cheers,
  Peter

>               is_touch = 1;
> 
>       if (ioctl(local->fd, EVIOCGBIT(0 /*EV*/, sizeof(ev)), ev) < 0)
> -- 
> 1.6.6.1

------------------------------------------------------------------------------
Download Intel&#174; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
_______________________________________________
Linuxwacom-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/linuxwacom-devel

Reply via email to