[vdr] VDR continuously initializing CAM

Tuomas Jormola tjormola at cc.hut.fi
Tue Apr 8 10:25:25 CEST 2008


Hi,

I forgot to post this earlier, but in the attachment you'll find logs  
of this issue on my system. I modified the code like this:

eModuleStatus cCamSlot::ModuleStatus(void)
{
   cMutexLock MutexLock(&mutex);
   eModuleStatus ms = ciAdapter ? ciAdapter->ModuleStatus(slotIndex) :  
msNone;
   isyslog("CAM DEBUG: ms: %d resetTime: %d", ms, resetTime);
   if (resetTime) {
      if (ms <= msReset) {
         isyslog("CAM DEBUG: ms le msReset");
         if (time(NULL) - resetTime < MODULE_RESET_TIMEOUT) {
            isyslog("CAM DEBUG: return msReset");
            return msReset;
         }
      }
      isyslog("CAM DEBUG: resetTime zero");
      resetTime = 0;
   }
   return ms;
}

btw. it looks like a bug crept into Arthur's code below. After
if (time(NULL) - resetTime < MODULE_RESET_TIMEOUT)
if this if expression evaluates true, only the debug message is  
printed, and return msReset is executed always due to missing  
brackets. Intendation of the closing brackets of the if blocks in the  
original piece of code seem to be incorrect, which makes it difficult  
to spot things like this.

Tuomas Jormola

On 7 Apr 2008, at 19:12, Klaus Schmidinger wrote:
> On 04/07/08 08:34, Arthur Konovalov wrote:
>> Well,
>> I'm not big guru of debugging.
>> I made following changes to mentioned part of code:
>>
>> eModuleStatus cCamSlot::ModuleStatus(void)
>> {
>>  cMutexLock MutexLock(&mutex);
>>  eModuleStatus ms = ciAdapter ? ciAdapter->ModuleStatus(slotIndex) :
>> msNone;
>>  isyslog("ms: %d", ms); //AKO
>>  isyslog("resetTime1: %d", resetTime); //AK
>>  if (resetTime) {
>>  isyslog("resetTime2: %d", resetTime); //AK
>>     if (ms <= msReset) {
>>  isyslog("resetTime3: %d", resetTime); //AK
>>        if (time(NULL) - resetTime < MODULE_RESET_TIMEOUT)
>>  isyslog("resetTime4: %d", resetTime); //AK
>>           return msReset;
>>        }
>>     resetTime = 0;
>>     }
>>  return ms;
>> }
>>
>> Log file attached. I suspect that additional instructions are  
>> welcome.
>
> At this point...
>
>> Apr  7 09:06:41 vdr vdr: [4862] ms: 3
>> Apr  7 09:06:41 vdr vdr: [4862] resetTime1: 0
>> Apr  7 09:06:41 vdr vdr: [4862] ms: 2
>
> ...the module status changed from 3 ("ready") to 2 ("present").
> The module status is retrieved from the driver in  
> cDvbCiAdapter::ModuleStatus():
>
> eModuleStatus cDvbCiAdapter::ModuleStatus(int Slot)
> {
>   ca_slot_info_t sinfo;
>   sinfo.num = Slot;
>   if (ioctl(fd, CA_GET_SLOT_INFO, &sinfo) != -1) {
>      if ((sinfo.flags & CA_CI_MODULE_READY) != 0)
>         return msReady;
>      else if ((sinfo.flags & CA_CI_MODULE_PRESENT) != 0)
>         return msPresent;
>      }
>   else
>      esyslog("ERROR: can't get info of CAM slot %d on device %d:  
> %m", Slot, device->DeviceNumber());
>   return msNone;
> }
>
> So for some reason the sinfo.flags doesn't seem to have the  
> CA_CI_MODULE_READY
> flag set any longer.
>
>
> Klaus
>
> _______________________________________________
> vdr mailing list
> vdr at linuxtv.org
> http://www.linuxtv.org/cgi-bin/mailman/listinfo/vdr

-------------- next part --------------
A non-text attachment was scrubbed...
Name: cam-debug.log
Type: application/octet-stream
Size: 91032 bytes
Desc: not available
Url : http://www.linuxtv.org/pipermail/vdr/attachments/20080408/bda52e93/attachment-0001.obj 
-------------- next part --------------



More information about the vdr mailing list