From 2db7becc5bd5d362e8796acf8a055969d51909f4 Mon Sep 17 00:00:00 2001 From: Mariusz Bialonczyk Date: Fri, 13 Dec 2013 09:16:20 +0100 Subject: [PATCH] capmt: adjust for recent OSCam frame change Additional byte describing adapter index was added to the beginning of the frame. It only affect tvh capmt mode 2. --- src/descrambler/capmt.c | 17 +++++++++++++++-- src/webui/static/app/capmteditor.js | 2 +- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/src/descrambler/capmt.c b/src/descrambler/capmt.c index 7e68347a..7bf95672 100644 --- a/src/descrambler/capmt.c +++ b/src/descrambler/capmt.c @@ -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); diff --git a/src/webui/static/app/capmteditor.js b/src/webui/static/app/capmteditor.js index 06fa1f78..ae040c8d 100644 --- a/src/webui/static/app/capmteditor.js +++ b/src/webui/static/app/capmteditor.js @@ -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)'] ]