libstb-hal: hdmi_cec: ensure time compatibility for rc_sync with _TIME_BITS=64

This commit replaces commit:

      libstb-hal: Fix compatibility issues with struct input_event time assignment

These issues arose because of updates in OE/Yocto versions (e.g. >= Honister),
which introduced changes requiring these adjustments.

- Added conditional compilation to check for input_event_sec.
- Updated hdmi_cec::rc_sync method to use appropriate time fields for 64-bit suseconds.
- Maintained backward compatibility for older systems with 32-bit suseconds.
- Leveraged macros defined in input.h for clarity and maintainability.

This should ensure proper handling of suseconds and maintain backward
compatibility with older systems.
This implementation uses input_event_sec and input_event_usec macros for clarity and maintainability.
This changes shuold resolve build issues encountered due to compatibility
problems with newer versions of libraries.

It is quite certain that similar adjustments will need to be made in
other files. However, since I have only worked on this platform so far,
only this part of the code was noticeable at first. It should be noted
that this problem likely does not "yet" affect older build systems,
but it will become necessary at some point.
This also applies to Neutrino (adjustments will follow).
This commit is contained in:
2024-06-27 10:13:19 +02:00
parent eb9ec0be3e
commit 7175842106

View File

@@ -790,7 +790,19 @@ void hdmi_cec::rc_sync(int fd)
{
struct input_event ev;
// Check if the input_event_sec macro is defined and use appropriate fields for setting time values.
// This ensures compatibility with both older and newer versions of the input_event structure.
// Newer versions use input_event_sec and input_event_usec macros for 64-bit time values,
// while older versions use the time field directly, which is a timeval structure.
#ifdef input_event_sec
struct timeval tv;
gettimeofday(&tv, NULL);
ev.input_event_sec = tv.tv_sec;
ev.input_event_usec = tv.tv_usec;
#else
gettimeofday(&ev.time, NULL);
#endif
ev.type = EV_SYN;
ev.code = SYN_REPORT;
ev.value = 0;