Mailing List archive

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

[vdr] Re: Fixed tuner lock detection



Am Samstag, 23. Oktober 2004 17:40 schrieb Dominique Simon:
> I still have the problems with picture from previous channel and sound from
> actual channel (sound with distortions) after zapping through channels.

Even worse:

Oct 23 19:45:10 linvdr user.debug vdr[1307]: receiver on device 1 thread ended 
(pid=1307, tid=856074)
Oct 23 19:45:10 linvdr user.debug vdr[455]: buffer stats: 0 (0%) used
Oct 23 19:45:10 linvdr user.info vdr[455]: switching to channel 16
Oct 23 19:45:11 linvdr syslog.err klogd: __av7110_send_fw_cmd: timeout waiting 
for COMMAND idle
Oct 23 19:45:11 linvdr syslog.warn klogd: av7110_send_fw_cmd error


The fw_cmd_idle error is back too :-(


I'll attach again the patch once posted on this mailinglist which cures my 
(and other peoples) fw_cmd_idle errors and "distortions from previous 
channel" errors

THANKS FOR YOUR EFFORTS TO WIPE THIS BUG OUT, Klaus! I know that the time will 
come when this bug is traced down ;)

Ciao, Dominique
--- dvbdevice.c.orig	2004-06-19 11:33:42.000000000 +0200
+++ dvbdevice.c	2004-07-22 21:34:18.000000000 +0200
@@ -35,7 +35,7 @@ extern "C" {
 
 #define DO_REC_AND_PLAY_ON_PRIMARY_DEVICE 1
 #define DO_MULTIPLE_RECORDINGS 1
-//#define WAIT_FOR_LOCK_AFTER_TUNING 1
+#define WAIT_FOR_LOCK_AFTER_TUNING 1
 
 #define DEV_VIDEO         "/dev/video"
 #define DEV_DVB_ADAPTER   "/dev/dvb/adapter"
@@ -241,6 +241,15 @@ bool cDvbTuner::SetFrontend(void)
          esyslog("ERROR: attempt to set channel with unknown DVB frontend type");
          return false;
     }
+  
+  /* discard stale events */
+  dvb_frontend_event event;
+  while (1)
+  {
+    if (ioctl(fd_frontend, FE_GET_EVENT, &event) == -1)
+      break;
+  }
+  
   if (ioctl(fd_frontend, FE_SET_FRONTEND, &Frontend) < 0) {
      esyslog("ERROR: frontend %d: %m", cardIndex);
      return false;
@@ -255,12 +264,14 @@ void cDvbTuner::Action(void)
         cMutexLock MutexLock(&mutex);
         if (tunerStatus == tsSet)
            tunerStatus = SetFrontend() ? tsTuned : tsIdle;
+        /*
         if (tunerStatus == tsTuned) {
            fe_status_t status = fe_status_t(0);
            CHECK(ioctl(fd_frontend, FE_READ_STATUS, &status));
            if (status & FE_HAS_LOCK)
               tunerStatus = tsLocked;
            }
+        */
         if (tunerStatus != tsIdle) {
            dvb_frontend_event event;
            if (ioctl(fd_frontend, FE_GET_EVENT, &event) == 0) {
@@ -269,6 +280,8 @@ void cDvbTuner::Action(void)
                  esyslog("ERROR: frontend %d was reinitialized - re-tuning", cardIndex);
                  continue;
                  }
+              if (event.status & FE_HAS_LOCK)
+                tunerStatus = tsLocked;
               }
            }
         if (ciHandler) {
@@ -293,7 +306,8 @@ void cDvbTuner::Action(void)
               tunerStatus = tsLocked;
            }
         // in the beginning we loop more often to let the CAM connection start up fast
-        newSet.Wait((ciHandler && (time(NULL) - startTime < 20)) ? 100 : 1000);
+	bool fast = (tunerStatus == tsTuned) || (ciHandler && (time(NULL) - startTime < 20));
+        newSet.Wait(fast ? 100 : 1000);
         }
 }
 

Home | Main Index | Thread Index