mirror of
https://github.com/VDR4Arch/vdr.git
synced 2023-10-10 13:36:52 +02:00
Added a fifth parameter to the 'shutdown' call that indicates the reason for this shutdown request
This commit is contained in:
parent
62c452561e
commit
78d1fe10a4
2
HISTORY
2
HISTORY
@ -856,3 +856,5 @@ Video Disk Recorder Revision History
|
|||||||
out should always be in sync.
|
out should always be in sync.
|
||||||
- Fixed handling the "Power" key in case Setup.MinUserInactivity is set to 0 to
|
- Fixed handling the "Power" key in case Setup.MinUserInactivity is set to 0 to
|
||||||
disable automatic shutdown.
|
disable automatic shutdown.
|
||||||
|
- Added a fifth parameter to the 'shutdown' call that indicates the reason for
|
||||||
|
this shutdown request (see INSTALL).
|
||||||
|
8
INSTALL
8
INSTALL
@ -127,7 +127,7 @@ active, the user has been inactive for at least MinUserInactivity minutes
|
|||||||
and the next timer event is at least MinEventTimeout minutes in the future
|
and the next timer event is at least MinEventTimeout minutes in the future
|
||||||
(see the Setup parameters in MANUAL).
|
(see the Setup parameters in MANUAL).
|
||||||
|
|
||||||
The command given in the '-s' option will be called with four parameters.
|
The command given in the '-s' option will be called with five parameters.
|
||||||
The first one is the time (in UTC) of the next timer event (as a time_t
|
The first one is the time (in UTC) of the next timer event (as a time_t
|
||||||
type number), and the second one is the number of seconds from the current
|
type number), and the second one is the number of seconds from the current
|
||||||
time until the next timer event. Your program can choose which one to use
|
time until the next timer event. Your program can choose which one to use
|
||||||
@ -153,6 +153,12 @@ contains the file name of the recording as defined in the timer (or an empty
|
|||||||
string if no timer is present). These can be used by the shutdown program to
|
string if no timer is present). These can be used by the shutdown program to
|
||||||
show that information on some display interface etc.
|
show that information on some display interface etc.
|
||||||
|
|
||||||
|
The fifth parameter indicates the reason why the shutdown was requested.
|
||||||
|
'0' means this is an automatic shutdown due to some timeout, while '1' means
|
||||||
|
that this is a user requested shutdown (resulting from pressing the "Power"
|
||||||
|
key). The shutdown program may use this information to decide whether or
|
||||||
|
not to actually perform the system shutdown.
|
||||||
|
|
||||||
If a timer is currently recording, the parameters will reflect the start
|
If a timer is currently recording, the parameters will reflect the start
|
||||||
time of that timer. This means that the first parameter will be a time in
|
time of that timer. This means that the first parameter will be a time in
|
||||||
the past, and the second parameter will be a negative number. This only
|
the past, and the second parameter will be a negative number. This only
|
||||||
|
7
vdr.c
7
vdr.c
@ -22,7 +22,7 @@
|
|||||||
*
|
*
|
||||||
* The project's page is at http://www.cadsoft.de/people/kls/vdr
|
* The project's page is at http://www.cadsoft.de/people/kls/vdr
|
||||||
*
|
*
|
||||||
* $Id: vdr.c 1.88 2001/11/03 11:48:21 kls Exp $
|
* $Id: vdr.c 1.89 2001/11/03 12:23:45 kls Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <getopt.h>
|
#include <getopt.h>
|
||||||
@ -503,11 +503,12 @@ int main(int argc, char *argv[])
|
|||||||
dsyslog(LOG_INFO, "next timer event at %s", ctime(&Next));
|
dsyslog(LOG_INFO, "next timer event at %s", ctime(&Next));
|
||||||
if (WatchdogTimeout > 0)
|
if (WatchdogTimeout > 0)
|
||||||
signal(SIGALRM, SIG_IGN);
|
signal(SIGALRM, SIG_IGN);
|
||||||
if (Interface->Confirm(tr("Press any key to cancel shutdown"), LastActivity == 1 ? 5 : SHUTDOWNWAIT, true)) {
|
bool UserShutdown = key == kPower;
|
||||||
|
if (Interface->Confirm(tr("Press any key to cancel shutdown"), UserShutdown ? 5 : SHUTDOWNWAIT, true)) {
|
||||||
int Channel = timer ? timer->channel : 0;
|
int Channel = timer ? timer->channel : 0;
|
||||||
const char *File = timer ? timer->file : "";
|
const char *File = timer ? timer->file : "";
|
||||||
char *cmd;
|
char *cmd;
|
||||||
asprintf(&cmd, "%s %ld %ld %d '%s'", Shutdown, Next, Delta, Channel, File);
|
asprintf(&cmd, "%s %ld %ld %d '%s' %d", Shutdown, Next, Delta, Channel, File, UserShutdown);
|
||||||
isyslog(LOG_INFO, "executing '%s'", cmd);
|
isyslog(LOG_INFO, "executing '%s'", cmd);
|
||||||
SystemExec(cmd);
|
SystemExec(cmd);
|
||||||
delete cmd;
|
delete cmd;
|
||||||
|
Loading…
Reference in New Issue
Block a user