From 2c64d2fb2b4e47b095b46b80337599af1df82bcc Mon Sep 17 00:00:00 2001 From: svenhoefer Date: Mon, 18 Jan 2016 08:10:23 +0100 Subject: [PATCH] Revert "rcinput/neutrino: avoid the use of EVT_TIMESET" This reverts commit b307b78bf8259f0cac0694e1da95196e878d0c73. In some cases keys are don't used immediately: --- 0 key: 0074 value 0, translate: 0074 -standby- 1 key: 0074 value 1, translate: 0074 -standby- 0 key: 0074 value 0, translate: 0074 -standby- 1 key: 0074 value 1, translate: 0074 -standby- CVFD::ShowText: [14:14] 0 key: 0074 value 0, translate: 0074 -standby- 1 key: 0074 value 1, translate: 0074 -standby- 0 key: 0074 value 0, translate: 0074 -standby- 1 key: 0074 value 1, translate: 0074 -standby- 0 key: 0074 value 0, translate: 0074 -standby- 1 key: 0074 value 1, translate: 0074 -standby- 0 key: 0074 value 0, translate: 0074 -standby- 1 key: 0074 value 1, translate: 0074 -standby- 0 key: 0074 value 0, translate: 0074 -standby- 1 key: 0074 value 1, translate: 0074 -standby- 0 key: 0074 value 0, translate: 0074 -standby- 1 key: 0074 value 1, translate: 0074 -standby- 0 key: 0074 value 0, translate: 0074 -standby- 1 key: 0074 value 1, translate: 0074 -standby- 0 key: 0074 value 0, translate: 0074 -standby- 1 key: 0074 value 1, translate: 0074 -standby- 0 key: 0074 value 0, translate: 0074 -standby- 1 key: 0074 value 1, translate: 0074 -standby- 0 key: 0074 value 0, translate: 0074 -standby- 1 key: 0074 value 1, translate: 0074 -standby- 0 key: 0074 value 0, translate: 0074 -standby- 1 key: 0074 value 1, translate: 0074 -standby- 0 key: 0074 value 0, translate: 0074 -standby- 2 key: 0074 value 2, translate: 0074 -standby- 0 key: 0074 value 0, translate: 0074 -standby- 1 key: 0074 value 1, translate: 0074 -standby- 0 key: 0074 value 0, translate: 0074 -standby- [/.../cst-next/src/neutrino.cpp:standbyMode:3615] OFF CSAPI (POWER-CLK): new CPU frequency: 600000000Hz CSAPI (VIDEO): Standby 1 -> 0 CSAPI (HDMI-CEC): Power Status: STANDBY -> ON CSAPI (HDMI-CEC): Device free (Logical Address: 03) CSAPI (HDMI-CEC): Power Status: ON --- --- src/driver/rcinput.cpp | 25 ++++--------------------- src/neutrino.cpp | 8 ++------ 2 files changed, 6 insertions(+), 27 deletions(-) diff --git a/src/driver/rcinput.cpp b/src/driver/rcinput.cpp index e8346e09e..c11368e01 100644 --- a/src/driver/rcinput.cpp +++ b/src/driver/rcinput.cpp @@ -4,7 +4,7 @@ Copyright (C) 2001 Steffen Hehn 'McClean' 2003 thegoodguy - Copyright (C) 2008-2014,2016 Stefan Seyfried + Copyright (C) 2008-2012 Stefan Seyfried Copyright (C) 2013-2014 martii License: GPL @@ -519,6 +519,7 @@ 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_repeat_key = KEY_MAX; + struct timeval tv; struct timeval tvselect; uint64_t InitialTimeout = Timeout; int64_t targetTimeout; @@ -1201,7 +1202,6 @@ void CRCInput::getMsg_us(neutrino_msg_t * msg, neutrino_msg_data_t * data, uint6 for (int i = 0; i < NUMBER_OF_EVENT_DEVICES; i++) { if ((fd_rc[i] != -1) && (FD_ISSET(fd_rc[i], &rfds))) { - uint64_t now_pressed = 0; t_input_event ev; int ret = read(fd_rc[i], &ev, sizeof(t_input_event)); if (ret != sizeof(t_input_event)) { @@ -1214,22 +1214,6 @@ void CRCInput::getMsg_us(neutrino_msg_t * msg, neutrino_msg_data_t * data, uint6 } if (ev.type == EV_SYN) 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(); if (ev.value && firstKey) { firstKey = false; @@ -1276,12 +1260,11 @@ void CRCInput::getMsg_us(neutrino_msg_t * msg, neutrino_msg_data_t * data, uint6 #ifdef RCDEBUG printf("rc_last_key %04x rc_last_repeat_key %04x\n\n", rc_last_key, rc_last_repeat_key); #endif - bool keyok = true; -#if 0 uint64_t now_pressed; + bool keyok = true; + tv = ev.time; now_pressed = (uint64_t) tv.tv_usec + (uint64_t)((uint64_t) tv.tv_sec * (uint64_t) 1000000); -#endif if (trkey == rc_last_key) { /* only allow selected keys to be repeated */ if (mayRepeat(trkey, bAllowRepeatLR) || diff --git a/src/neutrino.cpp b/src/neutrino.cpp index c2d208e18..9c5bd6fa8 100644 --- a/src/neutrino.cpp +++ b/src/neutrino.cpp @@ -5,7 +5,7 @@ and some other guys Homepage: http://dbox.cyberphoria.org/ - Copyright (C) 2006-2016 Stefan Seyfried + Copyright (C) 2006-2014 Stefan Seyfried Copyright (C) 2011 CoolStream International Ltd @@ -1840,11 +1840,7 @@ void CNeutrinoApp::InitZapitClient() void CNeutrinoApp::InitSectiondClient() { 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_EIT_COMPLETE, 222, NEUTRINO_UDS_NAME); g_Sectionsd->registerEvent(CSectionsdClient::EVT_WRITE_SI_FINISHED, 222, NEUTRINO_UDS_NAME);