summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKlaus Schmidinger <vdr@tvdr.de>2010-02-06 15:56:01 +0100
committerKlaus Schmidinger <vdr@tvdr.de>2010-02-06 15:56:01 +0100
commit184db9ec8a9a5f14876a0049aa2dc36cb2e7a83b (patch)
tree423a0dba7f54ffe7ba287fce3ade6f2698dc9e70
parent91115a64e4cb8860aee4938b7359ad4dc35babe6 (diff)
downloadvdr-184db9ec8a9a5f14876a0049aa2dc36cb2e7a83b.tar.gz
vdr-184db9ec8a9a5f14876a0049aa2dc36cb2e7a83b.tar.bz2
Added device definitions to the diseqc.conf file format
-rw-r--r--HISTORY2
-rw-r--r--diseqc.c31
-rw-r--r--diseqc.conf4
-rw-r--r--diseqc.h6
-rw-r--r--dvbdevice.c14
-rw-r--r--vdr.511
6 files changed, 57 insertions, 11 deletions
diff --git a/HISTORY b/HISTORY
index 5f699db6..586f6a67 100644
--- a/HISTORY
+++ b/HISTORY
@@ -6350,3 +6350,5 @@ Video Disk Recorder Revision History
-include $(VDRDIR)/Make.config
------------------------------------------------------------
+- Added device definitions to the diseqc.conf file format, so that certain satellite
+ positions can be limited to a given list of devices.
diff --git a/diseqc.c b/diseqc.c
index 2bf6f008..205444cd 100644
--- a/diseqc.c
+++ b/diseqc.c
@@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
- * $Id: diseqc.c 2.1 2009/12/05 15:57:02 kls Exp $
+ * $Id: diseqc.c 2.2 2010/02/06 15:43:31 kls Exp $
*/
#include "diseqc.h"
@@ -16,6 +16,11 @@
cDiseqc::cDiseqc(void)
{
+ devices = 0;
+ source = 0;
+ slof = 0;
+ polarization = 0;
+ lof = 0;
commands = NULL;
parsing = false;
numCodes = 0;
@@ -30,6 +35,21 @@ bool cDiseqc::Parse(const char *s)
{
bool result = false;
char *sourcebuf = NULL;
+ if (*s && s[strlen(s) - 1] == ':') {
+ const char *p = s;
+ while (*p && *p != ':') {
+ char *t = NULL;
+ int d = strtol(p, &t, 10);
+ p = t;
+ if (0 < d && d < 32)
+ devices |= (1 << d - 1);
+ else {
+ esyslog("ERROR: invalid device number %d in '%s'", d, s);
+ return false;
+ }
+ }
+ return true;
+ }
int fields = sscanf(s, "%a[^ ] %d %c %d %a[^\n]", &sourcebuf, &slof, &polarization, &lof, &commands);
if (fields == 4)
commands = NULL; //XXX Apparently sscanf() doesn't work correctly if the last %a argument results in an empty string
@@ -126,9 +146,16 @@ cDiseqc::eDiseqcActions cDiseqc::Execute(char **CurrentAction)
cDiseqcs Diseqcs;
-cDiseqc *cDiseqcs::Get(int Source, int Frequency, char Polarization)
+cDiseqc *cDiseqcs::Get(int Device, int Source, int Frequency, char Polarization)
{
+ int Devices = 0;
for (cDiseqc *p = First(); p; p = Next(p)) {
+ if (p->Devices()) {
+ Devices = p->Devices();
+ continue;
+ }
+ if (Devices && !(Devices & (1 << Device - 1)))
+ continue;
if (p->Source() == Source && p->Slof() > Frequency && p->Polarization() == toupper(Polarization))
return p;
}
diff --git a/diseqc.conf b/diseqc.conf
index 3dfc7036..c9ab3ad3 100644
--- a/diseqc.conf
+++ b/diseqc.conf
@@ -23,6 +23,10 @@
#
# The 'command...' part is optional.
#
+# A line containing space separated integer numbers, terminated with a ':',
+# defines that any following DiSEqC sequences apply only to the given list
+# of device numbers.
+#
# Examples:
# Full DiSEqC sequence:
diff --git a/diseqc.h b/diseqc.h
index 602bdecb..1b9a41d2 100644
--- a/diseqc.h
+++ b/diseqc.h
@@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
- * $Id: diseqc.h 1.2 2002/12/07 13:54:02 kls Exp $
+ * $Id: diseqc.h 2.1 2010/02/06 15:14:42 kls Exp $
*/
#ifndef __DISEQC_H
@@ -26,6 +26,7 @@ public:
};
enum { MaxDiseqcCodes = 6 };
private:
+ int devices;
int source;
int slof;
char polarization;
@@ -48,6 +49,7 @@ public:
// it. Call Execute() repeatedly (always providing the same CurrentAction pointer)
// until it returns daNone. After a successful execution of all commands
// *CurrentAction points to the value 0x00.
+ int Devices(void) const { return devices; }
int Source(void) const { return source; }
int Slof(void) const { return slof; }
char Polarization(void) const { return polarization; }
@@ -58,7 +60,7 @@ public:
class cDiseqcs : public cConfig<cDiseqc> {
public:
- cDiseqc *Get(int Source, int Frequency, char Polarization);
+ cDiseqc *Get(int Device, int Source, int Frequency, char Polarization);
};
extern cDiseqcs Diseqcs;
diff --git a/dvbdevice.c b/dvbdevice.c
index 373628b6..6915de45 100644
--- a/dvbdevice.c
+++ b/dvbdevice.c
@@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
- * $Id: dvbdevice.c 2.26 2010/02/06 14:38:44 kls Exp $
+ * $Id: dvbdevice.c 2.27 2010/02/06 15:34:14 kls Exp $
*/
#include "dvbdevice.h"
@@ -30,6 +30,7 @@
class cDvbTuner : public cThread {
private:
enum eTunerStatus { tsIdle, tsSet, tsTuned, tsLocked };
+ int device;
int fd_frontend;
int adapter, frontend;
int tuneTimeout;
@@ -46,7 +47,7 @@ private:
bool SetFrontend(void);
virtual void Action(void);
public:
- cDvbTuner(int Fd_Frontend, int Adapter, int Frontend, fe_delivery_system FrontendType);
+ cDvbTuner(int Device, int Fd_Frontend, int Adapter, int Frontend, fe_delivery_system FrontendType);
virtual ~cDvbTuner();
const cChannel *GetTransponder(void) const { return &channel; }
bool IsTunedTo(const cChannel *Channel) const;
@@ -54,8 +55,9 @@ public:
bool Locked(int TimeoutMs = 0);
};
-cDvbTuner::cDvbTuner(int Fd_Frontend, int Adapter, int Frontend, fe_delivery_system FrontendType)
+cDvbTuner::cDvbTuner(int Device, int Fd_Frontend, int Adapter, int Frontend, fe_delivery_system FrontendType)
{
+ device = Device;
fd_frontend = Fd_Frontend;
adapter = Adapter;
frontend = Frontend;
@@ -175,7 +177,7 @@ bool cDvbTuner::SetFrontend(void)
if (frontendType == SYS_DVBS || frontendType == SYS_DVBS2) {
unsigned int frequency = channel.Frequency();
if (Setup.DiSEqC) {
- cDiseqc *diseqc = Diseqcs.Get(channel.Source(), channel.Frequency(), channel.Polarization());
+ cDiseqc *diseqc = Diseqcs.Get(device, channel.Source(), channel.Frequency(), channel.Polarization());
if (diseqc) {
if (diseqc->Commands() && (!diseqcCommands || strcmp(diseqcCommands, diseqc->Commands()) != 0)) {
cDiseqc::eDiseqcActions da;
@@ -420,7 +422,7 @@ cDvbDevice::cDvbDevice(int Adapter, int Frontend)
if (frontendType == SYS_DVBS2)
numProvidedSystems++;
isyslog("frontend %d/%d provides %s (\"%s\")", adapter, frontend, DeliverySystems[frontendType], frontendInfo.name);
- dvbTuner = new cDvbTuner(fd_frontend, adapter, frontend, frontendType);
+ dvbTuner = new cDvbTuner(DeviceNumber(), fd_frontend, adapter, frontend, frontendType);
}
}
else
@@ -612,7 +614,7 @@ bool cDvbDevice::ProvidesTransponder(const cChannel *Channel) const
return DeviceHooksProvidesTransponder(Channel); // source is sufficient for non sat
if (frontendType == SYS_DVBS && Channel->System() == SYS_DVBS2)
return false; // requires modulation system which frontend doesn't provide
- if (!Setup.DiSEqC || Diseqcs.Get(Channel->Source(), Channel->Frequency(), Channel->Polarization()))
+ if (!Setup.DiSEqC || Diseqcs.Get(DeviceNumber(), Channel->Source(), Channel->Frequency(), Channel->Polarization()))
return DeviceHooksProvidesTransponder(Channel);
return false;
}
diff --git a/vdr.5 b/vdr.5
index 4b2cb90b..9d974abf 100644
--- a/vdr.5
+++ b/vdr.5
@@ -8,7 +8,7 @@
.\" License as specified in the file COPYING that comes with the
.\" vdr distribution.
.\"
-.\" $Id: vdr.5 2.13 2010/01/31 12:59:50 kls Exp $
+.\" $Id: vdr.5 2.14 2010/02/06 15:52:38 kls Exp $
.\"
.TH vdr 5 "10 Feb 2008" "1.6" "Video Disk Recorder Files"
.SH NAME
@@ -452,6 +452,15 @@ l l.
There can be any number of actions in a line, including none at all - in which case
the entry would be used only to set the LOF to use for the given frequency range
and polarization.
+
+By default it is assumed that every DVB-S device can receive every satellite.
+If this is not the case in a particular setup, lines of the form
+
+\fB1 2 4:\fR
+
+may be inserted in the \fIdiseqc.conf\fR file, defining the devices that are able
+to receive the satellites following thereafter. In this case, only the devices
+1, 2 and 4 would be able to receive any satellites following this line.
.SS REMOTE CONTROL KEYS
The file \fIremote.conf\fR contains the key assignments for all remote control
units. Each line consists of one key assignment in the following format: