Mailing List archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[vdr] Re: multiple cards, different diseqc configs



Hi,

I've attached the source-caps patch for vdr-1.3.16 to this mail. It adds the 
functionallity to assign sources to cards, so that you can tell vdr, that you 
ff-card can receive S13.0 and S19.2E and your budget-card S28.2E

Patch vdr, add these two to setup.conf:

SourceCaps = 1 S13.0 S19.2E
SoruceCaps = 2 S28.2E

If you add a switch to the bugdet card, you'll have to work around a 
limitation of diseqc.conf. At moment there is only a global diseqc.conf, but 
for more sophisticated setups like yours or mine, we need a per card 
diseqc.conf. Unfortunatly i don't have time at the moment to implement this, 
so you will have to find a diseqc-sequence for S13.0E, which will work for 
both switches.

AFAIK there is a "dummy" example in diseqc.conf.

Good luck,
Chris

On Sunday 12 December 2004 21:28, syrius.ml@no-log.org wrote:
> Hi,
>
> At the moment here is my setup:
> ff card #1 : connected to diseqc 1.0 switch (A=S13.0E & B=S19.2E)
> budget card #2: directly connected to lnb (S28.2E)
>
> diseqc is set to 1.
> diseqc.conf correctly describes how to switch to S13.0E or S19.2E.
> (perfectly works when vdr is launched with -D 0)
>
> But it doesn't when trying to watch a S28.2E channel.
> vdr complains about DiSEqC parameters not being found for that
> channel.
>
> ca field for S28.2E channels is correctly set.
>
> How could i resolve this problem ?
> Does a dummy diseqc code exist ? (I could then create a S28.2E entry in
> diseqc.conf with a dummy code)
>
> I'm pretty sure i saw a patch concerning this limitation, but I can't
> find it anymore.
>
> If I have to connect another diseqc switch to my budget card that
> would allow to have A=S28.2E and B=S13.0E, how would i configure vdr ?
diff -Naur vdr-1.3.16.orig/config.c vdr-1.3.16/config.c
--- vdr-1.3.16.orig/config.c	2004-10-31 17:17:39.000000000 +0100
+++ vdr-1.3.16/config.c	2004-11-20 14:50:53.783393496 +0100
@@ -14,6 +14,7 @@
 #include "interface.h"
 #include "plugin.h"
 #include "recording.h"
+#include "sources.h"
 
 // IMPORTANT NOTE: in the 'sscanf()' calls there is a blank after the '%d'
 // format characters in order to allow any number of blanks after a numeric
@@ -295,6 +296,7 @@
   MultiSpeedMode = 0;
   ShowReplayMode = 0;
   ResumeID = 0;
+  memset(SourceCaps, sizeof(SourceCaps), 0);
   CurrentChannel = -1;
   CurrentVolume = MAXVOLUME;
 }
@@ -360,6 +362,54 @@
   return false;
 }
 
+void cSetup::StoreSourceCaps(const char *Name)
+{
+  cSetupLine *l;
+  while ((l = Get(Name)) != NULL)
+        Del(l);
+
+  for(int i = 0; i < MAXDEVICES; i++)
+  {
+     char buffer[MAXPARSEBUFFER]={0,}, *q = buffer;
+     int j = 0;
+     while(SourceCaps[i][j] && j < MAXSOURCECAPS)
+     {
+         if(j==0) q += snprintf(buffer, sizeof(buffer), "%i ", i+1);
+         q += snprintf(q, sizeof(buffer) - (q-buffer), "%s ",
+            cSource::ToString(SourceCaps[i][j++]));
+     }
+     if(*buffer)
+         Store(Name, buffer, NULL, true);
+  }
+
+}
+
+bool cSetup::ParseSourceCaps(const char *Value)
+{
+  bool erg = true;
+  char *p, *t;
+  int d = strtol(Value, &p, 10), i = 0;
+  d--;
+  while(p<Value+strlen(Value))
+  {
+     if(*p==0) return erg;
+     if(isblank(*p)) ++p;
+     if(isalpha(*p))
+     {
+        int source = cSource::FromString(p);
+        if(source != cSource::stNone)
+            SourceCaps[d][i++] = source;
+        else
+            return false;
+        //printf("SourceCaps[%i][%i] = %i ... p = %s\n", d, i-1, SourceCaps[d][i-1], p);
+        while(!isblank(*p) && *p)
+            ++p;
+        if(i>MAXSOURCECAPS) return false;
+     }
+  }
+  return true;
+}
+
 void cSetup::StoreLanguages(const char *Name, int *Values)
 {
   char buffer[I18nNumLanguages * 4];
@@ -448,6 +498,7 @@
   else if (!strcasecmp(Name, "MultiSpeedMode"))      MultiSpeedMode     = atoi(Value);
   else if (!strcasecmp(Name, "ShowReplayMode"))      ShowReplayMode     = atoi(Value);
   else if (!strcasecmp(Name, "ResumeID"))            ResumeID           = atoi(Value);
+  else if (!strcasecmp(Name, "SourceCaps"))          return ParseSourceCaps(Value);
   else if (!strcasecmp(Name, "CurrentChannel"))      CurrentChannel     = atoi(Value);
   else if (!strcasecmp(Name, "CurrentVolume"))       CurrentVolume      = atoi(Value);
   else
@@ -508,6 +559,7 @@
   Store("MultiSpeedMode",     MultiSpeedMode);
   Store("ShowReplayMode",     ShowReplayMode);
   Store("ResumeID",           ResumeID);
+  StoreSourceCaps("SourceCaps");
   Store("CurrentChannel",     CurrentChannel);
   Store("CurrentVolume",      CurrentVolume);
 
diff -Naur vdr-1.3.16.orig/config.h vdr-1.3.16/config.h
--- vdr-1.3.16.orig/config.h	2004-11-02 18:20:27.000000000 +0100
+++ vdr-1.3.16/config.h	2004-11-20 14:50:53.789392584 +0100
@@ -198,6 +198,8 @@
 private:
   void StoreLanguages(const char *Name, int *Values);
   bool ParseLanguages(const char *Value, int *Values);
+  void StoreSourceCaps(const char *Name);
+  bool ParseSourceCaps(const char *Value);
   bool Parse(const char *Name, const char *Value);
   cSetupLine *Get(const char *Name, const char *Plugin = NULL);
   void Store(const char *Name, const char *Value, const char *Plugin = NULL, bool AllowMultiple = false);
@@ -249,6 +251,7 @@
   int MultiSpeedMode;
   int ShowReplayMode;
   int ResumeID;
+  int SourceCaps[MAXDEVICES][MAXSOURCECAPS];
   int CurrentChannel;
   int CurrentVolume;
   int __EndData__;
diff -Naur vdr-1.3.16.orig/device.c vdr-1.3.16/device.c
--- vdr-1.3.16.orig/device.c	2004-10-30 16:53:38.000000000 +0200
+++ vdr-1.3.16/device.c	2004-11-20 14:50:53.792392128 +0100
@@ -57,8 +57,10 @@
   for (int i = 0; i < MAXRECEIVERS; i++)
       receiver[i] = NULL;
 
-  if (numDevices < MAXDEVICES)
+  if (numDevices < MAXDEVICES) {
      device[numDevices++] = this;
+     SetSourceCaps(cardIndex);
+  }
   else
      esyslog("ERROR: too many devices!");
 }
@@ -194,6 +196,17 @@
   return d;
 }
 
+void cDevice::SetSourceCaps(int Index)
+{
+  for (int d = 0; d < numDevices; d++) {
+      if (Index < 0 || Index == device[d]->CardIndex()) {
+         for (int i = 0; i < MAXSOURCECAPS; i++)
+             device[d]->sourceCaps[i] = Setup.SourceCaps[device[d]->CardIndex()][i];
+         }
+      }
+}
+
+
 void cDevice::Shutdown(void)
 {
   for (int i = 0; i < numDevices; i++) {
diff -Naur vdr-1.3.16.orig/device.h vdr-1.3.16/device.h
--- vdr-1.3.16.orig/device.h	2004-10-30 16:49:56.000000000 +0200
+++ vdr-1.3.16/device.h	2004-11-20 14:50:53.795391672 +0100
@@ -22,6 +22,7 @@
 #include "tools.h"
 
 #define MAXDEVICES         16 // the maximum number of devices in the system
+#define MAXSOURCECAPS     128 // the maximum number of different sources per device
 #define MAXPIDHANDLES      16 // the maximum number of different PIDs per device
 #define MAXRECEIVERS       16 // the maximum number of receivers per device
 #define MAXVOLUME         255
@@ -97,6 +98,9 @@
          ///< given Priority.
          ///< See ProvidesChannel() for more information on how
          ///< priorities are handled, and the meaning of NeedsDetachReceivers.
+  static void SetSourceCaps(int Index = -1);
+         ///< Sets the SourceCaps of the given device according to the Setup data.
+         ///< By default the SourceCaps of all devices are set.         
   static void Shutdown(void);
          ///< Closes down all devices.
          ///< Must be called at the end of the program.
@@ -104,6 +108,8 @@
   static int nextCardIndex;
   int cardIndex;
 protected:
+  int sourceCaps[MAXSOURCECAPS];
+protected:
   cDevice(void);
   virtual ~cDevice();
   static int NextCardIndex(int n = 0);
diff -Naur vdr-1.3.16.orig/dvbdevice.c vdr-1.3.16/dvbdevice.c
--- vdr-1.3.16.orig/dvbdevice.c	2004-11-07 11:27:19.000000000 +0100
+++ vdr-1.3.16/dvbdevice.c	2004-11-20 14:50:53.799391064 +0100
@@ -703,9 +703,16 @@
 bool cDvbDevice::ProvidesSource(int Source) const
 {
   int type = Source & cSource::st_Mask;
+  if(type == cSource::stSat  && frontendType == FE_QPSK)
+  {
+      for(int i = 0;i<MAXSOURCECAPS; i++)
+          if(sourceCaps[i] == Source)
+              return true;
+      return false;
+  }
+  else
   return type == cSource::stNone
       || type == cSource::stCable && frontendType == FE_QAM
-      || type == cSource::stSat   && frontendType == FE_QPSK
       || type == cSource::stTerr  && frontendType == FE_OFDM;
   return true;
 }
diff -Naur vdr-1.3.16.orig/sources.c vdr-1.3.16/sources.c
--- vdr-1.3.16.orig/sources.c	2004-01-11 11:36:57.000000000 +0100
+++ vdr-1.3.16/sources.c	2004-11-20 14:50:53.801390760 +0100
@@ -68,7 +68,7 @@
      int pos = 0;
      bool dot = false;
      bool neg = false;
-     while (*++s) {
+     while (*++s && !isblank(*s)) {
            switch (toupper(*s)) {
              case '0' ... '9': pos *= 10;
                                pos += *s - '0';

Home | Main Index | Thread Index