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]
Message-Id: <1354226281-3476-5-git-send-email-kamal@canonical.com>
Date:	Thu, 29 Nov 2012 13:58:01 -0800
From:	Kamal Mostafa <kamal@...onical.com>
To:	linux-input@...r.kernel.org, linux-kernel@...r.kernel.org,
	Dmitry Torokhov <dmitry.torokhov@...il.com>,
	Henrik Rydberg <rydberg@...omail.se>
Cc:	David Solda <dso@...ress.com>, Troy Abercrombia <ta@...ress.com>,
	Dudley Du <dudl@...ress.com>,
	Cypress Semiconductor Corporation <customercare@...ress.com>,
	Kamal Mostafa <kamal@...onical.com>,
	Kyle Fazzari <git@...tus.e4ward.com>,
	Mario Limonciello <mario_limonciello@...l.com>,
	Tim Gardner <tim.gardner@...onical.com>,
	Herton Krzesinski <herton.krzesinski@...onical.com>
Subject: [PATCH v3 4/4] input: Cypress PS/2 Trackpad simulated multitouch

Instead of SEMI_MT, present a full mt interface with simulated contact
positions for >=3 fingers.  Enables e.g. multi-finger tap and drag.

Signed-off-by: Kamal Mostafa <kamal@...onical.com>
---
 drivers/input/mouse/cypress_ps2.c |   16 ++++++++++++++++
 drivers/input/mouse/cypress_ps2.h |   14 +++++++++++++-
 2 files changed, 29 insertions(+), 1 deletion(-)

diff --git a/drivers/input/mouse/cypress_ps2.c b/drivers/input/mouse/cypress_ps2.c
index 472342a..bbaa9b9 100644
--- a/drivers/input/mouse/cypress_ps2.c
+++ b/drivers/input/mouse/cypress_ps2.c
@@ -408,7 +408,9 @@ static int cypress_set_input_params(struct input_dev *input,
 			return ret;
 		}
 
+#if ( CYPRESS_SIMULATED_MT != 1 )
 		__set_bit(INPUT_PROP_SEMI_MT, input->propbit);
+#endif
 
 		if (cytp->tp_res_x && cytp->tp_res_x) {
 			input_abs_set_res(input, ABS_X, cytp->tp_res_x);
@@ -531,6 +533,20 @@ static int cypress_parse_packet(struct psmouse *psmouse,
 				((packet[5] & 0x0f) << 8) | packet[7];
 			if (cytp->mode & CYTP_BIT_ABS_PRESSURE)
 				report_data->contacts[1].z = report_data->contacts[0].z;
+#if ( CYPRESS_SIMULATED_MT == 1 )
+			/* simulate contact positions for >2 fingers */
+			if ( report_data->contact_cnt >= 3 )
+				for ( i=1; i<report_data->contact_cnt; i++ ) {
+				    report_data->contacts[i].x =
+						    report_data->contacts[0].x
+						    + 100*(i)*((i%2)?-1:1);
+				    report_data->contacts[i].y =
+						    report_data->contacts[0].y;
+				    if (cytp->mode & CYTP_BIT_ABS_PRESSURE)
+					    report_data->contacts[i].z =
+						    report_data->contacts[0].z;
+				}
+#endif
 		}
 
 		report_data->left = (header_byte & BTN_LEFT_BIT) ? 1 : 0;
diff --git a/drivers/input/mouse/cypress_ps2.h b/drivers/input/mouse/cypress_ps2.h
index ce70462..4b903a9 100644
--- a/drivers/input/mouse/cypress_ps2.h
+++ b/drivers/input/mouse/cypress_ps2.h
@@ -134,7 +134,19 @@
 #define RESP_SMBUS_BIT      0x80
 
 #define CYTP_MAX_CONTACTS 5
-#define CYTP_MAX_MT_SLOTS 2
+
+/*
+ * CYPRESS_SIMULATED_MT
+ *   set to 1 for simulated multitouch (up to CTYP_MAX_CONTACTS fingers)
+ *   set to 0 for SEMI_MT (2 fingers only)
+ */
+#define CYPRESS_SIMULATED_MT 1
+
+#if ( CYPRESS_SIMULATED_MT == 1 )
+# define CYTP_MAX_MT_SLOTS 16
+#else
+# define CYTP_MAX_MT_SLOTS 2
+#endif
 
 enum cytp_type {
 	CYTP_STG,
-- 
1.7.10.4

--
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