1 From 6544830d1a0b9810c2feb2fcb34df3f90b010d2f Mon Sep 17 00:00:00 2001
2 From: Lars Op den Kamp <lars@opdenkamp.eu>
3 Date: Mon, 27 Oct 2014 21:01:00 +0100
4 Subject: [PATCH 4/8] [CEC] fixed: don't return garbage from CEC related app
6 https://github.com/xbmc/xbmc/commit/19d37944ca2a2ac2f3e71a40a94e9ea289d8f2db#commitcomment-8248480
9 xbmc/Application.cpp | 14 ++++++++------
10 xbmc/ApplicationMessenger.cpp | 20 +++++---------------
11 xbmc/ApplicationMessenger.h | 4 ++--
12 3 files changed, 15 insertions(+), 23 deletions(-)
14 diff --git a/xbmc/Application.cpp b/xbmc/Application.cpp
15 index d5604dc..4d26183 100644
16 --- a/xbmc/Application.cpp
17 +++ b/xbmc/Application.cpp
18 @@ -2351,16 +2351,18 @@
20 if (StringUtils::StartsWithNoCase(action.GetName(),"CECToggleState") || StringUtils::StartsWithNoCase(action.GetName(),"CECStandby"))
24 - CLog::Log(LOGDEBUG, "%s: action %s [%d], toggling state of playing device", __FUNCTION__, action.GetName().c_str(), action.GetID());
25 // do not wake up the screensaver right after switching off the playing device
26 if (StringUtils::StartsWithNoCase(action.GetName(),"CECToggleState"))
27 - ret = CApplicationMessenger::Get().CECToggleState();
29 + CLog::Log(LOGDEBUG, "%s: action %s [%d], toggling state of playing device", __FUNCTION__, action.GetName().c_str(), action.GetID());
30 + if (!CApplicationMessenger::Get().CECToggleState())
34 - ret = CApplicationMessenger::Get().CECStandby();
35 - if (!ret) /* display is switched off */
37 + CApplicationMessenger::Get().CECStandby();
43 diff --git a/xbmc/ApplicationMessenger.cpp b/xbmc/ApplicationMessenger.cpp
44 index 1a59c5c..d228273 100644
45 --- a/xbmc/ApplicationMessenger.cpp
46 +++ b/xbmc/ApplicationMessenger.cpp
47 @@ -843,12 +843,12 @@ void CApplicationMessenger::ProcessMessage(ThreadMessage *pMsg)
49 case TMSG_CECACTIVATESOURCE:
51 - *((bool*)pMsg->lpVoid) = g_peripherals.ToggleDeviceState(STATE_ACTIVATE_SOURCE);
52 + g_peripherals.ToggleDeviceState(STATE_ACTIVATE_SOURCE);
57 - *((bool*)pMsg->lpVoid) = g_peripherals.ToggleDeviceState(STATE_STANDBY);
58 + g_peripherals.ToggleDeviceState(STATE_STANDBY);
61 case TMSG_START_ANDROID_ACTIVITY:
62 @@ -1396,29 +1396,19 @@ bool CApplicationMessenger::CECToggleState()
64 ThreadMessage tMsg = {TMSG_CECTOGGLESTATE};
65 tMsg.lpVoid = (void*)&result;
66 - SendMessage(tMsg, false);
67 + SendMessage(tMsg, true);
72 -bool CApplicationMessenger::CECActivateSource()
73 +void CApplicationMessenger::CECActivateSource()
77 ThreadMessage tMsg = {TMSG_CECACTIVATESOURCE};
78 - tMsg.lpVoid = (void*)&result;
79 SendMessage(tMsg, false);
84 -bool CApplicationMessenger::CECStandby()
85 +void CApplicationMessenger::CECStandby()
89 ThreadMessage tMsg = {TMSG_CECSTANDBY};
90 - tMsg.lpVoid = (void*)&result;
91 SendMessage(tMsg, false);
95 diff --git a/xbmc/ApplicationMessenger.h b/xbmc/ApplicationMessenger.h
96 index 9013567..543e065 100644
97 --- a/xbmc/ApplicationMessenger.h
98 +++ b/xbmc/ApplicationMessenger.h
99 @@ -219,8 +219,8 @@ public:
101 void LoadProfile(unsigned int idx);
102 bool CECToggleState();
103 - bool CECActivateSource();
105 + void CECActivateSource();
108 CStdString GetResponse();
109 int SetResponse(CStdString response);