lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Mon, 30 Dec 2013 18:06:40 -0800
From:	"Felipe F. Tonello" <eu@...ipetonello.com>
To:	linux-input@...r.kernel.org
Cc:	"Felipe F. Tonello" <eu@...ipetonello.com>,
	linux-kernel@...r.kernel.org, Henrik Rydberg <rydberg@...omail.se>,
	Dmitry Torokhov <dmitry.torokhov@...il.com>
Subject: [PATCH 1/2] input: mt: Add helper function to send end events

From: "Felipe F. Tonello" <eu@...ipetonello.com>

This is useful to report for users of devices that don't know anything
about the suspension of the device. So users will receive a touch end event
when the device is about to suspend, making it more user friendly.

One example of users is the X Server with the evdev input driver. This patch
make sure that the X server will propagate a touch end event to its windows.

Signed-off-by: Felipe F. Tonello <eu@...ipetonello.com>
---
 drivers/input/input-mt.c | 33 +++++++++++++++++++++++++++++++++
 include/linux/input/mt.h |  2 ++
 2 files changed, 35 insertions(+)

diff --git a/drivers/input/input-mt.c b/drivers/input/input-mt.c
index d398f13..6010357 100644
--- a/drivers/input/input-mt.c
+++ b/drivers/input/input-mt.c
@@ -157,6 +157,39 @@ void input_mt_report_slot_state(struct input_dev *dev,
 EXPORT_SYMBOL(input_mt_report_slot_state);
 
 /**
+ * input_mt_report_end_state() - report end touch events
+ * @dev: input device with allocated MT slots
+ *
+ * Reports a touch end event for current active slots (with active tracking id).
+ * This is useful when the device might suspend (or sleep) while there were
+ * still active tracking ids.
+ */
+void input_mt_report_end_state(struct input_dev *dev)
+{
+	struct input_mt *mt = dev->mt;
+	struct input_mt_slot *slot;
+	int id, i;
+
+	if (!mt)
+		return;
+
+	for (i = 0; i < mt->num_slots; ++i) {
+		slot = &mt->slots[i];
+		slot->frame = mt->frame;
+
+		id = input_mt_get_value(slot, ABS_MT_TRACKING_ID);
+
+		/* if id == -1 is 'unused' */
+		if (id >= 0) {
+			input_mt_set_value(slot, ABS_MT_TRACKING_ID, -1);
+			input_event(dev, EV_ABS, ABS_MT_TRACKING_ID, -1);
+		}
+	}
+}
+EXPORT_SYMBOL(input_mt_report_end_state);
+
+
+/**
  * input_mt_report_finger_count() - report contact count
  * @dev: input device with allocated MT slots
  * @count: the number of contacts
diff --git a/include/linux/input/mt.h b/include/linux/input/mt.h
index 1b1dfa8..0e6c9f7 100644
--- a/include/linux/input/mt.h
+++ b/include/linux/input/mt.h
@@ -103,6 +103,8 @@ static inline bool input_is_mt_axis(int axis)
 void input_mt_report_slot_state(struct input_dev *dev,
 				unsigned int tool_type, bool active);
 
+void input_mt_report_end_state(struct input_dev *dev);
+
 void input_mt_report_finger_count(struct input_dev *dev, int count);
 void input_mt_report_pointer_emulation(struct input_dev *dev, bool use_count);
 
-- 
1.8.3.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