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

Added device definitions to the diseqc.conf file format

This commit is contained in:
Klaus Schmidinger 2010-02-06 15:56:01 +01:00
parent 91115a64e4
commit 184db9ec8a
6 changed files with 57 additions and 11 deletions

View File

@ -6350,3 +6350,5 @@ Video Disk Recorder Revision History
-include $(VDRDIR)/Make.config -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.

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: 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" #include "diseqc.h"
@ -16,6 +16,11 @@
cDiseqc::cDiseqc(void) cDiseqc::cDiseqc(void)
{ {
devices = 0;
source = 0;
slof = 0;
polarization = 0;
lof = 0;
commands = NULL; commands = NULL;
parsing = false; parsing = false;
numCodes = 0; numCodes = 0;
@ -30,6 +35,21 @@ bool cDiseqc::Parse(const char *s)
{ {
bool result = false; bool result = false;
char *sourcebuf = NULL; 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); int fields = sscanf(s, "%a[^ ] %d %c %d %a[^\n]", &sourcebuf, &slof, &polarization, &lof, &commands);
if (fields == 4) if (fields == 4)
commands = NULL; //XXX Apparently sscanf() doesn't work correctly if the last %a argument results in an empty string 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; 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)) { 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)) if (p->Source() == Source && p->Slof() > Frequency && p->Polarization() == toupper(Polarization))
return p; return p;
} }

View File

@ -23,6 +23,10 @@
# #
# The 'command...' part is optional. # 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: # Examples:
# Full DiSEqC sequence: # Full DiSEqC sequence:

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: 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 #ifndef __DISEQC_H
@ -26,6 +26,7 @@ public:
}; };
enum { MaxDiseqcCodes = 6 }; enum { MaxDiseqcCodes = 6 };
private: private:
int devices;
int source; int source;
int slof; int slof;
char polarization; char polarization;
@ -48,6 +49,7 @@ public:
// it. Call Execute() repeatedly (always providing the same CurrentAction pointer) // it. Call Execute() repeatedly (always providing the same CurrentAction pointer)
// until it returns daNone. After a successful execution of all commands // until it returns daNone. After a successful execution of all commands
// *CurrentAction points to the value 0x00. // *CurrentAction points to the value 0x00.
int Devices(void) const { return devices; }
int Source(void) const { return source; } int Source(void) const { return source; }
int Slof(void) const { return slof; } int Slof(void) const { return slof; }
char Polarization(void) const { return polarization; } char Polarization(void) const { return polarization; }
@ -58,7 +60,7 @@ public:
class cDiseqcs : public cConfig<cDiseqc> { class cDiseqcs : public cConfig<cDiseqc> {
public: public:
cDiseqc *Get(int Source, int Frequency, char Polarization); cDiseqc *Get(int Device, int Source, int Frequency, char Polarization);
}; };
extern cDiseqcs Diseqcs; extern cDiseqcs Diseqcs;

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: 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" #include "dvbdevice.h"
@ -30,6 +30,7 @@
class cDvbTuner : public cThread { class cDvbTuner : public cThread {
private: private:
enum eTunerStatus { tsIdle, tsSet, tsTuned, tsLocked }; enum eTunerStatus { tsIdle, tsSet, tsTuned, tsLocked };
int device;
int fd_frontend; int fd_frontend;
int adapter, frontend; int adapter, frontend;
int tuneTimeout; int tuneTimeout;
@ -46,7 +47,7 @@ private:
bool SetFrontend(void); bool SetFrontend(void);
virtual void Action(void); virtual void Action(void);
public: 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(); virtual ~cDvbTuner();
const cChannel *GetTransponder(void) const { return &channel; } const cChannel *GetTransponder(void) const { return &channel; }
bool IsTunedTo(const cChannel *Channel) const; bool IsTunedTo(const cChannel *Channel) const;
@ -54,8 +55,9 @@ public:
bool Locked(int TimeoutMs = 0); 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; fd_frontend = Fd_Frontend;
adapter = Adapter; adapter = Adapter;
frontend = Frontend; frontend = Frontend;
@ -175,7 +177,7 @@ bool cDvbTuner::SetFrontend(void)
if (frontendType == SYS_DVBS || frontendType == SYS_DVBS2) { if (frontendType == SYS_DVBS || frontendType == SYS_DVBS2) {
unsigned int frequency = channel.Frequency(); unsigned int frequency = channel.Frequency();
if (Setup.DiSEqC) { 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) {
if (diseqc->Commands() && (!diseqcCommands || strcmp(diseqcCommands, diseqc->Commands()) != 0)) { if (diseqc->Commands() && (!diseqcCommands || strcmp(diseqcCommands, diseqc->Commands()) != 0)) {
cDiseqc::eDiseqcActions da; cDiseqc::eDiseqcActions da;
@ -420,7 +422,7 @@ cDvbDevice::cDvbDevice(int Adapter, int Frontend)
if (frontendType == SYS_DVBS2) if (frontendType == SYS_DVBS2)
numProvidedSystems++; numProvidedSystems++;
isyslog("frontend %d/%d provides %s (\"%s\")", adapter, frontend, DeliverySystems[frontendType], frontendInfo.name); 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 else
@ -612,7 +614,7 @@ bool cDvbDevice::ProvidesTransponder(const cChannel *Channel) const
return DeviceHooksProvidesTransponder(Channel); // source is sufficient for non sat return DeviceHooksProvidesTransponder(Channel); // source is sufficient for non sat
if (frontendType == SYS_DVBS && Channel->System() == SYS_DVBS2) if (frontendType == SYS_DVBS && Channel->System() == SYS_DVBS2)
return false; // requires modulation system which frontend doesn't provide 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 DeviceHooksProvidesTransponder(Channel);
return false; return false;
} }

11
vdr.5
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.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" .TH vdr 5 "10 Feb 2008" "1.6" "Video Disk Recorder Files"
.SH NAME .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 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 the entry would be used only to set the LOF to use for the given frequency range
and polarization. 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 .SS REMOTE CONTROL KEYS
The file \fIremote.conf\fR contains the key assignments for all remote control 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: units. Each line consists of one key assignment in the following format: