]> 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 7b3784826cce920f3d3e1697f9302f12bb028b38..8b29949507d1692f436b1db5045ca7ed4b8d54f3 100644 (file)
@@ -966,7 +966,7 @@ static int wacom_intuos_irq(struct wacom_wac *wacom)
                        input_report_key(input, BTN_A, (data[2] & 0x80));  /* Down   */
                        input_report_key(input, BTN_0, (data[1] & 0x01));  /* Center */
 
-                       if (data[4] | (data[3] & 0x01)) {
+                       if (data[2] | (data[1] & 0x07)) {
                                input_report_abs(input, ABS_MISC, PAD_DEVICE_ID);
                        } else {
                                input_report_abs(input, ABS_MISC, 0);
@@ -1652,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;
@@ -1739,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)
@@ -2066,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)