]> Pileus Git - ~andy/linux/blobdiff - drivers/input/tablet/wacom_wac.c
Merge tag 'v3.13-rc4' into next
[~andy/linux] / drivers / input / tablet / wacom_wac.c
index 782c2535f1d81a26db96716ac406405b2b03a78b..7655088f78e0efc4bab45fa62cfc442230b460c1 100644 (file)
@@ -1151,8 +1151,8 @@ static void wacom_bpt3_touch_msg(struct wacom_wac *wacom, unsigned char *data)
                int width, height;
 
                if (features->type >= INTUOSPS && features->type <= INTUOSPL) {
-                       width  = data[5];
-                       height = data[6];
+                       width  = data[5] * 100;
+                       height = data[6] * 100;
                } else {
                        /*
                         * "a" is a scaled-down area which we assume is
@@ -1176,10 +1176,16 @@ static void wacom_bpt3_touch_msg(struct wacom_wac *wacom, unsigned char *data)
 static void wacom_bpt3_button_msg(struct wacom_wac *wacom, unsigned char *data)
 {
        struct input_dev *input = wacom->input;
+       struct wacom_features *features = &wacom->features;
 
-       input_report_key(input, BTN_LEFT, (data[1] & 0x08) != 0);
+       if (features->type == INTUOSHT) {
+               input_report_key(input, BTN_LEFT, (data[1] & 0x02) != 0);
+               input_report_key(input, BTN_BACK, (data[1] & 0x08) != 0);
+       } else {
+               input_report_key(input, BTN_BACK, (data[1] & 0x02) != 0);
+               input_report_key(input, BTN_LEFT, (data[1] & 0x08) != 0);
+       }
        input_report_key(input, BTN_FORWARD, (data[1] & 0x04) != 0);
-       input_report_key(input, BTN_BACK, (data[1] & 0x02) != 0);
        input_report_key(input, BTN_RIGHT, (data[1] & 0x01) != 0);
 }
 
@@ -1217,7 +1223,7 @@ static int wacom_bpt_pen(struct wacom_wac *wacom)
        unsigned char *data = wacom->data;
        int prox = 0, x = 0, y = 0, p = 0, d = 0, pen = 0, btn1 = 0, btn2 = 0;
 
-       if (data[0] != 0x02)
+       if (data[0] != WACOM_REPORT_PENABLED)
            return 0;
 
        prox = (data[1] & 0x20) == 0x20;
@@ -1297,7 +1303,7 @@ static int wacom_wireless_irq(struct wacom_wac *wacom, size_t len)
        unsigned char *data = wacom->data;
        int connected;
 
-       if (len != WACOM_PKGLEN_WIRELESS || data[0] != 0x80)
+       if (len != WACOM_PKGLEN_WIRELESS || data[0] != WACOM_REPORT_WL)
                return 0;
 
        connected = data[1] & 0x01;
@@ -1391,6 +1397,7 @@ void wacom_wac_irq(struct wacom_wac *wacom_wac, size_t len)
                break;
 
        case BAMBOO_PT:
+       case INTUOSHT:
                sync = wacom_bpt_irq(wacom_wac, len);
                break;
 
@@ -1459,7 +1466,7 @@ void wacom_setup_device_quirks(struct wacom_features *features)
 
        /* these device have multiple inputs */
        if (features->type >= WIRELESS ||
-           (features->type >= INTUOS5S && features->type <= INTUOSPL) ||
+           (features->type >= INTUOS5S && features->type <= INTUOSHT) ||
            (features->oVid && features->oPid))
                features->quirks |= WACOM_QUIRK_MULTI_INPUT;
 
@@ -1771,33 +1778,43 @@ int wacom_setup_input_capabilities(struct input_dev *input_dev,
                __set_bit(INPUT_PROP_POINTER, input_dev->propbit);
                break;
 
+       case INTUOSHT:
        case BAMBOO_PT:
                __clear_bit(ABS_MISC, input_dev->absbit);
 
-               __set_bit(INPUT_PROP_POINTER, input_dev->propbit);
-
                if (features->device_type == BTN_TOOL_FINGER) {
-                       unsigned int flags = INPUT_MT_POINTER;
 
                        __set_bit(BTN_LEFT, input_dev->keybit);
                        __set_bit(BTN_FORWARD, input_dev->keybit);
                        __set_bit(BTN_BACK, input_dev->keybit);
                        __set_bit(BTN_RIGHT, input_dev->keybit);
 
-                       if (features->pktlen == WACOM_PKGLEN_BBTOUCH3) {
-                               input_set_abs_params(input_dev,
+                       if (features->touch_max) {
+                               /* touch interface */
+                               unsigned int flags = INPUT_MT_POINTER;
+
+                               __set_bit(INPUT_PROP_POINTER, input_dev->propbit);
+                               if (features->pktlen == WACOM_PKGLEN_BBTOUCH3) {
+                                       input_set_abs_params(input_dev,
                                                     ABS_MT_TOUCH_MAJOR,
                                                     0, features->x_max, 0, 0);
-                               input_set_abs_params(input_dev,
+                                       input_set_abs_params(input_dev,
                                                     ABS_MT_TOUCH_MINOR,
                                                     0, features->y_max, 0, 0);
+                               } else {
+                                       __set_bit(BTN_TOOL_FINGER, input_dev->keybit);
+                                       __set_bit(BTN_TOOL_DOUBLETAP, input_dev->keybit);
+                                       flags = 0;
+                               }
+                               input_mt_init_slots(input_dev, features->touch_max, flags);
                        } else {
-                               __set_bit(BTN_TOOL_FINGER, input_dev->keybit);
-                               __set_bit(BTN_TOOL_DOUBLETAP, input_dev->keybit);
-                               flags = 0;
+                               /* buttons/keys only interface */
+                               __clear_bit(ABS_X, input_dev->absbit);
+                               __clear_bit(ABS_Y, input_dev->absbit);
+                               __clear_bit(BTN_TOUCH, input_dev->keybit);
                        }
-                       input_mt_init_slots(input_dev, features->touch_max, flags);
                } else if (features->device_type == BTN_TOOL_PEN) {
+                       __set_bit(INPUT_PROP_POINTER, input_dev->propbit);
                        __set_bit(BTN_TOOL_RUBBER, input_dev->keybit);
                        __set_bit(BTN_TOOL_PEN, input_dev->keybit);
                        __set_bit(BTN_STYLUS, input_dev->keybit);
@@ -2200,6 +2217,17 @@ static const struct wacom_features wacom_features_0x300 =
 static const struct wacom_features wacom_features_0x301 =
        { "Wacom Bamboo One M",    WACOM_PKGLEN_BBPEN,    21648, 13530, 1023,
          31, BAMBOO_PT, WACOM_INTUOS_RES, WACOM_INTUOS_RES };
+static const struct wacom_features wacom_features_0x302 =
+       { "Wacom Intuos PT S",     WACOM_PKGLEN_BBPEN,    15200,  9500, 1023,
+         31, INTUOSHT, WACOM_INTUOS_RES, WACOM_INTUOS_RES,
+         .touch_max = 16 };
+static const struct wacom_features wacom_features_0x303 =
+       { "Wacom Intuos PT M",     WACOM_PKGLEN_BBPEN,    21600, 13500, 1023,
+         31, INTUOSHT, WACOM_INTUOS_RES, WACOM_INTUOS_RES,
+         .touch_max = 16 };
+static const struct wacom_features wacom_features_0x30E =
+       { "Wacom Intuos S",        WACOM_PKGLEN_BBPEN,    15200,  9500, 1023,
+         31, INTUOSHT, WACOM_INTUOS_RES, WACOM_INTUOS_RES };
 static const struct wacom_features wacom_features_0x6004 =
        { "ISD-V4",               WACOM_PKGLEN_GRAPHIRE,  12800,  8000,  255,
          0, TABLETPC, WACOM_INTUOS_RES, WACOM_INTUOS_RES };
@@ -2337,6 +2365,9 @@ const struct usb_device_id wacom_ids[] = {
        { USB_DEVICE_WACOM(0x10F) },
        { USB_DEVICE_WACOM(0x300) },
        { USB_DEVICE_WACOM(0x301) },
+       { USB_DEVICE_DETAILED(0x302, USB_CLASS_HID, 0, 0) },
+       { USB_DEVICE_DETAILED(0x303, USB_CLASS_HID, 0, 0) },
+       { USB_DEVICE_DETAILED(0x30E, USB_CLASS_HID, 0, 0) },
        { USB_DEVICE_WACOM(0x304) },
        { USB_DEVICE_DETAILED(0x314, USB_CLASS_HID, 0, 0) },
        { USB_DEVICE_DETAILED(0x315, USB_CLASS_HID, 0, 0) },