From: Ping Cheng <pingli...@gmail.com>

Bamboo models do not support HID_DG_CONTACTMAX. Plus, Bamboo pen-only
has touch descriptor. This leads to some complications in the code.

This patch also fixes duplicated PAD interfeaces for Intuos Pen
models.

Signed-off-by: Ping Cheng <pi...@wacom.com>
Reviewed-by:  Benjamin Tissoires <benjamin.tissoi...@redhat.com>
Signed-off-by: Jiri Kosina <jkos...@suse.cz>
---
 3.17/wacom.h     |  2 +-
 3.17/wacom_sys.c | 25 +++++++++++++++----------
 3.17/wacom_wac.c |  9 +++++++--
 3 files changed, 23 insertions(+), 13 deletions(-)

diff --git a/3.17/wacom.h b/3.17/wacom.h
index 5adde6c..1539c68 100644
--- a/3.17/wacom.h
+++ b/3.17/wacom.h
@@ -141,7 +141,7 @@ extern const struct hid_device_id wacom_ids[];
 
 void wacom_wac_irq(struct wacom_wac *wacom_wac, size_t len);
 void wacom_setup_device_quirks(struct wacom_features *features);
-int wacom_setup_input_capabilities(struct input_dev *input_dev,
+int wacom_setup_pentouch_input_capabilities(struct input_dev *input_dev,
                                   struct wacom_wac *wacom_wac);
 int wacom_setup_pad_input_capabilities(struct input_dev *input_dev,
                                       struct wacom_wac *wacom_wac);
diff --git a/3.17/wacom_sys.c b/3.17/wacom_sys.c
index 8ff5875..398159d 100644
--- a/3.17/wacom_sys.c
+++ b/3.17/wacom_sys.c
@@ -192,9 +192,15 @@ static void wacom_usage_mapping(struct hid_device *hdev,
        if (!pen && !finger)
                return;
 
-       if (finger && !features->touch_max)
-               /* touch device at least supports one touch point */
-               features->touch_max = 1;
+       /*
+        * Bamboo models do not support HID_DG_CONTACTMAX.
+        * And, Bamboo Pen only descriptor contains touch.
+        */
+       if (features->type != BAMBOO_PT) {
+               /* ISDv4 touch devices at least supports one touch point */
+               if (finger && !features->touch_max)
+                       features->touch_max = 1;
+       }
 
        switch (usage->hid) {
        case HID_GD_X:
@@ -1151,13 +1157,12 @@ static int wacom_register_inputs(struct wacom *wacom)
        if (!input_dev || !pad_input_dev)
                return -EINVAL;
 
-       error = wacom_setup_input_capabilities(input_dev, wacom_wac);
-       if (error)
-               return error;
-
-       error = input_register_device(input_dev);
-       if (error)
-               return error;
+       error = wacom_setup_pentouch_input_capabilities(input_dev, wacom_wac);
+       if (!error) {
+               error = input_register_device(input_dev);
+               if (error)
+                       return error;
+       }
 
        error = wacom_setup_pad_input_capabilities(pad_input_dev, wacom_wac);
        if (error) {
diff --git a/3.17/wacom_wac.c b/3.17/wacom_wac.c
index 51c7353..caf035f 100644
--- a/3.17/wacom_wac.c
+++ b/3.17/wacom_wac.c
@@ -2032,7 +2032,7 @@ static void wacom_abs_set_axis(struct input_dev 
*input_dev,
        }
 }
 
-int wacom_setup_input_capabilities(struct input_dev *input_dev,
+int wacom_setup_pentouch_input_capabilities(struct input_dev *input_dev,
                                   struct wacom_wac *wacom_wac)
 {
        struct wacom_features *features = &wacom_wac->features;
@@ -2246,6 +2246,9 @@ int wacom_setup_input_capabilities(struct input_dev 
*input_dev,
                                __clear_bit(ABS_X, input_dev->absbit);
                                __clear_bit(ABS_Y, input_dev->absbit);
                                __clear_bit(BTN_TOUCH, input_dev->keybit);
+
+                               /* PAD is setup by 
wacom_setup_pad_input_capabilities later */
+                               return 1;
                        }
                } else if (features->device_type == BTN_TOOL_PEN) {
                        __set_bit(INPUT_PROP_POINTER, input_dev->propbit);
@@ -2444,7 +2447,9 @@ int wacom_setup_pad_input_capabilities(struct input_dev 
*input_dev,
        case INTUOSHT:
        case BAMBOO_PT:
                /* pad device is on the touch interface */
-               if (features->device_type != BTN_TOOL_FINGER)
+               if ((features->device_type != BTN_TOOL_FINGER) ||
+                   /* Bamboo Pen only tablet does not have pad */
+                   ((features->type == BAMBOO_PT) && !features->touch_max))
                        return -ENODEV;
 
                __clear_bit(ABS_MISC, input_dev->absbit);
-- 
2.1.3


------------------------------------------------------------------------------
Dive into the World of Parallel Programming! The Go Parallel Website,
sponsored by Intel and developed in partnership with Slashdot Media, is your
hub for all things parallel software development, from weekly thought
leadership blogs to news, videos, case studies, tutorials and more. Take a
look and join the conversation now. http://goparallel.sourceforge.net
_______________________________________________
Linuxwacom-devel mailing list
Linuxwacom-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linuxwacom-devel

Reply via email to