As discussed at linux-input, BTN_TOOL_FINGER should be used to
report single touch events. Update tool type and event process
accordingly.

Signed-off-by: Ping Cheng <[email protected]>
---
 src/wcmUSB.c            |   32 ++++++++++++--------------------
 src/wcmValidateDevice.c |   18 +++++++++++++-----
 2 files changed, 25 insertions(+), 25 deletions(-)

diff --git a/src/wcmUSB.c b/src/wcmUSB.c
index efd4319..30c57a3 100644
--- a/src/wcmUSB.c
+++ b/src/wcmUSB.c
@@ -935,30 +935,22 @@ static int usbParseKeyEvent(WacomCommonPtr common,
                        ds->proximity = (event->value != 0);
                        break;
 
-               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);
+               case BTN_TOUCH:
+                       /* actual events are processed by BTN_TOOL_* events */
                        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.
-                        */
+               case BTN_TOOL_FINGER:
+                       /* A pad tool */
                        if (common->wcmProtocolLevel != WCM_PROTOCOL_GENERIC)
+                       {
+                               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;
+                       }
 
                        /* fall through */
                case BTN_TOOL_DOUBLETAP:
diff --git a/src/wcmValidateDevice.c b/src/wcmValidateDevice.c
index b2ec79e..fd424dc 100644
--- a/src/wcmValidateDevice.c
+++ b/src/wcmValidateDevice.c
@@ -123,11 +123,11 @@ static struct
        __u16 tool[3]; /* tool array is terminated by 0 */
 } wcmType [] =
 {
-       { "stylus", { BTN_TOOL_PEN,       0        } },
-       { "eraser", { BTN_TOOL_RUBBER,    0        } },
-       { "cursor", { BTN_TOOL_MOUSE,     0        } },
-       { "touch",  { BTN_TOOL_DOUBLETAP, 0        } },
-       { "pad",    { BTN_FORWARD,        BTN_0, 0 } }
+       { "stylus", { BTN_TOOL_PEN,       0                  } },
+       { "eraser", { BTN_TOOL_RUBBER,    0                  } },
+       { "cursor", { BTN_TOOL_MOUSE,     0                  } },
+       { "touch",  { BTN_TOOL_DOUBLETAP, BTN_TOOL_FINGER, 0 } },
+       { "pad",    { BTN_FORWARD,        BTN_0,           0 } }
 };
 
 /* validate tool type for device/product */
@@ -151,6 +151,14 @@ Bool wcmIsAValidType(InputInfoPtr pInfo, const char* type)
                                if (ISBITSET (common->wcmKeys, 
wcmType[j].tool[k]))
                                {
                                        ret = TRUE;
+
+                                       /* non GENERIC devices use 
BTN_TOOL_FINGER for pad */
+                                       if (common->wcmProtocolLevel != 
WCM_PROTOCOL_GENERIC)
+                                       {
+                                               if (!strcmp(type, "touch") &&
+                                                       wcmType[j].tool[k] == 
BTN_TOOL_FINGER)
+                                                   ret = FALSE;
+                                       }
                                }
                                else if (!strlen(dsource)) /* an user defined 
type */
                                {
-- 
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

Reply via email to