Diseqc switch question

Message ID 43B55E75.5030701@gmx.de
State New
Headers

Commit Message

Reinhard Nissl Dec. 30, 2005, 4:21 p.m. UTC
  Hi,

Mlists wrote:

> I'm running vdr 1.3.37 with a diseqc 2.0 switch.  The problem I seem to
> have is that switching between ports on the switch doesn't work cleanly.
> Often it will not switch and give me a black screen.
> 
> Can someone please confirm whether I have the right diseqc settings?
> This is what I have --
> 
> # EchoStar 7 - 119W - Port 1
> S119.0W 99999 V 11250 t v W15 [E0 10 38 F0]
> S119.0W 99999 H 11250 t V W15 [E0 10 38 F0]
> 
> # EchoStar 6/8 - 110W - Port 2
> S110.0W 99999 V 11250 t v W15 [E0 10 38 F4]
> S110.0W 99999 H 11250 t V W15 [E0 10 38 F4]

Hhm, they don't look wrong, but I must admit that I cannot access those 
satellites.

You may want to try the attached patch which repeats the DiSEqC message 
every 1000 ms until the tuner gets a lock on the signal. This should 
avoid the black screen with an additional delay of a little bit more 
then a second.

Bye.
  

Comments

Mlists Dec. 30, 2005, 4:55 p.m. UTC | #1
Reinhard Nissl wrote:

> Hi,
>
> Mlists wrote:
>
>> I'm running vdr 1.3.37 with a diseqc 2.0 switch.  The problem I seem to
>> have is that switching between ports on the switch doesn't work cleanly.
>> Often it will not switch and give me a black screen.
>>
>> Can someone please confirm whether I have the right diseqc settings?
>> This is what I have --
>>
>> # EchoStar 7 - 119W - Port 1
>> S119.0W 99999 V 11250 t v W15 [E0 10 38 F0]
>> S119.0W 99999 H 11250 t V W15 [E0 10 38 F0]
>>
>> # EchoStar 6/8 - 110W - Port 2
>> S110.0W 99999 V 11250 t v W15 [E0 10 38 F4]
>> S110.0W 99999 H 11250 t V W15 [E0 10 38 F4]
>
>
> Hhm, they don't look wrong, but I must admit that I cannot access 
> those satellites.
>
> You may want to try the attached patch which repeats the DiSEqC 
> message every 1000 ms until the tuner gets a lock on the signal. This 
> should avoid the black screen with an additional delay of a little bit 
> more then a second.
>

Wow, that patch seems to have done it!  Thanks!!

Norm
  

Patch

--- ../vdr-1.3.37-orig/dvbdevice.c	2005-11-26 14:23:11.000000000 +0100
+++ dvbdevice.c	2005-12-11 19:59:37.000000000 +0100
@@ -70,7 +70,7 @@  static int DvbOpen(const char *Name, int
 
 class cDvbTuner : public cThread {
 private:
-  enum eTunerStatus { tsIdle, tsSet, tsTuned, tsLocked };
+  enum eTunerStatus { tsIdle, tsSet, tsTuned, tsLocked, tsLockVanished };
   int fd_frontend;
   int cardIndex;
   fe_type_t frontendType;
@@ -130,6 +130,8 @@  void cDvbTuner::Set(const cChannel *Chan
 
 bool cDvbTuner::Locked(int TimeoutMs)
 {
+  // due to tsLockVanished, this method determines whether we got
+  // tsLocked at least once since the last tuning action (tsSet).
   bool isLocked = (tunerStatus >= tsLocked);
   if (isLocked || !TimeoutMs)
      return isLocked;
@@ -284,8 +286,12 @@  bool cDvbTuner::SetFrontend(void)
   return true;
 }
 
+#define DISEQC_TUNE_TO_RETUNE_TIMEOUT       1000 //ms
+#define DISEQC_LOST_LOCK_TO_RETUNE_TIMEOUT  1000 //ms
+
 void cDvbTuner::Action(void)
 {
+  cTimeMs Timer;
   dvb_frontend_event event;
   while (Running()) {
         bool hasEvent = GetFrontendEvent(event, 1);
@@ -298,9 +304,17 @@  void cDvbTuner::Action(void)
                if (hasEvent)
                   continue;
                tunerStatus = SetFrontend() ? tsTuned : tsIdle;
+               Timer.Set(DISEQC_TUNE_TO_RETUNE_TIMEOUT);
                continue;
           case tsTuned:
+               if (diseqcCommands && Timer.TimedOut()) { // DiSEqC tuning timed out
+                  tunerStatus = tsSet;
+                  diseqcCommands = NULL; // deep re-tuning (= resend DiSEqC commands)
+                  esyslog("ERROR: frontend %d timed out while tuning - re-tuning", cardIndex);
+                  continue;
+                  }
           case tsLocked:
+          case tsLockVanished:
                if (hasEvent) {
                   if (event.status & FE_REINIT) {
                      tunerStatus = tsSet;
@@ -310,13 +324,23 @@  void cDvbTuner::Action(void)
                      tunerStatus = tsLocked;
                      locked.Broadcast();
                      }
+                  else if (tunerStatus == tsLocked) { // trigger DiSEqC re-tuning
+                     tunerStatus = tsLockVanished;
+                     Timer.Set(DISEQC_LOST_LOCK_TO_RETUNE_TIMEOUT);
+                     }
+                  continue;
+                  }
+               else if (tunerStatus >= tsLockVanished && diseqcCommands && Timer.TimedOut()) { // DiSEqC tuning lost lock
+                  tunerStatus = tsSet;
+                  diseqcCommands = NULL; // deep re-tuning (= resend DiSEqC commands)
+                  esyslog("ERROR: frontend %d lost lock - re-tuning", cardIndex);
                   continue;
                   }
           }
 
         if (ciHandler)
            ciHandler->Process();
-        if (tunerStatus != tsTuned)
+        if (tunerStatus != tsTuned && tunerStatus != tsLockVanished)
            newSet.TimedWait(mutex, 1000);
         }
 }