All of lore.kernel.org
 help / color / mirror / Atom feed
From: Vasyl Vavrychuk <vasyl.vavrychuk@opensynergy.com>
To: <linux-input@vger.kernel.org>,
	<virtualization@lists.linux-foundation.org>
Cc: Gerd Hoffmann <kraxel@redhat.com>,
	Henrik Rydberg <rydberg@bitmath.org>,
	CROMBEZ Mathias <mathias.crombez@faurecia.com>,
	Vasyl Vavrychuk <vasyl.vavrychuk@opensynergy.com>
Subject: [PATCH] virtio-input: add multi-touch support
Date: Wed, 25 Nov 2020 15:09:02 +0200	[thread overview]
Message-ID: <20201125130902.10185-1-vasyl.vavrychuk@opensynergy.com> (raw)

From: Mathias Crombez <mathias.crombez@faurecia.com>

Without multi-touch slots allocated, ABS_MT_SLOT events will be lost by
input_handle_abs_event.

Signed-off-by: Mathias Crombez <mathias.crombez@faurecia.com>
Signed-off-by: Vasyl Vavrychuk <vasyl.vavrychuk@opensynergy.com>
Tested-by: Vasyl Vavrychuk <vasyl.vavrychuk@opensynergy.com>
---
 drivers/virtio/Kconfig        | 11 +++++++++++
 drivers/virtio/virtio_input.c |  8 ++++++++
 2 files changed, 19 insertions(+)

diff --git a/drivers/virtio/Kconfig b/drivers/virtio/Kconfig
index 7b41130d3f35..2cfd5b01d96d 100644
--- a/drivers/virtio/Kconfig
+++ b/drivers/virtio/Kconfig
@@ -111,6 +111,17 @@ config VIRTIO_INPUT

         If unsure, say M.

+config VIRTIO_INPUT_MULTITOUCH_SLOTS
+       depends on VIRTIO_INPUT
+       int "Number of multitouch slots"
+       range 0 64
+       default 10
+       help
+        Define the number of multitouch slots used. Default to 10.
+        This parameter is unused if there is no multitouch capability.
+
+        0 will disable the feature.
+
 config VIRTIO_MMIO
        tristate "Platform bus driver for memory mapped virtio devices"
        depends on HAS_IOMEM && HAS_DMA
diff --git a/drivers/virtio/virtio_input.c b/drivers/virtio/virtio_input.c
index f1f6208edcf5..13f3d90e6c30 100644
--- a/drivers/virtio/virtio_input.c
+++ b/drivers/virtio/virtio_input.c
@@ -7,6 +7,7 @@

 #include <uapi/linux/virtio_ids.h>
 #include <uapi/linux/virtio_input.h>
+#include <linux/input/mt.h>

 struct virtio_input {
        struct virtio_device       *vdev;
@@ -205,6 +206,7 @@ static int virtinput_probe(struct virtio_device *vdev)
        unsigned long flags;
        size_t size;
        int abs, err;
+       bool is_mt = false;

        if (!virtio_has_feature(vdev, VIRTIO_F_VERSION_1))
                return -ENODEV;
@@ -287,9 +289,15 @@ static int virtinput_probe(struct virtio_device *vdev)
                for (abs = 0; abs < ABS_CNT; abs++) {
                        if (!test_bit(abs, vi->idev->absbit))
                                continue;
+                       if (input_is_mt_value(abs))
+                               is_mt = true;
                        virtinput_cfg_abs(vi, abs);
                }
        }
+       if (is_mt)
+               input_mt_init_slots(vi->idev,
+                                   CONFIG_VIRTIO_INPUT_MULTITOUCH_SLOTS,
+                                   INPUT_MT_DIRECT);

        virtio_device_ready(vdev);
        vi->ready = true;
--
2.23.0


Please mind our privacy notice<https://www.opensynergy.com/datenschutzerklaerung/privacy-notice-for-business-partners-pursuant-to-article-13-of-the-general-data-protection-regulation-gdpr/> pursuant to Art. 13 GDPR. // Unsere Hinweise zum Datenschutz gem. Art. 13 DSGVO finden Sie hier.<https://www.opensynergy.com/de/datenschutzerklaerung/datenschutzhinweise-fuer-geschaeftspartner-gem-art-13-dsgvo/>

WARNING: multiple messages have this Message-ID (diff)
From: Vasyl Vavrychuk <vasyl.vavrychuk@opensynergy.com>
To: <linux-input@vger.kernel.org>,
	<virtualization@lists.linux-foundation.org>
Cc: Vasyl Vavrychuk <vasyl.vavrychuk@opensynergy.com>,
	Henrik Rydberg <rydberg@bitmath.org>,
	CROMBEZ Mathias <mathias.crombez@faurecia.com>
Subject: [PATCH] virtio-input: add multi-touch support
Date: Wed, 25 Nov 2020 15:09:02 +0200	[thread overview]
Message-ID: <20201125130902.10185-1-vasyl.vavrychuk@opensynergy.com> (raw)

From: Mathias Crombez <mathias.crombez@faurecia.com>

Without multi-touch slots allocated, ABS_MT_SLOT events will be lost by
input_handle_abs_event.

Signed-off-by: Mathias Crombez <mathias.crombez@faurecia.com>
Signed-off-by: Vasyl Vavrychuk <vasyl.vavrychuk@opensynergy.com>
Tested-by: Vasyl Vavrychuk <vasyl.vavrychuk@opensynergy.com>
---
 drivers/virtio/Kconfig        | 11 +++++++++++
 drivers/virtio/virtio_input.c |  8 ++++++++
 2 files changed, 19 insertions(+)

diff --git a/drivers/virtio/Kconfig b/drivers/virtio/Kconfig
index 7b41130d3f35..2cfd5b01d96d 100644
--- a/drivers/virtio/Kconfig
+++ b/drivers/virtio/Kconfig
@@ -111,6 +111,17 @@ config VIRTIO_INPUT

         If unsure, say M.

+config VIRTIO_INPUT_MULTITOUCH_SLOTS
+       depends on VIRTIO_INPUT
+       int "Number of multitouch slots"
+       range 0 64
+       default 10
+       help
+        Define the number of multitouch slots used. Default to 10.
+        This parameter is unused if there is no multitouch capability.
+
+        0 will disable the feature.
+
 config VIRTIO_MMIO
        tristate "Platform bus driver for memory mapped virtio devices"
        depends on HAS_IOMEM && HAS_DMA
diff --git a/drivers/virtio/virtio_input.c b/drivers/virtio/virtio_input.c
index f1f6208edcf5..13f3d90e6c30 100644
--- a/drivers/virtio/virtio_input.c
+++ b/drivers/virtio/virtio_input.c
@@ -7,6 +7,7 @@

 #include <uapi/linux/virtio_ids.h>
 #include <uapi/linux/virtio_input.h>
+#include <linux/input/mt.h>

 struct virtio_input {
        struct virtio_device       *vdev;
@@ -205,6 +206,7 @@ static int virtinput_probe(struct virtio_device *vdev)
        unsigned long flags;
        size_t size;
        int abs, err;
+       bool is_mt = false;

        if (!virtio_has_feature(vdev, VIRTIO_F_VERSION_1))
                return -ENODEV;
@@ -287,9 +289,15 @@ static int virtinput_probe(struct virtio_device *vdev)
                for (abs = 0; abs < ABS_CNT; abs++) {
                        if (!test_bit(abs, vi->idev->absbit))
                                continue;
+                       if (input_is_mt_value(abs))
+                               is_mt = true;
                        virtinput_cfg_abs(vi, abs);
                }
        }
+       if (is_mt)
+               input_mt_init_slots(vi->idev,
+                                   CONFIG_VIRTIO_INPUT_MULTITOUCH_SLOTS,
+                                   INPUT_MT_DIRECT);

        virtio_device_ready(vdev);
        vi->ready = true;
--
2.23.0


Please mind our privacy notice<https://www.opensynergy.com/datenschutzerklaerung/privacy-notice-for-business-partners-pursuant-to-article-13-of-the-general-data-protection-regulation-gdpr/> pursuant to Art. 13 GDPR. // Unsere Hinweise zum Datenschutz gem. Art. 13 DSGVO finden Sie hier.<https://www.opensynergy.com/de/datenschutzerklaerung/datenschutzhinweise-fuer-geschaeftspartner-gem-art-13-dsgvo/>
_______________________________________________
Virtualization mailing list
Virtualization@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/virtualization

             reply	other threads:[~2020-11-25 13:18 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-25 13:09 Vasyl Vavrychuk [this message]
2020-11-25 13:09 ` [PATCH] virtio-input: add multi-touch support Vasyl Vavrychuk

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20201125130902.10185-1-vasyl.vavrychuk@opensynergy.com \
    --to=vasyl.vavrychuk@opensynergy.com \
    --cc=kraxel@redhat.com \
    --cc=linux-input@vger.kernel.org \
    --cc=mathias.crombez@faurecia.com \
    --cc=rydberg@bitmath.org \
    --cc=virtualization@lists.linux-foundation.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.