On Sun, Nov 14, 2010 at 8:46 AM,  <ch...@cnpbagwell.com> wrote:
> From: Chris Bagwell <ch...@cnpbagwell.com>
>
> Signed-off-by: Chris Bagwell <ch...@cnpbagwell.com>
> ---
>  src/wcmUSB.c |   16 ++++++++++------
>  1 files changed, 10 insertions(+), 6 deletions(-)
>
> diff --git a/src/wcmUSB.c b/src/wcmUSB.c
> index 4d8a0fb..eb4d592 100644
> --- a/src/wcmUSB.c
> +++ b/src/wcmUSB.c
> @@ -929,12 +929,16 @@ static int usbParseKeyEvent(WacomCommonPtr common,
>
>                case BTN_TOUCH:
>                        /* Treat BTN_TOUCH same as BTN_TOOL_DOUBLETAP
> -                        * for touchpads.
> -                        * TODO: Tablets that do not use wacom style
> -                        * multiplexing over a single input device
> -                        * also can report BTN_TOUCH same as
> -                        * BTN_TOOL_PEN would be used.  We should
> -                        * allow for that case as well.
> +                        * for generic touchscreens/Tablet PC's.
> +                        *
> +                        * Generic touchpads will send BTN_TOOL_FINGER
> +                        * and BTN_TOUCH together.  Ignore BTN_TOOL_FINGER
> +                        * to keep same code flow for both cases.
> +                        *
> +                        * TODO: Generic tablets will send both
> +                        * BTN_TOOL_PEN and BTN_TOUCH. This currently
> +                        * gets mis-interrepted as a touch.  An IsStylus()
> +                        * is probably needed here.

If both finger and pen would report BTN_TOUCH event, default BTN_TOUCH
to touch without taking care of the pen would mess up pen data for
sure. Also, IsStylus() can not be checked here since we do not know
which tool is sending the data at this stage, especially if we are
going to process serial Tablet PC, which has both pen and touch on the
same logical port, in wcmUSB.c. The real tool will be decided in
wcmCommon.c by commonDispatchDevice later.

The issue here is the mess of BTN_TOOL_FINGER which can be a pad or a
touch. So, let's leave  BTN_TOUCH alone and focus on distinguishing
this BTN_TOOL_FINGER (touch) from the other BTN_TOOL_FINGER (pad), if
you know what I am talking about ;).

We send TOOL_ID for all Wacom devices in the kernel (except the new MT
bamboo code) through:

input_report_abs(input, ABS_MISC, wacom->id[0]); /* TOOL ID */

Can we rely on ABS_MISC for tool type (pad PAD_DEVICE_ID or
fingerTOUCH_TOOL_ID ) for all Wacom devices? For other vendors' tools,
it would always be TOUCH_TOOL_ID. No confusion whatsoever, I hope ;).
Why do we want to mess up Wacom devices, for which we can make
decisions, with other vendors', which are normally out of our reach?

There are two changes we need to make (there may be changes related to
WCM_PROTOCOL_GENERIC too. I won't touch those with this thread):

1.   in wacom_wac.c for Bamboo touch, add

      input_report_abs(input, ABS_MISC,PAD_DEVICE_ID );

2.   in wcmUSB.c, change:

                case BTN_TOOL_FINGER:
                        /* If a real finger report, ignore. */
                        if (common->wcmProtocolLevel == WCM_PROTOCOL_GENERIC)
                                break;

                        DBG(6, common,
                            "USB Pad detected %x (value=%d)\n",
                            event->code, event->value);
                        ds->device_type = PAD_ID;
                        ds->device_id = PAD_DEVICE_ID;
                        ds->proximity = (event->value != 0);
                        break;

               case BTN_TOUCH:
                        /* Treat BTN_TOUCH same as BTN_TOOL_DOUBLETAP
                         * for touchpads.
                         * TODO: Tablets that do not use wacom style
                         * multiplexing over a single input device
                         * also can report BTN_TOUCH same as
                         * BTN_TOOL_PEN would be used.  We should
                         * allow for that case as well.
                         */
                        if (common->wcmProtocolLevel != WCM_PROTOCOL_GENERIC)
                                break;

                        /* fall through */
                case BTN_TOOL_DOUBLETAP:

[.....]

                case ABS_MISC:
                        if (event->value)
                                ds->device_id = event->value;
                        break;

To:

               case BTN_TOUCH:
                                break; /* do nothing */

                case BTN_TOOL_FINGER:
                        if (WACOM_VENDOR_ID == WacomModelDesc[i].vendor_id)
                        {
                            /* rely on ABS_MISC to decide device_id and 
device_type */
                            DBG(6, common,
                                 "USB BTN_TOOL_FINGER detected %x (value=%d)\n",
                                 event->code, event->value);
                            ds->proximity = (event->value != 0);
                            break;
                         }

                        /* fall through for real single finger touch */
                case BTN_TOOL_DOUBLETAP:
[.....]

                case ABS_MISC:
                        if (event->value)
                        {
                                ds->device_id = event->value;
                                ds->device_type = /* a_routine_to update 
device_type by device_id here */
                        }
                        break;

Ping

------------------------------------------------------------------------------
Centralized Desktop Delivery: Dell and VMware Reference Architecture
Simplifying enterprise desktop deployment and management using
Dell EqualLogic storage and VMware View: A highly scalable, end-to-end
client virtualization framework. Read more!
http://p.sf.net/sfu/dell-eql-dev2dev
_______________________________________________
Linuxwacom-devel mailing list
Linuxwacom-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linuxwacom-devel

Reply via email to