Checking if there is a connection to the keyboard and if VDR is running in the foreground

This commit is contained in:
Klaus Schmidinger 2002-12-13 13:41:55 +01:00
parent b941f94486
commit 7d0596878b
4 changed files with 13 additions and 6 deletions

View File

@ -464,6 +464,7 @@ Gerhard Steiner <steiner@mail.austria.com>
Jaakko Hyvätti <jaakko@hyvatti.iki.fi> Jaakko Hyvätti <jaakko@hyvatti.iki.fi>
for translating OSD texts to the Finnish language for translating OSD texts to the Finnish language
for adding a check if there is a connection to the keyboard
Dennis Noordsij <dennis.noordsij@wiral.com> Dennis Noordsij <dennis.noordsij@wiral.com>
for reporting a small glitch when switching channels for reporting a small glitch when switching channels

View File

@ -1862,3 +1862,8 @@ Video Disk Recorder Revision History
(Thanks to Thomas Sailer for pointing out how to set the terminal parameters to (Thanks to Thomas Sailer for pointing out how to set the terminal parameters to
read from the keyboard). read from the keyboard).
- The 'ncurses' library is now only necessary when compiling VDR with DEBUG_OSD=1. - The 'ncurses' library is now only necessary when compiling VDR with DEBUG_OSD=1.
2002-12-13: Version 1.1.20
- Now checking if there is a connection to the keyboard (thanks to Jaakko Hyvätti)
and only creating the KBD remote control if VDR is running in the foreground.

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.143 2002/12/06 14:17:55 kls Exp $ * $Id: config.h 1.144 2002/12/13 13:41:55 kls Exp $
*/ */
#ifndef __CONFIG_H #ifndef __CONFIG_H
@ -19,7 +19,7 @@
#include "device.h" #include "device.h"
#include "tools.h" #include "tools.h"
#define VDRVERSION "1.1.19" #define VDRVERSION "1.1.20"
#define MAXPRIORITY 99 #define MAXPRIORITY 99
#define MAXLIFETIME 99 #define MAXLIFETIME 99

9
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.137 2002/12/08 13:34:39 kls Exp $ * $Id: vdr.c 1.138 2002/12/13 13:37:28 kls Exp $
*/ */
#include <getopt.h> #include <getopt.h>
@ -81,7 +81,7 @@ int main(int argc, char *argv[])
// Save terminal settings: // Save terminal settings:
struct termios savedTm; struct termios savedTm;
tcgetattr(STDIN_FILENO, &savedTm); bool HasStdin = tcgetpgrp(STDIN_FILENO) == getpid() && tcgetattr(STDIN_FILENO, &savedTm) == 0;
// Initiate locale: // Initiate locale:
@ -386,7 +386,7 @@ int main(int argc, char *argv[])
new cLircRemote("/dev/lircd"); new cLircRemote("/dev/lircd");
#endif #endif
#if defined(REMOTE_KBD) #if defined(REMOTE_KBD)
if (!DaemonMode) if (!DaemonMode && HasStdin)
new cKbdRemote; new cKbdRemote;
#endif #endif
Interface->LearnKeys(); Interface->LearnKeys();
@ -724,7 +724,8 @@ int main(int argc, char *argv[])
isyslog("exiting"); isyslog("exiting");
if (SysLogLevel > 0) if (SysLogLevel > 0)
closelog(); closelog();
tcsetattr(STDIN_FILENO, TCSANOW, &savedTm); if (HasStdin)
tcsetattr(STDIN_FILENO, TCSANOW, &savedTm);
if (cThread::EmergencyExit()) { if (cThread::EmergencyExit()) {
esyslog("emergency exit!"); esyslog("emergency exit!");
return 1; return 1;