From: Dmitry Torokhov <dmitry.torokhov@gmail.com>
To: Richard Pospesel <pospeselr@gmail.com>
Cc: Chris Diamand <chris@diamand.org>, linux-input@vger.kernel.org
Subject: Re: [PATCH] Input: byd - enable absolute mode
Date: Tue, 23 Feb 2016 10:08:44 -0800 [thread overview]
Message-ID: <20160223180844.GB30638@dtor-ws> (raw)
In-Reply-To: <56CBE3C3.9020008@gmail.com>
Hi Richard,
On Mon, Feb 22, 2016 at 08:44:51PM -0800, Richard Pospesel wrote:
> Hi Dmitry,
>
>
> On 02/22/2016 12:05 PM, Dmitry Torokhov wrote:
> >Hi Chris,
> >
> >On Thu, Feb 18, 2016 at 12:07:52AM +0000, Chris Diamand wrote:
> >>+
> >>+ serio_continue_rx(psmouse->ps2dev.serio);
> >> }
> >>
> >> static psmouse_ret_t byd_process_byte(struct psmouse *psmouse)
> >> {
> >>- struct input_dev *dev = psmouse->dev;
> >>+ struct byd_data *priv = psmouse->private;
> >>+ u32 now = jiffies_to_msecs(jiffies);
> >> u8 *pkt = psmouse->packet;
> >>
> >> if (psmouse->pktcnt > 0 && !(pkt[0] & PS2_ALWAYS_1)) {
> >>@@ -102,53 +292,33 @@ static psmouse_ret_t byd_process_byte(struct psmouse *psmouse)
> >>
> >> /* Otherwise, a full packet has been received */
> >> switch (pkt[3]) {
> >>- case 0: {
> >>+ case BYD_PACKET_ABSOLUTE:
> >>+ /* Only use absolute packets for the start of movement. */
> >>+ if (!priv->touch) {
> >>+ priv->abs_x = pkt[1] * (BYD_PAD_WIDTH / 256);
> >>+ priv->abs_y = (255 - pkt[2]) *
> >>+ (BYD_PAD_HEIGHT / 256);
> >>+
> >>+ /* needed to detect tap */
> >>+ if (now - priv->last_touch_time > BYD_TOUCH_TIMEOUT_MS)
> >>+ priv->touch = true;
> >
> >This is not correct: it will break when time wraps around. If you need
> >to store/compare times do it in jiffies and use
> >time_before()/time_after() API.
> >
> >But I am confused why you need this. Can you please explain?
> >
> >Thanks.
> >
>
> This does work when time wraps around, unless I've misunderstood you (
> see: https://ideone.com/OTnMH7 ). However, I will change this to
> jiffies since that seems to be the lingua franca for time in the
> kernel.
Please.
>
> I went over why this particular time delta check is required earlier
> in this thread. For brevity, I'll say this is required to allow
> "two-finger" scenario where one finger navigates, while the other
> clicks on the primary mouse button. I can go into further detail if
> you like.
Please because I tried going back to earlier messages but I could not
find detailed explanation for the delay in reporting touch.
Thanks.
--
Dmitry
next prev parent reply other threads:[~2016-02-23 18:08 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-02-18 0:07 [PATCH] Input: byd - enable absolute mode Chris Diamand
2016-02-22 20:05 ` Dmitry Torokhov
2016-02-23 4:44 ` Richard Pospesel
2016-02-23 18:08 ` Dmitry Torokhov [this message]
2016-02-24 2:47 ` Richard Pospesel
[not found] <6CBE3C3.9020008@gmail.com>
2016-02-26 3:43 ` Richard Pospesel
2016-02-29 16:55 ` Richard Pospesel
2016-03-02 0:55 ` Dmitry Torokhov
2016-03-02 5:27 ` Richard Pospesel
2016-03-02 5:27 ` Richard Pospesel
2016-03-12 13:32 ` Chris Diamand
2016-03-17 15:51 ` Richard Pospesel
[not found] ` <CAHc7Qt3XhUMFu3eov67mYmJAGKU9rdcJ8UMx++mQ+AA4KEZcjw@mail.gmail.com>
2016-03-25 23:39 ` Dmitry Torokhov
2016-03-26 0:17 ` Dmitry Torokhov
2016-03-26 0:30 ` Chris Diamand
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=20160223180844.GB30638@dtor-ws \
--to=dmitry.torokhov@gmail.com \
--cc=chris@diamand.org \
--cc=linux-input@vger.kernel.org \
--cc=pospeselr@gmail.com \
/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).