Permalink
Browse files

[cec] fixed - make xbmc the active source again when resuming from st…

…andby and xbmc was the active source before it went to standby
  • Loading branch information...
1 parent 906bd93 commit abcb3f86843ed098822c30d1dab17e378aa0b946 @opdenkamp opdenkamp committed Dec 6, 2012
@@ -130,6 +130,7 @@ void CPeripheralCecAdapter::ResetMembers(void)
m_bDeviceRemoved = false;
m_bActiveSourcePending = false;
m_bStandbyPending = false;
+ m_bActiveSourceBeforeStandby = false;
m_currentButton.iButton = 0;
m_currentButton.iDuration = 0;
@@ -180,14 +181,24 @@ void CPeripheralCecAdapter::Announce(AnnouncementFlag flag, const char *sender,
// this will also power off devices when we're the active source
{
CSingleLock lock(m_critSection);
- m_bGoingToStandby = false;
+ m_bGoingToStandby = true;
}
StopThread();
}
else if (flag == System && !strcmp(sender, "xbmc") && !strcmp(message, "OnWake"))
{
CLog::Log(LOGDEBUG, "%s - reconnecting to the CEC adapter after standby mode", __FUNCTION__);
- ReopenConnection();
+ if (ReopenConnection())
+ {
+ bool bActivate(false);
+ {
+ CSingleLock lock(m_critSection);
+ bActivate = m_bActiveSourceBeforeStandby;
+ m_bActiveSourceBeforeStandby = false;
+ }
+ if (bActivate)
+ ActivateSource();
+ }
}
else if (flag == Player && !strcmp(sender, "xbmc") && !strcmp(message, "OnStop"))
{
@@ -391,6 +402,7 @@ void CPeripheralCecAdapter::Process(void)
m_iExitCode = EXITCODE_QUIT;
m_bGoingToStandby = false;
m_bIsRunning = true;
+ m_bActiveSourceBeforeStandby = false;
}
CAnnouncementManager::AddAnnouncer(this);
@@ -424,6 +436,9 @@ void CPeripheralCecAdapter::Process(void)
!m_bDeviceRemoved &&
(!m_bGoingToStandby || GetSettingBool("standby_tv_on_pc_standby")) &&
GetSettingBool("enabled");
+
+ if (m_bGoingToStandby)
+ m_bActiveSourceBeforeStandby = m_cecAdapter->IsLibCECActiveSource();
}
if (bSendStandbyCommands)
@@ -1669,7 +1684,7 @@ void CPeripheralCecAdapter::OnDeviceRemoved(void)
m_bDeviceRemoved = true;
}
-void CPeripheralCecAdapter::ReopenConnection(void)
+bool CPeripheralCecAdapter::ReopenConnection(void)
{
// stop running thread
{
@@ -1684,7 +1699,7 @@ void CPeripheralCecAdapter::ReopenConnection(void)
ResetMembers();
// reopen the connection
- InitialiseFeature(FEATURE_CEC);
+ return InitialiseFeature(FEATURE_CEC);
}
void CPeripheralCecAdapter::ActivateSource(void)
@@ -129,7 +129,7 @@ namespace PERIPHERALS
static int CecAlert(void *cbParam, const CEC::libcec_alert alert, const CEC::libcec_parameter data);
static void CecSourceActivated(void *param, const CEC::cec_logical_address address, const uint8_t activated);
bool IsRunning(void) const;
- void ReopenConnection(void);
+ bool ReopenConnection(void);
void ProcessActivateSource(void);
void ProcessStandbyDevices(void);
@@ -168,6 +168,7 @@ namespace PERIPHERALS
bool m_bActiveSourcePending;
bool m_bStandbyPending;
CDateTime m_preventActivateSourceOnPlay;
+ bool m_bActiveSourceBeforeStandby;
};
class CPeripheralCecAdapterUpdateThread : public CThread

0 comments on commit abcb3f8

Please sign in to comment.