]> git.ipfire.org Git - thirdparty/tvheadend.git/commitdiff
capmt: adjust for recent OSCam frame change 311/head
authorMariusz Bialonczyk <manio@skyboo.net>
Fri, 13 Dec 2013 08:16:20 +0000 (09:16 +0100)
committerMariusz Bialonczyk <manio@skyboo.net>
Fri, 13 Dec 2013 08:21:24 +0000 (09:21 +0100)
Additional byte describing adapter index was
added to the beginning of the frame.
It only affect tvh capmt mode 2.

src/descrambler/capmt.c
src/webui/static/app/capmteditor.js

index 7e68347a678dfe01f33dda12d38782a2bbfdf99a..7bf95672870fd133824d0d347a3d5f6044f6fd57 100644 (file)
@@ -385,7 +385,7 @@ handle_ca0(capmt_t* capmt) {
   int *request = NULL;
   ca_descr_t *ca;
   ca_pid_t *cpd;
-  int process_key, process_next, cai;
+  int process_key, process_next, cai = 0;
   int i, j;
   int recvsock = 0;
 
@@ -422,6 +422,18 @@ handle_ca0(capmt_t* capmt) {
       else
         recvsock = capmt->capmt_sock_ca0[i];
       if (recvsock > 0) {
+        if (capmt->capmt_oscam == 2)
+        {
+          // adapter index is in first byte
+          uint8_t adapter_index;
+          ret = recv(recvsock, &adapter_index, 1, MSG_DONTWAIT);
+          if (ret < 0)
+          {
+            usleep(10 * 1000);
+            continue;
+          }
+          cai = adapter_index;
+        }
         request = NULL;
         ret = recv(recvsock, buffer, (capmt->capmt_oscam == 2) ? sizeof(int) : bufsize, MSG_DONTWAIT);
         if (ret > 0) {
@@ -481,7 +493,8 @@ handle_ca0(capmt_t* capmt) {
     if (capmt->capmt_oscam) {
       if (!request)
         continue;
-      cai = i;
+      if (capmt->capmt_oscam != 2) //in mode 2 we read it directly from socket
+        cai = i;
       if (*request == CA_SET_PID) {
         cpd = (ca_pid_t *)&buffer[sizeof(int)];
         tvhlog(LOG_DEBUG, "capmt", "CA_SET_PID cai %d req %d (%d %04x)", cai, *request, cpd->index, cpd->pid);
index 06fa1f78fd6b99ac2e73af3113c308753e39dbe5..ae040c8d5d297963f6d640412726c1770f555667 100644 (file)
@@ -25,7 +25,7 @@ tvheadend.capmteditor = function() {
                        fields: ['res','name'],
                        id: 0,
                        data: [
-                               ['2','Recent OSCam (svn rev >= 9063)'],
+                               ['2','Recent OSCam (svn rev >= 9095)'],
                                ['1','Older OSCam'],
                                ['0','Wrapper (capmt_ca.so)']
                        ]