VDR-1.3.37: retuning -- possibly a fix for VDSB

Message ID 439C244B.8050203@gmx.de
State New
Headers

Commit Message

Reinhard Nissl Dec. 11, 2005, 1:06 p.m. UTC
  Hi,

Thomas Rausch wrote:

>> So for now, I've no further requirements concerning any test. Maybe 
>> I'll modify and post my patch later with a new invitation for testing ;-)
> 
> I wait completely longingly for it. :-)

Attached you'll find the updated patch:
- retunes now only in DiSEqC setups.
- just a single timeout (1000 ms) for retuning/resending DiSEqC message.
- lost lock timeout increased (1000 ms).

As resending the DiSEqC message requires to retune afterwards, it is now 
possible, that you cannot tune to channels where tuning takes longer 
than 1000 ms. In such a (rare) case, please increase the 
DISEQC_TUNE_TO_RETUNE_TIMEOUT e. g. to 1500, 2000 or an even larger value.

Bye.
  

Comments

cedo n Dec. 11, 2005, 7:42 p.m. UTC | #1
Reinhard Nissl <rnissl@gmx.de> wrote:Attached you'll find the updated patch:
- retunes now only in DiSEqC setups.
- just a single timeout (1000 ms) for retuning/resending DiSEqC message.
- lost lock timeout increased (1000 ms).

As resending the DiSEqC message requires to retune afterwards, it is now 
possible, that you cannot tune to channels where tuning takes longer 
than 1000 ms. In such a (rare) case, please increase the 
DISEQC_TUNE_TO_RETUNE_TIMEOUT e. g. to 1500, 2000 or an even larger value.
Hi,
 
 Finally with this patch my motorized dish is working well.
 I had to increase DISEQC_TUNE_TO_RETUNE_TIMEOUT to 2000,
 because with 1000 dish didn't move at all until vdr is killed.
 
 thanx,
 cedo
 

			
---------------------------------
Yahoo! Shopping
 Find Great Deals on Holiday Gifts at Yahoo! Shopping
  
Reinhard Nissl Dec. 11, 2005, 8:28 p.m. UTC | #2
Hi,

cedo n wrote:

>> As resending the DiSEqC message requires to retune afterwards, it is now
>> possible, that you cannot tune to channels where tuning takes longer
>> than 1000 ms. In such a (rare) case, please increase the
>> DISEQC_TUNE_TO_RETUNE_TIMEOUT e. g. to 1500, 2000 or an even larger value.
> 
> Finally with this patch my motorized dish is working well.
> I had to increase DISEQC_TUNE_TO_RETUNE_TIMEOUT to 2000,
> because with 1000 dish didn't move at all until vdr is killed.

Please clearify: dish is "still"/"now" working well.

Was 2000 the smallest value that worked with your dish?

Bye.
  
Thomas Rausch Dec. 12, 2005, 9:41 p.m. UTC | #3
Reinhard Nissl schrieb:

> Was 2000 the smallest value that worked with your dish?

I switched DiSEqC on now. Also a value with 
DISEQC_TUNE_TO_RETUNE_TIMEOUT from 2000.  No improvement. I go then 
times on 4000.
  

Patch

--- ../vdr-1.3.37-orig/dvbdevice.c	2005-11-26 14:23:11.000000000 +0100
+++ dvbdevice.c	2005-12-11 13:11:22.000000000 +0100
@@ -284,8 +284,14 @@  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)
 {
+  enum { tssIdle, tssLostLock } TunerSubStatus = tssIdle;
+  cTimeMs Timer;
+
   dvb_frontend_event event;
   while (Running()) {
         bool hasEvent = GetFrontendEvent(event, 1);
@@ -298,8 +304,16 @@  void cDvbTuner::Action(void)
                if (hasEvent)
                   continue;
                tunerStatus = SetFrontend() ? tsTuned : tsIdle;
+               TunerSubStatus = tssIdle;
+               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:
                if (hasEvent) {
                   if (event.status & FE_REINIT) {
@@ -308,16 +322,27 @@  void cDvbTuner::Action(void)
                      }
                   if (event.status & FE_HAS_LOCK) {
                      tunerStatus = tsLocked;
+                     TunerSubStatus = tssIdle;
                      locked.Broadcast();
                      }
+                  else if (diseqcCommands && tunerStatus >= tsLocked) { // trigger DiSEqC re-tuning
+                     TunerSubStatus = tssLostLock;
+                     Timer.Set(DISEQC_LOST_LOCK_TO_RETUNE_TIMEOUT);
+                     }
+                  continue;
+                  }
+               else if (tunerStatus >= tsLocked && TunerSubStatus == tssLostLock && Timer.TimedOut()) {
+                  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)
-           newSet.TimedWait(mutex, 1000);
+        if (tunerStatus != tsTuned) // the tuners sub status may require faster reaction
+           newSet.TimedWait(mutex, (TunerSubStatus != tssIdle) ? 100 : 1000);
         }
 }