diff options
-rw-r--r-- | cmake/scripts/windows/ArchSetup.cmake | 2 | ||||
-rw-r--r-- | xbmc/input/IRTranslator.cpp | 30 | ||||
-rw-r--r-- | xbmc/input/IRTranslator.h | 4 | ||||
-rw-r--r-- | xbmc/input/InputManager.cpp | 154 | ||||
-rw-r--r-- | xbmc/input/InputManager.h | 22 | ||||
-rw-r--r-- | xbmc/network/EventClient.cpp | 17 | ||||
-rw-r--r-- | xbmc/platform/linux/input/LIRC.cpp | 35 | ||||
-rw-r--r-- | xbmc/platform/linux/input/LIRC.h | 29 | ||||
-rw-r--r-- | xbmc/platform/win32/input/IRServerSuite.cpp | 20 | ||||
-rw-r--r-- | xbmc/platform/win32/input/IRServerSuite.h | 36 | ||||
-rw-r--r-- | xbmc/powermanagement/PowerManager.cpp | 21 | ||||
-rw-r--r-- | xbmc/windowing/WinSystem.cpp | 6 | ||||
-rw-r--r-- | xbmc/windowing/windows/WinSystemWin32.cpp | 2 |
13 files changed, 201 insertions, 177 deletions
diff --git a/cmake/scripts/windows/ArchSetup.cmake b/cmake/scripts/windows/ArchSetup.cmake index 57f2390f7c..40df029634 100644 --- a/cmake/scripts/windows/ArchSetup.cmake +++ b/cmake/scripts/windows/ArchSetup.cmake @@ -44,7 +44,7 @@ if(${ARCH} STREQUAL win32) endif() # Additional SYSTEM_DEFINES -list(APPEND SYSTEM_DEFINES -DHAS_IRSERVERSUITE -DHAS_WIN32_NETWORK -DHAS_FILESYSTEM_SMB) +list(APPEND SYSTEM_DEFINES -DHAS_WIN32_NETWORK -DHAS_FILESYSTEM_SMB) # Make sure /FS is set for Visual Studio in order to prevent simultaneous access to pdb files. if(CMAKE_GENERATOR MATCHES "Visual Studio") diff --git a/xbmc/input/IRTranslator.cpp b/xbmc/input/IRTranslator.cpp index 3dc42e66e7..374abfeac5 100644 --- a/xbmc/input/IRTranslator.cpp +++ b/xbmc/input/IRTranslator.cpp @@ -36,29 +36,10 @@ CIRTranslator::CIRTranslator(const CProfilesManager &profileManager) : { } -bool CIRTranslator::HasIR() +void CIRTranslator::Load(const std::string &irMapName) { -#if defined(HAS_LIRC) || defined(HAS_IRSERVERSUITE) - return true; -#else - return false; -#endif -} - -void CIRTranslator::Load() -{ - if (!HasIR()) - return; - Clear(); - std::string irMapName; -#ifdef TARGET_POSIX - irMapName = "Lircmap.xml"; -#else - irMapName = "IRSSmap.xml"; -#endif - bool success = false; std::string irMapPath = URIUtils::AddFileToFolder("special://xbmc/system/", irMapName); @@ -79,12 +60,9 @@ void CIRTranslator::Load() bool CIRTranslator::LoadIRMap(const std::string &irMapPath) { - std::string remoteMapTag; -#ifdef TARGET_POSIX - remoteMapTag = "lircmap"; -#else - remoteMapTag = "irssmap"; -#endif + std::string remoteMapTag = URIUtils::GetFileName(irMapPath); + URIUtils::RemoveExtension(remoteMapTag); + StringUtils::ToLower(remoteMapTag); // Load our xml file, and fill up our mapping tables CXBMCTinyXML xmlDoc; diff --git a/xbmc/input/IRTranslator.h b/xbmc/input/IRTranslator.h index face4d821f..1326f5d9d5 100644 --- a/xbmc/input/IRTranslator.h +++ b/xbmc/input/IRTranslator.h @@ -34,7 +34,7 @@ public: /*! * \brief Loads Lircmap.xml/IRSSmap.xml */ - void Load(); + void Load(const std::string &irMapName); /*! * \brief Clears the map @@ -50,8 +50,6 @@ private: bool LoadIRMap(const std::string &irMapPath); void MapRemote(TiXmlNode *pRemote, const std::string &szDevice); - static bool HasIR(); - // Construction parameters const CProfilesManager &m_profileManager; diff --git a/xbmc/input/InputManager.cpp b/xbmc/input/InputManager.cpp index a22aec7b11..942693ef24 100644 --- a/xbmc/input/InputManager.cpp +++ b/xbmc/input/InputManager.cpp @@ -40,17 +40,7 @@ #include "guilib/GUIWindow.h" #include "guilib/GUIWindowManager.h" #include "guilib/GUIMessage.h" - #include "network/EventServer.h" - -#ifdef HAS_LIRC -#include "platform/linux/input/LIRC.h" -#endif - -#ifdef HAS_IRSERVERSUITE -#include "platform/win32/input/IRServerSuite.h" -#endif - #include "ButtonTranslator.h" #include "peripherals/Peripherals.h" #include "peripherals/devices/PeripheralImon.h" @@ -69,6 +59,8 @@ using EVENTSERVER::CEventServer; using namespace KODI; using namespace MESSAGING; +CreateRemoteControlFunc CInputManager::m_createRemoteControl = nullptr; + CInputManager::CInputManager(const CAppParamParser ¶ms, const CProfilesManager &profileManager) : m_keymapEnvironment(new CKeymapEnvironment), @@ -85,6 +77,9 @@ CInputManager::CInputManager(const CAppParamParser ¶ms, RegisterKeyboardDriverHandler(m_keyboardEasterEgg.get()); + if (m_createRemoteControl) + m_RemoteControl.reset(m_createRemoteControl()); + if (!params.RemoteControlName().empty()) SetRemoteControlName(params.RemoteControlName()); @@ -101,6 +96,8 @@ CInputManager::~CInputManager() { Deinitialize(); + m_RemoteControl.reset(); + // Unregister settings CServiceBroker::GetSettings().UnregisterCallback(this); @@ -113,10 +110,8 @@ CInputManager::~CInputManager() void CInputManager::InitializeInputs() { -#if defined(HAS_LIRC) || defined(HAS_IRSERVERSUITE) - m_RemoteControl.Initialize(); -#endif - + if (m_RemoteControl) + m_RemoteControl->Initialize(); m_Keyboard.Initialize(); m_Mouse.Initialize(); @@ -125,21 +120,22 @@ void CInputManager::InitializeInputs() void CInputManager::Deinitialize() { -#if defined(HAS_LIRC) || defined(HAS_IRSERVERSUITE) - m_RemoteControl.Disconnect(); -#endif + if (m_RemoteControl) + m_RemoteControl->Disconnect(); } bool CInputManager::ProcessRemote(int windowId) { -#if defined(HAS_LIRC) || defined(HAS_IRSERVERSUITE) - if (m_RemoteControl.GetButton()) + if (!m_RemoteControl) + return false; + + m_RemoteControl->Update(); + if (m_RemoteControl->GetButton()) { - CKey key(m_RemoteControl.GetButton(), m_RemoteControl.GetHoldTime()); - m_RemoteControl.Reset(); + CKey key(m_RemoteControl->GetButton(), m_RemoteControl->GetHoldTimeMs()); + m_RemoteControl->Reset(); return OnKey(key); } -#endif return false; } @@ -357,11 +353,6 @@ void CInputManager::QueueAction(const CAction& action) bool CInputManager::Process(int windowId, float frameTime) { -#if defined(HAS_LIRC) || defined(HAS_IRSERVERSUITE) - // Read the input from a remote - m_RemoteControl.Update(); -#endif - // process input actions ProcessRemote(windowId); ProcessEventServer(windowId, frameTime); @@ -744,42 +735,41 @@ bool CInputManager::ExecuteInputAction(const CAction &action) bool CInputManager::HasBuiltin(const std::string& command) { -#if defined(HAS_LIRC) || defined(HAS_IRSERVERSUITE) - return command == "lirc.stop" || - command ==" lirc.start" || - command == "lirc.send"; -#endif - + if (HasRemoteControl()) + return command == "lirc.stop" || + command ==" lirc.start" || + command == "lirc.send"; return false; } int CInputManager::ExecuteBuiltin(const std::string& execute, const std::vector<std::string>& params) { -#if defined(HAS_LIRC) || defined(HAS_IRSERVERSUITE) - if (execute == "lirc.stop") + if (HasRemoteControl()) { - m_RemoteControl.Disconnect(); - m_RemoteControl.SetEnabled(false); - } - else if (execute == "lirc.start") - { - m_RemoteControl.SetEnabled(true); - m_RemoteControl.Initialize(); - } - else if (execute == "lirc.send") - { - std::string command; - for (int i = 0; i < (int)params.size(); i++) + if (execute == "lirc.stop") + { + m_RemoteControl->Disconnect(); + m_RemoteControl->SetEnabled(false); + } + else if (execute == "lirc.start") + { + m_RemoteControl->SetEnabled(true); + m_RemoteControl->Initialize(); + } + else if (execute == "lirc.send") { - command += params[i]; - if (i < (int)params.size() - 1) - command += ' '; + std::string command; + for (int i = 0; i < (int)params.size(); i++) + { + command += params[i]; + if (i < (int)params.size() - 1) + command += ' '; + } + m_RemoteControl->AddSendCommand(command); } - m_RemoteControl.AddSendCommand(command); + else + return -1; } - else - return -1; -#endif return 0; } @@ -818,56 +808,52 @@ void CInputManager::SetMouseState(MOUSE_STATE mouseState) m_Mouse.SetState(mouseState); } +bool CInputManager::HasRemoteControl() +{ + return m_RemoteControl ? true : false; +} + bool CInputManager::IsRemoteControlEnabled() { -#if defined(HAS_LIRC) || defined(HAS_IRSERVERSUITE) - return m_RemoteControl.IsInUse(); -#else - return false; -#endif + return m_RemoteControl && m_RemoteControl->IsInUse(); } bool CInputManager::IsRemoteControlInitialized() { -#if defined(HAS_LIRC) || defined(HAS_IRSERVERSUITE) - return m_RemoteControl.IsInitialized(); -#else - return false; -#endif + return m_RemoteControl && m_RemoteControl->IsInitialized(); } void CInputManager::EnableRemoteControl() { -#if defined(HAS_LIRC) || defined(HAS_IRSERVERSUITE) - m_RemoteControl.SetEnabled(true); - if (!m_RemoteControl.IsInitialized()) + if (!m_RemoteControl) + return; + + m_RemoteControl->SetEnabled(true); + if (!m_RemoteControl->IsInitialized()) { - m_RemoteControl.Initialize(); + m_RemoteControl->Initialize(); } -#endif } void CInputManager::DisableRemoteControl() { -#if defined(HAS_LIRC) || defined(HAS_IRSERVERSUITE) - m_RemoteControl.Disconnect(); - m_RemoteControl.SetEnabled(false); -#endif + if (m_RemoteControl) + { + m_RemoteControl->Disconnect(); + m_RemoteControl->SetEnabled(false); + } } void CInputManager::InitializeRemoteControl() { -#if defined(HAS_LIRC) || defined(HAS_IRSERVERSUITE) - if (!m_RemoteControl.IsInitialized()) - m_RemoteControl.Initialize(); -#endif + if (m_RemoteControl && !m_RemoteControl->IsInitialized()) + m_RemoteControl->Initialize(); } void CInputManager::SetRemoteControlName(const std::string& name) { -#if defined(HAS_LIRC) || defined(HAS_IRSERVERSUITE) - m_RemoteControl.SetDeviceName(name); -#endif + if (m_RemoteControl) + m_RemoteControl->SetDeviceName(name); } void CInputManager::OnSettingChanged(std::shared_ptr<const CSetting> setting) @@ -932,7 +918,8 @@ bool CInputManager::LoadKeymaps() if (m_buttonTranslator->Load()) { - m_irTranslator->Load(); + if (m_RemoteControl) + m_irTranslator->Load(m_RemoteControl->GetMapFile()); bSuccess = true; } @@ -1025,3 +1012,8 @@ void CInputManager::UnregisterMouseDriverHandler(MOUSE::IMouseDriverHandler* han { m_mouseHandlers.erase(std::remove(m_mouseHandlers.begin(), m_mouseHandlers.end(), handler), m_mouseHandlers.end()); } + +void CInputManager::RegisterRemoteControl(CreateRemoteControlFunc createFunc) +{ + m_createRemoteControl = createFunc; +} diff --git a/xbmc/input/InputManager.h b/xbmc/input/InputManager.h index 46c15fb394..17f03e56cc 100644 --- a/xbmc/input/InputManager.h +++ b/xbmc/input/InputManager.h @@ -24,18 +24,12 @@ #include <string> #include <vector> -#if defined(HAS_LIRC) -#include "platform/linux/input/LIRC.h" -#endif -#if defined(HAS_IRSERVERSUITE) -#include "platform/win32/input/IRServerSuite.h" -#endif - #include "Action.h" #include "windowing/XBMC_events.h" #include "input/mouse/interfaces/IMouseInputProvider.h" #include "input/mouse/MouseStat.h" #include "input/KeyboardStat.h" +#include "input/remote/IRemoteControl.h" #include "interfaces/IActionListener.h" #include "settings/lib/ISettingCallback.h" #include "threads/CriticalSection.h" @@ -65,6 +59,7 @@ namespace MOUSE } } +using CreateRemoteControlFunc = KODI::REMOTE::IRemoteControl* (*)(); /// \addtogroup input /// \{ @@ -208,6 +203,12 @@ public: */ void InitializeRemoteControl(); + /*! \brief Check if the remote control exists + * + * \return true if remote control is exists, false otherwise + */ + bool HasRemoteControl(); + /*! \brief Check if the remote control is enabled * * \return true if remote control is enabled, false otherwise @@ -288,6 +289,7 @@ public: virtual void RegisterMouseDriverHandler(KODI::MOUSE::IMouseDriverHandler* handler); virtual void UnregisterMouseDriverHandler(KODI::MOUSE::IMouseDriverHandler* handler); + static void RegisterRemoteControl(CreateRemoteControlFunc createFunc); private: /*! \brief Process keyboard event and translate into an action @@ -342,10 +344,6 @@ private: CMouseStat m_Mouse; CKey m_LastKey; -#if defined(HAS_LIRC) || defined(HAS_IRSERVERSUITE) - CRemoteControl m_RemoteControl; -#endif - std::map<std::string, std::map<int, float> > m_lastAxisMap; std::vector<CAction> m_queuedActions; @@ -358,11 +356,13 @@ private: std::unique_ptr<CCustomControllerTranslator> m_customControllerTranslator; std::unique_ptr<CTouchTranslator> m_touchTranslator; std::unique_ptr<CJoystickMapper> m_joystickTranslator; + std::unique_ptr<KODI::REMOTE::IRemoteControl> m_RemoteControl; std::vector<KODI::KEYBOARD::IKeyboardDriverHandler*> m_keyboardHandlers; std::vector<KODI::MOUSE::IMouseDriverHandler*> m_mouseHandlers; std::unique_ptr<KODI::KEYBOARD::IKeyboardDriverHandler> m_keyboardEasterEgg; + static CreateRemoteControlFunc m_createRemoteControl; }; /// \} diff --git a/xbmc/network/EventClient.cpp b/xbmc/network/EventClient.cpp index 5816305224..68454f4611 100644 --- a/xbmc/network/EventClient.cpp +++ b/xbmc/network/EventClient.cpp @@ -91,13 +91,16 @@ void CEventButtonState::Load() else if ( (m_mapName.length() > 3) && (StringUtils::StartsWith(m_mapName, "LI:")) ) // starts with LI: ? { -#if defined(HAS_LIRC) || defined(HAS_IRSERVERSUITE) - std::string lircDevice = m_mapName.substr(3); - m_iKeyCode = CServiceBroker::GetInputManager().TranslateLircRemoteString( lircDevice.c_str(), - m_buttonName.c_str() ); -#else - CLog::Log(LOGERROR, "ES: LIRC support not enabled"); -#endif + if (CServiceBroker::GetInputManager().HasRemoteControl()) + { + std::string lircDevice = m_mapName.substr(3); + m_iKeyCode = CServiceBroker::GetInputManager().TranslateLircRemoteString( lircDevice.c_str(), + m_buttonName.c_str() ); + } + else + { + CLog::Log(LOGERROR, "ES: LIRC support not enabled"); + } } else { diff --git a/xbmc/platform/linux/input/LIRC.cpp b/xbmc/platform/linux/input/LIRC.cpp index 1649ad92b4..a72d646d94 100644 --- a/xbmc/platform/linux/input/LIRC.cpp +++ b/xbmc/platform/linux/input/LIRC.cpp @@ -37,6 +37,18 @@ #include "threads/SingleLock.h" #include "ServiceBroker.h" +#define LIRC_MAP_FILENAME "Lircmap.xml" + +KODI::REMOTE::IRemoteControl* CRemoteControl::CreateInstance() +{ + return new CRemoteControl(); +} + +void CRemoteControl::Register() +{ + CInputManager::RegisterRemoteControl(CRemoteControl::CreateInstance); +} + CRemoteControl::CRemoteControl() : CThread("RemoteControl") , m_fd(-1) @@ -61,10 +73,15 @@ CRemoteControl::~CRemoteControl() fclose(m_file); } -void CRemoteControl::SetEnabled(bool value) +std::string CRemoteControl::GetMapFile() +{ + return LIRC_MAP_FILENAME; +} + +void CRemoteControl::SetEnabled(bool bEnabled) { - m_used=value; - if (!value) + m_used = bEnabled; + if (!bEnabled) CLog::Log(LOGINFO, "LIRC %s: disabled", __FUNCTION__); } @@ -107,12 +124,12 @@ void CRemoteControl::Disconnect() } } -void CRemoteControl::SetDeviceName(const std::string& value) +void CRemoteControl::SetDeviceName(const std::string& name) { - if (value.length()>0) - m_deviceName=value; + if (name.length() > 0) + m_deviceName = name; else - m_deviceName=LIRC_DEVICE; + m_deviceName = LIRC_DEVICE; } void CRemoteControl::Initialize() @@ -305,12 +322,12 @@ void CRemoteControl::Update() } } -unsigned short CRemoteControl::GetButton() +uint16_t CRemoteControl::GetButton() const { return m_button; } -unsigned int CRemoteControl::GetHoldTime() const +uint32_t CRemoteControl::GetHoldTimeMs() const { return m_holdTime; } diff --git a/xbmc/platform/linux/input/LIRC.h b/xbmc/platform/linux/input/LIRC.h index a13a523519..dceb9f6e71 100644 --- a/xbmc/platform/linux/input/LIRC.h +++ b/xbmc/platform/linux/input/LIRC.h @@ -24,28 +24,33 @@ #include <atomic> #include "system.h" +#include "input/remote/IRemoteControl.h" #include "threads/Thread.h" #include "threads/Event.h" -class CRemoteControl : CThread +class CRemoteControl : public KODI::REMOTE::IRemoteControl, CThread { public: CRemoteControl(); ~CRemoteControl() override; - void Initialize(); - void Disconnect(); - void Reset(); - void Update(); - unsigned short GetButton(); + void Initialize() override; + void Disconnect() override; + void Reset() override; + void Update() override; + uint16_t GetButton() const override; /*! \brief retrieve the time in milliseconds that the button has been held \return time in milliseconds the button has been down */ - unsigned int GetHoldTime() const; - void SetDeviceName(const std::string& value); - void SetEnabled(bool value); - bool IsInUse() const { return m_used; } - bool IsInitialized() const { return m_bInitialized; } - void AddSendCommand(const std::string& command); + uint32_t GetHoldTimeMs() const override; + void SetDeviceName(const std::string& name) override; + void SetEnabled(bool bEnabled) override; + bool IsInUse() const override { return m_used; } + bool IsInitialized() const override { return m_bInitialized; } + void AddSendCommand(const std::string& command) override; + std::string GetMapFile() override; + + static IRemoteControl* CreateInstance(); + static void Register(); protected: void Process() override; diff --git a/xbmc/platform/win32/input/IRServerSuite.cpp b/xbmc/platform/win32/input/IRServerSuite.cpp index 33f127a588..db29faef1d 100644 --- a/xbmc/platform/win32/input/IRServerSuite.cpp +++ b/xbmc/platform/win32/input/IRServerSuite.cpp @@ -26,6 +26,17 @@ #include <Ws2tcpip.h> #define IRSS_PORT 24000 +#define IRSS_MAP_FILENAME "IRSSmap.xml" + +KODI::REMOTE::IRemoteControl* CRemoteControl::CreateInstance() +{ + return new CRemoteControl(); +} + +void CRemoteControl::Register() +{ + CInputManager::RegisterRemoteControl(CRemoteControl::CreateInstance); +} CRemoteControl::CRemoteControl() : CThread("RemoteControl") @@ -41,6 +52,11 @@ CRemoteControl::~CRemoteControl() Disconnect(); } +std::string CRemoteControl::GetMapFile() +{ + return IRSS_MAP_FILENAME; +} + void CRemoteControl::Disconnect() { m_event.Set(); @@ -471,12 +487,12 @@ bool CRemoteControl::ReadPacket(CIrssMessage &message) } } -WORD CRemoteControl::GetButton() +uint16_t CRemoteControl::GetButton() const { return m_button; } -unsigned int CRemoteControl::GetHoldTime() const +uint32_t CRemoteControl::GetHoldTimeMs() const { return 0; } diff --git a/xbmc/platform/win32/input/IRServerSuite.h b/xbmc/platform/win32/input/IRServerSuite.h index f7ebd55ee9..05b9bff46c 100644 --- a/xbmc/platform/win32/input/IRServerSuite.h +++ b/xbmc/platform/win32/input/IRServerSuite.h @@ -19,31 +19,35 @@ * */ -#include <winsock2.h> -#include <string> - #include "IrssMessage.h" +#include "input/remote/IRemoteControl.h" #include "threads/Thread.h" #include "threads/Event.h" -class CRemoteControl : CThread +#include <winsock2.h> +#include <string> + +class CRemoteControl : public KODI::REMOTE::IRemoteControl, CThread { public: CRemoteControl(); virtual ~CRemoteControl(); - void Initialize(); - void Disconnect(); - void Reset(); - void Update(); - WORD GetButton(); - unsigned int GetHoldTime() const; - bool IsInitialized() {return m_bInitialized;} + void Initialize() override; + void Disconnect() override; + void Reset() override; + void Update() override; + uint16_t GetButton() const override; + uint32_t GetHoldTimeMs() const override; + bool IsInitialized() const override { return m_bInitialized; } + std::string GetMapFile() override; + + void SetEnabled(bool) override { } + void SetDeviceName(const std::string&) override { } + void AddSendCommand(const std::string&) override { } + bool IsInUse() const override { return false; } - //lirc stuff, not implemented - bool IsInUse() {return false;} - void SetEnabled(bool) { } - void SetDeviceName(const std::string&) { } - void AddSendCommand(const std::string&) {} + static IRemoteControl* CreateInstance(); + static void Register(); protected: virtual void Process(); diff --git a/xbmc/powermanagement/PowerManager.cpp b/xbmc/powermanagement/PowerManager.cpp index b17b8d09c8..1617969f72 100644 --- a/xbmc/powermanagement/PowerManager.cpp +++ b/xbmc/powermanagement/PowerManager.cpp @@ -34,6 +34,7 @@ #include "interfaces/builtins/Builtins.h" #include "network/Network.h" #include "pvr/PVRManager.h" +#include "ServiceBroker.h" #include "settings/lib/Setting.h" #include "settings/Settings.h" #include "system.h" @@ -184,10 +185,11 @@ void CPowerManager::OnSleep() CLog::Log(LOGNOTICE, "%s: Running sleep jobs", __FUNCTION__); // stop lirc -#if defined(HAS_LIRC) || defined(HAS_IRSERVERSUITE) - CLog::Log(LOGNOTICE, "%s: Stopping lirc", __FUNCTION__); - CBuiltins::GetInstance().Execute("LIRC.Stop"); -#endif + if (CBuiltins::GetInstance().HasCommand("LIRC.Stop")) + { + CLog::Log(LOGNOTICE, "%s: Stopping lirc", __FUNCTION__); + CBuiltins::GetInstance().Execute("LIRC.Stop"); + } CServiceBroker::GetPVRManager().OnSleep(); StorePlayerState(); @@ -215,7 +217,7 @@ void CPowerManager::OnWake() if (CServiceBroker::GetWinSystem().IsFullScreen()) { #if defined(TARGET_WINDOWS_DESKTOP) - ShowWindow(g_hWnd,SW_RESTORE); + ShowWindow(g_hWnd, SW_RESTORE); SetForegroundWindow(g_hWnd); #endif } @@ -223,10 +225,11 @@ void CPowerManager::OnWake() #endif // restart lirc -#if defined(HAS_LIRC) || defined(HAS_IRSERVERSUITE) - CLog::Log(LOGNOTICE, "%s: Restarting lirc", __FUNCTION__); - CBuiltins::GetInstance().Execute("LIRC.Start"); -#endif + if (CBuiltins::GetInstance().HasCommand("LIRC.Start")) + { + CLog::Log(LOGNOTICE, "%s: Restarting lirc", __FUNCTION__); + CBuiltins::GetInstance().Execute("LIRC.Start"); + } CServiceBroker::GetActiveAE().Resume(); g_application.UpdateLibraries(); diff --git a/xbmc/windowing/WinSystem.cpp b/xbmc/windowing/WinSystem.cpp index 23a3b76bfd..b2b9219408 100644 --- a/xbmc/windowing/WinSystem.cpp +++ b/xbmc/windowing/WinSystem.cpp @@ -29,6 +29,9 @@ #if HAS_GLES #include "guilib/GUIFontTTFGL.h" #endif +#if HAS_LIRC +#include "platform/linux/input/LIRC.h" +#endif CWinSystemBase::CWinSystemBase() { @@ -41,6 +44,9 @@ CWinSystemBase::CWinSystemBase() m_nScreen = 0; m_bBlankOtherDisplay = false; m_fRefreshRate = 0.0f; +#if HAS_LIRC + CRemoteControl::Register(); +#endif } CWinSystemBase::~CWinSystemBase() = default; diff --git a/xbmc/windowing/windows/WinSystemWin32.cpp b/xbmc/windowing/windows/WinSystemWin32.cpp index 75b6dbbfc4..e4f46ed0f3 100644 --- a/xbmc/windowing/windows/WinSystemWin32.cpp +++ b/xbmc/windowing/windows/WinSystemWin32.cpp @@ -38,6 +38,7 @@ #include "utils/CharsetConverter.h" #include "utils/SystemInfo.h" #include "VideoSyncD3D.h" +#include "platform/win32/input/IRServerSuite.h" #include <tpcshrd.h> #include "guilib/GraphicContext.h" @@ -68,6 +69,7 @@ CWinSystemWin32::CWinSystemWin32() CAESinkDirectSound::Register(); CAESinkWASAPI::Register(); CWin32PowerSyscall::Register(); + CRemoteControl::Register(); } CWinSystemWin32::~CWinSystemWin32() |