Mailing List archive

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

[vdr] Re: CAM-Error: Read failed



-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Am Sonntag, 25. Mai 2003 12:01 schrieben Sie:
> Patrick Maier wrote:
> > Hi,
> > I've tested the new vdr-1.1.32 with the driver linux-dvb.2003-05-10
> > All works fine but on encrypted channels video and audio is fine for
> > about 1 or 2 minutes and then the video and audio stopps for about 15
> > seconds and then video and audio resumes for another 1 or 2 minutes and
> > then stopps again.....
> >
> > on the syslog there are entries:
> > May 19 22:56:28 dago vdr[1824]: ERROR: CAM: Read failed: slot 0, tcid 1
> > May 19 22:56:38 dago vdr[1824]: CAM: Irdeto SE       , 01, 0602, 1702
> > May 19 22:57:30 dago vdr[1824]: ERROR: CAM: Read failed: slot 0, tcid 1
> > May 19 22:57:41 dago vdr[1824]: CAM: Irdeto SE       , 01, 0602, 1702
> > ...
> >
> > then I've enabled debugging like described in the cams.txt and thats the
> > output when the video stopps:
> >
> > http://www.djdagobert.com/cam-error.txt
>
> That's what happens with some CAMs, but I haven't been able to find
> out what exactly causes this, since it doesn't happen with my CAM here
> (at least not frequently enough to do serious debugging - I do have this
> like once a day or so). You may want to try the "-icam" firmware (see
> DVB/driver/av7110/README-firmware).
>
> Klaus
I've made a patch for my own.
This patch reimplements the ci stopping syntax for 1.1.32 and disables the ci 
connection after 30 seconds. Also it does an emergency restart if cam fails.
For me it works fine, probably it's usefull for you, too.
Ciao
- -- 
- ------------------------
Currently used Version: GnuPG V1.2.2
PGP-Key: http://www.afisys.net/keys/andreas.pub.key
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.2 (GNU/Linux)

iD8DBQE+0K2UutDvSyBZadQRAlMwAKConCM3Zjb7toRrkgu9sI83DC1tlwCgg0ZG
B1o3vHHKBdi3D3hQtkvijVU=
=Y3m1
-----END PGP SIGNATURE-----
diff -Nru vdr-1.1.32/ci.c vdr-1.1.32-1/ci.c
--- vdr-1.1.32/ci.c	2003-04-20 11:52:45.000000000 +0200
+++ vdr-1.1.32-1/ci.c	2003-05-25 12:44:17.000000000 +0200
@@ -362,6 +362,7 @@
      }
   else {
      esyslog("ERROR: CAM: Read failed: slot %d, tcid %d\n", slot, tcid);
+     cThread::EmergencyExit(true);
      Init(-1, slot, tcid);
      }
   return lastResponse;
@@ -1290,6 +1291,7 @@
   numSlots = NumSlots;
   newCaSupport = false;
   hasUserIO = false;
+  enabled = true;
   for (int i = 0; i < MAX_CI_SESSION; i++)
       sessions[i] = NULL;
   tpl = new cCiTransportLayer(Fd, numSlots);
@@ -1445,6 +1447,8 @@
 
 bool cCiHandler::Process(void)
 {
+  if (!enabled)
+     return false;
   bool result = true;
   cMutexLock MutexLock(&mutex);
   for (int Slot = 0; Slot < numSlots; Slot++) {
diff -Nru vdr-1.1.32/ci.h vdr-1.1.32-1/ci.h
--- vdr-1.1.32/ci.h	2003-04-20 11:21:23.000000000 +0200
+++ vdr-1.1.32-1/ci.h	2003-05-25 12:44:17.000000000 +0200
@@ -80,6 +80,7 @@
 private:
   cMutex mutex;
   int numSlots;
+  bool enabled;
   bool newCaSupport;
   bool hasUserIO;
   cCiSession *sessions[MAX_CI_SESSION];
@@ -97,6 +98,8 @@
 public:
   ~cCiHandler();
   static cCiHandler *CreateCiHandler(const char *FileName);
+  void SetEnabled(bool Enabled) { enabled = Enabled; }
+  bool IsEnabled(void) { return enabled; }
   int NumSlots(void) { return numSlots; }
   bool Process(void);
   bool HasUserIO(void) { return hasUserIO; }
diff -Nru vdr-1.1.32/dvbdevice.c vdr-1.1.32-1/dvbdevice.c
--- vdr-1.1.32/dvbdevice.c	2003-05-03 16:03:20.000000000 +0200
+++ vdr-1.1.32-1/dvbdevice.c	2003-05-25 12:44:17.000000000 +0200
@@ -74,6 +74,7 @@
   const char *diseqcCommands;
   bool active;
   time_t startTime;
+  time_t ciTime;
   eTunerStatus tunerStatus;
   cMutex mutex;
   cCondVar newSet;
@@ -97,6 +98,7 @@
   active = false;
   tunerStatus = tsIdle;
   startTime = time(NULL);
+  ciTime = time(NULL);
   Start();
 }
 
@@ -246,6 +248,21 @@
   dsyslog("tuner thread started on device %d (pid=%d)", cardIndex + 1, getpid());
   active = true;
   while (active) {
+	if ( ciTime == 0 && (ciHandler->IsEnabled() == true ))
+	{
+	    ciTime = time(NULL);
+	    isyslog("citime set!");
+	} else if( ciTime != 0 && (ciHandler && (time(NULL) - ciTime >= 40)) && ciHandler->IsEnabled() == true && tunerStatus >= tsLocked)
+	{
+	    ciHandler->SetEnabled(false);
+	    ciTime = 0;
+	    isyslog("ci stoped!");
+	} else if (ciHandler->IsEnabled() == false && tunerStatus <= tsSet)
+	{
+	    ciHandler->SetEnabled(true);
+	    ciTime = time(NULL);
+	    isyslog("ci startetd!");
+	}
         cMutexLock MutexLock(&mutex);
         if (tunerStatus == tsSet)
            tunerStatus = SetFrontend() ? tsTuned : tsIdle;
@@ -774,6 +791,8 @@
          CHECK(ioctl(fd_audio, AUDIO_SET_MUTE, false));
          if (siProcessor)
             siProcessor->SetStatus(true);
+	 if (ciHandler)
+            ciHandler->SetEnabled(true);
          break;
     case pmAudioVideo:
          if (playMode == pmNone)
@@ -782,6 +801,8 @@
     case pmAudioOnlyBlack:
          if (siProcessor)
             siProcessor->SetStatus(false);
+	 if (ciHandler)
+            ciHandler->SetEnabled(false);
          CHECK(ioctl(fd_video, VIDEO_SET_BLANK, true));
          CHECK(ioctl(fd_audio, AUDIO_SELECT_SOURCE, AUDIO_SOURCE_MEMORY));
          CHECK(ioctl(fd_audio, AUDIO_SET_AV_SYNC, PlayMode == pmAudioVideo));
@@ -792,6 +813,8 @@
     case pmAudioOnly:
          if (siProcessor)
             siProcessor->SetStatus(false);
+         if (ciHandler)
+            ciHandler->SetEnabled(false);
          CHECK(ioctl(fd_video, VIDEO_SET_BLANK, true));
          CHECK(ioctl(fd_audio, AUDIO_STOP, true));
          CHECK(ioctl(fd_audio, AUDIO_CLEAR_BUFFER));
@@ -803,6 +826,8 @@
     case pmExtern_THIS_SHOULD_BE_AVOIDED:
          if (siProcessor)
             siProcessor->SetStatus(false);
+         if (ciHandler)
+            ciHandler->SetEnabled(false);
          close(fd_video);
          close(fd_audio);
          fd_video = fd_audio = -1;
diff -Nru vdr-1.1.32/menu.c vdr-1.1.32-1/menu.c
--- vdr-1.1.32/menu.c	2003-05-16 14:40:12.000000000 +0200
+++ vdr-1.1.32-1/menu.c	2003-05-25 12:59:18.000000000 +0200
@@ -36,6 +36,7 @@
 
 #define CHNUMWIDTH  (numdigits(Channels.MaxNumber()) + 1)
 
+extern bool Addcutter( const char * Filename);
 // --- cMenuEditChanItem -----------------------------------------------------
 
 class cMenuEditChanItem : public cMenuEditIntItem {
@@ -3502,7 +3503,14 @@
            Interface->Info(tr("Editing process started"));
         }
      else
-        Interface->Error(tr("Editing process already active!"));
+    {
+
+	if (Addcutter(fileName))
+    	    Interface->Info(tr("Added to List!"));
+        else
+	    Interface->Error(tr("Editing process already active!"));
+
+     }
      ShowMode();
      }
 }
diff -Nru vdr-1.1.32/vdr.c vdr-1.1.32-1/vdr.c
--- vdr-1.1.32/vdr.c	2003-05-16 14:11:45.000000000 +0200
+++ vdr-1.1.32-1/vdr.c	2003-05-25 12:59:59.000000000 +0200
@@ -58,6 +58,8 @@
 #define SHUTDOWNWAIT   300 // seconds to wait in user prompt before automatic shutdown
 #define MANUALSTART    600 // seconds the next timer must be in the future to assume manual start
 
+bool Nextcutter(void);
+
 static int Interrupted = 0;
 
 static void SignalHandler(int signum)
@@ -87,6 +89,7 @@
   // Initiate locale:
 
   setlocale(LC_ALL, "");
+  time_t StartTime = time(NULL);
 
   // Command line options:
 
@@ -497,7 +500,7 @@
            time_t Now = time(NULL); // must do both following calls with the exact same time!
            cRecordControls::Process(Now);
            cTimer *Timer = Timers.GetMatch(Now);
-           if (Timer) {
+           if ( Timer && (time(NULL) - StartTime > 30)) {
               if (!cRecordControls::Start(Timer))
                  Timer->SetPending(true);
               }
@@ -708,6 +711,8 @@
                  Interface->Error(tr("Editing process failed!"));
               else
                  Interface->Info(tr("Editing process finished"));
+		if(Nextcutter())
+		    Interface->Info(tr("Editing process started from List"));
               }
            }
         if (!Interact && ((!cRecordControls::Active() && !cCutter::Active() && (!Interface->HasSVDRPConnection() || UserShutdown)) || ForceShutdown)) {
@@ -797,3 +802,69 @@
      }
   return 0;
 }
+
+bool Addcutter(const char *FileName)
+{
+    FILE *fd;
+
+    if((fd = fopen("/video/cutter.lst","a")))
+    {
+	fprintf( fd, "%s\n", FileName);
+	fclose( fd);
+	return true;
+    } else
+    {
+	return false;
+    }
+}
+
+bool Nextcutter(void)
+{
+    char	*linebuffer2 = NULL;
+    FILE	*fd;
+    FILE	*fd2;
+    int		i;
+    bool	ret;
+
+    ret = false;
+    if((void *)linebuffer2 = malloc( 1024))
+    {
+	if((fd = fopen("/video/cutter.lst","r+")))
+	{
+	    strcpy( linebuffer2, "");
+	    fscanf( fd, "%s\n", linebuffer2);
+	    if( strlen(linebuffer2))
+	    {
+		cCutter::Start(linebuffer2);
+		ret = true;
+	    }
+	    fclose(fd);
+	}
+	if((fd = fopen("/video/cutter.lst","r")))
+	{
+	    if((fd2 = fopen("/video/cutter2.lst","w+")))
+	    {
+		i = 0;
+		while(!feof(fd) && !ferror(fd))
+		{
+		    if( fscanf( fd, "%s", linebuffer2) != -1)
+		    {
+			fscanf( fd, "%*[^\n]");
+			if (i == 1)
+			{
+			    fprintf( fd2, "%s\n", linebuffer2);
+			} else
+			{
+			    i = 1;
+			}
+		    }
+		}
+		fclose(fd2);
+	    }
+	    fclose( fd);
+	    remove( "/video/cutter.lst");
+	    rename( "/video/cutter2.lst", "/video/cutter.lst");    
+	}
+    }
+    return ret;
+}

Home | Main Index | Thread Index