Re: [PATCH 3/3] Input: synaptics - remove touches over button click area

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



At Mon, 11 Oct 2010 12:46:40 -0500,
Chris Bagwell wrote:
> 
> On Mon, Oct 11, 2010 at 12:10 PM, Takashi Iwai <tiwai@xxxxxxx> wrote:
> > At Mon, 11 Oct 2010 11:24:04 -0500,
> > Chris Bagwell wrote:
> >>
> >> On Fri, Oct 8, 2010 at 9:58 AM, Chase Douglas
> >> <chase.douglas@xxxxxxxxxxxxx> wrote:
> >> > Now that we have proper multitouch support, we can handle integrated
> >> > buttons better. If we know the top of the buttons on the touchpad, we
> >> > can ignore any touches that occur within the touchpad area while a
> >> > button is clicked. It may be possible to get the button area by querying
> >> > the device, but for now allow the user to manually set it.
> >> >
> >> > A note on why this works: the Synaptics touchpads have pseudo touch
> >> > tracking. When two touches are on the touchpad, an MT touch packet with
> >> > just the X, Y, and pressure values is sent before a normal Synaptics
> >> > touch packet. When one touch is obviously in motion and the other is
> >> > stationary, the touchpad controller sends the touch in motion in the
> >> > normal packet and the stationary touch in the MT packet. Single touch
> >> > emulation is provided by the normal packet, so an action like clicking
> >> > a button and dragging with another finger still works as expected.
> >> >
> >> > Tested on a Dell Mini 1012 with synaptics_multitouch=1 and
> >> > synaptics_button_thresh=4100.
> >> >
> >> > Signed-off-by: Chase Douglas <chase.douglas@xxxxxxxxxxxxx>
> >> > ---
> >> > Âdrivers/input/mouse/synaptics.c | Â 16 +++++++++++++++-
> >> > Â1 files changed, 15 insertions(+), 1 deletions(-)
> >> >
> >> > diff --git a/drivers/input/mouse/synaptics.c b/drivers/input/mouse/synaptics.c
> >> > index 7289d88..e67778d 100644
> >> > --- a/drivers/input/mouse/synaptics.c
> >> > +++ b/drivers/input/mouse/synaptics.c
> >> > @@ -49,6 +49,12 @@ module_param(synaptics_multitouch, bool, 0644);
> >> > ÂMODULE_PARM_DESC(synaptics_multitouch,
> >> > Â Â Â Â Â Â Â Â "Enable multitouch mode on Synaptics devices");
> >> >
> >> > +static int synaptics_button_thresh = YMIN_NOMINAL + YMAX_NOMINAL;
> >> > +module_param(synaptics_button_thresh, int, 0644);
> >> > +MODULE_PARM_DESC(synaptics_button_thres,
> >> > + Â Â Â Â Â Â Â Â"Y coordinate threshold of integrated buttons on Synaptics "
> >> > + Â Â Â Â Â Â Â Â"devices");
> >> > +
> >> > Â/*****************************************************************************
> >> > Â* Â Â Stuff we need even when we do not want native Synaptics support
> >> > Â****************************************************************************/
> >> > @@ -463,6 +469,10 @@ static void synaptics_parse_hw_state(unsigned char buf[], struct synaptics_data
> >> > Â Â Â Â}
> >> > Â}
> >> >
> >> > +#define TOUCH_OVER_BUTTON(hw) (((hw).left || (hw).middle || (hw).right) && \
> >> > + Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â(YMAX_NOMINAL + YMIN_NOMINAL - (hw).y > \
> >> > + Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â synaptics_button_thresh))
> >> > +
> >> > Â/*
> >> > Â* Âcalled for each full received packet from the touchpad
> >> > Â*/
> >> > @@ -477,7 +487,7 @@ static void synaptics_process_packet(struct psmouse *psmouse)
> >> > Â Â Â Âsynaptics_parse_hw_state(psmouse->packet, priv, &hw);
> >> >
> >> > Â Â Â Âif (SYN_MULTITOUCH(priv, &hw)) {
> >> > - Â Â Â Â Â Â Â if (hw.z > 0) {
> >> > + Â Â Â Â Â Â Â if (hw.z > 0 && !TOUCH_OVER_BUTTON(hw)) {
> >> > Â Â Â Â Â Â Â Â Â Â Â Âinput_report_abs(dev, ABS_MT_POSITION_X, hw.x);
> >> > Â Â Â Â Â Â Â Â Â Â Â Âinput_report_abs(dev, ABS_MT_POSITION_Y,
> >> > Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â YMAX_NOMINAL + YMIN_NOMINAL - hw.y);
> >> > @@ -509,6 +519,10 @@ static void synaptics_process_packet(struct psmouse *psmouse)
> >> > Â Â Â Â Â Â Â Âreturn;
> >> > Â Â Â Â}
> >> >
> >> > + Â Â Â /* If touch occurs over depressed button, ignore it */
> >> > + Â Â Â if (TOUCH_OVER_BUTTON(hw))
> >> > + Â Â Â Â Â Â Â hw.z = 0;
> >> > +
> >> > Â Â Â Âif (hw.z > 0) {
> >> > Â Â Â Â Â Â Â Âpriv->num_fingers++;
> >> > Â Â Â Â Â Â Â Âfinger_width = 5;
> >> > --
> >> > 1.7.1
> >> >
> >> >
> >>
> >> I'm convinced now that clickpad style touchpads can't work without
> >> multi-touch and something like logic in xf86-input-multitouch.
> >
> > Actually Clickpad works without multi-touch patch. ÂWith my patches to
> > synaptics, it worked in some level. ÂThere are many restrictions (e.g.
> > pushing the button first then drag), though.
> >
> 
> True, but if I understand synaptic hardware MT behavior (sends
> actively moving finger in higher resolution packet regardless of
> original finger touch) then your patch will result in jumpy cursor on
> X side and that side would need patches to attempt to guess invalid
> data and discard.  I've worked on a few similar patches to various
> xf86-input-* and generally they've failed to detect difference between
> invalid packets vs. fast user movements.

Right.  I also tackled to this once.

> The main point of my 3 options was to address jumpy cursor in
> xf86-input-* that are not MT aware.  I think ABS_X/ABS_Y should only
> allow its meaning to change at detectable time periods so user can
> account for it and, specifically, that time period is best at
> transition of BTN_TOOL_DOUBLETAP.
> 
> Assuming its easy enough to support exact rules for ABS_X/ABS_Y
> changing meanings on kernel side (which I think it probably is pretty
> easy), I think we should do it so that applications don't have to
> become MT-aware as the official solution for jumpy cursors.

Hm, so are you suggesting that we need to transform MT events to
non-MT events in the kernel side with some clever filtering?
I don't know whether this is really needed...  If the patch is minimal
amount, it might be worth to get in, though.

However, I feel that we should forget about clickpad support in
kernel; as you mentioned, Clickpad works properly only with the
multi-touch, after all...

Rather I'm concerned how to decide the kernel driver's behavior,
whether behaving in MT or non-MT mode.  As Henrik suggested, in MT
mode, all events should be ABS_MT_* type.  But non-MT-aware user-space
apps won't understand all these events.  So, we'll need some fallback
mechanism for non-MT apps, anyway.

I've implemented multi_touch module option for that purpose, but it's
hacikish.  Dmitry, do you have any suggestion?


thanks,

Takashi
--
To unsubscribe from this list: send the line "unsubscribe linux-input" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Media Devel]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Linux Wireless Networking]     [Linux Omap]

  Powered by Linux