linux-input.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Yufeng Shen <miletus@google.com>
To: Benjamin Tissoires <benjamin.tissoires@gmail.com>
Cc: Peter Hutterer <peter.hutterer@who-t.net>,
	linux-input@vger.kernel.org, Henrik Rydberg <rydberg@euromail.se>,
	Daniel Kurtz <djkurtz@chromium.org>,
	rbyers@chromium.org, sadrul@chromium.org
Subject: Re: [RFC] input: mt: Support for touch cancel
Date: Tue, 12 Mar 2013 14:18:55 -0400	[thread overview]
Message-ID: <CAPDwgkPpM6WPytMEBjGo+fsp-r8fsJBqiOmM2feS_XwUBQvOXw@mail.gmail.com> (raw)
In-Reply-To: <CAN+gG=F280vzLM_43zU1biJf+p+Jq+=z5egFc+KOYAvth3+BZQ@mail.gmail.com>

On Tue, Mar 12, 2013 at 4:59 AM, Benjamin Tissoires
<benjamin.tissoires@gmail.com> wrote:
> On Tue, Mar 12, 2013 at 2:36 AM, Peter Hutterer
> <peter.hutterer@who-t.net> wrote:
>> On Mon, Mar 11, 2013 at 04:34:27PM -0400, Yufeng Shen wrote:
>>> I have ran into cases where I want to make a touch end event to have a
>>> touch cancel indication.
>>>
>>> This comes from trying to solve the problem of :
>>>
>>> If the touch sequence happens before the system suspends, and the touch
>>> release event is
>>> never received after the system resumes, userspace MT state tracking could
>>> be in a bad state.
>>>
>>> ( see #5 from
>>> https://bugs.launchpad.net/ubuntu/+source/xserver-xorg-input-synaptics/+bug/968845
>>> for an example of how this could happen from lid close/open on MBA)
>>
>> ftr, this a bug in the driver and should be fixed now.
>>
>>> One possible workaround is to let the touch device driver to release all
>>> existing touches on
>>> resume, which has the effect of clearing all the MT states in userspace
>>> touch stacks.
>>> But the touch release/end event often will result in some gesture being
>>> recognized and performed,
>>> like a tap-to-click being generated.
>>>
>>> So I am wondering what's the best way to solve the problem of clearing the
>>> touch states with
>>> minimal side effect. One way I can think of is to have MTB protocol add
>>> support of
>>> a touch cancel indication on touch release, e.g. making TRACKING_ID = -2
>>> meaning that
>>> the touch release is synthesized from the system and really has the meaning
>>> of releasing and canceling the current touch, while TRACKING_ID = -1
>>> meaning that the touch release is reported back from the device.
>>>
>>> And from Xf86-input driver level, we can add a corresponding TouchCancel
>>> for this.
>>
>> I can handle touch-cancel events in the synaptics driver to avoid
>> tap-to-click but further details get a bit nasty.
>>
>> To actually add TouchCancel to the client-protocol means a new XI protocol
>> revision, plus the stuff in the server _and_ the stuff in the client. that
>> is quite some lag time here, and if a client cannot handle TouchCancel all
>> we can do is do a TouchEnd - which will still trigger the gesture.
>>
>> even if you update the touch clients you're still lacking any solution for
>> pointer-emulated clients. again, here we can only do a ButtonRelease event
>> which again will trigger whatever it did.
>>
>> All the above can be implemented though. In fact, I suspect the protocol
>> part is the easy bit (just a flag on TouchEnd) but the server part is
>> reasonably nasty.
>>
>> the real counter-argument is that I think it is a partial solution only.
>> From an X perspective touches also end when you vt-switch away from the
>> server (device is disabled). but the kernel won't cancel the touch event for
>> that. Or when the device is disabled by the client ("disable touchpad while
>> typing" feature), So we'd have to maintain both implicit cancel and explicit
>> cancel in the driver anyway.
>>
>> so yeah, I don't think adding this to the kernel would provide any
>> significant benefit since we still need to handle all the other cases
>> anyway.
>
> If the same effect is seen when VT-switching, it's definitively a user
> space synchronization problem, not a kernel problem.
>
> I think we have all the pieces in term of protocol in the kernel for
> this use case:
> When coming back from resume, the kernel should guarantee that the
> current input state is correct. If fingers are still present, then
> their slots are still assigned, if they are missing, their slots
> should be silently released (as if the released occurs while
> sleeping). This is something the kernel can work on.
> As for the user-space, when coming back from a situation where
> inconsistency may have occurred (VT-switching, sleep/resume, events
> dropped due to a SYN_DROPPED event, or device disabled by the client),
> the user-space driver has to retrieve the current state of the kernel
> driver through the correct ioctls. If it doesn't do it, then that
> means that he is not following the evdev protocol. It's up to it to
> notify or not the toolkit/gesture recognizer that events have been
> dropped.

what's your suggestion on implementing "notify the toolkit/gesture
recognizer that events have been dropped" ?

>
> Cheers,
> Benjamin

  reply	other threads:[~2013-03-12 18:18 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CAPDwgkMbwTtf2a5Xuvb3_B18FBJ7w6VJx1CJN=gGwaaRSKzDbA@mail.gmail.com>
2013-03-12  1:36 ` [RFC] input: mt: Support for touch cancel Peter Hutterer
2013-03-12  8:59   ` Benjamin Tissoires
2013-03-12 18:18     ` Yufeng Shen [this message]
2013-03-12 19:15       ` Benjamin Tissoires
2013-03-12 18:10   ` Yufeng Shen
2013-03-13  0:54     ` Peter Hutterer
     [not found]       ` <CAPDwgkO5LUUkVQiUWyoC+mSeN+fXDPV2yV-2Qt6aqQ=eh-bwpg@mail.gmail.com>
2013-03-13 23:43         ` Peter Hutterer

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=CAPDwgkPpM6WPytMEBjGo+fsp-r8fsJBqiOmM2feS_XwUBQvOXw@mail.gmail.com \
    --to=miletus@google.com \
    --cc=benjamin.tissoires@gmail.com \
    --cc=djkurtz@chromium.org \
    --cc=linux-input@vger.kernel.org \
    --cc=peter.hutterer@who-t.net \
    --cc=rbyers@chromium.org \
    --cc=rydberg@euromail.se \
    --cc=sadrul@chromium.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;
as well as URLs for NNTP newsgroup(s).