Re: [PATCH v3 13/13] HID: hid-multitouch: forwards ABS_SCAN_TIME

From: Henrik Rydberg
Date: Tue Nov 13 2012 - 13:21:54 EST


> >> @@ -98,6 +99,9 @@ struct mt_device {
> >> bool serial_maybe; /* need to check for serial protocol */
> >> bool curvalid; /* is the current contact valid? */
> >> unsigned mt_flags; /* flags to pass to input-mt */
> >> + __s32 dev_time; /* the scan time provided by the device */
> >> + unsigned long jiffies; /* the frame's jiffies */
> >> + unsigned timestamp; /* the timestamp to be sent */
> >
> > Why not just dev_time here?
>
> because max dev_time is at least 65535 according to the norm, and the
> win 8 device I have has his max value of 65535.
> Which means that every 6 seconds and a half the counter resets, and
> the value is not properly reset in the way I understand the
> specification. The device just forwards an internal clock that is
> never reset.

Ok, I though it was a 32-bit value, and that it would wrap with a
longer period. It does not change the essence of the definition,
though. If we say "seconds" instead of "hours", we should still be
fine, no?

> So if you wait 653500 us + 8ms, everything happens as if the device
> sent this frame right after the previous one (you get the same value).

Yes, but we have this effect on a 32-bit counter as well.

> I think that it's the job of the kernel to provide clean and coherent
> values through evdev, which won't be the case if the jiffies thing is
> not in place: every devices will have a different behavior, leading to
> complicate things in the user-space.

The whole point is to provide the device clock to userland when it
exists, isn't it? Thus, the jiffies would never be used. If a future
device needs additions to work conformly, we just have to deal with it
at that point in time.

To conclude, we obviously have devices with a rather short wrap-around
time. However, since the normal inter-frame time is in the millisecond
range, it should not be overly restrictive to change the definition of
the minimum wraparound time from hours to seconds.

Thanks,
Henrik
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/