From a0481953d007ccb6853674dce706dd5382ca4059 Mon Sep 17 00:00:00 2001 From: vanhofen Date: Wed, 22 Feb 2017 08:59:56 +0100 Subject: [PATCH 1/2] rc_input: rename checkLnkDev() to checkdev_lnk(); ... just to align form-style to latest changes Origin commit data ------------------ Branch: ni/coolstream Commit: https://github.com/neutrino-images/ni-neutrino/commit/0e435bb389d3923325d8f92bb452e45268e88966 Author: vanhofen Date: 2017-02-22 (Wed, 22 Feb 2017) Origin message was: ------------------ - rc_input: rename checkLnkDev() to checkdev_lnk(); ... just to align form-style to latest changes ------------------ This commit was generated by Migit --- src/driver/rcinput.cpp | 41 ++++++++++++++++++++--------------------- src/driver/rcinput.h | 2 +- 2 files changed, 21 insertions(+), 22 deletions(-) diff --git a/src/driver/rcinput.cpp b/src/driver/rcinput.cpp index b7974a09c..0541b69f1 100644 --- a/src/driver/rcinput.cpp +++ b/src/driver/rcinput.cpp @@ -174,6 +174,25 @@ bool CRCInput::checkdev() return true; /* need to check anyway... */ } +#ifdef BOXMODEL_CS_HD2 +bool CRCInput::checkdev_lnk(std::string lnk) +{ + static struct stat info; + if (lstat(lnk.c_str(), &info) != -1) { + if (S_ISLNK(info.st_mode)) { + std::string tmp = readLink(lnk); + if (!tmp.empty()) { + if (lstat(tmp.c_str(), &info) != -1) { + if (S_ISCHR(info.st_mode)) + return true; + } + } + } + } + return false; +} +#endif + bool CRCInput::checkpath(in_dev id) { for (std::vector::iterator it = indev.begin(); it != indev.end(); ++it) { @@ -206,25 +225,6 @@ bool CRCInput::checkpath(in_dev id) return false; } -#ifdef BOXMODEL_CS_HD2 -bool CRCInput::checkLnkDev(std::string lnk) -{ - static struct stat info; - if (lstat(lnk.c_str(), &info) != -1) { - if (S_ISLNK(info.st_mode)) { - std::string tmp = readLink(lnk); - if (!tmp.empty()) { - if (lstat(tmp.c_str(), &info) != -1) { - if (S_ISCHR(info.st_mode)) - return true; - } - } - } - } - return false; -} -#endif - /* if recheck == true, only not already opened devices are opened, if not, close then (re)open all */ void CRCInput::open(bool recheck) { @@ -249,13 +249,12 @@ void CRCInput::open(bool recheck) #ifdef BOXMODEL_CS_HD2 && (dentry->d_type != DT_LNK) #endif - ) { d_printf("[rcinput:%s] skipping '%s'\n", __func__, dentry->d_name); continue; } #ifdef BOXMODEL_CS_HD2 - if ((dentry->d_type == DT_LNK) && (!checkLnkDev("/dev/input/" + std::string(dentry->d_name)))) { + if ((dentry->d_type == DT_LNK) && (!checkdev_lnk("/dev/input/" + std::string(dentry->d_name)))) { d_printf("[rcinput:%s] skipping '%s'\n", __func__, dentry->d_name); continue; } diff --git a/src/driver/rcinput.h b/src/driver/rcinput.h index 37cfd4b8a..450dd4dd7 100644 --- a/src/driver/rcinput.h +++ b/src/driver/rcinput.h @@ -171,7 +171,7 @@ class CRCInput bool checkpath(in_dev id); bool checkdev(); #ifdef BOXMODEL_CS_HD2 - bool checkLnkDev(std::string lnk); + bool checkdev_lnk(std::string lnk); #endif void close(); int translate(int code); From bab85d298cb90b66e2035804432efecb20d4befc Mon Sep 17 00:00:00 2001 From: vanhofen Date: Wed, 22 Feb 2017 08:59:56 +0100 Subject: [PATCH 2/2] rc_input: just cosmetics to satisfy syntax-highlighters Origin commit data ------------------ Branch: ni/coolstream Commit: https://github.com/neutrino-images/ni-neutrino/commit/d7ed439e53cc55b5c936fe843044ff8fc708b17d Author: vanhofen Date: 2017-02-22 (Wed, 22 Feb 2017) Origin message was: ------------------ - rc_input: just cosmetics to satisfy syntax-highlighters ------------------ No further description and justification available within origin commit message! ------------------ This commit was generated by Migit --- src/driver/rcinput.cpp | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/driver/rcinput.cpp b/src/driver/rcinput.cpp index 0541b69f1..9facaaf59 100644 --- a/src/driver/rcinput.cpp +++ b/src/driver/rcinput.cpp @@ -574,8 +574,6 @@ int CRCInput::checkTimers() return _id; } - - int64_t CRCInput::calcTimeoutEnd(const int timeout_in_seconds) { return time_monotonic_us() + ((uint64_t)timeout_in_seconds * (uint64_t) 1000000); @@ -1432,13 +1430,13 @@ void CRCInput::getMsg_us(neutrino_msg_t * msg, neutrino_msg_data_t * data, uint6 if (trkey == rc_last_key) { /* only allow selected keys to be repeated */ if (mayRepeat(trkey, bAllowRepeatLR) || - (g_settings.shutdown_real_rcdelay && - ((trkey == RC_standby) && + (g_settings.shutdown_real_rcdelay && ((trkey == RC_standby) && #if HAVE_COOL_HARDWARE - (cs_get_revision() > 7)))) + (cs_get_revision() > 7) #else - (g_info.hw_caps->can_shutdown)))) + (g_info.hw_caps->can_shutdown) #endif + ))) { #ifdef ENABLE_REPEAT_CHECK if (rc_last_repeat_key != trkey) {