]> git.kernelconcepts.de Git - karo-tx-linux.git/blobdiff - drivers/hid/wacom_wac.c
Merge remote-tracking branch 'device-mapper/for-next'
[karo-tx-linux.git] / drivers / hid / wacom_wac.c
index a0d875c5ed38ead7c9e311c32cd893abe32db990..8b29949507d1692f436b1db5045ca7ed4b8d54f3 100644 (file)
@@ -765,7 +765,7 @@ static void wacom_intuos_general(struct wacom_wac *wacom)
        /* general pen packet */
        if ((data[1] & 0xb8) == 0xa0) {
                t = (data[6] << 2) | ((data[7] >> 6) & 3);
-               if (features->type >= INTUOS4S && features->type <= CINTIQ_HYBRID) {
+               if (features->pressure_max == 2047) {
                        t = (t << 1) | (data[1] & 1);
                }
                input_report_abs(input, ABS_PRESSURE, t);
@@ -951,6 +951,27 @@ static int wacom_intuos_irq(struct wacom_wac *wacom)
                        } else {
                                input_report_abs(input, ABS_MISC, 0);
                        }
+
+               } else if (features->type == CINTIQ_COMPANION_2) {
+                       input_report_key(input, BTN_1, (data[1] & 0x02));
+                       input_report_key(input, BTN_2, (data[2] & 0x01));
+                       input_report_key(input, BTN_3, (data[2] & 0x02));
+                       input_report_key(input, BTN_4, (data[2] & 0x04));
+                       input_report_key(input, BTN_5, (data[2] & 0x08));
+                       input_report_key(input, BTN_6, (data[1] & 0x04));
+
+                       input_report_key(input, BTN_7, (data[2] & 0x10));  /* Right  */
+                       input_report_key(input, BTN_8, (data[2] & 0x20));  /* Up         */
+                       input_report_key(input, BTN_9, (data[2] & 0x40));  /* Left   */
+                       input_report_key(input, BTN_A, (data[2] & 0x80));  /* Down   */
+                       input_report_key(input, BTN_0, (data[1] & 0x01));  /* Center */
+
+                       if (data[2] | (data[1] & 0x07)) {
+                               input_report_abs(input, ABS_MISC, PAD_DEVICE_ID);
+                       } else {
+                               input_report_abs(input, ABS_MISC, 0);
+                       }
+
                } else if (features->type >= INTUOS5S && features->type <= INTUOSPL) {
                        int i;
 
@@ -1631,6 +1652,7 @@ static void wacom_wac_finger_usage_mapping(struct hid_device *hdev,
                wacom_map_usage(input, usage, field, EV_KEY, BTN_TOUCH, 0);
                break;
        case HID_DG_CONTACTCOUNT:
+               wacom_wac->hid_data.cc_report = field->report->id;
                wacom_wac->hid_data.cc_index = field->index;
                wacom_wac->hid_data.cc_value_index = usage->usage_index;
                break;
@@ -1718,7 +1740,32 @@ static void wacom_wac_finger_pre_report(struct hid_device *hdev,
        struct wacom_wac *wacom_wac = &wacom->wacom_wac;
        struct hid_data* hid_data = &wacom_wac->hid_data;
 
-       if (hid_data->cc_index >= 0) {
+       if (hid_data->cc_report != 0 &&
+           hid_data->cc_report != report->id) {
+               int i;
+
+               hid_data->cc_report = report->id;
+               hid_data->cc_index = -1;
+               hid_data->cc_value_index = -1;
+
+               for (i = 0; i < report->maxfield; i++) {
+                       struct hid_field *field = report->field[i];
+                       int j;
+
+                       for (j = 0; j < field->maxusage; j++) {
+                               if (field->usage[j].hid == HID_DG_CONTACTCOUNT) {
+                                       hid_data->cc_index = i;
+                                       hid_data->cc_value_index = j;
+
+                                       /* break */
+                                       i = report->maxfield;
+                                       j = field->maxusage;
+                               }
+                       }
+               }
+       }
+       if (hid_data->cc_report != 0 &&
+           hid_data->cc_index >= 0) {
                struct hid_field *field = report->field[hid_data->cc_index];
                int value = field->value[hid_data->cc_value_index];
                if (value)
@@ -2045,7 +2092,6 @@ static int wacom_bpt_irq(struct wacom_wac *wacom, size_t len)
        struct wacom_features *features = &wacom->features;
 
        if ((features->type == INTUOSHT2) &&
-           (wacom->data[0] == WACOM_REPORT_INTUOS_PEN) &&
            (features->device_type & WACOM_DEVICETYPE_PEN))
                return wacom_intuos_irq(wacom);
        else if (len == WACOM_PKGLEN_BBTOUCH)
@@ -2276,6 +2322,7 @@ void wacom_wac_irq(struct wacom_wac *wacom_wac, size_t len)
        case WACOM_27QHD:
        case DTK:
        case CINTIQ_HYBRID:
+       case CINTIQ_COMPANION_2:
                sync = wacom_intuos_irq(wacom_wac);
                break;
 
@@ -2543,6 +2590,7 @@ int wacom_setup_pen_input_capabilities(struct input_dev *input_dev,
        case CINTIQ:
        case WACOM_13HD:
        case CINTIQ_HYBRID:
+       case CINTIQ_COMPANION_2:
                input_set_abs_params(input_dev, ABS_Z, -900, 899, 0, 0);
                input_abs_set_res(input_dev, ABS_Z, 287);
                __set_bit(INPUT_PROP_DIRECT, input_dev->propbit);
@@ -2783,6 +2831,7 @@ int wacom_setup_pad_input_capabilities(struct input_dev *input_dev,
        switch (features->type) {
 
        case CINTIQ_HYBRID:
+       case CINTIQ_COMPANION_2:
        case DTK:
        case DTUS:
        case GRAPHIRE_BT:
@@ -3356,6 +3405,14 @@ static const struct wacom_features wacom_features_0x318 =
 static const struct wacom_features wacom_features_0x319 =
        { "Wacom Wireless Bamboo PAD", 4095, 4095, /* Touch */
          .type = BAMBOO_PAD, 35, 48, .touch_max = 4 };
+static const struct wacom_features wacom_features_0x325 =
+       { "Wacom ISDv5 325", 59552, 33848, 2047, 63,
+         CINTIQ_COMPANION_2, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES, 11,
+         WACOM_CINTIQ_OFFSET, WACOM_CINTIQ_OFFSET,
+         .oVid = USB_VENDOR_ID_WACOM, .oPid = 0x326 };
+static const struct wacom_features wacom_features_0x326 = /* Touch */
+       { "Wacom ISDv5 326", .type = HID_GENERIC, .oVid = USB_VENDOR_ID_WACOM,
+         .oPid = 0x325 };
 static const struct wacom_features wacom_features_0x323 =
        { "Wacom Intuos P M", 21600, 13500, 1023, 31,
          INTUOSHT, WACOM_INTUOS_RES, WACOM_INTUOS_RES,
@@ -3531,6 +3588,8 @@ const struct hid_device_id wacom_ids[] = {
        { USB_DEVICE_WACOM(0x318) },
        { USB_DEVICE_WACOM(0x319) },
        { USB_DEVICE_WACOM(0x323) },
+       { USB_DEVICE_WACOM(0x325) },
+       { USB_DEVICE_WACOM(0x326) },
        { USB_DEVICE_WACOM(0x32A) },
        { USB_DEVICE_WACOM(0x32B) },
        { USB_DEVICE_WACOM(0x32C) },