Merge branch 'master' of https://github.com/neutrino-mp/neutrino-mp into ni/mp/tuxbox

Origin commit data
------------------
Branch: ni/coolstream
Commit: c5e829a1d4
Author: vanhofen <vanhofen@gmx.de>
Date: 2017-09-21 (Thu, 21 Sep 2017)


------------------
No further description and justification available within origin commit message!

------------------
This commit was generated by Migit
This commit is contained in:
vanhofen
2017-09-21 10:37:09 +02:00
2 changed files with 87 additions and 9 deletions

View File

@@ -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);
@@ -1304,7 +1308,10 @@ void CRCInput::getMsg_us(neutrino_msg_t * msg, neutrino_msg_data_t * data, uint6
}
}
for (std::vector<in_dev>::iterator i = indev.begin(); i != indev.end(); ++i) {
/* iterate backwards or the vector will be corrupted by the indev.erase(i) */
std::vector<in_dev>::iterator i = indev.end();
while (i != indev.begin()) {
--i;
if (((*i).fd != -1) && (FD_ISSET((*i).fd, &rfds))) {
uint64_t now_pressed = 0;
t_input_event ev;
@@ -1316,7 +1323,7 @@ void CRCInput::getMsg_us(neutrino_msg_t * msg, neutrino_msg_data_t * data, uint6
if (errno == ENODEV) {
/* hot-unplugged? */
::close((*i).fd);
indev.erase(i);
i = indev.erase(i);
}
continue;
}
@@ -1740,6 +1747,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<in_dev>::iterator it = indev.begin(); it != indev.end(); ++it) {
int fd = (*it).fd;
std::string path = (*it).path;