]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/blobdiff - drivers/hid/hid-multitouch.c
HID: core: move Usage Page concatenation to Main item
[mirror_ubuntu-bionic-kernel.git] / drivers / hid / hid-multitouch.c
index 65ea23be9677b6dbd0b539ee2cc7ca1abd58958a..15687b45b33c8788a7dc4b079f7ca7c9a69138c6 100644 (file)
@@ -365,7 +365,8 @@ static const struct attribute_group mt_attribute_group = {
 static void mt_get_feature(struct hid_device *hdev, struct hid_report *report)
 {
        struct mt_device *td = hid_get_drvdata(hdev);
-       int ret, size = hid_report_len(report);
+       int ret;
+       u32 size = hid_report_len(report);
        u8 *buf;
 
        /*
@@ -778,9 +779,11 @@ static int mt_touch_event(struct hid_device *hid, struct hid_field *field,
 }
 
 static void mt_process_mt_event(struct hid_device *hid, struct hid_field *field,
-                               struct hid_usage *usage, __s32 value)
+                               struct hid_usage *usage, __s32 value,
+                               bool first_packet)
 {
        struct mt_device *td = hid_get_drvdata(hid);
+       __s32 cls = td->mtclass.name;
        __s32 quirks = td->mtclass.quirks;
        struct input_dev *input = field->hidinput->input;
 
@@ -837,6 +840,15 @@ static void mt_process_mt_event(struct hid_device *hid, struct hid_field *field,
                        break;
 
                default:
+                       /*
+                        * For Win8 PTP touchpads we should only look at
+                        * non finger/touch events in the first_packet of
+                        * a (possible) multi-packet frame.
+                        */
+                       if ((cls == MT_CLS_WIN_8 || cls == MT_CLS_WIN_8_DUAL) &&
+                           !first_packet)
+                               return;
+
                        if (usage->type)
                                input_event(input, usage->type, usage->code,
                                                value);
@@ -856,6 +868,7 @@ static void mt_touch_report(struct hid_device *hid, struct hid_report *report)
 {
        struct mt_device *td = hid_get_drvdata(hid);
        struct hid_field *field;
+       bool first_packet;
        unsigned count;
        int r, n;
 
@@ -874,6 +887,7 @@ static void mt_touch_report(struct hid_device *hid, struct hid_report *report)
                        td->num_expected = value;
        }
 
+       first_packet = td->num_received == 0;
        for (r = 0; r < report->maxfield; r++) {
                field = report->field[r];
                count = field->report_count;
@@ -883,7 +897,7 @@ static void mt_touch_report(struct hid_device *hid, struct hid_report *report)
 
                for (n = 0; n < count; n++)
                        mt_process_mt_event(hid, field, &field->usage[n],
-                                       field->value[n]);
+                                           field->value[n], first_packet);
        }
 
        if (td->num_received >= td->num_expected)
@@ -1079,7 +1093,7 @@ static void mt_set_input_mode(struct hid_device *hdev)
        struct hid_report_enum *re;
        struct mt_class *cls = &td->mtclass;
        char *buf;
-       int report_len;
+       u32 report_len;
 
        if (td->inputmode < 0)
                return;
@@ -1463,6 +1477,10 @@ static const struct hid_device_id mt_devices[] = {
                HID_DEVICE(BUS_I2C, HID_GROUP_MULTITOUCH_WIN_8,
                        USB_VENDOR_ID_ALPS_JP,
                        HID_DEVICE_ID_ALPS_U1_DUAL_3BTN_PTP) },
+       { .driver_data = MT_CLS_WIN_8_DUAL,
+               HID_DEVICE(BUS_I2C, HID_GROUP_MULTITOUCH_WIN_8,
+                       USB_VENDOR_ID_ALPS_JP,
+                       HID_DEVICE_ID_ALPS_1222) },
 
        /* Lenovo X1 TAB Gen 2 */
        { .driver_data = MT_CLS_WIN_8_DUAL,
@@ -1504,6 +1522,12 @@ static const struct hid_device_id mt_devices[] = {
                MT_USB_DEVICE(USB_VENDOR_ID_CHUNGHWAT,
                        USB_DEVICE_ID_CHUNGHWAT_MULTITOUCH) },
 
+       /* Cirque devices */
+       { .driver_data = MT_CLS_WIN_8_DUAL,
+               HID_DEVICE(BUS_I2C, HID_GROUP_MULTITOUCH_WIN_8,
+                       I2C_VENDOR_ID_CIRQUE,
+                       I2C_PRODUCT_ID_CIRQUE_121F) },
+
        /* CJTouch panels */
        { .driver_data = MT_CLS_NSMU,
                MT_USB_DEVICE(USB_VENDOR_ID_CJTOUCH,