On Thu, Mar 4, 2010 at 5:41 PM, <ch...@cnpbagwell.com> wrote:

> From: Chris Bagwell <ch...@cnpbagwell.com>
>
> For Bamboo P&T devices, both a touch and pad type are
> shared for single input device and can be called in any
> order based on xorg.conf.  And normal HAL order is to
> invoke usbGetRanges() from pad first.
>
> This meant all logic related to IsTouch() was not
> correctly running.  Updated to treat pad type as
> touch in special case of Bamboo P&T.
>
> This is applies to devices that have both BTN_TOOL_FINGER
> and BTN_TOOL_DOUBLETAP which currently is limitted to
> Bamboo touch devices.
>

Since the patch applies to the devices that have both BTN_TOOL_FINGER
and BTN_TOOL_DOUBLETAP tools, which currently are limitted to Bamboo touch
devices, can we make it a bit generic by checking BTN_TOOL_FINGER &
BTN_TOOL_DOUBLETAP, instead of the specific product IDs?

+       if (IsPad(priv) &&
+           common->tablet_id >= 0xd0 && common->tablet_id <= 0xd3)

Sorry for coming up with this idea so late.

Ping


> Signed-off-by: Chris Bagwell <ch...@cnpbagwell>
> Reviewed-by: Peter Hutterer <peter.hutte...@who-t.net>
> Reviewed-by:  Ping Cheng <pingli...@gmail.com>
> ---
>  src/wcmUSB.c |   21 ++++++++++++++++-----
>  1 files changed, 16 insertions(+), 5 deletions(-)
>
> diff --git a/src/wcmUSB.c b/src/wcmUSB.c
> index ed53897..466ffae 100644
> --- a/src/wcmUSB.c
> +++ b/src/wcmUSB.c
> @@ -613,6 +613,17 @@ int usbWcmGetRanges(LocalDevicePtr local)
>        unsigned long abs[NBITS(ABS_MAX)] = {0};
>        WacomDevicePtr priv = (WacomDevicePtr)local->private;
>        WacomCommonPtr common = priv->common;
> +       int is_touch;
> +
> +       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.
> +        */
> +       if (IsPad(priv) &&
> +           common->tablet_id >= 0xd0 && common->tablet_id <= 0xd3)
> +               is_touch = 1;
>
>        if (ioctl(local->fd, EVIOCGBIT(0 /*EV*/, sizeof(ev)), ev) < 0)
>        {
> @@ -647,7 +658,7 @@ int usbWcmGetRanges(LocalDevicePtr local)
>                xf86Msg(X_ERROR, "%s: xmax value is wrong.\n", local->name);
>                return !Success;
>        }
> -       if (!IsTouch(priv))
> +       if (!is_touch)
>                common->wcmMaxX = absinfo.maximum;
>        else
>                common->wcmMaxTouchX = absinfo.maximum;
> @@ -664,7 +675,7 @@ int usbWcmGetRanges(LocalDevicePtr local)
>                xf86Msg(X_ERROR, "%s: ymax value is wrong.\n", local->name);
>                return !Success;
>        }
> -       if (!IsTouch(priv))
> +       if (!is_touch)
>                common->wcmMaxY = absinfo.maximum;
>        else
>                common->wcmMaxTouchY = absinfo.maximum;
> @@ -673,7 +684,7 @@ int usbWcmGetRanges(LocalDevicePtr local)
>         * or touch physical X for TabletPCs with touch */
>        if (ioctl(local->fd, EVIOCGABS(ABS_RX), &absinfo) == 0)
>        {
> -               if (IsTouch(priv))
> +               if (is_touch)
>                        common->wcmTouchResolX = absinfo.maximum;
>                else
>                        common->wcmMaxStripX = absinfo.maximum;
> @@ -683,13 +694,13 @@ int usbWcmGetRanges(LocalDevicePtr local)
>         * or touch physical Y for TabletPCs with touch */
>        if (ioctl(local->fd, EVIOCGABS(ABS_RY), &absinfo) == 0)
>        {
> -               if (IsTouch(priv))
> +               if (is_touch)
>                        common->wcmTouchResolY = absinfo.maximum;
>                else
>                        common->wcmMaxStripY = absinfo.maximum;
>        }
>
> -       if (IsTouch(priv) && common->wcmTouchResolX &&
> common->wcmMaxTouchX)
> +       if (is_touch && common->wcmTouchResolX && common->wcmMaxTouchX)
>        {
>                common->wcmTouchResolX =
> (int)(((double)common->wcmTouchResolX)
>                         / ((double)common->wcmMaxTouchX) + 0.5);
> --
> 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
> Linuxwacom-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/linuxwacom-devel
>
------------------------------------------------------------------------------
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
Linuxwacom-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linuxwacom-devel

Reply via email to