Skip to content

linux_wayland (uinput) doesn't work on 32-bit linux systems #12

@BrianHoldsworth

Description

@BrianHoldsworth

Hi. I've only tested on ARMv7, but I'd assume the problem exists with any 32-bit linux. On 32-bit linux, the timeval struct, which is part of the input_event struct, uses 32-bit longs. However, the struct is hard-coded for 64-bit longs.

I fixed this for ARMv7 with the following change:

diff --git a/src/linux_wayland/ffi/input.rs b/src/linux_wayland/ffi/input.rs
index a8c6b08..3447684 100644
--- a/src/linux_wayland/ffi/input.rs
+++ b/src/linux_wayland/ffi/input.rs
@@ -1,11 +1,13 @@
 // https://github.com/torvalds/linux/blob/master/include/uapi/linux/input.h
 
+use std::ffi::c_long;
+
 #[repr(C)]
 #[allow(non_camel_case_types)]
 pub struct timeval {
     // Not quite sure if these should be 32 or 64
-    pub tv_sec: i64,
-    pub tv_usec: i64,
+    pub tv_sec: c_long,
+    pub tv_usec: c_long,
 }
 
 #[repr(C)]

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions