Upgrading from 1.4.7 to 1.7.0 : enabling #define

Message ID 481D813F.3050401@cadsoft.de
State New
Headers

Commit Message

Klaus Schmidinger May 4, 2008, 9:26 a.m. UTC
  On 05/04/08 10:23, Pierre-Yves Paranthoen (PERSO) wrote:
> Added in device.c debug output to cDevice::GetDevice(const cChannel 
> *Channel, int Priority, bool LiveView) :
>  
>  
> GetDevice 2 0 1 -1
> j = 1, i = 0, imp = 020C4C4B, Impact = FFFFFFFF
> device 0
> GetDevice 2 0 1 -1
> no usable CAM slots!
> ...

Looks like for some reason the CAM is not usable at this time.

Please apply the attched patch instead of the previous one.
It produces additional output and writes it into the syslog,
so that it will be in sync with the other log messages.

Klaus
  

Patch

--- device.c	2008/04/12 14:12:14	2.2
+++ device.c	2008/05/04 09:24:16
@@ -372,26 +372,35 @@ 
 
 cDevice *cDevice::GetDevice(const cChannel *Channel, int Priority, bool LiveView)
 {
+  dsyslog("GetDevice %d %d %d %d %04X", Channel->Number(), Priority, LiveView, avoidDevice ? avoidDevice->CardIndex() : -1, Channel->Ca());//XXX
   cDevice *AvoidDevice = avoidDevice;
   avoidDevice = NULL;
   // Collect the current priorities of all CAM slots that can decrypt the channel:
   int NumCamSlots = CamSlots.Count();
+  dsyslog("NumCamSlots = %d", NumCamSlots);//XXX
   int SlotPriority[NumCamSlots];
   int NumUsableSlots = 0;
   if (Channel->Ca() >= CA_ENCRYPTED_MIN) {
      for (cCamSlot *CamSlot = CamSlots.First(); CamSlot; CamSlot = CamSlots.Next(CamSlot)) {
          SlotPriority[CamSlot->Index()] = MAXPRIORITY + 1; // assumes it can't be used
          if (CamSlot->ModuleStatus() == msReady) {
+            dsyslog("CAM %d ready", CamSlot->Index());//XXX
             if (CamSlot->ProvidesCa(Channel->Caids())) {
+               dsyslog("CAM %d provides CA", CamSlot->Index());//XXX
                if (!ChannelCamRelations.CamChecked(Channel->GetChannelID(), CamSlot->SlotNumber())) {
                   SlotPriority[CamSlot->Index()] = CamSlot->Priority();
                   NumUsableSlots++;
+                  dsyslog("NumUsableSlots = %d", NumUsableSlots);//XXX
                   }
+               else dsyslog("ChannelCamRelations.CamChecked(%s, %d) = 0", *Channel->GetChannelID().ToString(), CamSlot->SlotNumber());//XXX
                }
             }
+         else dsyslog("CAM %d not ready", CamSlot->Index());//XXX
          }
      if (!NumUsableSlots)
+        {dsyslog("no usable CAM slots!");//XXX
         return NULL; // no CAM is able to decrypt this channel
+        }//XXX
      }
 
   bool NeedsDetachReceivers = false;
@@ -432,6 +441,7 @@ 
              imp <<= 1; imp |= NumUsableSlots ? 0 : device[i]->HasCi();                                              // avoid cards with Common Interface for FTA channels
              imp <<= 1; imp |= device[i]->HasDecoder();                                                              // avoid full featured cards
              imp <<= 1; imp |= NumUsableSlots ? !ChannelCamRelations.CamDecrypt(Channel->GetChannelID(), j + 1) : 0; // prefer CAMs that are known to decrypt this channel
+             dsyslog("j = %d, i = %d, imp = %08X, Impact = %08X", j, i, imp, Impact);//XXX
              if (imp < Impact) {
                 // This device has less impact than any previous one, so we take it.
                 Impact = imp;
@@ -446,6 +456,7 @@ 
          break; // no CAM necessary, so just one loop over the devices
       }
   if (d) {
+     dsyslog("device %d", d->CardIndex());//XXX
      if (NeedsDetachReceivers)
         d->DetachAllReceivers();
      if (s) {
@@ -460,6 +471,7 @@ 
      else if (d->CamSlot() && !d->CamSlot()->IsDecrypting())
         d->CamSlot()->Assign(NULL);
      }
+  else dsyslog("no device found");//XXX
   return d;
 }