Re: [PATCH evemu 5/5] Record events with an initial offset of 1µs

Benjamin Tissoires benjamin.tissoires at gmail.com
Mon Aug 17 17:11:42 PDT 2015


On Thu, Aug 6, 2015 at 8:58 PM, Peter Hutterer <peter.hutterer at who-t.net> wrote:
> Since 63df84261355d, the first event frame always has a timestamp of 0.0. When
> reading those events we'll replay the first event frame, and set evtime. On
> the second frame, evtime is 0.0 which evemu_read_event_realtime() takes as
> "uninitialized" and thus resets it again, causing the second frame to be
> replayed immediately instead of waiting for the correct time.
>
> Since this behavior is part of the API, work around this by giving the first
> event an offset of 1µs. Since the 0 offset was to make reading event logs
> easier, this offset won't hurt us. It won't change existing recordings, but
> over time this will be less of an issue and it's less of a hack than trying to
> work magic values into evemu_play/evemu_read_event_realtime.
>
> The alternative to this hack would be to add another API (or break the current
> one), but it's not yet worth it for the little gain we get from it.
>
> Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
> ---

For the series:
Reviewed-by: Benjamin Tissoires <benjamin.tissoires at gmail.com>

Sorry, for technical reasons I can not merge them in a timely manneer.
Feel free to push them.

Cheers,
Benjamin

>  src/evemu.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/src/evemu.c b/src/evemu.c
> index ad45dd3..3ccb849 100644
> --- a/src/evemu.c
> +++ b/src/evemu.c
> @@ -768,7 +768,7 @@ int evemu_record(FILE *fp, int fd, int ms)
>                         long time;
>
>                         if (offset == 0)
> -                               offset = time_to_long(&ev.time);
> +                               offset = time_to_long(&ev.time) - 1;
>
>                         time = time_to_long(&ev.time);
>                         ev.time = long_to_time(time - offset);
> --
> 2.4.3
>
> _______________________________________________
> Input-tools mailing list
> Input-tools at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/input-tools


More information about the Input-tools mailing list