HID: wacom: remove hardcoded WACOM_QUIRK_MULTI_INPUT
authorPing Cheng <pinglinux@gmail.com>
Fri, 20 Mar 2015 21:57:00 +0000 (14:57 -0700)
committerJiri Kosina <jkosina@suse.cz>
Thu, 2 Apr 2015 12:09:59 +0000 (14:09 +0200)
The quirk was added for devices that support both pen and touch.  It decides if
a device supports multiple inputs by hardcoded feature type. However, for some
devices, we do not know if they support both before accessing their HID
descriptors.

This patch relies on dynamically assigned device_type to make the decision.
Also, we make it certain that wacom_wac->shared is always created. That is, the
driver will not be loaded if it fails to create wacom_wac->shared.

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

index 353fe476be266c96c09bb60c8160ee003bffa8fe..1b00d8d4466c9eb6c2b9e9af7a5829ede946fd15 100644 (file)
@@ -1521,19 +1521,17 @@ static int wacom_probe(struct hid_device *hdev,
        snprintf(wacom_wac->pad_name, sizeof(wacom_wac->pad_name),
                "%s Pad", features->name);
 
-       if (features->quirks & WACOM_QUIRK_MULTI_INPUT) {
-               /* Append the device type to the name */
-               if (features->device_type != BTN_TOOL_FINGER)
-                       strlcat(wacom_wac->name, " Pen", WACOM_NAME_MAX);
-               else if (features->touch_max)
-                       strlcat(wacom_wac->name, " Finger", WACOM_NAME_MAX);
-               else
-                       strlcat(wacom_wac->name, " Pad", WACOM_NAME_MAX);
-
-               error = wacom_add_shared_data(hdev);
-               if (error)
-                       goto fail_shared_data;
-       }
+       /* Append the device type to the name */
+       if (features->device_type != BTN_TOOL_FINGER)
+               strlcat(wacom_wac->name, " Pen", WACOM_NAME_MAX);
+       else if (features->touch_max)
+               strlcat(wacom_wac->name, " Finger", WACOM_NAME_MAX);
+       else
+               strlcat(wacom_wac->name, " Pad", WACOM_NAME_MAX);
+
+       error = wacom_add_shared_data(hdev);
+       if (error)
+               goto fail_shared_data;
 
        if (!(features->quirks & WACOM_QUIRK_MONITOR) &&
             (features->quirks & WACOM_QUIRK_BATTERY)) {
index fa0578ecd7a17f8d26164bd3ae405022507ec746..221443710aed60266956b20f2be5d1597ebe9f08 100644 (file)
@@ -581,12 +581,9 @@ static int wacom_intuos_inout(struct wacom_wac *wacom)
           (features->type == CINTIQ && !(data[1] & 0x40)))
                return 1;
 
-       if (wacom->shared) {
-               wacom->shared->stylus_in_proximity = true;
-
-               if (wacom->shared->touch_down)
-                       return 1;
-       }
+       wacom->shared->stylus_in_proximity = true;
+       if (wacom->shared->touch_down)
+               return 1;
 
        /* in Range while exiting */
        if (((data[1] & 0xfe) == 0x20) && wacom->reporting_data) {
@@ -598,8 +595,7 @@ static int wacom_intuos_inout(struct wacom_wac *wacom)
 
        /* Exit report */
        if ((data[1] & 0xfe) == 0x80) {
-               if (features->quirks & WACOM_QUIRK_MULTI_INPUT)
-                       wacom->shared->stylus_in_proximity = false;
+               wacom->shared->stylus_in_proximity = false;
                wacom->reporting_data = false;
 
                /* don't report exit if we don't know the ID */
@@ -2197,12 +2193,6 @@ void wacom_setup_device_quirks(struct wacom_features *features)
                features->y_max = 1023;
        }
 
-       /* these device have multiple inputs */
-       if (features->type >= WIRELESS ||
-           (features->type >= INTUOS5S && features->type <= INTUOSHT) ||
-           (features->oVid && features->oPid))
-               features->quirks |= WACOM_QUIRK_MULTI_INPUT;
-
        /* quirk for bamboo touch with 2 low res touches */
        if (features->type == BAMBOO_PT &&
            features->pktlen == WACOM_PKGLEN_BBTOUCH) {
index 1c7d8931f1fa9ea190847adbaff68dd97b427073..4700ac994a3b37c831b0903a34f62a5895f4b892 100644 (file)
 #define WACOM_REPORT_BPAD_TOUCH                16
 
 /* device quirks */
-#define WACOM_QUIRK_MULTI_INPUT                0x0001
-#define WACOM_QUIRK_BBTOUCH_LOWRES     0x0002
-#define WACOM_QUIRK_NO_INPUT           0x0004
-#define WACOM_QUIRK_MONITOR            0x0008
-#define WACOM_QUIRK_BATTERY            0x0010
+#define WACOM_QUIRK_BBTOUCH_LOWRES     0x0001
+#define WACOM_QUIRK_NO_INPUT           0x0002
+#define WACOM_QUIRK_MONITOR            0x0004
+#define WACOM_QUIRK_BATTERY            0x0008
 
 #define WACOM_PEN_FIELD(f)     (((f)->logical == HID_DG_STYLUS) || \
                                 ((f)->physical == HID_DG_STYLUS) || \