Input: wacom - add support for three new ISDv4 sensors
authorJason Gerecke <killertofu@gmail.com>
Thu, 15 May 2014 00:14:29 +0000 (17:14 -0700)
committerDmitry Torokhov <dmitry.torokhov@gmail.com>
Thu, 15 May 2014 01:47:09 +0000 (18:47 -0700)
This patch adds support for the 0x4004, 0x5000, and 0x5002 sensors found
on what should be the Motion R12, Fujitsu Q704, and Fujitsu T904. These
tablets use a new report ID (3) for their touch packets and a slightly
different HID descriptor format, but are otherwise largely identical in
protocol to the "MTTPC" tablets.

Note:
 * The R12 uses its 0x4004 sensor for touch input only. A pen interface
   is not present in its HID descriptor, though its possible a 0x4004
   may be used for pen input by other tablet PCs in the future.

 * The 0x5002 sensor appears to use a new report ID (8) for its pen
   packets. The other sensors continue to use the traditional report
   ID (2).

Signed-off-by: Jason Gerecke <killertofu@gmail.com>
Reviewed-by: Ping Cheng <pingc@wacom.com>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
drivers/input/tablet/wacom_sys.c
drivers/input/tablet/wacom_wac.c
drivers/input/tablet/wacom_wac.h

