Merge tag 'v4.4.2'
[firefly-linux-kernel-4.4.55.git] / drivers / hid / hid-multitouch.c
index 2b8ff18d3713bf21b22878a50a8838e76264d5fa..591d4ad7708ffe045a4b8faf71ec4a2fd3ff0c48 100644 (file)
@@ -445,6 +445,16 @@ static int mt_touch_input_mapping(struct hid_device *hdev, struct hid_input *hi,
        if ((usage->hid & HID_USAGE_PAGE) == HID_UP_BUTTON)
                td->buttons_count++;
 
+       /* Only map fields from TouchScreen or TouchPad collections.
+         * We need to ignore fields that belong to other collections
+         * such as Mouse that might have the same GenericDesktop usages. */
+       if (field->application == HID_DG_TOUCHSCREEN)
+               set_bit(INPUT_PROP_DIRECT, hi->input->propbit);
+       else if (field->application == HID_DG_TOUCHPAD)
+               set_bit(INPUT_PROP_POINTER, hi->input->propbit);
+       else
+               return 0;
+
        if (usage->usage_index)
                prev_usage = &field->usage[usage->usage_index - 1];