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

Added the command line options '--lirc', '--rcu' and '--no-kbd'

This commit is contained in:
Klaus Schmidinger 2005-07-31 11:38:40 +02:00
parent 44a4d12117
commit d6b8a28329
11 changed files with 89 additions and 28 deletions

View File

@ -1292,6 +1292,8 @@ Olaf Titz <olaf@bigred.inka.de>
Darren Salt <linux@youmustbejoking.demon.co.uk> Darren Salt <linux@youmustbejoking.demon.co.uk>
for pointing out that the '-' and 'ö' characters need to be escaped in the man for pointing out that the '-' and 'ö' characters need to be escaped in the man
pages pages
for a patch that was used to add the command line options '--lirc', '--rcu' and
'--no-kbd'
Sean Carlos <seanc@libero.it> Sean Carlos <seanc@libero.it>
for translating OSD texts to the Italian language for translating OSD texts to the Italian language

View File

@ -3634,7 +3634,7 @@ Video Disk Recorder Revision History
replaced with the new one instead of adding the new entries (thanks to Andreas replaced with the new one instead of adding the new entries (thanks to Andreas
Regel). Regel).
2005-07-30: Version 1.3.28 2005-07-31: Version 1.3.28
- Added a sleep in cDvbPlayer::Action() in case there is no data to send to the - Added a sleep in cDvbPlayer::Action() in case there is no data to send to the
device, which avoids a busy loop on very fast machines (thanks to Martin Wache). device, which avoids a busy loop on very fast machines (thanks to Martin Wache).
@ -3648,3 +3648,5 @@ Video Disk Recorder Revision History
VPS timers to stop recording prematurely. VPS timers to stop recording prematurely.
- Avoiding duplicate components in EPG events when reading epg.data or in the - Avoiding duplicate components in EPG events when reading epg.data or in the
PUTE SVDRP command (thanks to Olaf Titz for reporting this one). PUTE SVDRP command (thanks to Olaf Titz for reporting this one).
- Added the command line options '--lirc', '--rcu' and '--no-kbd' to allow setting
the remote control at runtime (based on a patch by Darren Salt).

16
INSTALL
View File

