Moderator Control Panel ]

TBS6984 and vdr-sasc-ng

TBS6984 and vdr-sasc-ng

Postby djkiller » Mon Aug 29, 2011 4:29 am

Hello I have problem with this card and vdr-sasc-ng. I'm using Debian Squezze (2.6.32-5-amd64 #1 SMP Tue Jun 14 09:42:28 UTC 2011 x86_64 GNU/Linux) and last TBS drivers.

Compiling drivers and vdr-SASC-NG will be fine. The SASC-vdr-ng give the dvb-dir tbs way to drivers. After running vdr-ng-SASC everything looks fine, but when any manipulation with the virtual adapter, nothing happens. When you turn on debug dvbloopback get "dvbloopback: timeout waiting for userspace". Previously I used TeVii S470 and s2-liplian and there everything worked properly. Thanks for any feedback.
djkiller
 
Posts: 6
Joined: Mon Aug 29, 2011 4:23 am

Re: TBS6984 and vdr-sasc-ng

Postby steven » Mon Aug 29, 2011 8:50 am

Hi

are you sure you are using the latest driver from our download page? Please email euro_support@tbsdtv.com with the detailed information
, we will give you an answer as soon as possible.

Thanks
steven
 
Posts: 2240
Joined: Fri Aug 06, 2010 3:23 pm

Re: TBS6984 and vdr-sasc-ng

Postby djkiller » Sat Sep 03, 2011 6:52 pm

Thanks. I wrote them, but they can't help me. So I've progressed. I can scan and I can watch free channels. When I tune to a paid channel, SASC-NG communicates with phoenix reader and receives keys. But SASC-NG writes in the log "CA_SET_DESCR failed (Resource temporarily unavailable). Expect a black screen.".

Here I was still stuck, any advice? Thank you;)
djkiller
 
Posts: 6
Joined: Mon Aug 29, 2011 4:23 am

Re: TBS6984 and vdr-sasc-ng

Postby steven » Mon Sep 05, 2011 9:02 am

Hi

I have got that your problem is just the 'sasc-ng' configuration problem,just have more test maybe you can success , :D

Thanks
steven
 
Posts: 2240
Joined: Fri Aug 06, 2010 3:23 pm

Re: TBS6984 and vdr-sasc-ng

Postby nickfudge » Tue Sep 13, 2011 7:24 pm

There's a couple of problems. The SET_CA_DESCR error was a code bug, which was fixed a couple of days ago, so you need to fetch the latest sources. Having done that, you should find that encrypted channels will be decrypted, but then sasc-ng will likely lock-up.

I've written the following patch which will get you a stable picture when using sasc-ng's newcamd cardclient protocol -- I haven't bothered porting the patches to the other cardclient protocols because I'm still trying to improve the overall stability of sasc-ng. I'd push these patches upstream, but I've not got an e-mail address for the author.

Code: Select All Code
diff -r 7e4626c93174 cam.c
--- a/cam.c   Thu Sep 08 07:14:07 2011 +0800
+++ b/cam.c   Tue Sep 13 12:35:44 2011 +0100
@@ -65,6 +65,7 @@
 #define L_HEX_HOOK  LCLASS(L_HEX,32)
 #define L_HEX_ALL   LALL(L_HEX_HOOK)
 
+
 static const struct LogModule lm_hex = {
   (LMOD_ENABLE|L_HEX_ALL)&LOPT_MASK,
   (LMOD_ENABLE)&LOPT_MASK,
@@ -2277,13 +2278,21 @@
 
 void cCam::Tune(const cChannel *channel)
 {
-  cMutexLock lock(&camMutex);
-  if(source!=channel->Source() || transponder!=channel->Transponder()) {
-    source=channel->Source(); transponder=channel->Transponder();
-    PRINTF(L_CORE_PIDS,"%s: now tuned to source %x(%s) transponder %x",devId,source,*cSource::ToString(source),transponder);
+  bool stop = false;
+  {
+    cMutexLock lock(&camMutex);
+    if(source!=channel->Source() || transponder!=channel->Transponder()) {
+      source=channel->Source(); transponder=channel->Transponder();
+      PRINTF(L_CORE_PIDS,"%s: now tuned to source %x(%s) transponder %x",devId,source,*cSource::ToString(source),transponder);
+      stop = true;
+    } else {
+      PRINTF(L_CORE_PIDS,"%s: tune to same source/transponder",devId);
+    }
+  }
+
+  if (stop) {
     Stop();
-    }
-  else PRINTF(L_CORE_PIDS,"%s: tune to same source/transponder",devId);
+  }
 }
 
 void cCam::PostTune(void)
@@ -2500,7 +2509,7 @@
 
 void cCam::LogEcmStatus(const cEcmInfo *ecm, bool on)
 {
-  cMutexLock lock(&camMutex);
+  //cMutexLock lock(&camMutex);
   if(on) LogStartup();
   if(logger) logger->EcmStatus(ecm,on);
 }
@@ -2561,9 +2570,9 @@
 
 bool cCam::SetCaDescr(ca_descr_t *ca_descr, bool initial)
 {
-#ifndef SASC
   if(!softcsa || (fullts && ca_descr->index==0))
     return devplugin->SetCaDescr(device,ca_descr,initial);
+#ifndef SASC
   else if(decsa)
     return decsa->SetDescr(ca_descr,initial);
 #endif //!SASC
@@ -2572,9 +2581,9 @@
 
 bool cCam::SetCaPid(ca_pid_t *ca_pid)
 {
-#ifndef SASC
   if(!softcsa || (fullts && ca_pid->index==0))
     return devplugin->SetCaPid(device,ca_pid);
+#ifndef SASC
   else if(decsa)
     return decsa->SetCaPid(ca_pid);
 #endif //!SASC
@@ -2583,9 +2592,7 @@
 
 void cCam::DumpAV7110(void)
 {
-#ifndef SASC
   devplugin->DumpAV(device);
-#endif //!SASC
 }
 
 int cCam::GetFreeIndex(void)
diff -r 7e4626c93174 contrib/sasc-ng/dvblb_plugins/plugin_cam.c
--- a/contrib/sasc-ng/dvblb_plugins/plugin_cam.c   Thu Sep 08 07:14:07 2011 +0800
+++ b/contrib/sasc-ng/dvblb_plugins/plugin_cam.c   Tue Sep 13 12:35:44 2011 +0100
@@ -260,6 +260,7 @@
 
   if (sidmsg->calen == 0) {
     free_sidmsg(sidmsg);
+    msg->type = MSG_PROCESSED;
     return;
   }
   for(ch=Channels.First(); ch; ch=Channels.Next(ch)) {
@@ -280,6 +281,7 @@
         }
       }
       free_sidmsg(sidmsg);
+      msg->type = MSG_PROCESSED;
       return;
     }
   } else {
diff -r 7e4626c93174 contrib/sasc-ng/dvblb_plugins/plugin_ffdecsa.c
--- a/contrib/sasc-ng/dvblb_plugins/plugin_ffdecsa.c   Thu Sep 08 07:14:07 2011 +0800
+++ b/contrib/sasc-ng/dvblb_plugins/plugin_ffdecsa.c   Tue Sep 13 12:35:44 2011 +0100
@@ -123,11 +123,13 @@
           pthread_mutex_unlock(&csa->state_lock);
           return;
         }
+        pthread_mutex_lock(&csa->keylock);
         if(! csa->keyindex[index].valid) {
           csa->keyindex[index].valid = 1;
           csa->keyindex[index].status = 0;
           csa->keyindex[index].queued = 0;
         }
+        pthread_mutex_unlock(&csa->keylock);
         pop_entry_from_queue_l(pid_ll, &pidmap_empty_queue, struct pid, &list_lock);
         pid_ll->pid = pid;
         pid_ll->index = index;
@@ -146,7 +148,9 @@
           ll_find_elem(pid_ll, csa->pid_map, index, index, struct pid);
           if(pid_ll == NULL) {
             //no valid pids on this index
+            pthread_mutex_lock(&csa->keylock);
             csa->keyindex[index].status = 0;
+            pthread_mutex_unlock(&csa->keylock);
             if(list_empty(&csa->pid_map)) {
               //state = ENCRYPTED_NOT_READY;
               csa->state = NOT_ENCRYPTED;
diff -r 7e4626c93174 systems/cardclient/cc.c
--- a/systems/cardclient/cc.c   Thu Sep 08 07:14:07 2011 +0800
+++ b/systems/cardclient/cc.c   Tue Sep 13 12:35:44 2011 +0100
@@ -110,7 +110,7 @@
 
 bool cCardClient::SendMsg(const unsigned char *data, int len)
 {
-  if(!so.Connected() && !Login()) return false;
+  if(!so.Connected() /*&& !Login()*/) return false;
   if(so.Write(data,len)<0) {
     PRINTF(L_CC_CORE,"send error. reconnecting...");
     Logout();
@@ -121,7 +121,7 @@
 
 int cCardClient::RecvMsg(unsigned char *data, int len, int to)
 {
-  if(!so.Connected() && !Login()) return -1;
+  if(!so.Connected() /*&& !Login()*/) return -1;
   int n=so.Read(data,len,to);
   if(n<0) {
     if(errno==ETIMEDOUT && (len<0 || to==0)) return 0;
diff -r 7e4626c93174 systems/cardclient/newcamd.c
--- a/systems/cardclient/newcamd.c   Thu Sep 08 07:14:07 2011 +0800
+++ b/systems/cardclient/newcamd.c   Tue Sep 13 12:35:44 2011 +0100
@@ -472,9 +472,19 @@
 
 bool cCardClientNewCamd::ProcessECM(const cEcmInfo *ecm, const unsigned char *data, unsigned char *cw)
 {
-  cMutexLock lock(this);
-  if((!so.Connected() && !Login()) || !CanHandle(ecm->caId)) return false;
-  so.Flush();
+  if (!CanHandle(ecm->caId))
+    return false;
+  //{
+  //  cMutexLock lock(this);
+  // if((!so.Connected() && !Login()) || !CanHandle(ecm->caId)) return false;
+  // so.Flush();
+  //}
+  {
+    cMutexLock lock(this);
+    if (!so.Connected() && !Login())
+      return false;
+    so.Flush();
+  }
 
   struct CustomData cd;
   InitCustomData(&cd,(unsigned short)ecm->prgId,0);
@@ -502,7 +512,6 @@
 bool cCardClientNewCamd::ProcessEMM(int caSys, const unsigned char *data)
 {
   if(emmProcessing && emmAllowed) {
-    cMutexLock lock(this);
     cAssembleData ad(data);
     if(MatchAndAssemble(&ad,0,0)) {
       while((data=ad.Assembled())) {


Hope it helps.

Regards,

Nick
nickfudge
 
Posts: 4
Joined: Tue Sep 13, 2011 5:08 pm

Re: TBS6984 and vdr-sasc-ng

Postby Shortfuse » Thu Sep 15, 2011 3:10 am

djkiller Wrote:Hello I have problem with this card and vdr-sasc-ng. I'm using Debian Squezze (2.6.32-5-amd64 #1 SMP Tue Jun 14 09:42:28 UTC 2011 x86_64 GNU/Linux) and last TBS drivers.

Compiling drivers and vdr-SASC-NG will be fine. The SASC-vdr-ng give the dvb-dir tbs way to drivers. After running vdr-ng-SASC everything looks fine, but when any manipulation with the virtual adapter, nothing happens. When you turn on debug dvbloopback get "dvbloopback: timeout waiting for userspace". Previously I used TeVii S470 and s2-liplian and there everything worked properly. Thanks for any feedback.


Hi there, i have a 6981 and i'm having the same problem with the virtual adapter doing nothing.
Could you please tell me how you fixed that?

Thanks
Shortfuse
 
Posts: 3
Joined: Thu Sep 15, 2011 3:06 am

Re: TBS6984 and vdr-sasc-ng

Postby djkiller » Thu Sep 15, 2011 6:03 pm

Yes, open this tutorial http://www.buydvb.net/blog/guide-for-using-sasc-ng-to-read-smartcard-on-linux-ubuntu-tbs-card-phoenix-card-reader-tbs3102.html and apply linux-2.6.38-dvb-mutex.patch to drivers. If you have last vdr-sasc-ng from repo, don't apply vdr patch.
djkiller
 
Posts: 6
Joined: Mon Aug 29, 2011 4:23 am

Re: TBS6984 and vdr-sasc-ng

Postby djkiller » Thu Sep 15, 2011 6:24 pm

nickfudge Wrote:There's a couple of problems. The SET_CA_DESCR error was a code bug, which was fixed a couple of days ago, so you need to fetch the latest sources. Having done that, you should find that encrypted channels will be decrypted, but then sasc-ng will likely lock-up.

I've written the following patch which will get you a stable picture when using sasc-ng's newcamd cardclient protocol -- I haven't bothered porting the patches to the other cardclient protocols because I'm still trying to improve the overall stability of sasc-ng. I'd push these patches upstream, but I've not got an e-mail address for the author.

Code: Select All Code
diff -r 7e4626c93174 cam.c
--- a/cam.c   Thu Sep 08 07:14:07 2011 +0800
+++ b/cam.c   Tue Sep 13 12:35:44 2011 +0100
@@ -65,6 +65,7 @@
 #define L_HEX_HOOK  LCLASS(L_HEX,32)
 #define L_HEX_ALL   LALL(L_HEX_HOOK)
 
+
 static const struct LogModule lm_hex = {
   (LMOD_ENABLE|L_HEX_ALL)&LOPT_MASK,
   (LMOD_ENABLE)&LOPT_MASK,
@@ -2277,13 +2278,21 @@
 
 void cCam::Tune(const cChannel *channel)
 {
-  cMutexLock lock(&camMutex);
-  if(source!=channel->Source() || transponder!=channel->Transponder()) {
-    source=channel->Source(); transponder=channel->Transponder();
-    PRINTF(L_CORE_PIDS,"%s: now tuned to source %x(%s) transponder %x",devId,source,*cSource::ToString(source),transponder);
+  bool stop = false;
+  {
+    cMutexLock lock(&camMutex);
+    if(source!=channel->Source() || transponder!=channel->Transponder()) {
+      source=channel->Source(); transponder=channel->Transponder();
+      PRINTF(L_CORE_PIDS,"%s: now tuned to source %x(%s) transponder %x",devId,source,*cSource::ToString(source),transponder);
+      stop = true;
+    } else {
+      PRINTF(L_CORE_PIDS,"%s: tune to same source/transponder",devId);
+    }
+  }
+
+  if (stop) {
     Stop();
-    }
-  else PRINTF(L_CORE_PIDS,"%s: tune to same source/transponder",devId);
+  }
 }
 
 void cCam::PostTune(void)
@@ -2500,7 +2509,7 @@
 
 void cCam::LogEcmStatus(const cEcmInfo *ecm, bool on)
 {
-  cMutexLock lock(&camMutex);
+  //cMutexLock lock(&camMutex);
   if(on) LogStartup();
   if(logger) logger->EcmStatus(ecm,on);
 }
@@ -2561,9 +2570,9 @@
 
 bool cCam::SetCaDescr(ca_descr_t *ca_descr, bool initial)
 {
-#ifndef SASC
   if(!softcsa || (fullts && ca_descr->index==0))
     return devplugin->SetCaDescr(device,ca_descr,initial);
+#ifndef SASC
   else if(decsa)
     return decsa->SetDescr(ca_descr,initial);
 #endif //!SASC
@@ -2572,9 +2581,9 @@
 
 bool cCam::SetCaPid(ca_pid_t *ca_pid)
 {
-#ifndef SASC
   if(!softcsa || (fullts && ca_pid->index==0))
     return devplugin->SetCaPid(device,ca_pid);
+#ifndef SASC
   else if(decsa)
     return decsa->SetCaPid(ca_pid);
 #endif //!SASC
@@ -2583,9 +2592,7 @@
 
 void cCam::DumpAV7110(void)
 {
-#ifndef SASC
   devplugin->DumpAV(device);
-#endif //!SASC
 }
 
 int cCam::GetFreeIndex(void)
diff -r 7e4626c93174 contrib/sasc-ng/dvblb_plugins/plugin_cam.c
--- a/contrib/sasc-ng/dvblb_plugins/plugin_cam.c   Thu Sep 08 07:14:07 2011 +0800
+++ b/contrib/sasc-ng/dvblb_plugins/plugin_cam.c   Tue Sep 13 12:35:44 2011 +0100
@@ -260,6 +260,7 @@
 
   if (sidmsg->calen == 0) {
     free_sidmsg(sidmsg);
+    msg->type = MSG_PROCESSED;
     return;
   }
   for(ch=Channels.First(); ch; ch=Channels.Next(ch)) {
@@ -280,6 +281,7 @@
         }
       }
       free_sidmsg(sidmsg);
+      msg->type = MSG_PROCESSED;
       return;
     }
   } else {
diff -r 7e4626c93174 contrib/sasc-ng/dvblb_plugins/plugin_ffdecsa.c
--- a/contrib/sasc-ng/dvblb_plugins/plugin_ffdecsa.c   Thu Sep 08 07:14:07 2011 +0800
+++ b/contrib/sasc-ng/dvblb_plugins/plugin_ffdecsa.c   Tue Sep 13 12:35:44 2011 +0100
@@ -123,11 +123,13 @@
           pthread_mutex_unlock(&csa->state_lock);
           return;
         }
+        pthread_mutex_lock(&csa->keylock);
         if(! csa->keyindex[index].valid) {
           csa->keyindex[index].valid = 1;
           csa->keyindex[index].status = 0;
           csa->keyindex[index].queued = 0;
         }
+        pthread_mutex_unlock(&csa->keylock);
         pop_entry_from_queue_l(pid_ll, &pidmap_empty_queue, struct pid, &list_lock);
         pid_ll->pid = pid;
         pid_ll->index = index;
@@ -146,7 +148,9 @@
           ll_find_elem(pid_ll, csa->pid_map, index, index, struct pid);
           if(pid_ll == NULL) {
             //no valid pids on this index
+            pthread_mutex_lock(&csa->keylock);
             csa->keyindex[index].status = 0;
+            pthread_mutex_unlock(&csa->keylock);
             if(list_empty(&csa->pid_map)) {
               //state = ENCRYPTED_NOT_READY;
               csa->state = NOT_ENCRYPTED;
diff -r 7e4626c93174 systems/cardclient/cc.c
--- a/systems/cardclient/cc.c   Thu Sep 08 07:14:07 2011 +0800
+++ b/systems/cardclient/cc.c   Tue Sep 13 12:35:44 2011 +0100
@@ -110,7 +110,7 @@
 
 bool cCardClient::SendMsg(const unsigned char *data, int len)
 {
-  if(!so.Connected() && !Login()) return false;
+  if(!so.Connected() /*&& !Login()*/) return false;
   if(so.Write(data,len)<0) {
     PRINTF(L_CC_CORE,"send error. reconnecting...");
     Logout();
@@ -121,7 +121,7 @@
 
 int cCardClient::RecvMsg(unsigned char *data, int len, int to)
 {
-  if(!so.Connected() && !Login()) return -1;
+  if(!so.Connected() /*&& !Login()*/) return -1;
   int n=so.Read(data,len,to);
   if(n<0) {
     if(errno==ETIMEDOUT && (len<0 || to==0)) return 0;
diff -r 7e4626c93174 systems/cardclient/newcamd.c
--- a/systems/cardclient/newcamd.c   Thu Sep 08 07:14:07 2011 +0800
+++ b/systems/cardclient/newcamd.c   Tue Sep 13 12:35:44 2011 +0100
@@ -472,9 +472,19 @@
 
 bool cCardClientNewCamd::ProcessECM(const cEcmInfo *ecm, const unsigned char *data, unsigned char *cw)
 {
-  cMutexLock lock(this);
-  if((!so.Connected() && !Login()) || !CanHandle(ecm->caId)) return false;
-  so.Flush();
+  if (!CanHandle(ecm->caId))
+    return false;
+  //{
+  //  cMutexLock lock(this);
+  // if((!so.Connected() && !Login()) || !CanHandle(ecm->caId)) return false;
+  // so.Flush();
+  //}
+  {
+    cMutexLock lock(this);
+    if (!so.Connected() && !Login())
+      return false;
+    so.Flush();
+  }
 
   struct CustomData cd;
   InitCustomData(&cd,(unsigned short)ecm->prgId,0);
@@ -502,7 +512,6 @@
 bool cCardClientNewCamd::ProcessEMM(int caSys, const unsigned char *data)
 {
   if(emmProcessing && emmAllowed) {
-    cMutexLock lock(this);
     cAssembleData ad(data);
     if(MatchAndAssemble(&ad,0,0)) {
       while((data=ad.Assembled())) {


Hope it helps.

Regards,

Nick


Thank you soooooo much :). I tried your patch, but I had problem applying a patch to last vdr-sasc-ng source codes. Finally I made some modifications manually, but I'm not sure if everything correctly. Can you please make diff from last source codes from http://85.17.209.13:6100/sc?

I tried the version with your patch and clean from the repository, both work, but time is a problem with communication after newcamd:

[cardclient.newcamd] 0004 msgid bad! = 0003
Sep 15 12:38:18.438 [cardclient.newcamd] sync error msg ID. Retrying ...

I'll help you to debug everything. :)
djkiller
 
Posts: 6
Joined: Mon Aug 29, 2011 4:23 am

Re: TBS6984 and vdr-sasc-ng

Postby Shortfuse » Fri Sep 16, 2011 1:38 am

djkiller Wrote:Yes, open this tutorial http://www.buydvb.net/blog/guide-for-using-sasc-ng-to-read-smartcard-on-linux-ubuntu-tbs-card-phoenix-card-reader-tbs3102.html and apply linux-2.6.38-dvb-mutex.patch to drivers. If you have last vdr-sasc-ng from repo, don't apply vdr patch.


Thanks for the tip, it never occurred to me to patch the drivers. Doh!

I'll give it a go tonight.
Shortfuse
 
Posts: 3
Joined: Thu Sep 15, 2011 3:06 am

Re: TBS6984 and vdr-sasc-ng

Postby Shortfuse » Fri Sep 16, 2011 5:46 pm

Yep, it worked.
It even worked leaving the existing 2.6.32 squeeze supplied kernel.
Once I realised that the tbs drivers REPLACE the kernel dvb subsystem, it makes perfect sense that all you need is the tbs tree and sasc built against it. Not forgetting the patch the tbs drivers like I did before.

Again many thanks djkiller.
Shortfuse
 
Posts: 3
Joined: Thu Sep 15, 2011 3:06 am

Next

Return to Linux

Who is online

Users browsing this forum: No registered users and 9 guests