Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature request] Icam support #1003

Closed
localhosthack0r opened this issue Oct 12, 2022 · 37 comments
Closed

[Feature request] Icam support #1003

localhosthack0r opened this issue Oct 12, 2022 · 37 comments

Comments

@localhosthack0r
Copy link
Contributor

localhosthack0r commented Oct 12, 2022

Hi,
I just saw patched versions of tvheadend and libdvbcsa supporting Icam decryption.
Would it be possible to implement this for minisatip as well?

This is the patch for libdvbcsa from https://github.com/glenvt18/libdvbcsa

index c7e9c59..b63fb7d 100644
--- a/src/dvbcsa/dvbcsa.h
+++ b/src/dvbcsa/dvbcsa.h
@@ -93,6 +93,8 @@ void dvbcsa_bs_key_free(struct dvbcsa_bs_key_s *key);
 
 void dvbcsa_bs_key_set(const dvbcsa_cw_t cw, struct dvbcsa_bs_key_s *key);
 
+void dvbcsa_bs_key_set_ecm(const unsigned char ecm, const dvbcsa_cw_t cw, struct dvbcsa_bs_key_s *key);
+
 /** get maximum number of packet per batch */
 
 unsigned int dvbcsa_bs_batch_size(void);
diff --git a/src/dvbcsa_bs_key.c b/src/dvbcsa_bs_key.c
index e2fcf55..d703325 100644
--- a/src/dvbcsa_bs_key.c
+++ b/src/dvbcsa_bs_key.c
@@ -63,3 +63,39 @@ dvbcsa_bs_key_set (const dvbcsa_cw_t cw, struct dvbcsa_bs_key_s *key)
     }
 }
 
+void
+dvbcsa_bs_key_set_ecm (const unsigned char ecm, const dvbcsa_cw_t cw, struct dvbcsa_bs_key_s *key)
+{
+  dvbcsa_keys_t kk;
+  int i;
+
+  /* precalculations for stream */
+
+  uint64_t ck = dvbcsa_load_le64(cw);
+
+  for (i = 0; i < DVBCSA_CWBITS_SIZE; i++)
+    key->stream[i] = (ck >> (i^4)) & 1 ? BS_VAL8(ff) : BS_VAL8(00);
+
+  /* precalculations for block */
+
+  dvbcsa_key_schedule_block_ecm(ecm, cw, kk);
+
+  for (i = 0; i < DVBCSA_KEYSBUFF_SIZE; i++)
+    {
+#if BS_BATCH_SIZE == 32
+      *(dvbcsa_u32_aliasing_t *)(key->block + i) = kk[i] * 0x01010101;
+
+#elif BS_BATCH_SIZE == 64
+      *(dvbcsa_u64_aliasing_t *)(key->block + i) = kk[i] * 0x0101010101010101ULL;
+
+#elif BS_BATCH_SIZE > 64 && BS_BATCH_SIZE % 64 == 0
+      uint64_t v = kk[i] * 0x0101010101010101ULL;
+      int j;
+
+      for (j = 0; j < BS_BATCH_BYTES / 8; j++)
+        *((dvbcsa_u64_aliasing_t *)(key->block + i) + j) = v;
+#else
+# error
+#endif
+    }
+}
diff --git a/src/dvbcsa_key.c b/src/dvbcsa_key.c
index 1ff17e0..bd2a2c1 100644
--- a/src/dvbcsa_key.c
+++ b/src/dvbcsa_key.c
@@ -585,3 +585,18 @@ dvbcsa_key_schedule_block(const dvbcsa_cw_t cw, uint8_t * kk)
       kk[i*8+j] = (k[i]>>(j*8)) ^ i;
 }
 
+void
+dvbcsa_key_schedule_block_ecm(const unsigned char ecm, const dvbcsa_cw_t cw, uint8_t * kk)
+{
+  uint64_t k[7];
+  int i, j;
+
+  k[6] = dvbcsa_load_le64_ecm(ecm, cw);
+  for (i = 6; i > 0; i--)
+    k[i - 1] = dvbcsa_key_permute_block(k[i]);
+
+  for (i = 0; i < 7; i++)
+    for (j = 0; j < 8; j++)
+      kk[i*8+j] = (k[i]>>(j*8)) ^ i;
+}
+
diff --git a/src/dvbcsa_pv.h b/src/dvbcsa_pv.h
index 83753b1..e59a70d 100644
--- a/src/dvbcsa_pv.h
+++ b/src/dvbcsa_pv.h
@@ -88,6 +88,26 @@ struct dvbcsa_key_s
 
 extern const uint8_t dvbcsa_block_sbox[256];
 
