Based on upstream commit 180623f1e7b5ca681f0c18405b503cf3afe53061

Touch support for kernels < 2.6.38 is not provided due to a lack
of proper MT protocol support. If/when we get this, touch can be
added fairly trivially.

Signed-off-by: Jason Gerecke <killert...@gmail.com>
---
 2.6.30/wacom_sys.c |   12 +++++++++-
 2.6.30/wacom_wac.h |    1 +
 2.6.36/wacom_sys.c |   10 +++++++++
 2.6.36/wacom_wac.c |    3 ++-
 2.6.36/wacom_wac.h |    1 +
 2.6.38/wacom_sys.c |   24 ++++++++++++++++++++
 2.6.38/wacom_wac.c |   63 +++++++++++++++++++++++++++++++++++++++++++++++-----
 7 files changed, 107 insertions(+), 7 deletions(-)

diff --git a/2.6.30/wacom_sys.c b/2.6.30/wacom_sys.c
index b61c200..4740d27 100755
--- a/2.6.30/wacom_sys.c
+++ b/2.6.30/wacom_sys.c
@@ -737,10 +737,20 @@ static int wacom_probe(struct usb_interface *intf, const 
struct usb_device_id *i
        if (error)
                goto fail2;
 
+       /* Ignore Intuos5 touch interface until BPT3 touch support backported */
+       if (features->type >= INTUOS5S && features->type <= INTUOS5L) {
+               if (endpoint->wMaxPacketSize == WACOM_PKGLEN_BBTOUCH3) {
+                       error = -ENODEV;
+                       goto fail2;
+               } else {
+                       features->device_type = BTN_TOOL_PEN;
+               }
+       }
+
        strlcpy(wacom_wac->name, features->name, sizeof(wacom_wac->name));
 
        if (features->type == TABLETPC || features->type == TABLETPC2FG ||
-                        features->type == BAMBOO_PT) {
+           features->type == BAMBOO_PT || (features->type >= INTUOS5S && 
features->type <= INTUOS5L)) {
                /* Append the device type to the name */
                strlcat(wacom_wac->name,
                        features->device_type == BTN_TOOL_PEN ?
diff --git a/2.6.30/wacom_wac.h b/2.6.30/wacom_wac.h
index 0d6c659..8427600 100755
--- a/2.6.30/wacom_wac.h
+++ b/2.6.30/wacom_wac.h
@@ -22,6 +22,7 @@
 #define WACOM_PKGLEN_TPC1FG     5
 #define WACOM_PKGLEN_TPC2FG    14
 #define WACOM_PKGLEN_BBTOUCH   20
+#define WACOM_PKGLEN_BBTOUCH3   64
 
 /* device IDs */
 #define STYLUS_DEVICE_ID       0x02
diff --git a/2.6.36/wacom_sys.c b/2.6.36/wacom_sys.c
index affcf94..23baa4b 100644
--- a/2.6.36/wacom_sys.c
+++ b/2.6.36/wacom_sys.c
@@ -860,6 +860,16 @@ static int wacom_probe(struct usb_interface *intf, const 
struct usb_device_id *i
        if (error)
                goto fail3;
 
+       /* Ignore Intuos5 touch interface until BPT3 touch support backported */
+       if (features->type >= INTUOS5S && features->type <= INTUOS5L) {
+               if (endpoint->wMaxPacketSize == WACOM_PKGLEN_BBTOUCH3) {
+                       error = -ENODEV;
+                       goto fail2;
+               } else {
+                       features->device_type = BTN_TOOL_PEN;
+               }
+       }
+
        wacom_setup_device_quirks(features);
 
        strlcpy(wacom_wac->name, features->name, sizeof(wacom_wac->name));
diff --git a/2.6.36/wacom_wac.c b/2.6.36/wacom_wac.c
index ae090e5..4fa3add 100644
--- a/2.6.36/wacom_wac.c
+++ b/2.6.36/wacom_wac.c
@@ -1209,7 +1209,8 @@ void wacom_setup_device_quirks(struct wacom_features 
*features)
 
        /* these device have multiple inputs */
        if (features->type == TABLETPC || features->type == TABLETPC2FG ||
-           features->type == BAMBOO_PT || features->type == MTSCREEN)
+           features->type == BAMBOO_PT || features->type == MTSCREEN ||
+           (features->type >= INTUOS5S && features->type <= INTUOS5L))
                features->quirks |= WACOM_QUIRK_MULTI_INPUT;
 
        /* quirks for bamboo touch */
diff --git a/2.6.36/wacom_wac.h b/2.6.36/wacom_wac.h
index f8d9acb..a10b26e 100644
--- a/2.6.36/wacom_wac.h
+++ b/2.6.36/wacom_wac.h
@@ -23,6 +23,7 @@
 #define WACOM_PKGLEN_TPC2FG    14
 #define WACOM_PKGLEN_BBTOUCH   20
 #define WACOM_PKGLEN_MTOUCH    62
+#define WACOM_PKGLEN_BBTOUCH3   64
 
 /* device IDs */
 #define STYLUS_DEVICE_ID       0x02
diff --git a/2.6.38/wacom_sys.c b/2.6.38/wacom_sys.c
index d987a9a..c76cfbb 100644
--- a/2.6.38/wacom_sys.c
+++ b/2.6.38/wacom_sys.c
@@ -228,6 +228,9 @@ static int wacom_parse_logical_collection(unsigned char 
*report,
  * 3rd gen Bamboo Touch no longer define a Digitizer-Finger Pysical
  * Collection. Instead they define a Logical Collection with a single
  * Logical Maximum for both X and Y.
+ *
+ * Intuos5 touch interface does not contain useful data. We deal with
+ * this after returning from this function.
  */
 static int wacom_parse_hid(struct usb_interface *intf,
                           struct hid_descriptor *hid_desc,
@@ -928,6 +931,27 @@ static int wacom_probe(struct usb_interface *intf, const 
struct usb_device_id *i
        if (error)
                goto fail3;
 
+       /* Intuos5 has no useful data about its touch interface in its
+        * HID descriptor. If this is the touch interface (wMaxPacketSize
+        * of WACOM_PKGLEN_BBTOUCH3), override the table values.
+        */
+       if (features->type >= INTUOS5S && features->type <= INTUOS5L) {
+               if (endpoint->wMaxPacketSize == WACOM_PKGLEN_BBTOUCH3) {
+                       features->device_type = BTN_TOOL_FINGER;
+                       features->pktlen = WACOM_PKGLEN_BBTOUCH3;
+
+                       features->x_phy =
+                               (features->x_max * 100) / 
features->x_resolution;
+                       features->y_phy =
+                               (features->y_max * 100) / 
features->y_resolution;
+
+                       features->x_max = 4096;
+                       features->y_max = 4096;
+               } else {
+                       features->device_type = BTN_TOOL_PEN;
+               }
+       }
+
        wacom_setup_device_quirks(features);
 
        strlcpy(wacom_wac->name, features->name, sizeof(wacom_wac->name));
diff --git a/2.6.38/wacom_wac.c b/2.6.38/wacom_wac.c
index 900080c..9b6c2d3 100644
--- a/2.6.38/wacom_wac.c
+++ b/2.6.38/wacom_wac.c
@@ -321,6 +321,9 @@ static int wacom_intuos_inout(struct wacom_wac *wacom)
 
        /* Enter report */
        if ((data[1] & 0xfc) == 0xc0) {
+               if (features->type >= INTUOS5S && features->type <= INTUOS5L)
+                       wacom->shared->stylus_in_proximity = true;
+
                /* serial number of the tool */
                wacom->serial[idx] = ((data[3] & 0x0f) << 28) +
                        (data[4] << 20) + (data[5] << 12) +
@@ -406,6 +409,9 @@ static int wacom_intuos_inout(struct wacom_wac *wacom)
 
        /* Exit report */
        if ((data[1] & 0xfe) == 0x80) {
+               if (features->type >= INTUOS5S && features->type <= INTUOS5L)
+                       wacom->shared->stylus_in_proximity = false;
+
                /*
                 * Reset all states otherwise we lose the initial states
                 * when in-prox next time
@@ -1099,9 +1105,6 @@ void wacom_wac_irq(struct wacom_wac *wacom_wac, size_t 
len)
        case INTUOS4S:
        case INTUOS4:
        case INTUOS4L:
-       case INTUOS5S:
-       case INTUOS5:
-       case INTUOS5L:
        case CINTIQ:
        case WACOM_BEE:
        case WACOM_21UX2:
@@ -1109,6 +1112,15 @@ void wacom_wac_irq(struct wacom_wac *wacom_wac, size_t 
len)
                sync = wacom_intuos_irq(wacom_wac);
                break;
 
+       case INTUOS5S:
+       case INTUOS5:
+       case INTUOS5L:
+               if (len == WACOM_PKGLEN_BBTOUCH3)
+                       sync = wacom_bpt3_touch(wacom_wac);
+               else
+                       sync = wacom_intuos_irq(wacom_wac);
+               break;
+
        case TABLETPC:
        case TABLETPC2FG:
                sync = wacom_tpc_irq(wacom_wac, len);
@@ -1179,7 +1191,7 @@ void wacom_setup_device_quirks(struct wacom_features 
*features)
 
        /* these device have multiple inputs */
        if (features->type == TABLETPC || features->type == TABLETPC2FG ||
-           features->type == BAMBOO_PT)
+           features->type == BAMBOO_PT || (features->type >= INTUOS5S && 
features->type <= INTUOS5L))
                features->quirks |= WACOM_QUIRK_MULTI_INPUT;
 
        /* quirk for bamboo touch with 2 low res touches */
@@ -1338,13 +1350,54 @@ void wacom_setup_input_capabilities(struct input_dev 
*input_dev,
 
        case INTUOS5:
        case INTUOS5L:
+               if (features->device_type == BTN_TOOL_PEN) {
+                       __set_bit(BTN_7, input_dev->keybit);
+                       __set_bit(BTN_8, input_dev->keybit);
+               }
+               /* fall through */
+
+       case INTUOS5S:
+               __set_bit(INPUT_PROP_POINTER, input_dev->propbit);
+
+               if (features->device_type == BTN_TOOL_PEN) {
+                       for (i = 0; i < 7; i++)
+                               __set_bit(BTN_0 + i, input_dev->keybit);
+
+                       input_set_abs_params(input_dev, ABS_DISTANCE, 0,
+                                             features->distance_max,
+                                             0, 0);
+
+                       input_set_abs_params(input_dev, ABS_Z, -900, 899, 0, 0);
+
+                       wacom_setup_intuos(wacom_wac);
+               } else if (features->device_type == BTN_TOOL_FINGER) {
+                       __clear_bit(ABS_MISC, input_dev->absbit);
+
+                       __set_bit(BTN_TOOL_FINGER, input_dev->keybit);
+                       __set_bit(BTN_TOOL_DOUBLETAP, input_dev->keybit);
+                       __set_bit(BTN_TOOL_TRIPLETAP, input_dev->keybit);
+                       __set_bit(BTN_TOOL_QUADTAP, input_dev->keybit);
+
+                       input_mt_init_slots(input_dev, 16);
+
+                       input_set_abs_params(input_dev, ABS_MT_TOUCH_MAJOR,
+                                            0, 255, 0, 0);
+
+                       input_set_abs_params(input_dev, ABS_MT_POSITION_X,
+                                            0, features->x_max,
+                                            features->x_fuzz, 0);
+                       input_set_abs_params(input_dev, ABS_MT_POSITION_Y,
+                                            0, features->y_max,
+                                            features->y_fuzz, 0);
+               }
+               break;
+
        case INTUOS4:
        case INTUOS4L:
                __set_bit(BTN_7, input_dev->keybit);
                __set_bit(BTN_8, input_dev->keybit);
                /* fall through */
 
-       case INTUOS5S:
        case INTUOS4S:
                for (i = 0; i < 7; i++)
                        __set_bit(BTN_0 + i, input_dev->keybit);
-- 
1.7.9.5


------------------------------------------------------------------------------
Better than sec? Nothing is better than sec when it comes to
monitoring Big Data applications. Try Boundary one-second 
resolution app monitoring today. Free.
http://p.sf.net/sfu/Boundary-dev2dev
_______________________________________________
Linuxwacom-devel mailing list
Linuxwacom-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linuxwacom-devel

Reply via email to