BTN_TOOL_FINGER indicates single touch/first finger if MT is enabled

Signed-off-by: Ping Cheng <pi...@wacom.com>
---
 src/wcmUSB.c |   13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

diff --git a/src/wcmUSB.c b/src/wcmUSB.c
index ef19b51..1f1db35 100644
--- a/src/wcmUSB.c
+++ b/src/wcmUSB.c
@@ -1441,13 +1441,15 @@ static void usbParseBTNEvent(WacomCommonPtr common,
  * Translates a tool code from the kernel (e.g. BTN_TOOL_PEN) into the
  * corresponding device type for the driver (e.g. STYLUS_ID).
  *
+ * @param[in] common
  * @param[in] type      Linux input tool type (e.g. EV_KEY)
  * @param[in] code      Linux input tool code (e.g. BTN_STYLUS_PEN)
- * @param[in] protocol  Wacom protocol type (e.g. WCM_PROTOCOL_GENERIC)
  * @return              Wacom device ID (e.g. STYLUS_ID) or 0 if no match.
  */
-static int toolTypeToDeviceType(int type, int code, int protocol)
+static int toolTypeToDeviceType(WacomCommonPtr common, int type, int code)
 {
+       wcmUSBData* private = common->private;
+
        if (type == EV_KEY) {
                switch(code) {
                        case BTN_TOOL_PEN:
@@ -1457,7 +1459,8 @@ static int toolTypeToDeviceType(int type, int code, int 
protocol)
                                return STYLUS_ID;
 
                        case BTN_TOOL_FINGER:
-                               if (protocol != WCM_PROTOCOL_GENERIC)
+                               if ((common->wcmProtocolLevel != 
WCM_PROTOCOL_GENERIC)
+                                   && !private->wcmUseMT)
                                        return PAD_ID;
                                else
                                        return TOUCH_ID;
@@ -1499,7 +1502,7 @@ static int refreshDeviceType(WacomCommonPtr common)
        for (i = 0; i < KEY_MAX; i++)
        {
                if (ISBITSET(keys, i))
-                       device_type = toolTypeToDeviceType(EV_KEY, i, 
common->wcmProtocolLevel);
+                       device_type = toolTypeToDeviceType(common, EV_KEY, i);
                if (device_type)
                        return device_type;
        }
@@ -1529,7 +1532,7 @@ static int usbInitToolType(WacomCommonPtr common, const 
struct input_event *even
 
        for (i = 0; (i < nevents) && !device_type; ++i, event_ptr++)
        {
-               device_type = toolTypeToDeviceType(event_ptr->type, 
event_ptr->code, common->wcmProtocolLevel);
+               device_type = toolTypeToDeviceType(common, event_ptr->type, 
event_ptr->code);
        }
 
        if (!device_type)
-- 
1.7.10.4


------------------------------------------------------------------------------
LogMeIn Rescue: Anywhere, Anytime Remote support for IT. Free Trial
Remotely access PCs and mobile devices and provide instant support
Improve your efficiency, and focus on delivering more value-add services
Discover what IT Professionals Know. Rescue delivers
http://p.sf.net/sfu/logmein_12329d2d
_______________________________________________
Linuxwacom-devel mailing list
Linuxwacom-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linuxwacom-devel

Reply via email to