OSDN Git Service

HID: wacom: Simplify check for presence of single-finger touch
authorJason Gerecke <killertofu@gmail.com>
Thu, 16 Apr 2015 00:22:32 +0000 (17:22 -0700)
committerJiri Kosina <jkosina@suse.cz>
Thu, 23 Apr 2015 08:06:10 +0000 (10:06 +0200)
To determine if a touch is present in the single-touch case, we can
simply check if the BTN_TOUCH key is active or not. This will work for
both HID_GENERIC and other device types.

Signed-off-by: Jason Gerecke <jason.gerecke@wacom.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
drivers/hid/wacom_wac.c

index 3609cbe..091bab4 100644 (file)
@@ -1072,9 +1072,8 @@ static int wacom_wac_finger_count_touches(struct wacom_wac *wacom)
        int count = 0;
        int i;
 
-       /* non-HID_GENERIC single touch input doesn't call this routine */
-       if ((touch_max == 1) && (wacom->features.type == HID_GENERIC))
-               return wacom->hid_data.tipswitch &&
+       if (touch_max == 1)
+               return test_bit(BTN_TOUCH, input->key) &&
                       !wacom->shared->stylus_in_proximity;
 
        for (i = 0; i < input->mt->num_slots; i++) {