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

New remote control key 'Power'

This commit is contained in:
Klaus Schmidinger 2001-09-01 11:44:08 +02:00
parent 63105a7842
commit dce6bb864b
9 changed files with 89 additions and 34 deletions

View File

@ -682,4 +682,5 @@ Video Disk Recorder Revision History
- Changed version number notation. - Changed version number notation.
- Implemented automatic shutdown (see INSTALL and MANUAL for details). - Implemented automatic shutdown (see INSTALL and MANUAL for details).
- New SVDRP command NEXT to show the next timer event. - New SVDRP command NEXT to show the next timer event.
- The new remote control key "Power" can be used to turn the VDR machine
off (this requires the presence of the '-s' option).

10
INSTALL
View File

@ -120,6 +120,12 @@ receives a SIGTERM when the computer is actually shut down. So in case
the shutdown fails, or the shutdown program for some reason decides not to the shutdown fails, or the shutdown program for some reason decides not to
perform a shutdown, VDR will stay up and running. perform a shutdown, VDR will stay up and running.
If there are currently no timers active, both parameters will be '0'.
In that case the program shall not set the hardware for automatic restart
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
parameter is '0'.
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
@ -140,6 +146,9 @@ that event. The 'sudo halt' command then shuts down the computer.
You will have to substitute both commands with whatever applies to your You will have to substitute both commands with whatever applies to your
particular hard- and software environment. particular hard- and software environment.
If the '-s' option is present, the VDR machine can be turned off by pressing
the "Power" key on the remote control.
Command line options: Command line options:
--------------------- ---------------------
@ -281,6 +290,7 @@ The default PC key assignments are:
Back 'End' in numeric block Back 'End' in numeric block
Red, Green, Yellow, Blue 'F1'..'F4' Red, Green, Yellow, Blue 'F1'..'F4'
0..9 '0'..'9' in top row 0..9 '0'..'9' in top row
Power 'P'
If you prefer different key assignments, or if the default doesn't work for If you prefer different key assignments, or if the default doesn't work for
your keyboard, simply delete the file 'keys-pc.conf' and restart 'vdr' to get your keyboard, simply delete the file 'keys-pc.conf' and restart 'vdr' to get

1
MANUAL
View File

@ -22,6 +22,7 @@ Video Disk Recorder User's Manual
Yellow - Eject DVD Delete Delete - Delete Skip +60s Yellow - Eject DVD Delete Delete - Delete Skip +60s
Blue - Resume Mark Mark(1) - Summary Stop Blue - Resume Mark Mark(1) - Summary Stop
0..9 Ch select - - - Numeric inp. - Editing 0..9 Ch select - - - Numeric inp. - Editing
Power Shutdown - - - - - -
(1) The "Mark" button in the "Timers" menu only works if sorting the timers (1) The "Mark" button in the "Timers" menu only works if sorting the timers
has been disabled in the "Setup" menu. has been disabled in the "Setup" menu.

View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and * See the main source file 'vdr.c' for copyright information and
* how to reach the author. * how to reach the author.
* *
* $Id: config.c 1.60 2001/08/31 13:46:26 kls Exp $ * $Id: config.c 1.61 2001/09/01 10:02:21 kls Exp $
*/ */
#include "config.h" #include "config.h"
@ -38,6 +38,7 @@ tKey keyTable[] = { // "Up" and "Down" must be the first two keys!
{ k7, "7", 0 }, { k7, "7", 0 },
{ k8, "8", 0 }, { k8, "8", 0 },
{ k9, "9", 0 }, { k9, "9", 0 },
{ kPower, "Power", 0 },
{ kNone, "", 0 }, { kNone, "", 0 },
}; };

View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and * See the main source file 'vdr.c' for copyright information and
* how to reach the author. * how to reach the author.
* *
* $Id: config.h 1.67 2001/09/01 07:15:26 kls Exp $ * $Id: config.h 1.68 2001/09/01 10:01:51 kls Exp $
*/ */
#ifndef __CONFIG_H #ifndef __CONFIG_H
@ -44,6 +44,7 @@ enum eKeys { // "Up" and "Down" must be the first two keys!
kYellow, kYellow,
kBlue, kBlue,
k0, k1, k2, k3, k4, k5, k6, k7, k8, k9, k0, k1, k2, k3, k4, k5, k6, k7, k8, k9,
kPower,
kNone, kNone,
// The following flags are OR'd with the above codes: // The following flags are OR'd with the above codes:
k_Repeat = 0x8000, k_Repeat = 0x8000,

29
i18n.c
View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and * See the main source file 'vdr.c' for copyright information and
* how to reach the author. * how to reach the author.
* *
* $Id: i18n.c 1.36 2001/08/31 15:37:05 kls Exp $ * $Id: i18n.c 1.37 2001/09/01 10:52:35 kls Exp $
* *
* Slovenian translations provided by Miha Setina <mihasetina@softhome.net> * Slovenian translations provided by Miha Setina <mihasetina@softhome.net>
* Italian translations provided by Alberto Carraro <bertocar@tin.it> * Italian translations provided by Alberto Carraro <bertocar@tin.it>
@ -385,6 +385,15 @@ const tPhrase Phrases[] = {
"Annuler les modifications?", "Annuler les modifications?",
"Avbryte redigering", "Avbryte redigering",
}, },
{ "Recording - shut down anyway?",
"Aufnahme läuft - trotzdem ausschalten?",
"", // TODO
"", // TODO
"", // TODO
"", // TODO
"", // TODO
"", // TODO
},
{ "Press any key to cancel shutdown", { "Press any key to cancel shutdown",
"Taste drücken um Shutdown abzubrechen", "Taste drücken um Shutdown abzubrechen",
"", // TODO "", // TODO
@ -667,6 +676,15 @@ const tPhrase Phrases[] = {
"Montage déjà en cours!", "Montage déjà en cours!",
"Redigeringsprosessen er allerede aktiv!", "Redigeringsprosessen er allerede aktiv!",
}, },
{ "Can't shutdown - option '-s' not given!",
"Shutdown unmöglich - Option '-s' fehlt!",
"", // TODO
"", // TODO
"", // TODO
"", // TODO
"", // TODO
"", // TODO
},
// Setup parameters: // Setup parameters:
{ "OSD-Language", { "OSD-Language",
"OSD-Sprache", "OSD-Sprache",
@ -1139,6 +1157,15 @@ const tPhrase Phrases[] = {
"Bleu", "Bleu",
"Blå", "Blå",
}, },
{ "Power",
"Ausschalten",
"", // TODO
"", // TODO
"", // TODO
"", // TODO
"", // TODO
"", // TODO
},
// Miscellaneous: // Miscellaneous:
{ "yes", { "yes",
"ja", "ja",

View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and * See the main source file 'vdr.c' for copyright information and
* how to reach the author. * how to reach the author.
* *
* $Id: interface.c 1.42 2001/09/01 07:30:37 kls Exp $ * $Id: interface.c 1.43 2001/09/01 10:33:03 kls Exp $
*/ */
#include "interface.h" #include "interface.h"
@ -356,7 +356,7 @@ void cInterface::QueryKeys(void)
WriteText(1, 5, tr("Press any key on the RC unit")); WriteText(1, 5, tr("Press any key on the RC unit"));
Flush(); Flush();
#ifndef REMOTE_KBD #ifndef REMOTE_KBD
unsigned char Code = 0; unsigned char Code = '0';
unsigned short Address; unsigned short Address;
#endif #endif
for (;;) { for (;;) {

Binary file not shown.

70
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.65 2001/09/01 08:57:11 kls Exp $ * $Id: vdr.c 1.66 2001/09/01 11:44:08 kls Exp $
*/ */
#define _GNU_SOURCE #define _GNU_SOURCE
@ -303,6 +303,7 @@ int main(int argc, char *argv[])
int PreviousChannel = cDvbApi::CurrentChannel(); int PreviousChannel = cDvbApi::CurrentChannel();
time_t LastActivity = 0; time_t LastActivity = 0;
int MaxLatencyTime = 0; int MaxLatencyTime = 0;
bool ForceShutdown = false;
if (WatchdogTimeout > 0) { if (WatchdogTimeout > 0) {
dsyslog(LOG_INFO, "setting watchdog timer to %d seconds", WatchdogTimeout); dsyslog(LOG_INFO, "setting watchdog timer to %d seconds", WatchdogTimeout);
@ -427,6 +428,18 @@ int main(int argc, char *argv[])
case kMenu: Menu = new cMenuMain(ReplayControl); break; case kMenu: Menu = new cMenuMain(ReplayControl); break;
// Viewing Control: // Viewing Control:
case kOk: LastChannel = -1; break; // forces channel display case kOk: LastChannel = -1; break; // forces channel display
// Power off:
case kPower: isyslog(LOG_INFO, "Power button pressed");
if (!Shutdown) {
Interface->Error(tr("Can't shutdown - option '-s' not given!"));
break;
}
if (cRecordControls::Active()) {
if (Interface->Confirm(tr("Recording - shut down anyway?")))
ForceShutdown = true;
}
LastActivity = 1; // not 0, see below!
break;
default: break; default: break;
} }
} }
@ -434,39 +447,40 @@ int main(int argc, char *argv[])
EITScanner.Process(); EITScanner.Process();
cVideoCutter::Active(); cVideoCutter::Active();
} }
if (!*Interact && !cRecordControls::Active()) { if (!*Interact && (!cRecordControls::Active() || ForceShutdown)) {
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) { if (Shutdown && (Setup.MinUserInactivity && Now - LastActivity > Setup.MinUserInactivity * 60 || ForceShutdown)) {
ForceShutdown = false;
cTimer *timer = Timers.GetNextActiveTimer(); cTimer *timer = Timers.GetNextActiveTimer();
if (timer) { time_t Next = timer ? timer->StartTime() : 0;
time_t Next = timer->StartTime(); time_t Delta = timer ? Next - Now : 0;
time_t Delta = Next - Now; if (timer)
dsyslog(LOG_INFO, "next timer event at %s", ctime(&Next)); dsyslog(LOG_INFO, "next timer event at %s", ctime(&Next));
if (Delta > Setup.MinEventTimeout * 60) { if (!Next || Delta > Setup.MinEventTimeout * 60) {
if (!LastActivity) { if (!LastActivity) {
// Apparently the user started VDR manually // Apparently the user started VDR manually
dsyslog(LOG_INFO, "assuming manual start of VDR"); dsyslog(LOG_INFO, "assuming manual start of VDR");
LastActivity = Now; LastActivity = Now;
continue; continue; // skip the rest of the housekeeping for now
}
if (WatchdogTimeout > 0)
signal(SIGALRM, SIG_IGN);
if (Interface->Confirm(tr("Press any key to cancel shutdown"), SHUTDOWNWAIT, true)) {
char *cmd;
asprintf(&cmd, "%s %ld %ld", Shutdown, Next, Delta);
isyslog(LOG_INFO, "executing '%s'", cmd);
system(cmd);
delete cmd;
}
else if (WatchdogTimeout > 0) {
alarm(WatchdogTimeout);
if (signal(SIGALRM, Watchdog) == SIG_IGN)
signal(SIGALRM, SIG_IGN);
}
LastActivity = Now; // don't try again too soon
} }
if (WatchdogTimeout > 0)
signal(SIGALRM, SIG_IGN);
if (Interface->Confirm(tr("Press any key to cancel shutdown"), LastActivity == 1 ? 5 : SHUTDOWNWAIT, true)) {
char *cmd;
asprintf(&cmd, "%s %ld %ld", Shutdown, Next, Delta);
isyslog(LOG_INFO, "executing '%s'", cmd);
system(cmd);
delete cmd;
}
else if (WatchdogTimeout > 0) {
alarm(WatchdogTimeout);
if (signal(SIGALRM, Watchdog) == SIG_IGN)
signal(SIGALRM, SIG_IGN);
}
LastActivity = Now; // don't try again too soon
continue; // skip the rest of the housekeeping for now
} }
} }
// Disk housekeeping: // Disk housekeeping: