Skip to content

Commit

Permalink
[power] hack - don't kill lirc or cec
Browse files Browse the repository at this point in the history
  • Loading branch information
popcornmix committed Mar 26, 2016
1 parent 4de8f79 commit d6ad118
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 2 deletions.
37 changes: 37 additions & 0 deletions xbmc/peripherals/devices/PeripheralCecAdapter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -184,12 +184,49 @@ void CPeripheralCecAdapter::Announce(AnnouncementFlag flag, const char *sender,
}
else if (flag == System && !strcmp(sender, "xbmc") && !strcmp(message, "OnSleep"))
{
#if 1
bool bSendStandbyCommands(false);
{
CSingleLock lock(m_critSection);
bSendStandbyCommands = m_iExitCode != EXITCODE_REBOOT &&
m_iExitCode != EXITCODE_RESTARTAPP &&
!m_bDeviceRemoved &&
(!m_bGoingToStandby || GetSettingBool("standby_tv_on_pc_standby")) &&
GetSettingBool("enabled");

if (m_bGoingToStandby)
m_bActiveSourceBeforeStandby = m_cecAdapter->IsLibCECActiveSource();
}

if (bSendStandbyCommands)
{
if (m_cecAdapter->IsLibCECActiveSource())
{
if (!m_configuration.powerOffDevices.IsEmpty())
{
CLog::Log(LOGDEBUG, "%s - sending standby commands", __FUNCTION__);
m_standbySent = CDateTime::GetCurrentDateTime();
m_cecAdapter->StandbyDevices();
}
else if (m_configuration.bSendInactiveSource == 1)
{
CLog::Log(LOGDEBUG, "%s - sending inactive source commands", __FUNCTION__);
m_cecAdapter->SetInactiveView();
}
}
else
{
CLog::Log(LOGDEBUG, "%s - XBMC is not the active source, not sending any standby commands", __FUNCTION__);
}
}
#else
// this will also power off devices when we're the active source
{
CSingleLock lock(m_critSection);
m_bGoingToStandby = true;
}
StopThread();
#endif
}
else if (flag == System && !strcmp(sender, "xbmc") && !strcmp(message, "OnWake"))
{
Expand Down
4 changes: 2 additions & 2 deletions xbmc/powermanagement/PowerManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@ void CPowerManager::OnSleep()
CLog::Log(LOGNOTICE, "%s: Running sleep jobs", __FUNCTION__);

// stop lirc
#if defined(HAS_LIRC) || defined(HAS_IRSERVERSUITE)
#if 0 //defined(HAS_LIRC) || defined(HAS_IRSERVERSUITE)
CLog::Log(LOGNOTICE, "%s: Stopping lirc", __FUNCTION__);
CBuiltins::GetInstance().Execute("LIRC.Stop");
#endif
Expand Down Expand Up @@ -297,7 +297,7 @@ void CPowerManager::OnWake()
#endif

// restart lirc
#if defined(HAS_LIRC) || defined(HAS_IRSERVERSUITE)
#if 0 // defined(HAS_LIRC) || defined(HAS_IRSERVERSUITE)
CLog::Log(LOGNOTICE, "%s: Restarting lirc", __FUNCTION__);
CBuiltins::GetInstance().Execute("LIRC.Start");
#endif
Expand Down

0 comments on commit d6ad118

Please sign in to comment.