1
0
mirror of https://github.com/VDR4Arch/vdr.git synced 2023-10-10 13:36:52 +02:00

Improved handling of 'Power' key

This commit is contained in:
Klaus Schmidinger 2001-09-08 13:02:05 +02:00
parent 57b324cd42
commit c7bb0bb739
3 changed files with 17 additions and 5 deletions

View File

@ -727,3 +727,8 @@ Video Disk Recorder Revision History
is no DVB card that can access this channel). is no DVB card that can access this channel).
- Fixed toggling channels with the '0' key in case the "Ok" button has been - Fixed toggling channels with the '0' key in case the "Ok" button has been
pressed to display the current/next information. pressed to display the current/next information.
- Pressing the "Power" key now always initiates the shutdown sequence (after
user confirmation in case of a recording timer), event if there is currently
a menu or a replay session active. Note the additional remarks in INSTALL
regarding the values of the two parameters given to the shutdown program
in case of a currently recording timer.

View File

@ -126,6 +126,12 @@ and only perform the system shutdown. A program that uses the second parameter
to set the hardware for restart must therefore also check whether the first to set the hardware for restart must therefore also check whether the first
parameter is '0'. parameter is '0'.
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
the past, and the second parameter will be a negative number. This only
happens if the user presses the "Power" key while a timer is currently
recording.
Before the shutdown program is called, the user will be prompted to inform Before the shutdown program is called, the user will be prompted to inform
him that the system is about to shut down. If any remote control key is him that the system is about to shut down. If any remote control key is
pressed while this prompt is visible, the shutdown will be cancelled (and pressed while this prompt is visible, the shutdown will be cancelled (and

11
vdr.c
View File

@ -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.70 2001/09/08 12:15:05 kls Exp $ * $Id: vdr.c 1.71 2001/09/08 12:49:38 kls Exp $
*/ */
#define _GNU_SOURCE #define _GNU_SOURCE
@ -350,7 +350,7 @@ int main(int argc, char *argv[])
EITScanner.Activity(); EITScanner.Activity();
LastActivity = time(NULL); LastActivity = time(NULL);
} }
if (*Interact) { if (*Interact && key != kPower) {
switch ((*Interact)->ProcessKey(key)) { switch ((*Interact)->ProcessKey(key)) {
case osMenu: DELETENULL(Menu); case osMenu: DELETENULL(Menu);
Menu = new cMenuMain(ReplayControl); Menu = new cMenuMain(ReplayControl);
@ -434,6 +434,7 @@ int main(int argc, char *argv[])
case kOk: LastChannel = -1; break; // forces channel display case kOk: LastChannel = -1; break; // forces channel display
// Power off: // Power off:
case kPower: isyslog(LOG_INFO, "Power button pressed"); case kPower: isyslog(LOG_INFO, "Power button pressed");
DELETENULL(*Interact);
if (!Shutdown) { if (!Shutdown) {
Interface->Error(tr("Can't shutdown - option '-s' not given!")); Interface->Error(tr("Can't shutdown - option '-s' not given!"));
break; break;
@ -455,8 +456,7 @@ int main(int argc, char *argv[])
time_t Now = time(NULL); time_t Now = time(NULL);
if (Now - LastActivity > ACTIVITYTIMEOUT) { if (Now - LastActivity > ACTIVITYTIMEOUT) {
// Shutdown: // Shutdown:
if (Shutdown && (Setup.MinUserInactivity && Now - LastActivity > Setup.MinUserInactivity * 60 || ForceShutdown)) { if (Shutdown && Setup.MinUserInactivity && Now - LastActivity > Setup.MinUserInactivity * 60) {
ForceShutdown = false;
cTimer *timer = Timers.GetNextActiveTimer(); cTimer *timer = Timers.GetNextActiveTimer();
time_t Next = timer ? timer->StartTime() : 0; time_t Next = timer ? timer->StartTime() : 0;
time_t Delta = timer ? Next - Now : 0; time_t Delta = timer ? Next - Now : 0;
@ -470,7 +470,8 @@ int main(int argc, char *argv[])
else else
LastActivity = 1; LastActivity = 1;
} }
if (!Next || Delta > Setup.MinEventTimeout * 60) { if (!Next || Delta > Setup.MinEventTimeout * 60 || ForceShutdown) {
ForceShutdown = false;
if (timer) if (timer)
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)