mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Takashi Iwai <tiwai@suse.de>
To: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Cc: Alex Chiang <achiang@hp.com>,
	linux-kernel <linux-kernel@vger.kernel.org>,
	linux-input@vger.kernel.org
Subject: Re: synaptics touchpad doesn't click
Date: Tue, 15 Dec 2009 07:40:55 +0100	[thread overview]
Message-ID: <s5h1viwn3ig.wl%tiwai@suse.de> (raw)
In-Reply-To: <20091215062628.GA12669@core.coreip.homeip.net>

At Mon, 14 Dec 2009 22:26:28 -0800,
Dmitry Torokhov wrote:
> 
> [1  <text/plain; us-ascii (7bit)>]
> Hi Alex,
> 
> On Mon, Dec 14, 2009 at 08:41:27PM -0700, Alex Chiang wrote:
> > 
> > Thanks, I did grab Takashi's patches and verify that they work
> > for me. I tested the separated patches, not the v2 combined
> > patch, although it doesn't make any difference based on visual
> > inspection of v2.
> > 
> > If you want, you can add my:
> > 
> > Tested-by: Alex Chiang <achiang@hp.com>
> 
> Thank you very much for testing, however could you please try a slightly
> different patch below (I did not quite like that the original patch
> mangled device's capability field and how it was reusing 'middle' field
> for different things)? It should apply on top of patch that
> I am attaching. I hope I did not screw it up too much,

I can't test the patch right now since I'm at home, but I'm afraid
it's a bit different behavior.  Namely,

> @@ -330,20 +339,52 @@ static void synaptics_parse_new_hw(unsigned char buf[],
>  				   struct synaptics_data *priv,
>  				   struct synaptics_hw_state *hw)
>  {
> -	hw->x = (((buf[3] & 0x10) << 8) | ((buf[1] & 0x0f) << 8) | buf[4]);
> -	hw->y = (((buf[3] & 0x20) << 7) | ((buf[1] & 0xf0) << 4) | buf[5]);
> +	int x = (((buf[3] & 0x10) << 8) | ((buf[1] & 0x0f) << 8) | buf[4]);
> +	int y = (((buf[3] & 0x20) << 7) | ((buf[1] & 0xf0) << 4) | buf[5]);
>  
>  	hw->z = buf[2];
>  	hw->w = (((buf[0] & 0x30) >> 2) |
>  		 ((buf[0] & 0x04) >> 1) |
>  		 ((buf[3] & 0x04) >> 2));
>  
> -	hw->left  = buf[0] & 0x01;
> -	hw->right = buf[0] & 0x02;
> +	if (SYN_CAP_CLICKPAD(priv->ext_cap)) {
> +		int click = (buf[0] ^ buf[3]) & 0x01;
> +
> +		if (click && y < YMIN_NOMINAL) {
> +			/*
> +			 * User pressed in ClickZone; report new button
> +			 * state but use old coordinates and don't report
> +			 * any pressure to prevent pointer movement.
> +			 */
> +			hw->left = x < CLICKPAD_LEFT_BTN_X;
> +			hw->right = x > CLICKPAD_RIGHT_BTN_X;
> +			hw->middle = x >= CLICKPAD_LEFT_BTN_X &&
> +				     x <= CLICKPAD_RIGHT_BTN_X;
> +			hw->z = 0;
> +
> +		} else {
> +			/*
> +			 * Finger is outside of the ClickZone - report
> +			 * current coordinates.
> +			 */
> +			hw->x = x;
> +			hw->y = y;
> +
> +			if (!click)
> +				hw->left = hw->right = hw->middle = 0;
> +		}

Here, when you touch outside the button area, left/right/middle are
always zero because hw was initialized.  So the above code gives the
click "released" state outside the button area.

In my original patch, the button states are kept.  This makes the
second touch while pressing the pad as dragging.  Since the button
choice is done by the first touch, you can't determine the button
position by the current touch.  Thus, remembering the last button
states is mandatory for ClickZone mode.


thanks,

Takashi

  reply	other threads:[~2009-12-15  6:41 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-12-14  1:48 Alex Chiang
2009-12-14 17:34 ` Dmitry Torokhov
2009-12-15  3:41   ` Alex Chiang
2009-12-15  6:26     ` Dmitry Torokhov
2009-12-15  6:40       ` Takashi Iwai [this message]
2009-12-15  7:33         ` Dmitry Torokhov
2009-12-15  7:41           ` Takashi Iwai
2009-12-15  8:25             ` Dmitry Torokhov
2009-12-15 10:19               ` Takashi Iwai
2009-12-15 10:41               ` Takashi Iwai
2009-12-16  1:05               ` Alex Chiang
2009-12-16  2:59                 ` Dmitry Torokhov
2009-12-16  6:50                   ` Takashi Iwai
2009-12-16  6:56                     ` Dmitry Torokhov
2009-12-16  7:14                       ` Takashi Iwai
2009-12-16  8:23                         ` Dmitry Torokhov
2009-12-16  9:17                           ` Takashi Iwai
2009-12-16 17:24                             ` Dmitry Torokhov
2009-12-16 17:32                               ` Takashi Iwai
2009-12-16  7:16                     ` Takashi Iwai
2009-12-16  6:52                   ` Alex Chiang
2009-12-16  7:03                     ` Dmitry Torokhov
2009-12-16  7:11                       ` Takashi Iwai
2009-12-16  8:20                         ` Dmitry Torokhov
2009-12-16  9:14                           ` Takashi Iwai
2009-12-16 17:31                       ` Alex Chiang
2009-12-16 17:42                         ` Dmitry Torokhov

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=s5h1viwn3ig.wl%tiwai@suse.de \
    --to=tiwai@suse.de \
    --cc=achiang@hp.com \
    --cc=dmitry.torokhov@gmail.com \
    --cc=linux-input@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.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

all inboxes | Powered by JetHome®