From: Chris Tallon Date: Wed, 5 Feb 2020 19:53:26 +0000 (+0000) Subject: Grab input devices exclsuively to avoid remote buttons going to console X-Git-Url: https://git.vomp.tv/gitweb/?a=commitdiff_plain;h=7b1b8c306868ddf28527dce5189bfb83adf9528c;p=vompclient.git Grab input devices exclsuively to avoid remote buttons going to console --- diff --git a/remotelinux.cc b/remotelinux.cc index 9018a3e..6367355 100644 --- a/remotelinux.cc +++ b/remotelinux.cc @@ -20,6 +20,7 @@ #include #include #include +#include #include #include @@ -99,6 +100,9 @@ int RemoteLinux::init(const char*) { Log::getInstance()->log("Remote", Log::NOTICE, "Add /dev/input/event%d to List", eventid); devices.push_back(new_fd); + + // Grab the device - make it exclusive to vomp. Fixes rubbish input going to console in background + ioctl(new_fd, EVIOCGRAB, 1); } else { @@ -190,11 +194,14 @@ int RemoteLinux::initCec() { int RemoteLinux::shutdown() { if (!initted) return 0; + deinitCec(); - while (devices.size()) { - int cur_fd = devices.back(); - devices.pop_back(); - close(cur_fd); + while (devices.size()) + { + int cur_fd = devices.back(); + devices.pop_back(); + ioctl(cur_fd, EVIOCGRAB, 0); + close(cur_fd); } initted = 0;