diff --git a/CONTRIBUTORS b/CONTRIBUTORS index 6c86b153..1d327e46 100644 --- a/CONTRIBUTORS +++ b/CONTRIBUTORS @@ -1187,6 +1187,7 @@ Marco Schl level from being set to a wrong value for fixing a possible hangup when ending a replay session while cIndexFile::CatchUp() is waiting + for improving resetting CAM connections Jürgen Schmitz for reporting a bug in displaying the current channel when switching via the SVDRP diff --git a/HISTORY b/HISTORY index 2d405771..619895a4 100644 --- a/HISTORY +++ b/HISTORY @@ -3578,9 +3578,10 @@ Video Disk Recorder Revision History - Added cThread::SetPriority() and using it in cSectionHandler::Action() to reduce the priority of the section handler threads (as suggested by Georg Acher). -2005-06-03: Version 1.3.26 +2005-06-04: Version 1.3.26 - Updated the Estonian OSD texts (thanks to Arthur Konovalov). - Updated the Finnish OSD texts (thanks to Rolf Ahrenberg). - Fixed handling 'summary.vdr' files with more than two empty lines (thanks to Christian Jacobsen for reporting this one). +- Improved resetting CAM connections (thanks to Marco Schlüßler). diff --git a/ci.c b/ci.c index 46b808ca..ff5203af 100644 --- a/ci.c +++ b/ci.c @@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: ci.c 1.23 2004/07/17 14:36:11 kls Exp $ + * $Id: ci.c 1.24 2005/06/04 11:57:05 kls Exp $ */ #include "ci.h" @@ -287,6 +287,7 @@ public: int RecvData(void); const uint8_t *Data(int &Length); //XXX Close() + void Reset(void); }; cCiTransportConnection::cCiTransportConnection(void) @@ -428,6 +429,11 @@ int cCiTransportConnection::Poll(void) return ERROR; } +void cCiTransportConnection::Reset(void) +{ + Init(-1, 0, 0); +} + // --- cCiTransportLayer ----------------------------------------------------- #define MAX_CI_CONNECT 16 // maximum possible value is 254 @@ -440,7 +446,7 @@ private: public: cCiTransportLayer(int Fd, int NumSlots); cCiTransportConnection *NewConnection(int Slot); - bool ResetSlot(int Slot); + bool ResetSlot(int Slot, bool Wait = false); bool ModuleReady(int Slot); cCiTransportConnection *Process(int Slot); }; @@ -451,6 +457,7 @@ cCiTransportLayer::cCiTransportLayer(int Fd, int NumSlots) numSlots = NumSlots; for (int s = 0; s < numSlots; s++) ResetSlot(s); + cCondWait::SleepMs(2000); } cCiTransportConnection *cCiTransportLayer::NewConnection(int Slot) @@ -467,10 +474,16 @@ cCiTransportConnection *cCiTransportLayer::NewConnection(int Slot) return NULL; } -bool cCiTransportLayer::ResetSlot(int Slot) +bool cCiTransportLayer::ResetSlot(int Slot, bool Wait) { + for (int i = 0; i < MAX_CI_CONNECT; i++) { + if (tc[i].State() != stIDLE && tc[i].Slot() == Slot) + tc[i].Reset(); + } dbgprotocol("Resetting slot %d...", Slot); if (ioctl(fd, CA_RESET, 1 << Slot) != -1) { + if (Wait) + cCondWait::SleepMs(2000); dbgprotocol("ok.\n"); return true; } @@ -1602,5 +1615,5 @@ bool cCiHandler::Reset(int Slot) { cMutexLock MutexLock(&mutex); CloseAllSessions(Slot); - return tpl->ResetSlot(Slot); + return tpl->ResetSlot(Slot, true); }