mirror of
https://github.com/tuxbox-fork-migrations/recycled-ni-neutrino.git
synced 2025-08-29 08:21:07 +02:00
rcinput: apply ev.time adjustment to all events
This fixes detection of keys that are allowed to be long-pressed if
"long keypress" feature is enabled.
No idea why this was applied only to key press events before :-)
Origin commit data
------------------
Branch: ni/coolstream
Commit: c3e5d77bfe
Author: Stefan Seyfried <seife@tuxbox-git.slipkontur.de>
Date: 2017-02-25 (Sat, 25 Feb 2017)
------------------
This commit was generated by Migit
This commit is contained in:
committed by
vanhofen
parent
bb76d51ddc
commit
7474d9f056
@@ -1320,21 +1320,19 @@ void CRCInput::getMsg_us(neutrino_msg_t * msg, neutrino_msg_data_t * data, uint6
|
|||||||
}
|
}
|
||||||
if (ev.type == EV_SYN)
|
if (ev.type == EV_SYN)
|
||||||
continue; /* ignore... */
|
continue; /* ignore... */
|
||||||
if (ev.value) {
|
/* try to compensate for possible changes in wall clock
|
||||||
/* try to compensate for possible changes in wall clock
|
* kernel ev.time default uses CLOCK_REALTIME, as does gettimeofday().
|
||||||
* kernel ev.time default uses CLOCK_REALTIME, as does gettimeofday().
|
* so subtract gettimeofday() from ev.time and then add
|
||||||
* so subtract gettimeofday() from ev.time and then add
|
* CLOCK_MONOTONIC, which is supposed to not change with settimeofday.
|
||||||
* CLOCK_MONOTONIC, which is supposed to not change with settimeofday.
|
* Everything would be much easier if we could use the post-kernel 3.4
|
||||||
* Everything would be much easier if we could use the post-kernel 3.4
|
* EVIOCSCLOCKID ioctl :-) */
|
||||||
* EVIOCSCLOCKID ioctl :-) */
|
struct timespec t1;
|
||||||
struct timespec t1;
|
now_pressed = ev.time.tv_usec + ev.time.tv_sec * 1000000ULL;
|
||||||
now_pressed = ev.time.tv_usec + ev.time.tv_sec * 1000000ULL;
|
if (!clock_gettime(CLOCK_MONOTONIC, &t1)) {
|
||||||
if (!clock_gettime(CLOCK_MONOTONIC, &t1)) {
|
struct timeval t2;
|
||||||
struct timeval t2;
|
gettimeofday(&t2, NULL);
|
||||||
gettimeofday(&t2, NULL);
|
now_pressed += t1.tv_sec * 1000000ULL + t1.tv_nsec / 1000;
|
||||||
now_pressed += t1.tv_sec * 1000000ULL + t1.tv_nsec / 1000;
|
now_pressed -= (t2.tv_usec + t2.tv_sec * 1000000ULL);
|
||||||
now_pressed -= (t2.tv_usec + t2.tv_sec * 1000000ULL);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
SHTDCNT::getInstance()->resetSleepTimer();
|
SHTDCNT::getInstance()->resetSleepTimer();
|
||||||
if (ev.value && firstKey) {
|
if (ev.value && firstKey) {
|
||||||
|
Reference in New Issue
Block a user