@ -45,17 +45,23 @@ installed.
IMPORTANT: See "Configuration files" below for information on how IMPORTANT: See "Configuration files" below for information on how
========= to set up the configuration files at the proper location! ========= to set up the configuration files at the proper location!
By default the 'vdr' program can be controlled via the PC keyboard. If you have By default the 'vdr' program can be controlled via the PC keyboard.
an infrared remote control unit you can define the REMOTE macro to one of the If you want to disable control via the keyboard, you can add NO_KBD=1
following values in the 'make' call to activate the respective control mode: to the 'make' call, or use the '--no-kbd' option at runtime.
If you have an infrared remote control unit you can define the REMOTE macro
to one of the following values in the 'make' call to make the respective control
the default:
REMOTE=RCU control via the "Remote Control Unit" receiver REMOTE=RCU control via the "Remote Control Unit" receiver
(see http://www.cadsoft.de/vdr/remote.htm) (see http://www.cadsoft.de/vdr/remote.htm)
REMOTE=LIRC control via the "Linux Infrared Remote Control" REMOTE=LIRC control via the "Linux Infrared Remote Control"
(see http://www.lirc.org) (see http://www.lirc.org)
If you want to disable control via the PC keyboard, you can add NO_KBD=1 Alternatively you can use the '--rcu' or '--lirc' options at runtime.
to the 'make' call. These options accept an optional path to the remote control device,
which's defaults can be set via the RCU_DEVICE and LIRC_DEVICE macros,
respectively.
If your video directory will be on a VFAT partition, add the compile If your video directory will be on a VFAT partition, add the compile
time switch time switch

View File

@ -6,7 +6,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: Make.config.template 1.4 2005/05/14 10:32:33 kls Exp $ # $Id: Make.config.template 1.5 2005/07/31 11:35:28 kls Exp $
### The C compiler and options: ### The C compiler and options:
@ -25,3 +25,8 @@ BINDIR = /usr/local/bin
PLUGINDIR= ./PLUGINS PLUGINDIR= ./PLUGINS
PLUGINLIBDIR= $(PLUGINDIR)/lib PLUGINLIBDIR= $(PLUGINDIR)/lib
VIDEODIR = /video VIDEODIR = /video
### The remote control:
LIRC_DEVICE = /dev/lircd
RCU_DEVICE = /dev/ttyS1

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: Makefile 1.75 2005/05/14 10:32:13 kls Exp $ # $Id: Makefile 1.76 2005/07/31 11:20:20 kls Exp $
.DELETE_ON_ERROR: .DELETE_ON_ERROR:
@ -65,8 +65,14 @@ SMLFONT_ISO8859_15 = -adobe-helvetica-medium-r-normal--18-*-100-100-p-*-iso8859-
ifndef NO_KBD ifndef NO_KBD
DEFINES += -DREMOTE_KBD DEFINES += -DREMOTE_KBD
endif endif
ifdef REMOTE
DEFINES += -DREMOTE_$(REMOTE) DEFINES += -DREMOTE_$(REMOTE)
endif
LIRC_DEVICE ?= /dev/lircd
RCU_DEVICE ?= /dev/ttyS1
DEFINES += -DLIRC_DEVICE=\"$(LIRC_DEVICE)\" -DRCU_DEVICE=\"$(RCU_DEVICE)\"
DEFINES += -D_GNU_SOURCE DEFINES += -D_GNU_SOURCE

4
lirc.c
View File

@ -6,7 +6,7 @@
* *
* LIRC support added by Carsten Koch <Carsten.Koch@icem.de> 2000-06-16. * LIRC support added by Carsten Koch <Carsten.Koch@icem.de> 2000-06-16.
* *
* $Id: lirc.c 1.10 2005/01/14 14:18:42 kls Exp $ * $Id: lirc.c 1.11 2005/07/31 10:18:09 kls Exp $
*/ */
#include "lirc.h" #include "lirc.h"
@ -18,7 +18,7 @@
#define REPEATDELAY 350 // ms #define REPEATDELAY 350 // ms
#define KEYPRESSDELAY 150 // ms #define KEYPRESSDELAY 150 // ms
cLircRemote::cLircRemote(char *DeviceName) cLircRemote::cLircRemote(const char *DeviceName)
:cRemote("LIRC") :cRemote("LIRC")
,cThread("LIRC remote control") ,cThread("LIRC remote control")
{ {

4
lirc.h
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: lirc.h 1.2 2003/04/12 14:15:20 kls Exp $ * $Id: lirc.h 1.3 2005/07/31 10:18:15 kls Exp $
*/ */
#ifndef __LIRC_H #ifndef __LIRC_H
@ -19,7 +19,7 @@ private:
int f; int f;
virtual void Action(void); virtual void Action(void);
public: public:
cLircRemote(char *DeviceName); cLircRemote(const char *DeviceName);
virtual ~cLircRemote(); virtual ~cLircRemote();
virtual bool Ready(void); virtual bool Ready(void);
}; };

4
rcu.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: rcu.c 1.8 2004/12/19 18:06:00 kls Exp $ * $Id: rcu.c 1.9 2005/07/31 10:17:45 kls Exp $
*/ */
#include "rcu.h" #include "rcu.h"
@ -16,7 +16,7 @@
#define REPEATLIMIT 20 // ms #define REPEATLIMIT 20 // ms
#define REPEATDELAY 350 // ms #define REPEATDELAY 350 // ms
cRcuRemote::cRcuRemote(char *DeviceName) cRcuRemote::cRcuRemote(const char *DeviceName)
:cRemote("RCU") :cRemote("RCU")
,cThread("RCU remote control") ,cThread("RCU remote control")
{ {

4
rcu.h
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: rcu.h 1.3 2003/04/12 14:36:09 kls Exp $ * $Id: rcu.h 1.4 2005/07/31 10:18:00 kls Exp $
*/ */
#ifndef __RCU_H #ifndef __RCU_H
@ -37,7 +37,7 @@ private:
virtual void ChannelSwitch(const cDevice *Device, int ChannelNumber); virtual void ChannelSwitch(const cDevice *Device, int ChannelNumber);
virtual void Recording(const cDevice *Device, const char *Name); virtual void Recording(const cDevice *Device, const char *Name);
public: public:
cRcuRemote(char *DeviceName); cRcuRemote(const char *DeviceName);
virtual ~cRcuRemote(); virtual ~cRcuRemote();
virtual bool Ready(void); virtual bool Ready(void);
virtual bool Initialize(void); virtual bool Initialize(void);

15
vdr.1
View File

@ -8,7 +8,7 @@
.\" License as specified in the file COPYING that comes with the .\" License as specified in the file COPYING that comes with the
.\" vdr distribution. .\" vdr distribution.
.\" .\"
.\" $Id: vdr.1 1.13 2004/12/19 09:36:25 kls Exp $ .\" $Id: vdr.1 1.14 2005/07/31 10:49:35 kls Exp $
.\" .\"
.TH vdr 1 "19 Dec 2004" "1.3.18" "Video Disk Recorder" .TH vdr 1 "19 Dec 2004" "1.3.18" "Video Disk Recorder"
.SH NAME .SH NAME
@ -46,7 +46,7 @@ Read config files from directory \fIdir\fR
(default is to read them from the video directory). (default is to read them from the video directory).
.TP .TP
.B \-d, \-\-daemon .B \-d, \-\-daemon
Run in daemon mode. Run in daemon mode (implies \-\-no\-kbd).
.TP .TP
.BI \-D\ num ,\ \-\-device= num .BI \-D\ num ,\ \-\-device= num
Use only the given DVB device (\fInum\fR = 0, 1, 2...). Use only the given DVB device (\fInum\fR = 0, 1, 2...).
@ -75,9 +75,16 @@ Search for plugins in directory \fIdir\fR (default is ./PLUGINS/lib).
There can be several \fB\-L\fR options with different \fIdir\fR values. There can be several \fB\-L\fR options with different \fIdir\fR values.
Each of them will apply to the \fB\-P\fR options following it. Each of them will apply to the \fB\-P\fR options following it.
.TP .TP
.BI \-\-lirc[= path ]
Use a LIRC remote control device.
If \fIpath\fR is omitted, vdr uses \fI/dev/lircd\fR.
.TP
.B \-m, \-\-mute .B \-m, \-\-mute
Mute audio of the primary DVB device at startup. Mute audio of the primary DVB device at startup.
.TP .TP
.B \-\-no\-kbd
Don't use the keyboard as an input device.
.TP
.BI \-p\ port ,\ \-\-port= port .BI \-p\ port ,\ \-\-port= port
Use \fIport\fR for SVDRP. A value of \fB0\fR turns off SVDRP. Use \fIport\fR for SVDRP. A value of \fB0\fR turns off SVDRP.
The default SVDRP port is \fB2001\fR. The default SVDRP port is \fB2001\fR.
@ -101,6 +108,10 @@ particular options) you can use
(note the quotes around the asterisk to prevent wildcard expansion). (note the quotes around the asterisk to prevent wildcard expansion).
.TP .TP
.BI \-\-rcu[= path ]
Use a serial port remote control device.
If \fIpath\fR is omitted, vdr uses \fI/dev/ttyS1\fR.
.TP
.BI \-r\ cmd ,\ \-\-record= cmd .BI \-r\ cmd ,\ \-\-record= cmd
Call \fIcmd\fR before and after a recording. Call \fIcmd\fR before and after a recording.
.TP .TP

47
vdr.c
View File

@ -22,7 +22,7 @@
* *
* The project's page is at http://www.cadsoft.de/vdr * The project's page is at http://www.cadsoft.de/vdr
* *
* $Id: vdr.c 1.208 2005/06/18 11:19:07 kls Exp $ * $Id: vdr.c 1.209 2005/07/31 11:25:16 kls Exp $
*/ */
#include <getopt.h> #include <getopt.h>
@ -115,6 +115,19 @@ int main(int argc, char *argv[])
int WatchdogTimeout = DEFAULTWATCHDOG; int WatchdogTimeout = DEFAULTWATCHDOG;
const char *Terminal = NULL; const char *Terminal = NULL;
const char *Shutdown = NULL; const char *Shutdown = NULL;
bool UseKbd = true;
const char *LircDevice = NULL;
const char *RcuDevice = NULL;
#if !defined(REMOTE_KBD)
UseKbd = false;
#endif
#if defined(REMOTE_LIRC)
LircDevice = LIRC_DEVICE;
#elif defined(REMOTE_RCU)
RcuDevice = RCU_DEVICE;
#endif
cPluginManager PluginManager(DEFAULTPLUGINDIR); cPluginManager PluginManager(DEFAULTPLUGINDIR);
int ExitCode = 0; int ExitCode = 0;
@ -126,10 +139,13 @@ int main(int argc, char *argv[])
{ "epgfile", required_argument, NULL, 'E' }, { "epgfile", required_argument, NULL, 'E' },
{ "help", no_argument, NULL, 'h' }, { "help", no_argument, NULL, 'h' },
{ "lib", required_argument, NULL, 'L' }, { "lib", required_argument, NULL, 'L' },
{ "lirc", optional_argument, NULL, 'l' | 0x100 },
{ "log", required_argument, NULL, 'l' }, { "log", required_argument, NULL, 'l' },
{ "mute", no_argument, NULL, 'm' }, { "mute", no_argument, NULL, 'm' },
{ "no-kbd", no_argument, NULL, 'n' | 0x100 },
{ "plugin", required_argument, NULL, 'P' }, { "plugin", required_argument, NULL, 'P' },
{ "port", required_argument, NULL, 'p' }, { "port", required_argument, NULL, 'p' },
{ "rcu", optional_argument, NULL, 'r' | 0x100 },
{ "record", required_argument, NULL, 'r' }, { "record", required_argument, NULL, 'r' },
{ "shutdown", required_argument, NULL, 's' }, { "shutdown", required_argument, NULL, 's' },
{ "terminal", required_argument, NULL, 't' }, { "terminal", required_argument, NULL, 't' },
@ -194,8 +210,14 @@ int main(int argc, char *argv[])
return 2; return 2;
} }
break; break;
case 'l' | 0x100:
LircDevice = optarg ? : LIRC_DEVICE;
break;
case 'm': MuteAudio = true; case 'm': MuteAudio = true;
break; break;
case 'n' | 0x100:
UseKbd = false;
break;
case 'p': if (isnumber(optarg)) case 'p': if (isnumber(optarg))
SVDRPport = atoi(optarg); SVDRPport = atoi(optarg);
else { else {
@ -205,6 +227,9 @@ int main(int argc, char *argv[])
break; break;
case 'P': PluginManager.AddPlugin(optarg); case 'P': PluginManager.AddPlugin(optarg);
break; break;
case 'r' | 0x100:
RcuDevice = optarg ? : RCU_DEVICE;
break;
case 'r': cRecordingUserCommand::SetCommand(optarg); case 'r': cRecordingUserCommand::SetCommand(optarg);
break; break;
case 's': Shutdown = optarg; case 's': Shutdown = optarg;
@ -261,10 +286,15 @@ int main(int argc, char *argv[])
" if logging should be done to LOG_LOCALn instead of\n" " if logging should be done to LOG_LOCALn instead of\n"
" LOG_USER, add '.n' to LEVEL, as in 3.7 (n=0..7)\n" " LOG_USER, add '.n' to LEVEL, as in 3.7 (n=0..7)\n"
" -L DIR, --lib=DIR search for plugins in DIR (default is %s)\n" " -L DIR, --lib=DIR search for plugins in DIR (default is %s)\n"
" --lirc[=PATH] use a LIRC remote control device, attached to PATH\n"
" (default: %s)\n"
" -m, --mute mute audio of the primary DVB device at startup\n" " -m, --mute mute audio of the primary DVB device at startup\n"
" --no-kbd don't use the keyboard as an input device\n"
" -p PORT, --port=PORT use PORT for SVDRP (default: %d)\n" " -p PORT, --port=PORT use PORT for SVDRP (default: %d)\n"
" 0 turns off SVDRP\n" " 0 turns off SVDRP\n"
" -P OPT, --plugin=OPT load a plugin defined by the given options\n" " -P OPT, --plugin=OPT load a plugin defined by the given options\n"
" --rcu[=PATH] use a remote control device, attached to PATH\n"
" (default: %s)\n"
" -r CMD, --record=CMD call CMD before and after a recording\n" " -r CMD, --record=CMD call CMD before and after a recording\n"
" -s CMD, --shutdown=CMD call CMD to shutdown the computer\n" " -s CMD, --shutdown=CMD call CMD to shutdown the computer\n"
" -t TTY, --terminal=TTY controlling tty\n" " -t TTY, --terminal=TTY controlling tty\n"
@ -275,7 +305,9 @@ int main(int argc, char *argv[])
"\n", "\n",
DEFAULTEPGDATAFILENAME, DEFAULTEPGDATAFILENAME,
DEFAULTPLUGINDIR, DEFAULTPLUGINDIR,
LIRC_DEVICE,
DEFAULTSVDRPPORT, DEFAULTSVDRPPORT,
RCU_DEVICE,
VideoDirectory, VideoDirectory,
DEFAULTWATCHDOG DEFAULTWATCHDOG
); );
@ -470,15 +502,12 @@ int main(int argc, char *argv[])
cThemes::Load(Skins.Current()->Name(), Setup.OSDTheme, Skins.Current()->Theme()); cThemes::Load(Skins.Current()->Name(), Setup.OSDTheme, Skins.Current()->Theme());
// Remote Controls: // Remote Controls:
#if defined(REMOTE_RCU) if (RcuDevice)
new cRcuRemote("/dev/ttyS1"); new cRcuRemote(RcuDevice);
#elif defined(REMOTE_LIRC) if (LircDevice)
new cLircRemote("/dev/lircd"); new cLircRemote(LircDevice);
#endif if (!DaemonMode && HasStdin && UseKbd)
#if defined(REMOTE_KBD)
if (!DaemonMode && HasStdin)
new cKbdRemote; new cKbdRemote;
#endif
Interface->LearnKeys(); Interface->LearnKeys();
// External audio: // External audio: