Commit 073b1b40 authored by Ariadne Conill's avatar Ariadne Conill

eventcomm: use 64-bit time safe accessors instead of timeval directly

when building on a 32-bit host with 64-bit time_t, using the
input_event and input_event_usec accessors are necessary to deal with
translation.
parent a4e5f74b
......@@ -575,9 +575,12 @@ SynapticsReadEvent(InputInfoPtr pInfo, struct input_event *ev)
ev->type = EV_SYN;
ev->code = SYN_REPORT;
ev->value = 0;
ev->time = last_event_time;
} else if (ev->type == EV_SYN)
last_event_time = ev->time;
ev->input_event_sec = last_event_time.tv_sec;
ev->input_event_usec = last_event_time.tv_usec;
} else if (ev->type == EV_SYN) {
last_event_time.tv_sec = ev->input_event_sec;
last_event_time.tv_usec = ev->input_event_usec;
}
return TRUE;
}
......@@ -725,7 +728,7 @@ EventReadHwState(InputInfoPtr pInfo,
case SYN_REPORT:
hw->numFingers = count_fingers(pInfo, comm);
if (proto_data->have_monotonic_clock)
hw->millis = 1000 * ev.time.tv_sec + ev.time.tv_usec / 1000;
hw->millis = 1000 * ev.input_event_sec + ev.input_event_usec / 1000;
else
hw->millis = GetTimeInMillis();
SynapticsCopyHwState(hwRet, hw);
......
  • Can't build the driver with this commit. KDE Neon (Ubuntu 18.04), 64bit machine. It builds on Arch though. So maybe you depend on a newer dependency.

    Error output:

    /home/roman/dev/gfx/xorg/src/driver/xf86-input-synaptics/src/eventcomm.c: In function ‘SynapticsReadEvent’:
    /home/roman/dev/gfx/xorg/src/driver/xf86-input-synaptics/src/eventcomm.c:578:11: error: ‘struct input_event’ has no member named ‘input_event_sec’
             ev->input_event_sec = last_event_time.tv_sec;
               ^~
    /home/roman/dev/gfx/xorg/src/driver/xf86-input-synaptics/src/eventcomm.c:579:11: error: ‘struct input_event’ has no member named ‘input_event_usec’
             ev->input_event_usec = last_event_time.tv_usec;
               ^~
    /home/roman/dev/gfx/xorg/src/driver/xf86-input-synaptics/src/eventcomm.c:581:36: error: ‘struct input_event’ has no member named ‘input_event_sec’
             last_event_time.tv_sec = ev->input_event_sec;
                                        ^~
    /home/roman/dev/gfx/xorg/src/driver/xf86-input-synaptics/src/eventcomm.c:582:37: error: ‘struct input_event’ has no member named ‘input_event_usec’
             last_event_time.tv_usec = ev->input_event_usec;
                                         ^~
    /home/roman/dev/gfx/xorg/src/driver/xf86-input-synaptics/src/eventcomm.c: In function ‘EventReadHwState’:
    /home/roman/dev/gfx/xorg/src/driver/xf86-input-synaptics/src/eventcomm.c:731:43: error: ‘struct input_event’ has no member named ‘input_event_sec’
                         hw->millis = 1000 * ev.input_event_sec + ev.input_event_usec / 1000;
                                               ^
    /home/roman/dev/gfx/xorg/src/driver/xf86-input-synaptics/src/eventcomm.c:731:64: error: ‘struct input_event’ has no member named ‘input_event_usec’
                         hw->millis = 1000 * ev.input_event_sec + ev.input_event_usec / 1000;
  • Unfortunately input_event_sec and input_event_usec were introduced with the 64-bit time changes. A workaround would be something like:

    #ifndef input_event_sec
    #define input_event_sec time.tv_sec
    #endif
    
    #ifndef input_event_usec
    #define input_event_usec time.tv_usec
    #endif
  • resolved in !4 (merged) once it is merged :)

Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment