From: Dmitry Torokhov <dmitry.torokhov@gmail.com>
To: Sebastian Kapfer <sebastian_kapfer@gmx.net>
Cc: Linux Input ML <linux-input@vger.kernel.org>
Subject: Re: [alps] Timing patch, revised again :-)
Date: Fri, 4 Dec 2009 15:49:48 -0800 [thread overview]
Message-ID: <200912041549.48949.dmitry.torokhov@gmail.com> (raw)
In-Reply-To: <1259963240.27307.213.camel@sardelle.necksus.de>
On Friday 04 December 2009 01:47:20 pm Sebastian Kapfer wrote:
> Hi Dmitry,
>
> thank you. I've tested it and it basically works. I still have two
> more nits to pick though :-)
>
> > Yeah, but due to protocol limitations we can't really do anything about
> > it. It should not desync though.
>
> It does still occasionally desync (but see below).
>
> > > I've changed two little things:
> > >
> > > 1. The reporting of buttons went to dev2 sometimes, as bare_ps2_packet
> > > signalled the click on 'dev', not psmouse->dev. This lead to sticking
> > > buttons.
> > >
> > > 2. We needlessly break the distinction of PS/2 and touchpad on older
> > > models, where it may have been cleanly possible. (If you don't want to
> > > keep that feature and rather simplify the code, that's fine with me,
> > > too. But as I said, bare_ps2_packet needs to be fixed up then.)
> >
> > I tend to agree with Dave's preference of routing button data from 3-byte
> > packets to stick only and 6- and 9-byte packets to the pad and sending
> > release to both devices. I think it makes most sense.
>
> It does, in a way. All I'm saying is that we're making a promise to
> userspace clients that we can't completely fulfil (i.e. some buttons
> will be reported incorrectly). Anyway, I really don't want to argue
> about this particular point anymore given Dave's previous attitude.
>
>
> What is more worrysome to me is that we're now reporting the same
> physical click on two input layer devices again. We should not do this,
> because this can lead to spurious double-click events. Imagine for
> example moving the touchpad while pressing the trackpoint button:
>
> 6byte -- no buttons set
> 3byte -- left set (in response to user click) dev2 down
> 6byte -- left set (hw copies over from trackpoint) dev down
> 3byte -- no buttons set (in response to user release) dev2, dev release
>
> Given unlucky timing and the way X11 reads event data, this is an X11
> double-click.
Hmm, I see... Right, we should not leave it like this.
>
> Reading the comments in the patch, I'm not sure if you're aware how the
> hardware reports buttons. When I press the trackpoint button, the
> corresponding bit is set in _all_ packets (3s, 6s, 9s) sent
> subsequently, until I release it. This is not about pressing two
> buttons at the same time, just one. Sorry if I'm reading too much into
> that comment and you already know this.
>
> Given this behaviour of the hw, I'd favour not reporting button presses
> on a device while the corresponding button on the other device is down.
> (Dave called this behaviour 'masking'.) Code implementing this was in
> the patch I sent to linux-input dated Nov. 11 (see the parts involving
> the btn_state variable). I have not put it back in the patch below
> because I'd like to await your opinion on this first.
OK, Let me take a look at that patch again.
>
> There is still one failure mode left that causes de-sync. It happens
> when the else branch in alps_handle_interleaved_ps2 gets called more
> than once, i.e. we're accidentially reconstructing a 12-, 15- etc byte
> packet. This was easier to deal with in my first patch, I just
> collected the whole 9 bytes in a buffer and implicitly knew when the
> packet was over. Example of this happening:
>
> Dec 4 21:03:22 sardelle kernel: [410740.786121] alps.c: handle: cf
> Dec 4 21:03:22 sardelle kernel: [410740.787499] alps.c: handle: 79
> Dec 4 21:03:22 sardelle kernel: [410740.788688] alps.c: handle: 12
> Dec 4 21:03:22 sardelle kernel: [410740.789979] alps.c: handle: 1f
> Dec 4 21:03:22 sardelle kernel: [410740.791146] alps.c: handle: ff
> Dec 4 21:03:22 sardelle kernel: [410740.792299] alps.c: handle: 1
> <suspect 9byte (really is)>
> Dec 4 21:03:22 sardelle kernel: [410740.796899] alps.c: handle: 4f
> <yup, it is, fold back>
Ah, ok, so when we report all 3 buttons pressed we mistaken it as interleaved
packet again... Insteado f waiting till 9th byte can't we just forcefully
exit inetrleaved mode (once we processed the bare packet) by doing:
psmouse->packet[3] &= 0xf7;
?
--
Dmitry
next prev parent reply other threads:[~2009-12-04 23:49 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-11-29 16:54 [alps] Timing patch, revised again :-) Sebastian Kapfer
2009-12-04 8:49 ` Dmitry Torokhov
2009-12-04 21:47 ` Sebastian Kapfer
2009-12-04 23:49 ` Dmitry Torokhov [this message]
2009-12-04 23:52 ` Dmitry Torokhov
2009-12-06 19:53 ` Sebastian Kapfer
2009-12-06 20:09 ` Dmitry Torokhov
2009-12-07 0:27 ` Sebastian Kapfer
2009-12-13 22:01 ` [PATCH 1/2] Sebastian Kapfer
2009-12-13 22:09 ` [PATCH 2/2] Alps Dualpoint, Interleaved packets Sebastian Kapfer
2009-12-15 6:42 ` Dmitry Torokhov
2009-12-15 21:01 ` Sebastian Kapfer
2009-12-15 22:49 ` Dmitry Torokhov
2009-12-16 0:01 ` Sebastian Kapfer
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=200912041549.48949.dmitry.torokhov@gmail.com \
--to=dmitry.torokhov@gmail.com \
--cc=linux-input@vger.kernel.org \
--cc=sebastian_kapfer@gmx.net \
/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).