From 7b1b8c306868ddf28527dce5189bfb83adf9528c Mon Sep 17 00:00:00 2001 From: Chris Tallon Date: Wed, 5 Feb 2020 19:53:26 +0000 Subject: [PATCH] Grab input devices exclsuively to avoid remote buttons going to console --- remotelinux.cc | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) 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; -- 2.39.2