Merge pull request #721 from Gujs/openelec-updates

System wake up for recordings
This commit is contained in:
Stephan Raue 2012-05-28 14:52:53 -07:00
commit 8fa4d325d9
4 changed files with 131 additions and 1 deletions

View File

@ -28,6 +28,7 @@ mkdir -p $INSTALL/usr/bin
cp $PKG_DIR/scripts/cputemp $INSTALL/usr/bin
cp $PKG_DIR/scripts/gputemp $INSTALL/usr/bin
cp $PKG_DIR/scripts/wait_on_xbmc_exit $INSTALL/usr/bin
cp $PKG_DIR/scripts/setwakeup.sh $INSTALL/usr/bin
cp $PKG_BUILD/tools/EventClients/Clients/XBMC\ Send/xbmc-send.py $INSTALL/usr/bin/xbmc-send
mkdir -p $INSTALL/usr/lib/xbmc

View File

@ -0,0 +1,101 @@
diff --git a/xbmc/ApplicationMessenger.cpp b/xbmc/ApplicationMessenger.cpp
index 7ef2027..bea711b 100644
--- a/xbmc/ApplicationMessenger.cpp
+++ b/xbmc/ApplicationMessenger.cpp
@@ -73,6 +73,9 @@
#include "utils/JobManager.h"
#include "storage/DetectDVDType.h"
+#include "pvr/PVRManager.h"
+
+using namespace PVR;
using namespace std;
CDelayedMessage::CDelayedMessage(ThreadMessage& msg, unsigned int delay)
@@ -261,12 +264,14 @@ void CApplicationMessenger::ProcessMessage(ThreadMessage *pMsg)
case TMSG_HIBERNATE:
{
+ g_PVRManager.SetWakeupCommand();
g_powerManager.Hibernate();
}
break;
case TMSG_SUSPEND:
{
+ g_PVRManager.SetWakeupCommand();
g_powerManager.Suspend();
}
break;
diff --git a/xbmc/pvr/PVRManager.h b/xbmc/pvr/PVRManager.h
index 94a8c9a..99280c6 100644
--- a/xbmc/pvr/PVRManager.h
+++ b/xbmc/pvr/PVRManager.h
@@ -450,6 +450,11 @@ namespace PVR
*/
void LoadCurrentChannelSettings(void);
+ /*!
+ * @brief Executes "pvrpowermanagement.setwakeupcmd"
+ */
+ bool SetWakeupCommand(void);
+
protected:
/*!
* @brief PVR update and control thread.
@@ -525,11 +530,6 @@ namespace PVR
void ShowProgressDialog(const CStdString &strText, int iProgress);
/*!
- * @brief Executes "pvrpowermanagement.setwakeupcmd"
- */
- bool SetWakeupCommand(void);
-
- /*!
* @brief Hide the progress dialog if it's visible.
*/
void HideProgressDialog(void);
diff --git a/xbmc/pvr/timers/PVRTimers.cpp b/xbmc/pvr/timers/PVRTimers.cpp
index cfba9bb..4e757d6 100644
--- a/xbmc/pvr/timers/PVRTimers.cpp
+++ b/xbmc/pvr/timers/PVRTimers.cpp
@@ -714,8 +714,7 @@ CDateTime CPVRTimers::GetNextEventTime(void) const
const CDateTimeSpan prewakeup(0, 0, g_guiSettings.GetInt("pvrpowermanagement.prewakeup"), 0);
const CDateTimeSpan idle(0, 0, g_guiSettings.GetInt("pvrpowermanagement.backendidletime"), 0);
- CDateTime timerwakeuptime;
- CDateTime dailywakeuptime;
+ CDateTime retVal;
/* Check next active time */
CPVRTimerInfoTag timer;
@@ -724,15 +723,16 @@ CDateTime CPVRTimers::GetNextEventTime(void) const
const CDateTime start = timer.StartAsUTC();
if ((start - idle) > now) {
- timerwakeuptime = start - prewakeup;
+ retVal = start - prewakeup;
} else {
- timerwakeuptime = now + idle;
+ retVal = now + idle;
}
}
/* check daily wake up */
if (dailywakup)
{
+ CDateTime dailywakeuptime;
dailywakeuptime.SetFromDBTime(g_guiSettings.GetString("pvrpowermanagement.dailywakeuptime", false));
dailywakeuptime = dailywakeuptime.GetAsUTCDateTime();
@@ -746,8 +746,9 @@ CDateTime CPVRTimers::GetNextEventTime(void) const
const CDateTimeSpan oneDay(1,0,0,0);
dailywakeuptime += oneDay;
}
+ if (dailywakeuptime < retVal)
+ retVal = dailywakeuptime;
}
- const CDateTime retVal((dailywakeuptime < timerwakeuptime) ? dailywakeuptime : timerwakeuptime);
return retVal;
}

View File

@ -0,0 +1,28 @@
#!/bin/sh
################################################################################
# Copyright (C) 2009-2010 OpenELEC.tv
# http://www.openelec.tv
#
# This Program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2, or (at your option)
# any later version.
#
# This Program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with OpenELEC.tv; see the file COPYING. If not, write to
# the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
# http://www.gnu.org/copyleft/gpl.html
################################################################################
if [ -f /sys/class/rtc/rtc0/wakealarm ]; then
logger -t setwakeup.sh "### Setting system wakeup time ###"
echo 0 > /sys/class/rtc/rtc0/wakealarm
echo $1 > /sys/class/rtc/rtc0/wakealarm
logger -t setwakeup.sh "### $(cat /proc/driver/rtc) ###"
fi

View File

@ -195,7 +195,7 @@ fi
# sleep 30 seconds before hw clock is synced
usleep 30000000
progress "syncing hardware clock with system clock"
/sbin/hwclock --systohc
/sbin/hwclock --systohc --utc
)&
fi