From 47ffb91b52c4eea2fbfc0f2eb9925b7e4ab04f37 Mon Sep 17 00:00:00 2001 From: Stefan Saraev Date: Sat, 31 Aug 2013 20:05:33 +0300 Subject: [PATCH] xbmc: re-added wait-for-nic-on-wakeup.patch thanks devkid --- .../xbmc-990.24-wait-for-nic-on-wakeup.patch | 60 +++++++++++++++++++ 1 file changed, 60 insertions(+) create mode 100644 packages/mediacenter/xbmc/patches/xbmc-990.24-wait-for-nic-on-wakeup.patch diff --git a/packages/mediacenter/xbmc/patches/xbmc-990.24-wait-for-nic-on-wakeup.patch b/packages/mediacenter/xbmc/patches/xbmc-990.24-wait-for-nic-on-wakeup.patch new file mode 100644 index 0000000000..a75dba87e4 --- /dev/null +++ b/packages/mediacenter/xbmc/patches/xbmc-990.24-wait-for-nic-on-wakeup.patch @@ -0,0 +1,60 @@ +diff --git a/xbmc/powermanagement/PowerManager.cpp b/xbmc/powermanagement/PowerManager.cpp +index 26d7002..71c4bd4 100644 +--- a/xbmc/powermanagement/PowerManager.cpp ++++ b/xbmc/powermanagement/PowerManager.cpp +@@ -23,6 +23,7 @@ + #include "Application.h" + #include "cores/AudioEngine/AEFactory.h" + #include "input/KeyboardStat.h" ++#include "network/Network.h" + #include "settings/GUISettings.h" + #include "windowing/WindowingFactory.h" + #include "utils/log.h" +@@ -218,10 +219,34 @@ void CPowerManager::OnSleep() + CAEFactory::Suspend(); + } + ++void CPowerManager::WaitForNet() ++{ ++ CLog::Log(LOGDEBUG, "%s: Waithing for first NIC to come up", __FUNCTION__); ++ ++ const unsigned maxLoopCount = 50u; ++ const unsigned sleepTimeMs = 200u; ++ ++ for(unsigned i=0; i < 50; ++i) ++ { ++ CNetworkInterface* pIface = g_application.getNetwork().GetFirstConnectedInterface(); ++ if (pIface && pIface->IsEnabled() && pIface->IsConnected()) ++ { ++ CLog::Log(LOGDEBUG, "%s: NIC is up after waiting %d ms", __FUNCTION__, i * sleepTimeMs); ++ return; ++ } ++ ++ Sleep(sleepTimeMs); ++ } ++ ++ CLog::Log(LOGDEBUG, "%s: NIC did not come up within %d ms... Lets give up...", __FUNCTION__, maxLoopCount * sleepTimeMs); ++} ++ + void CPowerManager::OnWake() + { + CLog::Log(LOGNOTICE, "%s: Running resume jobs", __FUNCTION__); + ++ WaitForNet(); ++ + // reset out timers + g_application.ResetShutdownTimers(); + +diff --git a/xbmc/powermanagement/PowerManager.h b/xbmc/powermanagement/PowerManager.h +index 0a9183c..714b5cc 100644 +--- a/xbmc/powermanagement/PowerManager.h ++++ b/xbmc/powermanagement/PowerManager.h +@@ -72,6 +72,8 @@ private: + + void OnLowBattery(); + ++ void WaitForNet(); ++ + IPowerSyscall *m_instance; + }; +