From: Kamal Mostafa <kamal@canonical.com>
To: linux-input@vger.kernel.org, linux-kernel@vger.kernel.org,
Dmitry Torokhov <dmitry.torokhov@gmail.com>,
Henrik Rydberg <rydberg@euromail.se>
Cc: David Solda <dso@cypress.com>, Troy Abercrombia <ta@cypress.com>,
Dudley Du <dudl@cypress.com>,
Cypress Semiconductor Corporation <customercare@cypress.com>,
Kamal Mostafa <kamal@canonical.com>,
Kyle Fazzari <git@status.e4ward.com>,
Mario Limonciello <mario_limonciello@dell.com>,
Tim Gardner <tim.gardner@canonical.com>,
Herton Krzesinski <herton.krzesinski@canonical.com>
Subject: [PATCH v3 4/4] input: Cypress PS/2 Trackpad simulated multitouch
Date: Thu, 29 Nov 2012 13:58:01 -0800 [thread overview]
Message-ID: <1354226281-3476-5-git-send-email-kamal@canonical.com> (raw)
In-Reply-To: <1354226281-3476-1-git-send-email-kamal@canonical.com>
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@canonical.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
next prev parent reply other threads:[~2012-11-29 21:58 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-11-29 21:57 [PATCH v3 0/4] Cypress PS/2 Trackpad driver Kamal Mostafa
2012-11-29 21:57 ` [PATCH v3 1/4] input: increase struct ps2dev cmdbuf[] to 8 bytes Kamal Mostafa
2012-11-29 21:57 ` [PATCH v3 2/4] input: Cypress PS/2 Trackpad psmouse driver Kamal Mostafa
2012-12-03 3:20 ` Dudley Du
2012-12-03 5:57 ` Dudley Du
2012-12-03 6:31 ` Henrik Rydberg
2012-12-03 6:31 ` Dudley Du
2012-12-03 7:45 ` Henrik Rydberg
2012-12-03 17:04 ` Dmitry Torokhov
2012-12-05 2:22 ` Kamal Mostafa
2012-12-05 6:24 ` Dudley Du
2012-11-29 21:58 ` [PATCH v3 3/4] input: Cypress PS/2 Trackpad link into psmouse-base Kamal Mostafa
2012-11-29 21:58 ` Kamal Mostafa [this message]
2012-12-03 1:58 ` [PATCH v3 4/4] input: Cypress PS/2 Trackpad simulated multitouch Dudley Du
2012-12-03 7:36 ` [PATCH v3 0/4] Cypress PS/2 Trackpad driver Dmitry Torokhov
2012-12-05 2:22 ` SEMI_MT vs. simulated mt (was Re: [PATCH v3 0/4] Cypress PS/2 Trackpad driver) Kamal Mostafa
2012-12-03 7:50 ` [PATCH v3 0/4] Cypress PS/2 Trackpad driver Henrik Rydberg
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=1354226281-3476-5-git-send-email-kamal@canonical.com \
--to=kamal@canonical.com \
--cc=customercare@cypress.com \
--cc=dmitry.torokhov@gmail.com \
--cc=dso@cypress.com \
--cc=dudl@cypress.com \
--cc=git@status.e4ward.com \
--cc=herton.krzesinski@canonical.com \
--cc=linux-input@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mario_limonciello@dell.com \
--cc=rydberg@euromail.se \
--cc=ta@cypress.com \
--cc=tim.gardner@canonical.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®