Input: uinput - allow injecting event times
authorBiswarup Pal <biswarupp@google.com>
Tue, 2 May 2023 03:19:19 +0000 (20:19 -0700)
committerDmitry Torokhov <dmitry.torokhov@gmail.com>
Tue, 2 May 2023 03:22:11 +0000 (20:22 -0700)
commit3a2df60200a03f78173f1fd831aa54c08464dcde
treeb913630b0e5539c6e9d1954bd99a191f8f945791
parent9780432158de0a0da88c3b506d6bdf63da43bc75
Input: uinput - allow injecting event times

Currently, uinput doesn't use the input_set_timestamp API, so any
event injected using uinput is not accurately timestamped in terms of
measuring when the actual event happened. Hence, call the
input_set_timestamp API from uinput in order to provide a more
accurate sense of time for the event. Propagate only the timestamps
which are a) positive, b) within a pre-defined offset (10 secs) from
the current time, and c) not in the future.

Signed-off-by: Biswarup Pal <biswarupp@google.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Siarhei Vishniakou <svv@google.com>
Link: https://lore.kernel.org/r/20230427000152.1407471-1-biswarupp@google.com
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
drivers/input/misc/uinput.c