From e12d2c0fa754336c948d0f9fb2aa753ebb850fc3 Mon Sep 17 00:00:00 2001 From: Stefan Seyfried Date: Wed, 6 Sep 2017 22:19:32 +0200 Subject: [PATCH] rcinput: add hack to set rcdelay after device hotplug this fixes e.g. wrong repeat settings after lircd restart Origin commit data ------------------ Branch: ni/coolstream Commit: https://github.com/neutrino-images/ni-neutrino/commit/ed5be5143b8c130a1be3281122cb841e02033164 Author: Stefan Seyfried Date: 2017-09-06 (Wed, 06 Sep 2017) ------------------ This commit was generated by Migit --- src/driver/rcinput.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/driver/rcinput.cpp b/src/driver/rcinput.cpp index 5080ca632..145cc8639 100644 --- a/src/driver/rcinput.cpp +++ b/src/driver/rcinput.cpp @@ -75,6 +75,9 @@ static bool saved_orig_termio = false; static bool input_stopped = false; static struct timespec devinput_mtime = { 0, 0 }; +static unsigned int _start_ms = 0; +static unsigned int _repeat_ms = 0; + #ifdef RCDEBUG #define d_printf printf #else @@ -243,6 +246,7 @@ void CRCInput::open(bool recheck) indev.push_back(id); } closedir(dir); + setKeyRepeatDelay(0, 0); id.path = "/tmp/neutrino.input"; if (! checkpath(id)) { id.fd = ::open(id.path.c_str(), O_RDWR|O_NONBLOCK|O_CLOEXEC); @@ -1737,6 +1741,13 @@ int CRCInput::translate(int code) void CRCInput::setKeyRepeatDelay(unsigned int start_ms, unsigned int repeat_ms) { + if (start_ms == 0 && repeat_ms == 0) { + start_ms = _start_ms; + repeat_ms = _repeat_ms; + } else { + _start_ms = start_ms; + _repeat_ms = repeat_ms; + } for (std::vector::iterator it = indev.begin(); it != indev.end(); ++it) { int fd = (*it).fd; std::string path = (*it).path;