mirror of
https://github.com/tuxbox-neutrino/neutrino.git
synced 2025-08-29 16:31:11 +02:00
rcinput/neutrino: avoid the use of EVT_TIMESET
sectionsd's EVT_TIMESET was only used to fix time calculations for input repeat detection. I doubt this reliably worked anyway. Just calculate an absolute input timestamp from CLOCK_MONOTONIC and use that. Even better solution would be to use a newer kernel with EVIOCSCLOCKID ioctl, leave that for later :-)
This commit is contained in:
@@ -4,7 +4,7 @@
|
|||||||
Copyright (C) 2001 Steffen Hehn 'McClean'
|
Copyright (C) 2001 Steffen Hehn 'McClean'
|
||||||
2003 thegoodguy
|
2003 thegoodguy
|
||||||
|
|
||||||
Copyright (C) 2008-2012 Stefan Seyfried
|
Copyright (C) 2008-2014,2016 Stefan Seyfried
|
||||||
Copyright (C) 2013-2014 martii
|
Copyright (C) 2013-2014 martii
|
||||||
|
|
||||||
License: GPL
|
License: GPL
|
||||||
@@ -529,7 +529,6 @@ void CRCInput::getMsg_us(neutrino_msg_t * msg, neutrino_msg_data_t * data, uint6
|
|||||||
//static __u16 rc_last_key = KEY_MAX;
|
//static __u16 rc_last_key = KEY_MAX;
|
||||||
static __u16 rc_last_repeat_key = KEY_MAX;
|
static __u16 rc_last_repeat_key = KEY_MAX;
|
||||||
|
|
||||||
struct timeval tv;
|
|
||||||
struct timeval tvselect;
|
struct timeval tvselect;
|
||||||
uint64_t InitialTimeout = Timeout;
|
uint64_t InitialTimeout = Timeout;
|
||||||
int64_t targetTimeout;
|
int64_t targetTimeout;
|
||||||
@@ -1211,6 +1210,7 @@ void CRCInput::getMsg_us(neutrino_msg_t * msg, neutrino_msg_data_t * data, uint6
|
|||||||
|
|
||||||
for (int i = 0; i < NUMBER_OF_EVENT_DEVICES; i++) {
|
for (int i = 0; i < NUMBER_OF_EVENT_DEVICES; i++) {
|
||||||
if ((fd_rc[i] != -1) && (FD_ISSET(fd_rc[i], &rfds))) {
|
if ((fd_rc[i] != -1) && (FD_ISSET(fd_rc[i], &rfds))) {
|
||||||
|
uint64_t now_pressed = 0;
|
||||||
t_input_event ev;
|
t_input_event ev;
|
||||||
memset(&ev, 0, sizeof(ev));
|
memset(&ev, 0, sizeof(ev));
|
||||||
/* we later check for ev.type = EV_SYN = 0x00, so set something invalid here... */
|
/* we later check for ev.type = EV_SYN = 0x00, so set something invalid here... */
|
||||||
@@ -1226,6 +1226,22 @@ 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
|
||||||
|
* kernel ev.time default uses CLOCK_REALTIME, as does gettimeofday().
|
||||||
|
* so subtract gettimeofday() from ev.time and then add
|
||||||
|
* CLOCK_MONOTONIC, which is supposed to not change with settimeofday.
|
||||||
|
* Everything would be much easier if we could use the post-kernel 3.4
|
||||||
|
* EVIOCSCLOCKID ioctl :-) */
|
||||||
|
struct timespec t1;
|
||||||
|
now_pressed = ev.time.tv_usec + ev.time.tv_sec * 1000000ULL;
|
||||||
|
if (!clock_gettime(CLOCK_MONOTONIC, &t1)) {
|
||||||
|
struct timeval t2;
|
||||||
|
gettimeofday(&t2, NULL);
|
||||||
|
now_pressed += t1.tv_sec * 1000000ULL + t1.tv_nsec / 1000;
|
||||||
|
now_pressed -= (t2.tv_usec + t2.tv_sec * 1000000ULL);
|
||||||
|
}
|
||||||
|
}
|
||||||
SHTDCNT::getInstance()->resetSleepTimer();
|
SHTDCNT::getInstance()->resetSleepTimer();
|
||||||
if (ev.value && firstKey) {
|
if (ev.value && firstKey) {
|
||||||
firstKey = false;
|
firstKey = false;
|
||||||
@@ -1272,11 +1288,12 @@ void CRCInput::getMsg_us(neutrino_msg_t * msg, neutrino_msg_data_t * data, uint6
|
|||||||
#ifdef RCDEBUG
|
#ifdef RCDEBUG
|
||||||
printf("rc_last_key %04x rc_last_repeat_key %04x\n\n", rc_last_key, rc_last_repeat_key);
|
printf("rc_last_key %04x rc_last_repeat_key %04x\n\n", rc_last_key, rc_last_repeat_key);
|
||||||
#endif
|
#endif
|
||||||
uint64_t now_pressed;
|
|
||||||
bool keyok = true;
|
bool keyok = true;
|
||||||
|
#if 0
|
||||||
|
uint64_t now_pressed;
|
||||||
tv = ev.time;
|
tv = ev.time;
|
||||||
now_pressed = (uint64_t) tv.tv_usec + (uint64_t)((uint64_t) tv.tv_sec * (uint64_t) 1000000);
|
now_pressed = (uint64_t) tv.tv_usec + (uint64_t)((uint64_t) tv.tv_sec * (uint64_t) 1000000);
|
||||||
|
#endif
|
||||||
if (trkey == rc_last_key) {
|
if (trkey == rc_last_key) {
|
||||||
/* only allow selected keys to be repeated */
|
/* only allow selected keys to be repeated */
|
||||||
if (mayRepeat(trkey, bAllowRepeatLR) ||
|
if (mayRepeat(trkey, bAllowRepeatLR) ||
|
||||||
|
@@ -4,7 +4,7 @@
|
|||||||
Copyright (C) 2001 Steffen Hehn 'McClean'
|
Copyright (C) 2001 Steffen Hehn 'McClean'
|
||||||
and some other guys
|
and some other guys
|
||||||
|
|
||||||
Copyright (C) 2006-2014 Stefan Seyfried
|
Copyright (C) 2006-2016 Stefan Seyfried
|
||||||
|
|
||||||
Copyright (C) 2011 CoolStream International Ltd
|
Copyright (C) 2011 CoolStream International Ltd
|
||||||
|
|
||||||
@@ -1879,7 +1879,11 @@ void CNeutrinoApp::InitSectiondClient()
|
|||||||
dprintf(DEBUG_NORMAL, "had to wait %ld ms for sectionsd to start up\n", time_monotonic_ms() - t);
|
dprintf(DEBUG_NORMAL, "had to wait %ld ms for sectionsd to start up\n", time_monotonic_ms() - t);
|
||||||
#endif
|
#endif
|
||||||
g_Sectionsd = new CSectionsdClient;
|
g_Sectionsd = new CSectionsdClient;
|
||||||
|
struct timespec t;
|
||||||
|
if (clock_gettime(CLOCK_MONOTONIC, &t)) {
|
||||||
|
dprintf(DEBUG_NORMAL, "CLOCK_MONOTONIC not supported? (%m), falling back to EVT_TIMESET\n");
|
||||||
g_Sectionsd->registerEvent(CSectionsdClient::EVT_TIMESET, 222, NEUTRINO_UDS_NAME);
|
g_Sectionsd->registerEvent(CSectionsdClient::EVT_TIMESET, 222, NEUTRINO_UDS_NAME);
|
||||||
|
}
|
||||||
g_Sectionsd->registerEvent(CSectionsdClient::EVT_GOT_CN_EPG, 222, NEUTRINO_UDS_NAME);
|
g_Sectionsd->registerEvent(CSectionsdClient::EVT_GOT_CN_EPG, 222, NEUTRINO_UDS_NAME);
|
||||||
g_Sectionsd->registerEvent(CSectionsdClient::EVT_EIT_COMPLETE, 222, NEUTRINO_UDS_NAME);
|
g_Sectionsd->registerEvent(CSectionsdClient::EVT_EIT_COMPLETE, 222, NEUTRINO_UDS_NAME);
|
||||||
g_Sectionsd->registerEvent(CSectionsdClient::EVT_WRITE_SI_FINISHED, 222, NEUTRINO_UDS_NAME);
|
g_Sectionsd->registerEvent(CSectionsdClient::EVT_WRITE_SI_FINISHED, 222, NEUTRINO_UDS_NAME);
|
||||||
|
Reference in New Issue
Block a user