+static const uint8_t            csa_block_perm_ecm[256] =
+  {
+    0x00,0x02,0x80,0x82,0x20,0x22,0xa0,0xa2, 0x04,0x06,0x84,0x86,0x24,0x26,0xa4,0xa6,
+    0x40,0x42,0xc0,0xc2,0x60,0x62,0xe0,0xe2, 0x44,0x46,0xc4,0xc6,0x64,0x66,0xe4,0xe6,
+    0x01,0x03,0x81,0x83,0x21,0x23,0xa1,0xa3, 0x05,0x07,0x85,0x87,0x25,0x27,0xa5,0xa7,
+    0x41,0x43,0xc1,0xc3,0x61,0x63,0xe1,0xe3, 0x45,0x47,0xc5,0xc7,0x65,0x67,0xe5,0xe7,
+    0x08,0x0a,0x88,0x8a,0x28,0x2a,0xa8,0xaa, 0x0c,0x0e,0x8c,0x8e,0x2c,0x2e,0xac,0xae,
+    0x48,0x4a,0xc8,0xca,0x68,0x6a,0xe8,0xea, 0x4c,0x4e,0xcc,0xce,0x6c,0x6e,0xec,0xee,
+    0x09,0x0b,0x89,0x8b,0x29,0x2b,0xa9,0xab, 0x0d,0x0f,0x8d,0x8f,0x2d,0x2f,0xad,0xaf,
+    0x49,0x4b,0xc9,0xcb,0x69,0x6b,0xe9,0xeb, 0x4d,0x4f,0xcd,0xcf,0x6d,0x6f,0xed,0xef,
+    0x10,0x12,0x90,0x92,0x30,0x32,0xb0,0xb2, 0x14,0x16,0x94,0x96,0x34,0x36,0xb4,0xb6,
+    0x50,0x52,0xd0,0xd2,0x70,0x72,0xf0,0xf2, 0x54,0x56,0xd4,0xd6,0x74,0x76,0xf4,0xf6,
+    0x11,0x13,0x91,0x93,0x31,0x33,0xb1,0xb3, 0x15,0x17,0x95,0x97,0x35,0x37,0xb5,0xb7,
+    0x51,0x53,0xd1,0xd3,0x71,0x73,0xf1,0xf3, 0x55,0x57,0xd5,0xd7,0x75,0x77,0xf5,0xf7,
+    0x18,0x1a,0x98,0x9a,0x38,0x3a,0xb8,0xba, 0x1c,0x1e,0x9c,0x9e,0x3c,0x3e,0xbc,0xbe,
+    0x58,0x5a,0xd8,0xda,0x78,0x7a,0xf8,0xfa, 0x5c,0x5e,0xdc,0xde,0x7c,0x7e,0xfc,0xfe,
+    0x19,0x1b,0x99,0x9b,0x39,0x3b,0xb9,0xbb, 0x1d,0x1f,0x9d,0x9f,0x3d,0x3f,0xbd,0xbf,
+    0x59,0x5b,0xd9,0xdb,0x79,0x7b,0xf9,0xfb, 0x5d,0x5f,0xdd,0xdf,0x7d,0x7f,0xfd,0xff
+};
+
 void dvbcsa_block_decrypt (const dvbcsa_keys_t key, const dvbcsa_block_t in, dvbcsa_block_t out);
 void dvbcsa_block_encrypt (const dvbcsa_keys_t key, const dvbcsa_block_t in, dvbcsa_block_t out);
 
@@ -95,6 +115,7 @@ void dvbcsa_stream_xor (const dvbcsa_cw_t cw, const dvbcsa_block_t iv,
                         uint8_t *stream, unsigned int len);
 
 void dvbcsa_key_schedule_block(const dvbcsa_cw_t cw, uint8_t * kk);
+void dvbcsa_key_schedule_block_ecm(const unsigned char ecm, const dvbcsa_cw_t cw, uint8_t * kk);
 
 DVBCSA_INLINE static inline void
 dvbcsa_xor_64 (uint8_t *b, const uint8_t *a)
@@ -141,6 +162,33 @@ dvbcsa_load_le64(const uint8_t *p)
 #endif
 }
 
+DVBCSA_INLINE static inline uint64_t
+dvbcsa_load_le64_ecm(const unsigned char ecm, const uint8_t *p)
+{
+  dvbcsa_block_t W;
+  memcpy(W, p, sizeof(W));
+  if (ecm == 4)
+  {
+    W[0] = csa_block_perm_ecm[p[0]];
+    W[4] = csa_block_perm_ecm[p[4]];
+  }
+#if defined(DVBCSA_ENDIAN_LITTLE)
+  uint64_t i;
+  memcpy(&i, W, 8);
+  return i;
+#else
+  return (uint64_t)( ((uint64_t)W[7] << 56) |
+                     ((uint64_t)W[6] << 48) |
+                     ((uint64_t)W[5] << 40) |
+                     ((uint64_t)W[4] << 32) |
+                     ((uint64_t)W[3] << 24) |
+                     ((uint64_t)W[2] << 16) |
+                     ((uint64_t)W[1] << 8 ) |
+                      (uint64_t)W[0]
+                     );
+#endif
+}
+
 DVBCSA_INLINE static inline void
 dvbcsa_store_le64(uint8_t *p, const uint64_t w)
 {

And this one for tvheadend 4.3:

index 71cc9ebd6..b5c46e329 100644
--- a/src/descrambler/descrambler.c
+++ b/src/descrambler/descrambler.c
@@ -966,12 +966,12 @@ key_flush( th_descrambler_runtime_t *dr, th_descrambler_key_t *tk, uint8_t chang
   /* update the keys */
   if (changed & 1) {
     debug2("%p: even key[%d] set for decoder", dr, tk->key_pid);
-    tvhcsa_set_key_even(&tk->key_csa, tk->key_data[0]);
+    tvhcsa_set_key_even(&tk->key_csa, tk->key_data[0], dr->dr_ecm);
     tk->key_valid |= 0x40;
   }
   if (changed & 2) {
     debug2("%p: odd key[%d] set for decoder", dr, tk->key_pid);
-    tvhcsa_set_key_odd(&tk->key_csa, tk->key_data[1]);
+    tvhcsa_set_key_odd(&tk->key_csa, tk->key_data[1], dr->dr_ecm);
     tk->key_valid |= 0x80;
   }
 }
@@ -1371,6 +1371,7 @@ descrambler_table_callback
                 }
               }
             }
+            dr->dr_ecm = (ptr[2] - ptr[4]) == 4 ? ptr[0x15] : 0;
             tvhtrace(LS_DESCRAMBLER, "ECM message %02x:%02x (section %d, len %d, pid %d) for service \"%s\"",
                      ptr[0], ptr[1], des->number, len, mt->mt_pid, t->s_dvb_svcname);
           }
diff --git a/src/descrambler/descrambler.h b/src/descrambler/descrambler.h
index ac5ff312c..697adfe04 100644
--- a/src/descrambler/descrambler.h
+++ b/src/descrambler/descrambler.h
@@ -103,6 +103,7 @@ typedef struct th_descrambler_runtime {
   int64_t  dr_ecm_start[2];
   int64_t  dr_ecm_last_key_time;
   int64_t  dr_ecm_key_margin;
+  uint8_t  dr_ecm;
   int64_t  dr_last_err;
   int64_t  dr_force_skip;
   th_descrambler_key_t dr_keys[DESCRAMBLER_MAX_KEYS];
diff --git a/src/descrambler/tvhcsa.c b/src/descrambler/tvhcsa.c
index 942ce92b5..664523665 100644
--- a/src/descrambler/tvhcsa.c
+++ b/src/descrambler/tvhcsa.c
@@ -220,12 +220,12 @@ tvhcsa_set_type( tvhcsa_t *csa, struct mpegts_service *s, int type )
 }
 
 
-void tvhcsa_set_key_even( tvhcsa_t *csa, const uint8_t *even )
+void tvhcsa_set_key_even( tvhcsa_t *csa, const uint8_t *even, const uint8_t ecm)
 {
   switch (csa->csa_type) {
   case DESCRAMBLER_CSA_CBC:
 #if ENABLE_DVBCSA
-    dvbcsa_bs_key_set(even, csa->csa_key_even);
+    dvbcsa_bs_key_set_ecm(ecm, even, csa->csa_key_even);
 #endif
     break;
   case DESCRAMBLER_DES_NCB:
@@ -241,13 +241,13 @@ void tvhcsa_set_key_even( tvhcsa_t *csa, const uint8_t *even )
   }
 }
 
-void tvhcsa_set_key_odd( tvhcsa_t *csa, const uint8_t *odd )
+void tvhcsa_set_key_odd( tvhcsa_t *csa, const uint8_t *odd, const uint8_t ecm )
 {
   assert(csa->csa_type);
   switch (csa->csa_type) {
   case DESCRAMBLER_CSA_CBC:
 #if ENABLE_DVBCSA
-    dvbcsa_bs_key_set(odd, csa->csa_key_odd);
+    dvbcsa_bs_key_set_ecm(ecm, odd, csa->csa_key_odd);
 #endif
     break;
   case DESCRAMBLER_DES_NCB:
diff --git a/src/descrambler/tvhcsa.h b/src/descrambler/tvhcsa.h
index 855de5acc..24eb729cb 100644
--- a/src/descrambler/tvhcsa.h
+++ b/src/descrambler/tvhcsa.h
@@ -66,8 +66,8 @@ typedef struct tvhcsa
 
 int  tvhcsa_set_type( tvhcsa_t *csa, struct mpegts_service *s, int type );
 
-void tvhcsa_set_key_even( tvhcsa_t *csa, const uint8_t *even );
-void tvhcsa_set_key_odd ( tvhcsa_t *csa, const uint8_t *odd );
+void tvhcsa_set_key_even( tvhcsa_t *csa, const uint8_t *even, const uint8_t ecm );
+void tvhcsa_set_key_odd ( tvhcsa_t *csa, const uint8_t *odd, const uint8_t ecm );
 
 void tvhcsa_init    ( tvhcsa_t *csa );
 void tvhcsa_destroy ( tvhcsa_t *csa );
@@ -76,8 +76,8 @@ void tvhcsa_destroy ( tvhcsa_t *csa );
 
 static inline int tvhcsa_set_type( tvhcsa_t *csa, struct mpegts_service *s, int type ) { return -1; }
 
-static inline void tvhcsa_set_key_even( tvhcsa_t *csa, const uint8_t *even ) { };
-static inline void tvhcsa_set_key_odd ( tvhcsa_t *csa, const uint8_t *odd ) { };
+static inline void tvhcsa_set_key_even( tvhcsa_t *csa, const uint8_t *even, const uint8_t ecm ) { };
+static inline void tvhcsa_set_key_odd ( tvhcsa_t *csa, const uint8_t *odd, const uint8_t ecm ) { };
 
 static inline void tvhcsa_init ( tvhcsa_t *csa ) { };
 static inline void tvhcsa_destroy ( tvhcsa_t *csa ) { };

So I think from minisatip perspective it is just required to use the patched libdvbcsa and to call the dvbcsa_bs_key_set() function from csa.c with a additional parameter for the Icam decryption. They just throw in a '4' for this parameter from tvheadend.
In tvheadend it seems to be derived from something when selecting the right descrambler, if it is Icam:

                 }
               }
             }
+            dr->dr_ecm = (ptr[2] - ptr[4]) == 4 ? ptr[0x15] : 0;
             tvhtrace(LS_DESCRAMBLER, "ECM message %02x:%02x (section %d, len %d, pid %d) for service \"%s\"",
                      ptr[0], ptr[1], des->number, len, mt->mt_pid, t->s_dvb_svcname);
           }

But there I have no clue what the equivalent in minisatip would be. Help would be very appreciated! :)
Thank you!

@Jalle19
Copy link
Collaborator

Jalle19 commented Oct 13, 2022

What is this for? Any context?

@localhosthack0r
Copy link
Contributor Author

Some providers with NDS Videoguard decryption are using this Icam. Seems to be a non-standard descrambling algorithm.
Sky Italia and Sky UK are using this since years, Sky Germany introduced it this summer.
And this patch is working according to some SAT forums at least for Sky Germany, for the others I don't know,...

@Yuri666
Copy link
Contributor

Yuri666 commented Oct 13, 2022

Tvheadend can decrypt icam with "stream relay" oscam feature. Minisatip can't use this feature by definition.

@localhosthack0r
Copy link
Contributor Author

localhosthack0r commented Oct 13, 2022

Here is something about the ECM structure:
https://trac.streamboard.tv/oscam/ticket/4389

@Yuri666
Yes, right, the first implementations were using stream relay, but with the modified libdvbcsa it seems to work without stream relay!

@Yuri666
Copy link
Contributor

Yuri666 commented Oct 13, 2022

I seen last patch to oscam. There only stream relay. Maybe I'm wrong, but not seen any other for now.

@localhosthack0r
Copy link
Contributor Author

@Yuri666
Copy link
Contributor

Yuri666 commented Oct 13, 2022

There is patches for tvheadend and for libdvbcsa. Also needs patch for oscam.

@catalinii
Copy link
Owner

Does not seem complex but without access to a system that has this is very hard to implement.

@localhosthack0r
Copy link
Contributor Author

localhosthack0r commented Oct 16, 2022

Hi,
for testing purposes I now setup a LXC container where I tried out the tvheadend solution, with one tuner from minisatip as DVB input source.
It is working just with the two patches from above, no need to patch oscam, no need for streamrelay!

@catalinii
I can maybe setup another container with a test minisatip instance, which runs as client to my productive minisatip server and provide you ssh access to that.

Or, maybe also an option: I might be able to implement it myself, if you guide me to where I can access the ECM data to find out if it is Icam or normal CSA. Then I would provide a PR.

@localhosthack0r
Copy link
Contributor Author

localhosthack0r commented Oct 16, 2022

So,...
I did another experiment. As a quick & dirty hack, I just hardcoded the calls to the modified libdvbcsa with the '4' for Icam:

root@tvheadend:~/minisatip# git diff
diff --git a/src/csa.c b/src/csa.c
index d0d5f7c..fb318b1 100644
--- a/src/csa.c
+++ b/src/csa.c
@@ -52,7 +52,7 @@ void dvbcsa_create_key(SCW *cw) { cw->key = dvbcsa_bs_key_alloc(); }
 void dvbcsa_delete_key(SCW *cw) { dvbcsa_key_free(cw->key); }
 
 void dvbcsa_set_cw(SCW *cw, SPMT *pmt) {
-    dvbcsa_bs_key_set((unsigned char *)cw->cw, cw->key);
+    dvbcsa_bs_key_set_ecm(4, (unsigned char *)cw->cw, cw->key);^M
 }
 
 void copy_batch(struct dvbcsa_bs_batch_s *d, SPMT_batch *s, int len) {

Then I'm running this version as a SAT>IP client to my unmodified productive setup.
./minisatip -N -o 192.168.178.75:2000,10 -s 192.168.178.75 -R ./html/

With that the Sky Germany channels are working and other channels are also working as they get decrypted from the unmodified server. :D

Not nice, as both client and server always try to decrypt, but as a quick workaround usable,...

@catalinii
Copy link
Owner

Do you know if the channels using lcam working on a CI+ cam using minisatip?

@localhosthack0r
Copy link
Contributor Author

Hi catalinii,
no sorry, I don't know.

@holli73
Copy link

holli73 commented Oct 20, 2022

So,... I did another experiment. As a quick & dirty hack, I just hardcoded the calls to the modified libdvbcsa with the '4' for Icam:

root@tvheadend:~/minisatip# git diff
diff --git a/src/csa.c b/src/csa.c
index d0d5f7c..fb318b1 100644
--- a/src/csa.c
+++ b/src/csa.c
@@ -52,7 +52,7 @@ void dvbcsa_create_key(SCW *cw) { cw->key = dvbcsa_bs_key_alloc(); }
 void dvbcsa_delete_key(SCW *cw) { dvbcsa_key_free(cw->key); }
 
 void dvbcsa_set_cw(SCW *cw, SPMT *pmt) {
-    dvbcsa_bs_key_set((unsigned char *)cw->cw, cw->key);
+    dvbcsa_bs_key_set_ecm(4, (unsigned char *)cw->cw, cw->key);^M
 }
 
 void copy_batch(struct dvbcsa_bs_batch_s *d, SPMT_batch *s, int len) {

Then I'm running this version as a SAT>IP client to my unmodified productive setup. ./minisatip -N -o 192.168.178.75:2000,10 -s 192.168.178.75 -R ./html/

With that the Sky Germany channels are working and other channels are also working as they get decrypted from the unmodified server. :D

Not nice, as both client and server always try to decrypt, but as a quick workaround usable,...

i tried this change - i have the modified libdvbcsa in place as soon as i change the csa.c and re-compile my normal channel (like orf) are not working anymore - i use kodi to watch through tvh and minisatip as my tuners having the oscam dvbapi.
i can see that my oscam server is sending the key but no picture in minisatip - once i change the line back in csa.c - orf channels are working again (key + picture) any idea?

thanks
holli

@localhosthack0r
Copy link
Contributor Author

localhosthack0r commented Oct 21, 2022

Hi holli,
yes, this behavior is expected. The missing part in minisatip is to distinguish between normal CSA and Icam.

My dirty workaround, making both decryption types working is to run two instances of minisatip, both connected to OSCam via dvbapi, where one (unchanged, productive setup) uses the normal libdvbcsa and the other instance working as SAT>IP client (-s) to the productive setup is using the modified minisatip and patched libdvbcsa, for the Icam channels. Please note that in the client the dvbapi connection to OScam is using an offset (-o 192.168.178.75:2000 ,10).

In your setup with tvh, I would recommend to use tvh for the decryption (not minisatip), with the patch from the first post, then both normal CSA and Icam is working, because there Icam- detection is already implemnted.

@localhosthack0r
Copy link
Contributor Author

localhosthack0r commented Oct 25, 2022

Hi all,
I have meanwhile implemented a version, where I try to identify Sky Germany / Austria channels via its CAIDs. This is working for me, so that this channels but also channels of other providers not using Icam are getting decrypted.

If you are interested, here is my playground:
https://github.com/localhosthack0r/minisatip

@catalinii
Copy link
Owner

@localhosthack0r can u provode remote access?

@dni1337
Copy link

dni1337 commented Oct 27, 2022

The caid approach is not the best, because not all channels on sly de are icam encrypted.

so, why not check the ecm like they do it in oscam?

if(er->ecm[5] == 0xB0 && er->ecm[6] == 0x01 )

@Jalle19
Copy link
Collaborator

Jalle19 commented Oct 27, 2022

Is there official documentation about this ECM format somewhere?

@dni1337
Copy link

dni1337 commented Oct 27, 2022

I guess its not... not public

@catalinii
Copy link
Owner

Can someone test this with a patched dvbcsa?

@holli73
Copy link

holli73 commented Jan 4, 2023

@catalinii
i tried following:
got the patched libdvbcsa in place - make clean / git pull / make LIBDVBCSA=yes

i can watch now orf (this was not working before with the patched lib) but my other channel still will not show - from oscam it looks ok
2023/01/04 16:43:44 30117810 c (dvbapi) Demuxer 0 stopped descrambling for program 132F (ORF1 HD) 2023/01/04 16:43:44 30117810 c (dvbapi) Demuxer 0 ecmpid 0 CAID: 09C4 ECM_PID: 1B93 PROVID: 000000 2023/01/04 16:43:44 30117810 c (dvbapi) Demuxer 0 ecmpid 1 CAID: 098C ECM_PID: 1A93 PROVID: 000000 2023/01/04 16:43:44 30117810 c (dvbapi) Demuxer 0 ecmpid 2 CAID: 098D ECM_PID: 1C93 PROVID: 000000 2023/01/04 16:43:44 30117810 c (dvbapi) Demuxer 0 found 3 ECM pids and 3 STREAM pids in CA PMT 2023/01/04 16:43:44 30117810 c (dvbapi) Demuxer 0 trying to descramble PID 2 CAID 098D PROVID 000000 ECMPID 1C93 ANY CHID PMTPID 0062 VPID 02FF 2023/01/04 16:43:46 30117810 c (ecm) dvbapi (098D@000000/1270/0074/B7:1C0B6E29CC0DFFD8B9496E6F43013E81): found (2139 ms) by oscam-vu - Sky Cinema Action HD 2023/01/04 16:43:46 30117810 c (ecm) dvbapi (098D@000000/1270/0074/B7:F8973E59A3D30CF1C37D683DF0749F35): found (1634 ms) by oscam-vu - Sky Cinema Action HD 2023/01/04 16:43:52 30117810 c (ecm) dvbapi (098D@000000/1270/0074/B7:61106DA739E12719A9F4EFE9B8DFF39A): found (648 ms) by oscam-vu - Sky Cinema Action HD 2023/01/04 16:43:59 30117810 c (ecm) dvbapi (098D@000000/1270/0074/B7:7FF840DA51038D824BEBA2E657B020C2): found (391 ms) by oscam-vu - Sky Cinema Action HD 2023/01/04 16:44:07 30117810 c (ecm) dvbapi (098D@000000/1270/0074/B7:7F7374463E5364D2B9AF22CF8CCFDE3D): found (1246 ms) by oscam-vu - Sky Cinema Action HD 2023/01/04 16:44:13 30117810 c (ecm) dvbapi (098D@000000/1270/0074/B7:4D15087C7618BE21DC48EADC40C43E45): found (323 ms) by oscam-vu - Sky Cinema Action HD 2023/01/04 16:44:20 30117810 c (ecm) dvbapi (098D@000000/1270/0074/B7:523C9C06E8E627BFF09638FFDFFC72B8): found (674 ms) by oscam-vu - Sky Cinema Action HD 2023/01/04 16:44:27 30117810 c (ecm) dvbapi (098D@000000/1270/0074/B7:FA2FA5345743EC5EF9B883430C802B8B): found (291 ms) by oscam-vu - Sky Cinema Action HD 2023/01/04 16:44:35 30117810 c (ecm) dvbapi (098D@000000/1270/0074/B7:E4D5713206DC309CE3C573317C601338): found (749 ms) by oscam-vu - Sky Cinema Action HD 2023/01/04 16:44:41 30117810 c (ecm) dvbapi (098D@000000/1270/0074/B7:AB4037E6DE25C58ABA17321FAD4D577B): found (336 ms) by oscam-vu - Sky Cinema Action HD 2023/01/04 16:44:48 30117810 c (ecm) dvbapi (098D@000000/1270/0074/B7:B7A6BB69025ED17C517992511E0D7ED1): found (464 ms) by oscam-vu - Sky Cinema Action HD 2023/01/04 16:44:56 30117810 c (ecm) dvbapi (098D@000000/1270/0074/B7:F873585A14AA551C74734557282F22B9): found (870 ms) by oscam-vu - Sky Cinema Action HD 2023/01/04 16:45:02 30117810 c (ecm) dvbapi (098D@000000/1270/0074/B7:AD311A93CB97DDB2958CAB4534E45981): found (307 ms) by oscam-vu - Sky Cinema Action HD 2023/01/04 16:45:09 30117810 c (ecm) dvbapi (098D@000000/1270/0074/B7:63528C575F0456E626F8C3F01D545768): found (665 ms) by oscam-vu - Sky Cinema Action HD 2023/01/04 16:45:14 30117810 c (dvbapi) Demuxer 0 stopped descrambling for program 0074 (Sky Cinema Action HD) 2023/01/04 16:45:15 30117810 c (dvbapi) Demuxer 0 ecmpid 0 CAID: 0648 ECM_PID: 0078 PROVID: 000000 2023/01/04 16:45:15 30117810 c (dvbapi) Demuxer 0 ecmpid 1 CAID: 0650 ECM_PID: 007A PROVID: 000000 2023/01/04 16:45:15 30117810 c (dvbapi) Demuxer 0 ecmpid 2 CAID: 0D95 ECM_PID: 010E PROVID: 000000 2023/01/04 16:45:15 30117810 c (dvbapi) Demuxer 0 ecmpid 3 CAID: 0D98 ECM_PID: 0110 PROVID: 000000 2023/01/04 16:45:15 30117810 c (dvbapi) Demuxer 0 ecmpid 4 CAID: 06E2 ECM_PID: 0140 PROVID: 000000 2023/01/04 16:45:15 30117810 c (dvbapi) Demuxer 0 ecmpid 5 CAID: 0500 ECM_PID: 01CD PROVID: 051900 2023/01/04 16:45:15 30117810 c (dvbapi) Demuxer 0 ecmpid 6 CAID: 098D ECM_PID: 01D6 PROVID: 000000 2023/01/04 16:45:15 30117810 c (dvbapi) Demuxer 0 ecmpid 7 CAID: 09C4 ECM_PID: 01E0 PROVID: 000000 2023/01/04 16:45:15 30117810 c (dvbapi) Demuxer 0 ecmpid 8 CAID: 098C ECM_PID: 01EA PROVID: 000000 2023/01/04 16:45:15 30117810 c (dvbapi) Demuxer 0 found 9 ECM pids and 6 STREAM pids in CA PMT 2023/01/04 16:45:15 30117810 c (dvbapi) Demuxer 0 trying to descramble PID 3 CAID 0D98 PROVID 000000 ECMPID 0110 ANY CHID PMTPID 006B VPID 0780 2023/01/04 16:45:15 30117810 c (ecm) dvbapi (0D98@000004/0000/132F/80:CF1130931E3DC8F18B8511E607AE8CC1): found (87 ms) by orficecard-2 (L/2/2/2) - ORF1 HD 2023/01/04 16:45:21 30117810 c (ecm) dvbapi (0D98@000004/0000/132F/80:1A8F17E7767705F3FB3758EE0198688B): found (88 ms) by orficecard (L/2/2/2) - ORF1 HD 2023/01/04 16:45:31 30117810 c (ecm) dvbapi (0D98@000004/0000/132F/80:E6BBFD62ECE2997A2D0E17A162215189): found (88 ms) by orficecard (L/2/2/2) - ORF1 HD 2023/01/04 16:45:41 30117810 c (ecm) dvbapi (0D98@000004/0000/132F/80:6CDB9C28FA8E0CD6026D2AF89F8B822C): found (88 ms) by orficecard (L/2/2/2) - ORF1 HD
so i get the key's but screen is still black - i use -o ip:port,10 as mentioned in the post's above but even without 10 it makes not difference.

thanks
holli

@catalinii
Copy link
Owner

Can you provide minisatip log?

@holli73
Copy link

holli73 commented Jan 4, 2023

@catalinii
sure - any special trace i should enable?

@catalinii
Copy link
Owner

-l http -f

@localhosthack0r
Copy link
Contributor Author

localhosthack0r commented Jan 5, 2023

Hi @catalinii
thanks a lot for implementing the Icam support.
I did a quick test and for me it is working! I tested both, Icam channels and normal CSA. Both is working.

So I cannot confirm @holli73 findings. @holli73 which version of the libdvbcsa patch do you use? I have seen that there are more then one version, meanwhile,.. I have still the initial patch from the first post in this thread running.

@holli73
Copy link

holli73 commented Jan 6, 2023

@localhosthack0r
i did use the files from the first post - but i did still use the normal tvh and not the modified maybe this was the issue?
is there somewhere a quick guide what needs to be done that minisatip uses dvbapi and tvh as client can watch both types of channels.

thanks
holli

@catalinii
Copy link
Owner

All clients using minisatip should work...please upload the log

@holli73
Copy link

holli73 commented Jan 6, 2023

@catalinii

i did 2 tests -

  1. direct dvbapi connect to oscam with icam on (vuzero4k) and tvh as client
    minisatip.dbg.txt

  2. direct dvbapi connect to main oscam and this oscam is connect to icam oscam through cs378x
    minisatip2.dbg.txt

on both tries i had vlc running against the same channel through the vuzero4k and it worked fine

thanks
holli

@catalinii
Copy link
Owner

None of the logs show the latest minisatip version running.

Try to do git pull && make clean

@holli73
Copy link

holli73 commented Jan 7, 2023

@catalinii
sorry - i have a script to make this automated but no error handling in it ... i did modify the csa in the past and that was the reason the script did not pull because of stashed file...

i did a hard/reset/force and clean/build - now it is on the latest commit but still not working in my env. i just traced a try with setup 2 - from oscam log on vuzero it looks ok and the same on my main oscam:

2023/01/07 01:33:51 5CD2A92A p  (newcamd) CAID: 098D - UA: 0000000000000000 - Provider # 1
2023/01/07 01:33:51 5CD2A92A p  (newcamd) Provider ID: 000000 - SA: 00000000
2023/01/07 01:33:51 6EDC9330 c      (ecm) satip (098D&000000/1270/0074/B7:2F551C0CCF0609262233868A6646BBAC:3CDC994E2353805E0000000000000000): found (372 ms) by skyde2_main - Sky Cinema Action HD
2023/01/07 01:33:53 6EDC9330 c      (ecm) satip (098D&000000/1270/0074/B7:310E1EAD12A07513D08BFE945D930F67:000000000000000029674C35C6DE2B29): found (274 ms) by skyde2_main - Sky Cinema Action HD
2023/01/07 01:34:00 6EDC9330 c      (ecm) satip (098D&000000/1270/0074/B7:7FE115BA35416AA092B8ED1E5D6F78D0:52C2293A5D0779740000000000000000): found (268 ms) by skyde2_main - Sky Cinema Action HD
2023/01/07 01:34:07 6EDC9330 c      (ecm) satip (098D&000000/1270/0074/B7:468CD33B5B96F9279E30F2C815C37E40:000000000000000068F7525F83109B26): found (266 ms) by skyde2_main - Sky Cinema Action HD
2023/01/07 01:34:14 6EDC9330 c      (ecm) satip (098D&000000/1270/0074/B7:B758283A9222DC32AC10EDABC01D71CB:94AAD64518AF515C0000000000000000): found (290 ms) by skyde2_main - Sky Cinema Action HD
2023/01/07 01:34:21 6EDC9330 c      (ecm) satip (098D&000000/1270/0074/B7:98E1463263E35D04BE28EC5C2BAFB0B9:000000000000000042D396772E67B35B): found (276 ms) by skyde2_main - Sky Cinema Action HD
2023/01/07 01:34:28 6EDC9330 c      (ecm) satip (098D&000000/1270/0074/B7:29E23AC12CB7CACA33F9CD1B82051623:0A44C622AD92366C0000000000000000): found (292 ms) by skyde2_main - Sky Cinema Action HD
2023/01/07 01:34:35 6EDC9330 c      (ecm) satip (098D&000000/1270/0074/B7:BA214DAB5969C8B7B6BCB32E9821C2EC:000000000000000038952551073FF503): found (295 ms) by skyde2_main - Sky Cinema Action HD
2023/01/07 01:37:10 6EDC9330 c      (ecm) satip (098D&000000/1270/0074/B7:1EC69D581C37A077D935EDB7EFB0839A:00000000000000000D36D74DB836D001): found (55 ms) by skyde2_main - Sky Cinema Action HD
2023/01/07 01:37:16 6EDC9330 c      (ecm) satip (098D&000000/1270/0074/B7:6FFDD2DA56DBE081E5B7F1843AE8DDC5:A763D036062A710C0000000000000000): found (314 ms) by skyde2_main - Sky Cinema Action HD
2023/01/07 01:37:23 6EDC9330 c      (ecm) satip (098D&000000/1270/0074/B7:8F3A130D1BE81399368538A28D71AFBC:0000000000000000A4D5F42CBBCD917D): found (264 ms) by skyde2_main - Sky Cinema Action HD
2023/01/07 01:37:30 6EDC9330 c      (ecm) satip (098D&000000/1270/0074/B7:0EB75728E1BB7FFE352E09B18085C5F7:D9F78A778E2CBA640000000000000000): found (295 ms) by skyde2_main - Sky Cinema Action HD
2023/01/07 01:37:37 6EDC9330 c      (ecm) satip (098D&000000/1270/0074/B7:D5CFDB26F9CFBBFC04D014EBF9EB85A7:000000000000000081974B52423E050A): found (296 ms) by skyde2_main - Sky Cinema Action HD
2023/01/07 01:43:28 5CD2A92A p   (reader) skyde2_main [newcamd] disconnected: reason inactivity

here is the new minisatip capture:
minisatip.dbg.txt

@catalinii
Copy link
Owner

Everything seems ok except validating the Control Word, because the stream obtained is not a valid stream.

@catalinii
Copy link
Owner

Try maybe to clean the dvbcsa build and apply the patch again, then build and install

@holli73
Copy link

holli73 commented Jan 7, 2023

hello,

i tried following:

cd libdvbcsa-catalin/
git clone https://github.com/glenvt18/libdvbcsa.git
git fetch origin pull/7/head:xx
git checkout xx
./bootstrap
./configure
make -j8
sudo make install

ls -lctr /usr/local/lib
-rwxr-xr-x 1 root root    71800 Jan  8 00:16 libdvbcsa.so.1.0.1
lrwxrwxrwx 1 root root       18 Jan  8 00:16 libdvbcsa.so.1 -> libdvbcsa.so.1.0.1
lrwxrwxrwx 1 root root       18 Jan  8 00:16 libdvbcsa.so -> libdvbcsa.so.1.0.1
-rwxr-xr-x 1 root root      946 Jan  8 00:16 libdvbcsa.la
-rw-r--r-- 1 root root    75282 Jan  8 00:16 libdvbcsa.a

holli@satip:~/BUILD/minisatip/minisatip-try-latest$ git pull
Already up to date.
holli@satip:~/BUILD/minisatip/minisatip-try-latest$ make clean
make -C src clean
make[1]: Entering directory '/home/holli/BUILD/minisatip/minisatip-try-latest/src'
rm -rf ../build ../minisatip >> /dev/null
...

make LIBDVBCSA=yes

ls -lctr  /home/holli/BUILD/minisatip/minisatip-master/minisatip-latest 
lrwxrwxrwx 1 holli holli     33 Oct 28 15:25 minisatip-latest -> ../minisatip-try-latest/minisatip

holli@satip:~/BUILD/minisatip/minisatip-try-latest$ ls -lctr $PWD/minisatip
-rwxrwxr-x 1 holli holli 977096 Jan  8 00:21 /home/holli/BUILD/minisatip/minisatip-try-latest/minisatip

holli@satip:~/BUILD/minisatip/minisatip-master$ sudo /home/holli/BUILD/minisatip/minisatip-master/minisatip-latest -a 8:0:0 -D 1 -e 0-7 -o 192.168.248.248:11234,10 -x 8080 -m 661122334455 -O -y 554 -c 0:0,1:0,2:0,3:0,4:0,5:0,6:0,7:0 -f -l htt > minisatip.dbg

but still the same - attached again the minisatip log - from oscam it looked ok:
minisatip.dbg.txt

2023/01/08 00:26:29 30117810 c   (dvbapi) Demuxer 0 stopped descrambling for program 0074 (Sky Cinema Action HD)
2023/01/08 00:28:20 30117810 c   (dvbapi) Client connected: 'minisatip/1.2.51~6d624cc' (protocol version = 2)
2023/01/08 00:28:39 30117810 c   (dvbapi) Demuxer 0 ecmpid 0 CAID: 09C4 ECM_PID: 1B93 PROVID: 000000 
2023/01/08 00:28:39 30117810 c   (dvbapi) Demuxer 0 ecmpid 1 CAID: 098C ECM_PID: 1A93 PROVID: 000000 
2023/01/08 00:28:39 30117810 c   (dvbapi) Demuxer 0 ecmpid 2 CAID: 098D ECM_PID: 1C93 PROVID: 000000 
2023/01/08 00:28:39 30117810 c   (dvbapi) Demuxer 0 found 3 ECM pids and 3 STREAM pids in CA PMT
2023/01/08 00:28:39 30117810 c   (dvbapi) Demuxer 0 trying to descramble PID 2 CAID 098D PROVID 000000 ECMPID 1C93 ANY CHID PMTPID 0062 VPID 02FF
2023/01/08 00:28:39 30117810 c      (ecm) dvbapi (098D@000000/1270/0074/B7:90B8489376B39EC4D08189F044F2F810): found (86 ms) by oscam-vu - Sky Cinema Action HD
2023/01/08 00:28:39 30117810 c      (ecm) dvbapi (098D@000000/1270/0074/B7:087DCEAAA2C2A37B5E793243898DA35A): found (228 ms) by oscam-vu - Sky Cinema Action HD
2023/01/08 00:28:46 30117810 c      (ecm) dvbapi (098D@000000/1270/0074/B7:D3BC1DF90CBA35687F56C7618D539557): found (244 ms) by oscam-vu - Sky Cinema Action HD
2023/01/08 00:28:53 30117810 c      (ecm) dvbapi (098D@000000/1270/0074/B7:0D17932CCA450D9EE1B90CF3AEB9F2D9): found (243 ms) by oscam-vu - Sky Cinema Action HD
2023/01/08 00:29:00 30117810 c      (ecm) dvbapi (098D@000000/1270/0074/B7:239C6448BCC58D67425CDC959E3ECCD9): found (289 ms) by oscam-vu - Sky Cinema Action HD
2023/01/08 00:29:02 30117810 c   (dvbapi) Demuxer 0 stopped descrambling for program 0074 (Sky Cinema Action HD)
2023/01/08 00:30:02 30117810 c   (dvbapi) Client connected: 'minisatip/1.2.51~6d624cc' (protocol version = 2)

i have no idea what might be wrong here?
any suggestions would be highly appreciated.

thanks
holli

@catalinii
Copy link
Owner

I am not sure if this is the issue as what you did is correct, but I have uploaded binaries with patched libdvbcsa here: https://github.com/catalinii/minisatip/releases

can you give them a try ?

@holli73
Copy link

holli73 commented Jan 12, 2023

@catalinii ,

thanks for the static build - but i can't run it - as my satip server is still on ubuntu 20.04 and glibc is only available till 2.31

holli@satip:~/BUILD/minisatip/minisatip.xx$ ./minisatip
./minisatip: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.33' not found (required by ./minisatip)
./minisatip: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.34' not found (required by ./minisatip)
holli@satip:~/BUILD/minisatip/minisatip.xx$ cat /etc/lsb-release
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=20.04
DISTRIB_CODENAME=focal
DISTRIB_DESCRIPTION="Ubuntu 20.04.5 LTS"
holli@satip:~/BUILD/minisatip/minisatip.xx$

best regards
holli

@holli73
Copy link

holli73 commented Feb 24, 2023

@catalinii - i use now a native icam on x64 and minisatip works fine - even my compiled minisatip with modified libdvbcsa - thanks for your help and time.

holli

@Jalle19
Copy link
Collaborator

Jalle19 commented Mar 10, 2023

Looks like we can close this

@Jalle19 Jalle19 closed this as completed Mar 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants