]> www.vanbest.org Git - sasc-ng.git/commitdiff
release 0.8.1 0.8.1
authorleslie <unknown>
Thu, 27 Dec 2007 21:00:19 +0000 (22:00 +0100)
committerleslie <unknown>
Thu, 27 Dec 2007 21:00:19 +0000 (22:00 +0100)
HISTORY
cam.c
cam.h
patches/vdr-1.4.x-sc7.diff
sc.c
scsetup.h
systems/cardclient/camd.c
systems/nagra/nagra2-7101.c [new file with mode: 0644]
version.h

diff --git a/HISTORY b/HISTORY
index 2fcc38e3f0e3a973747bd7d864f2d83a253108a9..8e55d656a7a5865d27cf002bf1dfd8bcbf5920b2 100644 (file)
--- a/HISTORY
+++ b/HISTORY
@@ -1,7 +1,17 @@
 VDR Plugin 'sc' Revision History
 --------------------------------
 
+06.07.2007: Version 0.8.1
+- Added Nagra2 7101 3DES support.
+- Added a setup option to force tranfermode with digital audio. Another common
+  used patched for the vdr-core is made unnecessary by this option.
+- Fixed camd33 EMM packet processing.
+- Fixed recording device allocation (1.4.x). You have to update the VDR core
+  patch. Thanks to dingo35.
+- Fixed compiling with VDR 1.5.0.
+
 22.06.2007: Version 0.8.0
+- Added Nagra2 0501 MECM support.
 - Added support for Nagra smartcards. Code is not well tested. Volunteers
   welcome. Timing is tricky, so you have to get cardreader clock AND -C
   parameter right.
diff --git a/cam.c b/cam.c
index 092071ce991c67458136883cf1c994e9592de7b8..cb4321ecca25e64cff03e336960d27ae9976b499 100644 (file)
--- a/cam.c
+++ b/cam.c
@@ -2419,7 +2419,7 @@ bool cDeCSA::Decrypt(unsigned char *data, int len, bool force)
     LBSTARTF(L_CORE_CSA);
     LBPUT("decrypting %3d packets (ccs=%3d cs=%3d %s)",ccs,ccs,cs,ccs>=cs?"OK ":"INC");
     int n=decrypt_packets(keys[currIdx],range);
-    LBPUT(" -> %3d packets decrypted\n",n);
+    LBPUT(" -> %3d packets decrypted",n);
     if(n>0) return true;
     LBEND();
     }
@@ -2598,6 +2598,8 @@ void cScDvbDevice::Shutdown(void)
 
 void cScDvbDevice::Startup(void)
 {
+  if(ScSetup.ForceTransfer)
+    SetTransferModeForDolbyDigital(2);
   for(int n=cDevice::NumDevices(); --n>=0;) {
     cScDvbDevice *dev=dynamic_cast<cScDvbDevice *>(cDevice::GetDevice(n));
     if(dev) dev->LateInit();
diff --git a/cam.h b/cam.h
index 8f80d4430fe13739d5bbb716ec2487670ca258d9..752a64e62d7b5aac90039440d9e3f8f395015b31 100644 (file)
--- a/cam.h
+++ b/cam.h
@@ -158,7 +158,8 @@ public:
   ~cScDvbDevice();
 #if APIVERSNUM >= 10501
   virtual bool HasCi(void);
-#else
+#endif
+#if APIVERSNUM < 10500
   virtual int ProvidesCa(const cChannel *Channel) const;
 #endif
   static void Capture(void);
index b043a43ac037e8d90bde3d68449fae9baf6da9ca..8ee66ef1360788020e853e4746f37d1f1b69014e 100644 (file)
@@ -24,7 +24,7 @@ diff -urN -X ex.vdr-sc7 vdr-1.4.7-orig/ci.c vdr-1.4.7-sc7/ci.c
  }
 diff -urN -X ex.vdr-sc7 vdr-1.4.7-orig/ci.h vdr-1.4.7-sc7/ci.h
 --- vdr-1.4.7-orig/ci.h        2006-08-12 11:43:31.000000000 +0200
-+++ vdr-1.4.7-sc7/ci.h 2007-05-13 18:41:42.000000000 +0200
++++ vdr-1.4.7-sc7/ci.h 2007-06-24 19:46:39.000000000 +0200
 @@ -85,10 +85,12 @@
  class cCiCaProgramData : public cListObject {
  public:
@@ -42,7 +42,7 @@ diff -urN -X ex.vdr-sc7 vdr-1.4.7-orig/ci.h vdr-1.4.7-sc7/ci.h
  class cCiTransportLayer;
  class cCiTransportConnection;
  
-+#define VDR_IS_SC_PATCHED 401
++#define VDR_IS_SC_PATCHED 402
 +
  class cCiHandler {
  private:
@@ -205,7 +205,7 @@ diff -urN -X ex.vdr-sc7 vdr-1.4.7-orig/device.h vdr-1.4.7-sc7/device.h
  
 diff -urN -X ex.vdr-sc7 vdr-1.4.7-orig/dvbdevice.c vdr-1.4.7-sc7/dvbdevice.c
 --- vdr-1.4.7-orig/dvbdevice.c 2007-02-24 12:10:14.000000000 +0100
-+++ vdr-1.4.7-sc7/dvbdevice.c  2007-05-13 18:04:04.000000000 +0200
++++ vdr-1.4.7-sc7/dvbdevice.c  2007-06-24 19:42:24.000000000 +0200
 @@ -419,7 +419,11 @@
       dvb_frontend_info feinfo;
       if (ioctl(fd_frontend, FE_GET_INFO, &feinfo) >= 0) {
@@ -227,7 +227,7 @@ diff -urN -X ex.vdr-sc7 vdr-1.4.7-orig/dvbdevice.c vdr-1.4.7-sc7/dvbdevice.c
 -                 needsDetachReceivers = Ca() != Channel->Ca();
 +              if (Ca() >= CA_ENCRYPTED_MIN || Channel->Ca() >= CA_ENCRYPTED_MIN) {
 +                 if(Channel->Ca()<CA_ENCRYPTED_MIN || CiAllowConcurrent())
-+                   return true;
++                   result = true;
 +                 else
 +                   needsDetachReceivers = Ca() != Channel->Ca();
 +                 }
diff --git a/sc.c b/sc.c
index 9444d89062bb64b4cf7cec89b4bc28d3da60ed33..382dcc243c5c297e12afc77ec4cbd655d2ca62ce 100644 (file)
--- a/sc.c
+++ b/sc.c
@@ -69,7 +69,7 @@
 #if !defined(VDR_IS_SC_PATCHED)
 #error You MUST patch the VDR core with the supplied patch. Next time read the README first.
 #endif
-#if VDR_IS_SC_PATCHED<401
+#if VDR_IS_SC_PATCHED<402
 #error Your VDR core is patched with an outdated patch version. Please upgrade to the supplied version.
 #endif
 #endif //APIVERSNUM >= 10500
@@ -951,6 +951,7 @@ cScSetup::cScSetup(void)
   ConcurrentFF = 0;
   memset(CaIgnore,0,sizeof(CaIgnore));
   LocalPriority = 0;
+  ForceTransfer = 1;
 }
 
 void cScSetup::Check(void)
@@ -967,6 +968,7 @@ void cScSetup::Check(void)
   PRINTF(L_CORE_LOAD,"** Key updates (AU) are %s",AutoUpdate?(AutoUpdate==1?"enabled (active CAIDs)":"enabled (all CAIDs)"):"DISABLED");
   PRINTF(L_CORE_LOAD,"** Local systems %stake priority over cached remote",LocalPriority?"":"DON'T ");
   PRINTF(L_CORE_LOAD,"** Concurrent FF recordings are %sallowed",ConcurrentFF?"":"NOT ");
+  PRINTF(L_CORE_LOAD,"** %sorce transfermode with digital auido",ForceTransfer?"F":"DON'T f");
   LBSTART(L_CORE_LOAD);
   LBPUT("** ScCaps are"); for(int i=0; i<MAXSCCAPS ; i++) LBPUT(" %d",ScCaps[i]);
   LBFLUSH();
@@ -1192,9 +1194,10 @@ public:
 cScPlugin::cScPlugin(void)
 {
   static const char *logg[] = { "off","active CAIDs","all CAIDs" };
-  ScOpts=new cOpts(0,5);
+  ScOpts=new cOpts(0,6);
   ScOpts->Add(new cOptSel  ("AutoUpdate"   ,"Update keys (AU)"     ,&ScSetup.AutoUpdate,3,logg));
   ScOpts->Add(new cOptBool ("ConcurrentFF" ,"Concurrent FF streams",&ScSetup.ConcurrentFF));
+  ScOpts->Add(new cOptBool ("ForceTranfer" ,"Force TransferMode"   ,&ScSetup.ForceTransfer));
   ScOpts->Add(new cOptBool ("LocalPriority","Prefer local systems" ,&ScSetup.LocalPriority));
   ScOpts->Add(new cOptMInt ("ScCaps"       ,"Active on DVB card"   , ScSetup.ScCaps,MAXSCCAPS,0));
   ScOpts->Add(new cOptMInt ("CaIgnore"     ,"Ignore CAID"          , ScSetup.CaIgnore,MAXCAIGN,2));
index 57905185c5d9c3e7ca2c6f43177158e967236ce4..49b7ce5641933a978950813447f4e7692e9f5813 100644 (file)
--- a/scsetup.h
+++ b/scsetup.h
@@ -32,6 +32,7 @@ public:
   int ConcurrentFF;
   int CaIgnore[MAXCAIGN];
   int LocalPriority;
+  int ForceTransfer;
 public:
   cScSetup(void);
   void Check(void);
index 56d6b4b5e16099bf207577c492e48ea4d8e27035..53df4ebb2a9ec38c373923d2e9f0f46a6d190fc8 100644 (file)
@@ -45,18 +45,16 @@ protected:
   cNetSocket so;
   bool emmProcessing;
   char username[11], password[11];
-  int CAID;
-  unsigned char lastEmmReq[32];
   //
   virtual bool Login(void);
   bool ParseKeyConfig(const char *config, int *num);
   bool ParseUserConfig(const char *config, int *num);
   virtual bool SendMsg(cNetSocket *so, const unsigned char *data, int len);
   virtual int RecvMsg(cNetSocket *so, unsigned char *data, int len, int to=-1);
-  void HandleEMMRequest(const unsigned char *buff, int len);
+  virtual void HandleEMMRequest(const unsigned char *buff, int len) {}
+  virtual bool CanHandleEMM(int SysId) { return false; }
 public:
   cCardClientCommon(const char *Name, bool ConReply, bool LogReply, bool DoAES, int MinMsgLen);
-  virtual bool CanHandle(unsigned short SysId);
   virtual bool Init(const char *config);
   virtual bool ProcessECM(const cEcmInfo *ecm, const unsigned char *source, unsigned char *cw);
   virtual bool ProcessEMM(int caSys, const unsigned char *source);
@@ -68,8 +66,6 @@ cCardClientCommon::cCardClientCommon(const char *Name, bool ConReply, bool LogRe
 {
   conReply=ConReply; logReply=LogReply; doAES=DoAES; minMsgLen=MinMsgLen;
   emmProcessing=exclusive=false;
-  CAID=0;
-  memset(lastEmmReq,0,sizeof(lastEmmReq));
 }
 
 bool cCardClientCommon::ParseUserConfig(const char *config, int *num)
@@ -126,11 +122,6 @@ int cCardClientCommon::RecvMsg(cNetSocket *so, unsigned char *data, int len, int
   return n;
 }
 
-bool cCardClientCommon::CanHandle(unsigned short SysId)
-{
-  return (emmProcessing && SysId==CAID) || cCardClient::CanHandle(SysId);
-}
-
 bool cCardClientCommon::Init(const char *config)
 {
   cMutexLock lock(this);
@@ -178,25 +169,9 @@ bool cCardClientCommon::Login(void)
   return true;
 }
 
-void cCardClientCommon::HandleEMMRequest(const unsigned char *buff, int len)
-{
-  if(len>=13 && buff[0]==0 && !CheckNull(buff,len) && memcmp(buff,lastEmmReq,13)) {
-    CAID=buff[1]*256+buff[2];
-    ResetIdSet();
-    SetCard(new cCardIrdeto(buff[6],&buff[3]));
-    AddProv(new cProviderIrdeto(0,&buff[7]));
-    AddProv(new cProviderIrdeto(2,&buff[10]));
-    memcpy(lastEmmReq,buff,13);
-    PRINTF(L_CC_LOGIN,"%s: CAID: %04x HexSerial: %02X%02X%02X, HexBase: %02X",name,CAID,buff[3],buff[4],buff[5],buff[6]);
-    PRINTF(L_CC_LOGIN,"%s: Provider00: %02X%02X%02X, Provider10: %02X%02X%02X",name,buff[7],buff[8],buff[9],buff[10],buff[11],buff[12]);
-    if(!emmAllowed) PRINTF(L_CC_EMM,"%s: EMM disabled from config",name);
-    emmProcessing=true;
-    }
-}
-
 bool cCardClientCommon::ProcessEMM(int caSys, const unsigned char *source)
 {
-  if(emmProcessing && emmAllowed) {
+  if(emmAllowed && CanHandleEMM(caSys)) {
     cMutexLock lock(this);
     if(MatchEMM(source)) {
       const int length=SCT_LEN(source);
@@ -269,15 +244,57 @@ bool cCardClientCommon::ProcessECM(const cEcmInfo *ecm, const unsigned char *sou
 // -- cCardClientCamd33 --------------------------------------------------------
 
 class cCardClientCamd33 : public cCardClientCommon {
+private:
+  int CAID;
+  unsigned char lastEmmReq[32];
+protected:
+  virtual void HandleEMMRequest(const unsigned char *buff, int len);
+  virtual bool CanHandleEMM(int SysId);
 public:
   cCardClientCamd33(const char *Name);
+  virtual bool CanHandle(unsigned short SysId);
   };
 
 static cCardClientLinkReg<cCardClientCamd33> __camd33("Camd33");
 
 cCardClientCamd33::cCardClientCamd33(const char *Name)
 :cCardClientCommon(Name,true,true,true,0)
-{}
+{
+  CAID=0;
+  memset(lastEmmReq,0,sizeof(lastEmmReq));
+}
+
+bool cCardClientCamd33::CanHandle(unsigned short SysId)
+{
+  return CanHandleEMM(SysId) || cCardClient::CanHandle(SysId);
+}
+
+bool cCardClientCamd33::CanHandleEMM(int SysId)
+{
+  return (emmProcessing && SysId==CAID);
+}
+
+void cCardClientCamd33::HandleEMMRequest(const unsigned char *buff, int len)
+{
+  if(len>=13 && buff[0]==0 && !CheckNull(buff,len) && memcmp(buff,lastEmmReq,13)) {
+    emmProcessing=false;
+    CAID=buff[1]*256+buff[2];
+    ResetIdSet();
+    switch(CAID>>8) {
+      case 0x17:
+      case 0x06:
+        SetCard(new cCardIrdeto(buff[6],&buff[3]));
+        AddProv(new cProviderIrdeto(0,&buff[7]));
+        AddProv(new cProviderIrdeto(2,&buff[10]));
+        memcpy(lastEmmReq,buff,13);
+        PRINTF(L_CC_LOGIN,"%s: CAID: %04x HexSerial: %02X%02X%02X, HexBase: %02X",name,CAID,buff[3],buff[4],buff[5],buff[6]);
+        PRINTF(L_CC_LOGIN,"%s: Provider00: %02X%02X%02X, Provider10: %02X%02X%02X",name,buff[7],buff[8],buff[9],buff[10],buff[11],buff[12]);
+        if(!emmAllowed) PRINTF(L_CC_EMM,"%s: EMM disabled from config",name);
+        emmProcessing=true;
+        break;
+      }
+    }
+}
 
 // -- cCardClientCardd ---------------------------------------------------------
 
diff --git a/systems/nagra/nagra2-7101.c b/systems/nagra/nagra2-7101.c
new file mode 100644 (file)
index 0000000..695150d
--- /dev/null
@@ -0,0 +1,47 @@
+/*
+ * Softcam plugin to VDR (C++)
+ *
+ * This code is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This code is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ * Or, point your browser to http://www.gnu.org/copyleft/gpl.html
+ */
+
+// -- cN2Prov7101 ----------------------------------------------------------------
+
+class cN2Prov7101 : public cN2Prov {
+public:
+  cN2Prov7101(int Id, int Flags):cN2Prov(Id,Flags) {}
+  virtual bool PostProcAU(int id, unsigned char *data);
+  };
+
+static cN2ProvLinkReg<cN2Prov7101,0x7101,N2FLAG_POSTAU> staticPL7101;
+
+bool cN2Prov7101::PostProcAU(int id, unsigned char *data)
+{
+  if(data[1]==0x01) {
+    cPlainKey *pk;
+    if(!(pk=keys.FindKey('N',id,MBC(N2_MAGIC,0x30),16))) {
+      PRINTF(L_SYS_EMM,"missing %04x NN 30 3DES key (16 bytes)",id);
+      return false;
+      }
+    unsigned char dkey[16];
+    pk->Get(dkey);
+    DES_key_schedule ks1, ks2;
+    DES_key_sched((DES_cblock *)&dkey[0],&ks1);
+    DES_key_sched((DES_cblock *)&dkey[8],&ks2);
+    DES_ecb2_encrypt(DES_CAST(&data[7]),DES_CAST(&data[7]),&ks1,&ks2,DES_DECRYPT);
+    DES_ecb2_encrypt(DES_CAST(&data[7+8]),DES_CAST(&data[7+8]),&ks1,&ks2,DES_DECRYPT);
+    }
+  return true;
+}
index 5c4ba1b72d51372633eafa64509ce40dab8e11f4..2c18ad9141b5bc74d7df3ec7c367c24b7ee73dce 100644 (file)
--- a/version.h
+++ b/version.h
@@ -21,8 +21,8 @@
 #define ___VERSION_H
 
 // all release versions must end with 0xFF !!
-#define SCVERSNUM 0x000800FF
-#define SCVERSION "0.8.0"
+#define SCVERSNUM 0x000801FF
+#define SCVERSION "0.8.1"
 
 extern const char *ScVersion;