index 611fc3905d00d9fafa7cf1088b28f6c22fccca28..2c613cd41dd68260b345141489c7c06defd94f89 100644 (file)
@@ -349,6 +349,7 @@ static int wacom_parse_hid(struct usb_interface *intf,
                                                break;
 
                                        case MTTPC:
+                                       case MTTPC_B:
                                                features->pktlen = WACOM_PKGLEN_MTTPC;
                                                break;
 
@@ -380,6 +381,16 @@ static int wacom_parse_hid(struct usb_interface *intf,
                                                i += 12;
                                                break;
 
+                                       case MTTPC_B:
+                                               features->x_max =
+                                                       get_unaligned_le16(&report[i + 3]);
+                                               features->x_phy =
+                                                       get_unaligned_le16(&report[i + 6]);
+                                               features->unit = report[i - 5];
+                                               features->unitExpo = report[i - 3];
+                                               i += 9;
+                                               break;
+
                                        default:
                                                features->x_max =
                                                        get_unaligned_le16(&report[i + 3]);
@@ -430,6 +441,14 @@ static int wacom_parse_hid(struct usb_interface *intf,
                                                i += 12;
                                                break;
 
+                                       case MTTPC_B:
+                                               features->y_max =
+                                                       get_unaligned_le16(&report[i + 3]);
+                                               features->y_phy =
+                                                       get_unaligned_le16(&report[i + 6]);
+                                               i += 9;
+                                               break;
+
                                        default:
                                                features->y_max =
                                                        features->x_max;
index f1430d825e432b87d59417f9df93f5874badb16b..24c0733cf7e5e52f759d4919c618d1a018796c2a 100644 (file)
@@ -962,7 +962,7 @@ static int wacom_mt_touch(struct wacom_wac *wacom)
        int x_offset = 0;
 
        /* MTTPC does not support Height and Width */
-       if (wacom->features.type == MTTPC)
+       if (wacom->features.type == MTTPC || wacom->features.type == MTTPC_B)
                x_offset = -4;
 
        /*
@@ -1114,6 +1114,9 @@ static int wacom_tpc_irq(struct wacom_wac *wacom, size_t len)
        case WACOM_PKGLEN_TPC2FG:
                return wacom_tpc_mt_touch(wacom);
 
+       case WACOM_PKGLEN_PENABLED:
+               return wacom_tpc_pen(wacom);
+
        default:
                switch (data[0]) {
                case WACOM_REPORT_TPC1FG:
@@ -1123,6 +1126,7 @@ static int wacom_tpc_irq(struct wacom_wac *wacom, size_t len)
                        return wacom_tpc_single_touch(wacom, len);
 
                case WACOM_REPORT_TPCMT:
+               case WACOM_REPORT_TPCMT2:
                        return wacom_mt_touch(wacom);
 
                case WACOM_REPORT_PENABLED:
@@ -1465,6 +1469,7 @@ void wacom_wac_irq(struct wacom_wac *wacom_wac, size_t len)
        case TABLETPC2FG:
        case MTSCREEN:
        case MTTPC:
+       case MTTPC_B:
                sync = wacom_tpc_irq(wacom_wac, len);
                break;
 
@@ -1806,6 +1811,7 @@ int wacom_setup_input_capabilities(struct input_dev *input_dev,
 
        case MTSCREEN:
        case MTTPC:
+       case MTTPC_B:
        case TABLETPC2FG:
                if (features->device_type == BTN_TOOL_FINGER) {
                        unsigned int flags = INPUT_MT_DIRECT;
@@ -2243,6 +2249,15 @@ static const struct wacom_features wacom_features_0x116 =
 static const struct wacom_features wacom_features_0x4001 =
        { "Wacom ISDv4 4001",      WACOM_PKGLEN_MTTPC,     26202, 16325,  255,
          0, MTTPC, WACOM_INTUOS_RES, WACOM_INTUOS_RES };
+static const struct wacom_features wacom_features_0x4004 =
+       { "Wacom ISDv4 4004",      WACOM_PKGLEN_MTTPC,     11060, 6220,  255,
+         0, MTTPC_B, WACOM_INTUOS_RES, WACOM_INTUOS_RES };
+static const struct wacom_features wacom_features_0x5000 =
+       { "Wacom ISDv4 5000",      WACOM_PKGLEN_MTTPC,     27848, 15752,  1023,
+         0, MTTPC_B, WACOM_INTUOS_RES, WACOM_INTUOS_RES };
+static const struct wacom_features wacom_features_0x5002 =
+       { "Wacom ISDv4 5002",      WACOM_PKGLEN_MTTPC,     29576, 16724,  1023,
+         0, MTTPC_B, WACOM_INTUOS_RES, WACOM_INTUOS_RES };
 static const struct wacom_features wacom_features_0x47 =
        { "Wacom Intuos2 6x8",    WACOM_PKGLEN_INTUOS,    20320, 16240, 1023,
          31, INTUOS, WACOM_INTUOS_RES, WACOM_INTUOS_RES };
@@ -2465,6 +2480,9 @@ const struct usb_device_id wacom_ids[] = {
        { USB_DEVICE_DETAILED(0x315, USB_CLASS_HID, 0, 0) },
        { USB_DEVICE_DETAILED(0x317, USB_CLASS_HID, 0, 0) },
        { USB_DEVICE_WACOM(0x4001) },
+       { USB_DEVICE_WACOM(0x4004) },
+       { USB_DEVICE_WACOM(0x5000) },
+       { USB_DEVICE_WACOM(0x5002) },
        { USB_DEVICE_WACOM(0x47) },
        { USB_DEVICE_WACOM(0xF4) },
        { USB_DEVICE_WACOM(0xF8) },
index a066dc00989fa24eb32baf192adde67310554a68..29774cae7da1f9de00aa8335fc495e95485d6b53 100644 (file)
@@ -31,6 +31,7 @@
 #define WACOM_PKGLEN_MTOUCH    62
 #define WACOM_PKGLEN_MTTPC     40
 #define WACOM_PKGLEN_DTUS      68
+#define WACOM_PKGLEN_PENABLED   8
 
 /* wacom data size per MT contact */
 #define WACOM_BYTES_PER_MT_PACKET      11
@@ -53,6 +54,7 @@
 #define WACOM_REPORT_TPC1FG            6
 #define WACOM_REPORT_TPC2FG            13
 #define WACOM_REPORT_TPCMT             13
+#define WACOM_REPORT_TPCMT2            3
 #define WACOM_REPORT_TPCHID            15
 #define WACOM_REPORT_TPCST             16
 #define WACOM_REPORT_DTUS              17
@@ -106,6 +108,7 @@ enum {
        TABLETPC2FG,
        MTSCREEN,
        MTTPC,
+       MTTPC_B,
        MAX_TYPE
 };