From: Chris Bagwell <chris@cnpbagwell.com>
To: Chase Douglas <chase.douglas@canonical.com>
Cc: linux-input@vger.kernel.org, xorg-devel@lists.x.org,
Dmitry Torokhov <dmitry.torokhov@gmail.com>,
Takashi Iwai <tiwai@suse.de>, Andy Whitcroft <apw@canonical.com>,
Henrik Rydberg <rydberg@euromail.se>,
linux-kernel@vger.kernel.org,
Peter Hutterer <peter.hutterer@who-t.net>,
Duncan McGreggor <duncan.mcgreggor@canonical.com>
Subject: Re: [PATCH 2/3] Input: synaptics - add multitouch multifinger support
Date: Sun, 10 Oct 2010 10:44:12 -0500 [thread overview]
Message-ID: <4CB1DF4C.8000105@cnpbagwell.com> (raw)
In-Reply-To: <1286549880-32580-3-git-send-email-chase.douglas@canonical.com>
On 10/08/2010 09:57 AM, Chase Douglas wrote:
> Newer multitouch Synaptics trackpads do not advertise multifinger
> support. Now that we have multitouch support, we can use the number of
> touches to report multifinger functionality.
>
> In conjunction with the X synaptics input module, this enables
> functionality such as two finger scrolling.
>
> Signed-off-by: Chase Douglas<chase.douglas@canonical.com>
> ---
> drivers/input/mouse/synaptics.c | 24 +++++++++++++-----------
> drivers/input/mouse/synaptics.h | 1 +
> 2 files changed, 14 insertions(+), 11 deletions(-)
>
> diff --git a/drivers/input/mouse/synaptics.c b/drivers/input/mouse/synaptics.c
> index 990598f..7289d88 100644
> --- a/drivers/input/mouse/synaptics.c
> +++ b/drivers/input/mouse/synaptics.c
> @@ -471,7 +471,6 @@ static void synaptics_process_packet(struct psmouse *psmouse)
> struct input_dev *dev = psmouse->dev;
> struct synaptics_data *priv = psmouse->private;
> struct synaptics_hw_state hw;
> - int num_fingers;
> int finger_width;
> int i;
>
> @@ -483,6 +482,7 @@ static void synaptics_process_packet(struct psmouse *psmouse)
> input_report_abs(dev, ABS_MT_POSITION_Y,
> YMAX_NOMINAL + YMIN_NOMINAL - hw.y);
> input_report_abs(dev, ABS_MT_PRESSURE, hw.z);
> + priv->num_fingers++;
> }
>
> input_mt_sync(dev);
> @@ -510,13 +510,13 @@ static void synaptics_process_packet(struct psmouse *psmouse)
> }
>
> if (hw.z> 0) {
> - num_fingers = 1;
> + priv->num_fingers++;
In this area of code, its not as obvious your relying on MT packets to
always come before standard packets. I think its worth a comment here
or below on why your initialising priv->num_fingers at bottom of
processing instead of at top of processing.
It will also help explain to reader why mt_sync events work out as expected.
> finger_width = 5;
> if (SYN_CAP_EXTENDED(priv->capabilities)) {
> switch (hw.w) {
> case 0 ... 1:
> if (SYN_CAP_MULTIFINGER(priv->capabilities))
> - num_fingers = hw.w + 2;
> + priv->num_fingers = hw.w + 2;
> break;
> case 2:
> if (SYN_MODEL_PEN(priv->model_id))
> @@ -528,10 +528,8 @@ static void synaptics_process_packet(struct psmouse *psmouse)
> break;
> }
> }
> - } else {
> - num_fingers = 0;
> + } else
> finger_width = 0;
> - }
>
> /* Post events
> * BTN_TOUCH has to be first as mousedev relies on it when doing
> @@ -555,15 +553,19 @@ static void synaptics_process_packet(struct psmouse *psmouse)
> if (SYN_CAP_PALMDETECT(priv->capabilities))
> input_report_abs(dev, ABS_TOOL_WIDTH, finger_width);
>
> - input_report_key(dev, BTN_TOOL_FINGER, num_fingers == 1);
> + input_report_key(dev, BTN_TOOL_FINGER, priv->num_fingers == 1);
> input_report_key(dev, BTN_LEFT, hw.left);
> input_report_key(dev, BTN_RIGHT, hw.right);
>
> - if (SYN_CAP_MULTIFINGER(priv->capabilities)) {
> - input_report_key(dev, BTN_TOOL_DOUBLETAP, num_fingers == 2);
> - input_report_key(dev, BTN_TOOL_TRIPLETAP, num_fingers == 3);
> + if (SYN_CAP_MULTIFINGER(priv->capabilities) || priv->multitouch) {
> + input_report_key(dev, BTN_TOOL_DOUBLETAP,
> + priv->num_fingers == 2);
> + input_report_key(dev, BTN_TOOL_TRIPLETAP,
> + priv->num_fingers == 3);
> }
>
> + priv->num_fingers = 0;
> +
> if (SYN_CAP_MIDDLE_BUTTON(priv->capabilities))
> input_report_key(dev, BTN_MIDDLE, hw.middle);
>
> @@ -674,7 +676,7 @@ static void set_input_params(struct input_dev *dev, struct synaptics_data *priv)
> __set_bit(BTN_LEFT, dev->keybit);
> __set_bit(BTN_RIGHT, dev->keybit);
>
> - if (SYN_CAP_MULTIFINGER(priv->capabilities)) {
> + if (SYN_CAP_MULTIFINGER(priv->capabilities) || priv->multitouch) {
> __set_bit(BTN_TOOL_DOUBLETAP, dev->keybit);
> __set_bit(BTN_TOOL_TRIPLETAP, dev->keybit);
> }
> diff --git a/drivers/input/mouse/synaptics.h b/drivers/input/mouse/synaptics.h
> index 5126c9c..0989b8d 100644
> --- a/drivers/input/mouse/synaptics.h
> +++ b/drivers/input/mouse/synaptics.h
> @@ -113,6 +113,7 @@ struct synaptics_data {
> unsigned char mode; /* current mode byte */
> int scroll;
> int multitouch; /* Whether device provides MT */
> + unsigned int num_fingers; /* Number of fingers touching */
> };
>
> void synaptics_module_init(void);
next prev parent reply other threads:[~2010-10-10 15:44 UTC|newest]
Thread overview: 36+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-10-08 14:57 [PATCH 0/3] Input: synaptics - multitouch and multifinger support Chase Douglas
2010-10-08 14:57 ` [PATCH 1/3] Input: synaptics - add multitouch support Chase Douglas
2010-10-08 14:57 ` [PATCH 2/3] Input: synaptics - add multitouch multifinger support Chase Douglas
2010-10-08 14:58 ` [PATCH 3/3] Input: synaptics - remove touches over button click area Chase Douglas
2010-10-10 15:58 ` Chris Bagwell
2010-10-11 16:24 ` Chris Bagwell
2010-10-11 17:10 ` Takashi Iwai
2010-10-11 17:30 ` Dmitry Torokhov
2010-10-11 17:40 ` Takashi Iwai
2010-10-11 17:46 ` Chris Bagwell
2010-10-11 17:54 ` Henrik Rydberg
2010-10-11 18:29 ` Takashi Iwai
2010-10-10 15:44 ` Chris Bagwell [this message]
2010-10-10 15:37 ` [PATCH 1/3] Input: synaptics - add multitouch support Chris Bagwell
2010-10-10 15:41 ` Chris Bagwell
2010-10-08 16:37 ` [PATCH 0/3] Input: synaptics - multitouch and multifinger support Takashi Iwai
2010-10-08 16:38 ` Takashi Iwai
2010-10-08 17:48 ` Takashi Iwai
2010-10-08 17:15 ` Chase Douglas
2010-10-08 17:46 ` Takashi Iwai
2010-10-08 18:04 ` Dmitry Torokhov
2010-10-08 19:31 ` Takashi Iwai
2010-10-10 21:04 ` Dmitry Torokhov
2010-10-11 7:35 ` Takashi Iwai
2010-10-11 7:48 ` Henrik Rydberg
2010-10-11 7:59 ` Takashi Iwai
2010-10-11 13:41 ` Chris Bagwell
2010-10-11 14:01 ` Takashi Iwai
2010-10-11 14:24 ` Henrik Rydberg
2010-10-11 14:49 ` Takashi Iwai
2010-10-11 15:31 ` Henrik Rydberg
2010-10-11 15:58 ` Takashi Iwai
2010-10-10 7:49 ` Henrik Rydberg
2010-10-10 20:59 ` Dmitry Torokhov
2010-10-11 7:28 ` Takashi Iwai
2010-10-11 7:40 ` 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=4CB1DF4C.8000105@cnpbagwell.com \
--to=chris@cnpbagwell.com \
--cc=apw@canonical.com \
--cc=chase.douglas@canonical.com \
--cc=dmitry.torokhov@gmail.com \
--cc=duncan.mcgreggor@canonical.com \
--cc=linux-input@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=peter.hutterer@who-t.net \
--cc=rydberg@euromail.se \
--cc=tiwai@suse.de \
--cc=xorg-devel@lists.x.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox