Modified handling user inactivity in the shutdown handler to avoid a problem in case the system time is changed after VDR has been started

This commit is contained in:
Klaus Schmidinger 2013-02-18 10:41:43 +01:00
parent a88ca5d4e5
commit eda593934d
5 changed files with 32 additions and 17 deletions

View File

@ -1777,6 +1777,8 @@ Udo Richter <udo_richter@gmx.de>
for suggesting to shift editing marks that don't point to an I-frame towards the next I-frame
when a recording is played
for requesting to keep using relative paths when building plugins locally
for fixing a problem with detecting user inactivity in case the system time is
changed after VDR has been started
Sven Kreiensen <svenk@kammer.uni-hannover.de>
for his help in keeping 'channels.conf.terr' up to date
@ -3039,6 +3041,8 @@ S
handling of PCR values
for improving cutting MPEG-2 video
for pointing out that FindHeader() can also be used in cMpeg2Fixer::AdjTref()
for reporting a problem with detecting user inactivity in case the system time is
changed after VDR has been started
Peter Münster <pmlists@free.fr>
for fixing 'make install' to not overwrite existing configuration files

View File

@ -7649,3 +7649,6 @@ Video Disk Recorder Revision History
- Updated the Finnish OSD texts (thanks to Rolf Ahrenberg).
- Updated the Polish OSD texts (thanks to Marek Nazarko).
- Modified handling user inactivity in the shutdown handler to avoid a problem in case
the system time is changed after VDR has been started (thanks to Udo Richter, reported
by Sören Moch).

View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
* $Id: config.h 2.68 2013/02/17 15:12:21 kls Exp $
* $Id: config.h 2.69 2013/02/18 10:41:43 kls Exp $
*/
#ifndef __CONFIG_H
@ -27,8 +27,8 @@
// The plugin API's version number:
#define APIVERSION "1.7.38"
#define APIVERSNUM 10738 // Version * 10000 + Major * 100 + Minor
#define APIVERSION "1.7.39"
#define APIVERSNUM 10739 // Version * 10000 + Major * 100 + Minor
// When loading plugins, VDR searches them by their APIVERSION, which
// may be smaller than VDRVERSION in case there have been no changes to

View File

@ -6,7 +6,7 @@
*
* Original version written by Udo Richter <udo_richter@gmx.de>.
*
* $Id: shutdown.c 1.5 2008/02/24 10:29:00 kls Exp $
* $Id: shutdown.c 2.1 2013/02/18 10:33:26 kls Exp $
*/
#include "shutdown.h"
@ -117,7 +117,7 @@ void cShutdownHandler::CheckManualStart(int ManualStart)
else {
// Set inactive from now on
dsyslog("scheduled wakeup time in %ld minutes, assuming automatic start of VDR", Delta / 60);
SetUserInactive();
SetUserInactiveTimeout(-3, true);
}
}
@ -147,9 +147,14 @@ void cShutdownHandler::SetUserInactiveTimeout(int Seconds, bool Force)
activeTimeout = 0;
return;
}
if (Seconds < 0)
Seconds = Setup.MinUserInactivity * 60;
activeTimeout = time(NULL) + Seconds;
if (Seconds >= 0)
activeTimeout = time(NULL) + Seconds;
else if (Seconds == -1)
activeTimeout = time(NULL) + Setup.MinUserInactivity * 60;
else if (Seconds == -2)
activeTimeout = 0;
else if (Seconds == -3)
activeTimeout = 1;
}
bool cShutdownHandler::ConfirmShutdown(bool Interactive)

View File

@ -6,7 +6,7 @@
*
* Original version written by Udo Richter <udo_richter@gmx.de>.
*
* $Id: shutdown.h 1.1 2007/02/24 17:23:59 kls Exp $
* $Id: shutdown.h 2.1 2013/02/18 10:35:27 kls Exp $
*/
#ifndef __SHUTDOWN_H
@ -38,7 +38,7 @@ public:
class cShutdownHandler {
private:
time_t activeTimeout;
///< Time when VDR will become non-interactive. 0 means never.
///< Time when VDR will become non-interactive. 0 means never, 1 means unknown time ago.
time_t retry;
///< Time for retrying the shutdown.
char *shutdownCommand;
@ -73,15 +73,18 @@ public:
///< Check whether VDR is in interactive mode or non-interactive mode (waiting for shutdown).
///< AtTime checks whether VDR will probably be inactive at that time.
time_t GetUserInactiveTime(void) { return activeTimeout; }
///< Time when user will become non-inactive, or 0 if never.
///< Time when user will become non-inactive, or 0 if never, 1 if a long time ago
void SetUserInactiveTimeout(int Seconds = -1, bool Force = false);
///< Set the time when VDR will switch into non-interactive mode or power down.
///< -1 means Setup.MinUserInactivity in the future.
///< Otherwise, seconds in the future.
///< If MinUserInactivity = 0 and Force = false, Seconds is ignored and VDR will
///< stay interactive forever.
///< Set the time in the future when VDR will switch into non-interactive mode or power down.
///< Seconds >= 0 means that many seconds in the future.
///< Seconds = -1 means Setup.MinUserInactivity in the future.
///< Seconds = -2 means never.
///< Seconds = -3 means a long, unknown time ago.
///< Setup.MinUserInactivity = 0 will overrule this, unless Force = true is given.
///< If Setup.MinUserInactivity = 0 and Force = false, Seconds is ignored and VDR will
///< stay interactive forever (like Seconds = -2).
void SetUserInactive(void) { SetUserInactiveTimeout(0, true); }
///< Set VDR manually into non-interactive mode.
///< Set VDR manually into non-interactive mode from now on.
bool Retry(time_t AtTime = 0) { return retry <= (AtTime ? AtTime : time(NULL)); }
///< Check whether its time to re-try the shutdown.
///< AtTime checks whether VDR will probably be inactive at that time.