Received: by 2002:a05:6a10:2785:0:0:0:0 with SMTP id ia5csp690865pxb; Thu, 14 Jan 2021 16:39:59 -0800 (PST) X-Google-Smtp-Source: ABdhPJxqWT5Mgs0CukzHvelNk/G454TyyPz2M/upzgKMzVNJH8SXsYWS5Ypi5JOorSe0Pe/fl3k/ X-Received: by 2002:a17:906:1b41:: with SMTP id p1mr4007826ejg.162.1610671199204; Thu, 14 Jan 2021 16:39:59 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1610671199; cv=none; d=google.com; s=arc-20160816; b=gQBFUsqAxdH6xpur37QF0jO34UlLw/bhneDn047yMqBywaRXDXU1RVH6+yYsidijH2 KPzONyTLIYlBJU+eGCALd9qm37xS5ZT2Fk4MY6G0/n5+RBSREEnnP3QkGUidvlBngdno cUWuu7HJbufaa9boDNMs0cD68LyKegPTY1iW0prQ0QQrbyFrPeVzBPFyBbXUmAp3sGLt mzZEr+stxNdasjONM+qmOJwvgMLvG2AXnte6R5B1+ms2alZCAXpiMgYpet9t48jAIVfE WJyqrs+pKAsJDzuuPHFGobX+TOuq8tlJRtSbTHsbgjedxKDFbtt1TDZMlgLU93N8RfAG YAYg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=vjQz/FTdcUA4ikts1emzODkjkcrbE4dUUeRlgxezK8s=; b=hFhZsidtJwA9oyycctRrvSoS17C8DOXRz05wGHQB1VGJNfOFYIpJFU6OxtGP2WfRRn lRR2UD+akV0/jO0gm5GwyI9BpfgHxBoiB1G8l4tp5quOZ5lgkfcA0SargXu5AswfxpV5 SRJ3OACgxACgZ238lr/ctQaNNNHm0DD2erHmmU6fUd1rBclFR4bsymCUwlMbjFNF3Fwx j65GRqF7yF/2JKxy1ZXP4CkDdoYJcUYC0iE4vw2DTQF8DuQ4rTSD+jrEjmuwQK9q7Iln kO+Kw9c0DvBXuK5Ht9TQDszXDOgnF3u2eZnqeG1Es+Fw0yjvSN2jPcWW27YG7wf7Iktp A17A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@opensynergy.com header.s=srmailgate02 header.b=qW2W7tpA; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=opensynergy.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id du21si2814511ejc.238.2021.01.14.16.39.34; Thu, 14 Jan 2021 16:39:59 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@opensynergy.com header.s=srmailgate02 header.b=qW2W7tpA; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=opensynergy.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731294AbhAOAgC (ORCPT + 99 others); Thu, 14 Jan 2021 19:36:02 -0500 Received: from mx1.opensynergy.com ([217.66.60.4]:62738 "EHLO mx1.opensynergy.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729048AbhAOAgB (ORCPT ); Thu, 14 Jan 2021 19:36:01 -0500 X-Greylist: delayed 520 seconds by postgrey-1.27 at vger.kernel.org; Thu, 14 Jan 2021 19:36:01 EST Received: from SR-MAILGATE-02.opensynergy.com (localhost.localdomain [127.0.0.1]) by mx1.opensynergy.com (Proxmox) with ESMTP id 09218A1372; Fri, 15 Jan 2021 01:26:40 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=opensynergy.com; h=cc:cc:content-transfer-encoding:content-type:content-type :date:from:from:message-id:mime-version:reply-to:subject:subject :to:to; s=srmailgate02; bh=vjQz/FTdcUA4ikts1emzODkjkcrbE4dUUeRlg xezK8s=; b=qW2W7tpA30Q0V4IIuz28HwNuJ/Ixfi/osS5uVNjrsQX3QtIenqFor o5ZPjJVKypOQFbZEU8O+C2sne911M4vQ5odKwrH3YxV6r8XF3m3Ht2IJfJ8wegqS 0lmKcrTApoySlxWOu1KRWuFdaJ/nk1rJEPQGdXx+EKqMF9tv4d3Ri7Y0mqgv8PQs aGyrQGx9zXMfwREtBUdzElhoxQiPLrg8YXYESz8J8EqO8OdSo8mki9J+XMnPcdt7 KAUvZ80eZ+6Dd/rkdIRlkiajLBXj90AowVuHCP/f9KjDva9aGEycaoBSu+4GmqgB +F774G3+DvXRU+UDSorxhle2JqZhMmyQQ== From: Vasyl Vavrychuk To: , , CC: "Michael S. Tsirkin" , Jason Wang , Gerd Hoffmann , Henrik Rydberg , Mathias Crombez , Vasyl Vavrychuk Subject: [PATCH RESEND v3] virtio-input: add multi-touch support Date: Fri, 15 Jan 2021 02:26:23 +0200 Message-ID: <20210115002623.8576-1-vasyl.vavrychuk@opensynergy.com> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: SR-MAIL-01.open-synergy.com (10.26.10.21) To SR-MAIL-01.open-synergy.com (10.26.10.21) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Mathias Crombez Without multi-touch slots allocated, ABS_MT_SLOT events will be lost by input_handle_abs_event. Implementation is based on uinput_create_device. Signed-off-by: Mathias Crombez Co-developed-by: Vasyl Vavrychuk Signed-off-by: Vasyl Vavrychuk --- v2: fix patch corrupted by corporate email server v3: use number of slots from the host Resend since to feedback. drivers/virtio/virtio_input.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/drivers/virtio/virtio_input.c b/drivers/virtio/virtio_input.c index f1f6208edcf5..f643536807dd 100644 --- a/drivers/virtio/virtio_input.c +++ b/drivers/virtio/virtio_input.c @@ -7,6 +7,7 @@ #include #include +#include struct virtio_input { struct virtio_device *vdev; @@ -204,7 +205,7 @@ static int virtinput_probe(struct virtio_device *vdev) struct virtio_input *vi; unsigned long flags; size_t size; - int abs, err; + int abs, err, nslots; if (!virtio_has_feature(vdev, VIRTIO_F_VERSION_1)) return -ENODEV; @@ -289,6 +290,13 @@ static int virtinput_probe(struct virtio_device *vdev) continue; virtinput_cfg_abs(vi, abs); } + + if (test_bit(ABS_MT_SLOT, vi->idev->absbit)) { + nslots = input_abs_get_max(vi->idev, ABS_MT_SLOT) + 1; + err = input_mt_init_slots(vi->idev, nslots, 0); + if (err) + goto err_mt_init_slots; + } } virtio_device_ready(vdev); @@ -304,6 +312,7 @@ static int virtinput_probe(struct virtio_device *vdev) spin_lock_irqsave(&vi->lock, flags); vi->ready = false; spin_unlock_irqrestore(&vi->lock, flags); +err_mt_init_slots: input_free_device(vi->idev); err_input_alloc: vdev->config->del_vqs(vdev); -- 2.20.1