[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <9e97eb50-f9a6-4655-9422-fa1106fff97a@app.fastmail.com>
Date: Tue, 19 Dec 2023 13:53:07 +0000
From: "Arnd Bergmann" <arnd@...db.de>
To: "Dmitry Torokhov" <dmitry.torokhov@...il.com>,
"Antonios Salios" <antonios@....re>,
"Deepa Dinamani" <deepa.kernel@...il.com>
Cc: rydberg@...math.org, linux-input@...r.kernel.org,
linux-kernel@...r.kernel.org, "Jan Henrik Weinstock" <jan@....re>,
Lukas Jünger <lukas@....re>
Subject: Re: element sizes in input_event struct on riscv32
On Tue, Dec 19, 2023, at 02:50, Dmitry Torokhov wrote:
> Hi Antonious,
>
> On Thu, Dec 14, 2023 at 11:11:18AM +0100, Antonios Salios wrote:
>> Hi all.
>>
>> I'm having trouble getting evdev to run in a simulated Buildroot
>> environment on riscv32. Evtest (and the x11 driver) seems to be
>> receiving garbage data from input devices.
>>
>> Analyzing the input_event struct shows that the kernel uses 32-bit (aka
>> __kernel_ulong_t) values for __sec & __usec.
>> Evtest on the other hand interprets these variables as 64-bit time_t
>> values in a timeval struct, resulting in a mismatch between the kernel
>> and userspace.
>>
>> What would be the correct size for these values on a 32-bit
>> architecture that uses 64-bit time_t values?
>
> I think there is misunderstanding - we do not have *2* 64-bit values on
> 32-but architectures. Here is what was done:
>
> Input: extend usable life of event timestamps to 2106 on 32 bit systems
Thanks for forwarding this to me. You are definitely right that
the user-space structure is intended to use a pair of __kernel_ulong_t
for the timestamp. Usually if an application gets this wrong, it is the
result of having copied old kernel headers the source directory that
need to be updated.
For evtest in particular, I don't see how that is possible, the source
code at [1] shows that it just includes the global linux/input.h,
which on riscv32 would have to be at least from linux-5.6 anyway
because older versions are too old to build a time64 glibc.
Antonios, can you check which header was used to build your copy
of evtest, and in case this came from /usr/include/linux, which
version it corresponds to?
Arnd
[1] https://gitlab.freedesktop.org/libevdev/evtest/-/blob/master/evtest.c?ref_type=heads
Powered by blists - more mailing lists