source: trunk/module-dvbapi-mca.c@ 8439

Last change on this file since 8439 was 8439, checked in by gf, 9 years ago

webif/dvbapi: Do not prefix log messages comming from WebIf with "dvbapi: ".

module-dvbapi.h redefines cs_log() to include "dvbapi: " prefix.

Since module-webif.c includes module-dvbapi.h all cs_log lines coming
from webif were wrongly were prefixed with "dvbapi: ".

File size: 16.6 KB
Line 
1/**
2 * dvbapi-support for Matrix Cam Air
3 *
4 * The code is based partially on module-dvbapi-azbox.
5 * the (closed source) oscam that comes with the MCA is
6 * apparently based on svn-revision 5124-5242.
7 * DEMUXMATRIX is essentially the old DEMUXTYPE which
8 * has changed since then.
9 *
10 * We may be able to implement add/remove-filter
11 * by adding/removing them from DEMUXMATRIX
12 * and reexecute mca_write_flt
13 * In some cases the MCA will send ECMs for multiple PIDS
14 * So it is apparently able to handle multiple filters
15 *
16 * @author dirtyharry123
17 */
18
19#include "globals.h"
20
21#if defined(HAVE_DVBAPI) && defined(WITH_MCA)
22
23//#include "extapi/openxcas/openxcas_api.h"
24//#include "extapi/openxcas/openxcas_message.h"
25
26#define DVBAPI_LOG_PREFIX 1
27#include "module-dvbapi.h"
28#include "module-dvbapi-mca.h"
29#include "oscam-client.h"
30#include "oscam-ecm.h"
31#include "oscam-reader.h"
32#include "oscam-string.h"
33#include "oscam-time.h"
34
35#define LOG_PREFIX "mca: "
36#define LOG_PREFIX_MSG "mcamsg: "
37
38int8_t dummy(void){ return 0;}
39#define openxcas_start_filter_ex(...) dummy()
40#define openxcas_stop_filter_ex(...) dummy()
41#define openxcas_get_message mca_get_message
42#define azbox_openxcas_ex_callback mca_ex_callback
43#define openxcas_stop_filter(...) do { } while(0)
44#define openxcas_remove_filter(...) do { } while(0)
45#define openxcas_destory_cipher_ex(...) do { } while(0)
46
47// These variables are declared in module-dvbapi.c
48extern void * dvbapi_client;
49extern DEMUXTYPE demux[MAX_DEMUX];
50
51// These are used in module-dvbapi.c
52int32_t openxcas_provid;
53uint16_t openxcas_sid, openxcas_caid, openxcas_ecm_pid;
54
55static unsigned char openxcas_cw[16];
56static int32_t openxcas_seq, openxcas_filter_idx, openxcas_stream_id, openxcas_cipher_idx, openxcas_busy;
57static uint16_t openxcas_video_pid, openxcas_audio_pid, openxcas_data_pid;
58static uint8_t found[MAX_DEMUX];
59
60int fd_mdvbi = -1;
61int fd_mdesc = -1;
62int fd_mflt = -1;
63
64int mca_open(void){
65 if((fd_mdvbi = open(MCA_DVBI, O_RDONLY)) < 0){
66 cs_log(LOG_PREFIX "can't open \"%s\" (err=%d %s)", MCA_DVBI, errno, strerror(errno));
67 return -1;
68 }
69 if((fd_mdesc = open(MCA_DESC, O_WRONLY)) < 0){
70 cs_log(LOG_PREFIX "can't open \"%s\" (err=%d %s)", MCA_DESC, errno, strerror(errno));
71 return -1;
72 }
73 if((fd_mflt = open(MCA_FLT, O_WRONLY)) < 0){
74 cs_log(LOG_PREFIX "can't open \"%s\" (err=%d %s)", MCA_FLT, errno, strerror(errno));
75 return -1;
76 }
77 return 0;
78}
79
80int mca_exit(void){
81 if((fd_mdvbi = close(fd_mdvbi)) < 0){
82 cs_log(LOG_PREFIX "can't close \"%s\" (err=%d %s)", MCA_DVBI, errno, strerror(errno));
83 return -1;
84 }
85 if((fd_mdvbi = close(fd_mdesc)) < 0){
86 cs_log(LOG_PREFIX "can't close \"%s\" (err=%d %s)", MCA_DESC, errno, strerror(errno));
87 return -1;
88 }
89 if((fd_mdvbi = close(fd_mflt)) < 0){
90 cs_log(LOG_PREFIX "can't close \"%s\" (err=%d %s)", MCA_FLT, errno, strerror(errno));
91 return -1;
92 }
93 return 0;
94}
95
96void mca_init(void){
97 if (mca_open() < 0) {
98 cs_log(LOG_PREFIX "could not init");
99 }
100}
101
102void mca_close(void){
103 if (mca_exit() < 0) {
104 cs_log(LOG_PREFIX "could not close");
105 }
106}
107
108int mca_get_message(openxcas_msg_t * message, int timeout){
109 int rval=-1;
110 struct pollfd mdvbi_poll_fd;
111 mdvbi_poll_fd.fd = fd_mdvbi;
112 mdvbi_poll_fd.events = POLLIN | POLLPRI;
113 rval=poll(&mdvbi_poll_fd, 1, timeout == 0 ? -1 : timeout);
114 if((rval >= 1) && (mdvbi_poll_fd.revents & (POLLIN | POLLPRI))){
115 rval = read(fd_mdvbi, message, 568);
116 }
117 else rval=-1;
118 return rval;
119}
120
121int mca_write_flt(DEMUXMATRIX * demux_matrix, int timeout){
122 int rval=-1;
123 struct pollfd mflt_poll_fd;
124 mflt_poll_fd.fd = fd_mflt;
125 mflt_poll_fd.events = POLLOUT;
126 rval=poll(&mflt_poll_fd, 1, timeout);
127 if((rval >= 1) && (mflt_poll_fd.revents & POLLOUT)){
128 rval = write(fd_mflt, demux_matrix, sizeof(DEMUXMATRIX));
129 }
130 else rval=-1;
131 return rval;
132}
133
134int mca_set_key(unsigned char * mca_cw){
135 int rval=-1;
136 struct pollfd mdesc_poll_fd;
137 mdesc_poll_fd.fd = fd_mdesc;
138 mdesc_poll_fd.events = POLLOUT;
139 rval=poll(&mdesc_poll_fd, 1, 0);
140 if((rval >= 1) && (mdesc_poll_fd.revents & POLLOUT)){
141 rval = write(fd_mdesc, mca_cw, 16);
142 }
143 else rval=-1;
144 return rval;
145}
146
147int mca_capmt_remove_duplicates(uchar *capmt, int len){
148 int i,newlen=len;
149 uint16_t descriptor_length = 0;
150 uint32_t program_info_length = ((capmt[4] & 0x0F) << 8) | capmt[5];
151 for (i=7; i<len; i+=descriptor_length +2){
152 descriptor_length = capmt[i+1];
153 if(capmt[i] != 0x09) continue;
154 if(!memcmp(&(capmt[i]), &(capmt[i+descriptor_length+2]), descriptor_length+2)){
155 memmove(&(capmt[i+descriptor_length+2]), &(capmt[i+(2*(descriptor_length+2))]), newlen-(descriptor_length+2));
156 newlen-=descriptor_length+2;
157 }
158 }
159 program_info_length-=(len-newlen);
160 capmt[4] = (uchar)((capmt[4] & 0xF0) | ((program_info_length & 0xF00) >> 8));
161 capmt[5] = (uchar)(program_info_length & 0x0FF);
162 return newlen;
163}
164
165void mca_demux_convert(DEMUXTYPE * demux_orig, DEMUXMATRIX * demux_matrix){
166 int i=0;
167 memset(demux_matrix, 0, sizeof(DEMUXMATRIX));
168 demux_matrix->demux_index = (int32_t)demux_orig->demux_index;
169 for(i=0; i<MAX_FILTER_MATRIX; ++i){
170 demux_matrix->demux_fd[i].fd = (uint32_t) demux_orig->demux_fd[i].fd;
171 demux_matrix->demux_fd[i].pidindex = (int32_t) demux_orig->demux_fd[i].pidindex;
172 demux_matrix->demux_fd[i].pid = (int32_t) demux_orig->demux_fd[i].pid;
173 demux_matrix->demux_fd[i].type = (uint16_t) demux_orig->demux_fd[i].type;
174 demux_matrix->demux_fd[i].count = (int32_t) demux_orig->demux_fd[i].count;
175 }
176 demux_matrix->ca_mask = (int32_t)demux_orig->ca_mask;
177 demux_matrix->adapter_index = (int32_t)demux_orig->adapter_index;
178 demux_matrix->socket_fd = (int32_t)demux_orig->socket_fd;
179 demux_matrix->ECMpidcount = (int32_t)demux_orig->ECMpidcount;
180 for(i=0; i<demux_matrix->ECMpidcount; ++i){
181 demux_matrix->ECMpids[i].CAID = (uint16_t)demux_orig->ECMpids[i].CAID;
182 demux_matrix->ECMpids[i].PROVID = (uint32_t)demux_orig->ECMpids[i].PROVID;
183 demux_matrix->ECMpids[i].ECM_PID = (uint16_t)demux_orig->ECMpids[i].ECM_PID;
184 demux_matrix->ECMpids[i].EMM_PID = (uint16_t)demux_orig->ECMpids[i].EMM_PID;
185 demux_matrix->ECMpids[i].irdeto_numchids = (int32_t)demux_orig->ECMpids[i].irdeto_chids;
186 demux_matrix->ECMpids[i].irdeto_curchid = (int32_t)demux_orig->ECMpids[i].irdeto_chids;
187 demux_matrix->ECMpids[i].irdeto_chid = (int32_t)demux_orig->ECMpids[i].irdeto_chids;
188 demux_matrix->ECMpids[i].checked = (int32_t)demux_orig->ECMpids[i].checked;
189 demux_matrix->ECMpids[i].status = (int32_t)demux_orig->ECMpids[i].status;
190 demux_matrix->ECMpids[i].table = (unsigned char)demux_orig->ECMpids[i].table;
191 demux_matrix->ECMpids[i].streams = (uint32_t)demux_orig->ECMpids[i].streams;
192 }
193 demux_matrix->STREAMpidcount = (int32_t)demux->STREAMpidcount;
194 memcpy(&demux_matrix->STREAMpids, &demux_orig->STREAMpids, demux_matrix->STREAMpidcount * sizeof(uint16_t));
195 demux_matrix->pidindex = (int32_t)demux_orig->pidindex;
196 demux_matrix->curindex = (int32_t)demux_orig->curindex;
197 demux_matrix->tries = (int32_t)demux_orig->tries;
198 demux_matrix->max_status = (int32_t)demux_orig->max_status;
199 demux_matrix->program_number = (uint16_t)demux_orig->program_number;
200 memcpy(&demux_matrix->lastcw, &demux_orig->lastcw, 2 * 8 * sizeof(unsigned char));
201 demux_matrix->emm_filter = (int32_t)demux_orig->emm_filter;
202 memcpy(&demux_matrix->hexserial, &demux_orig->hexserial, 8 * sizeof(uchar));
203 demux_matrix->rdr = (struct s_reader *)demux_orig->rdr;
204 memcpy(&demux_matrix->pmt_file, &demux_orig->pmt_file, 30);
205 demux_matrix->pmt_time = (int32_t)demux_orig->pmt_time;
206}
207
208void mca_ecm_callback(int32_t stream_id, uint32_t UNUSED(seq), int32_t cipher_index, uint32_t caid, unsigned char *ecm_data, int32_t l, uint16_t pid) {
209 cs_debug_mask(D_DVBAPI, LOG_PREFIX "ecm callback received");
210
211 openxcas_stream_id = stream_id;
212 //openxcas_seq = seq;
213 //openxcas_caid = caid;
214 openxcas_ecm_pid = pid;
215 openxcas_busy = 1;
216 //char tmp[1024];
217
218 //As soon as we have received a valid CW we lock onto that CAID, otherwise we will have freezers.
219 if (openxcas_caid && openxcas_caid != caid){
220 cs_log(LOG_PREFIX "ignoring caid: %04X, waiting for %04X", caid, openxcas_caid);
221 openxcas_busy = 0;
222 return;
223 }
224
225 ECM_REQUEST *er;
226 if (!(er=get_ecmtask()))
227 return;
228
229 er->srvid = openxcas_sid;
230 er->caid = openxcas_caid;
231 er->pid = openxcas_ecm_pid;
232 er->prid = openxcas_provid;
233
234 er->ecmlen = l;
235 memcpy(er->ecm, ecm_data, er->ecmlen);
236
237 request_cw(dvbapi_client, er);
238
239 openxcas_stop_filter(openxcas_stream_id, OPENXCAS_FILTER_ECM);
240 openxcas_remove_filter(openxcas_stream_id, OPENXCAS_FILTER_ECM);
241
242 openxcas_cipher_idx = cipher_index;
243
244 struct timeb tp;
245 cs_ftime(&tp);
246 tp.time+=500;
247}
248
249
250void mca_ex_callback(int32_t stream_id, uint32_t UNUSED(seq), int32_t idx, uint32_t pid, unsigned char *ecm_data, int32_t l) {
251 cs_debug_mask(D_DVBAPI, LOG_PREFIX "ex callback received");
252
253 openxcas_stream_id = stream_id;
254 openxcas_ecm_pid = pid;
255 openxcas_cipher_idx = idx; // is this really cipher_idx?
256
257 ECM_REQUEST *er;
258 if (!(er=get_ecmtask()))
259 return;
260
261 er->srvid = openxcas_sid;
262 er->caid = openxcas_caid;
263 er->pid = openxcas_ecm_pid;
264 er->prid = openxcas_provid;
265
266 er->ecmlen = l;
267 memcpy(er->ecm, ecm_data, er->ecmlen);
268
269 request_cw(dvbapi_client, er);
270
271 if (openxcas_stop_filter_ex(stream_id, seq, openxcas_filter_idx) < 0)
272 cs_log(LOG_PREFIX "unable to stop ex filter");
273 else
274 cs_debug_mask(D_DVBAPI, LOG_PREFIX "ex filter stopped");
275
276
277
278 unsigned char mask[12];
279 unsigned char comp[12];
280 memset(&mask, 0x00, sizeof(mask));
281 memset(&comp, 0x00, sizeof(comp));
282
283 mask[0] = 0xff;
284 comp[0] = ecm_data[0] ^ 1;
285
286 if ((openxcas_filter_idx = openxcas_start_filter_ex(stream_id, seq, openxcas_ecm_pid, mask, comp, (void *)azbox_openxcas_ex_callback)) < 0)
287 cs_log(LOG_PREFIX "unable to start ex filter");
288 else
289 cs_debug_mask(D_DVBAPI, LOG_PREFIX "ex filter started, pid = %x", openxcas_ecm_pid);
290}
291
292void * mca_main_thread(void *cli) {
293 struct s_client * client = (struct s_client *) cli;
294 client->thread=pthread_self();
295 pthread_setspecific(getclient, cli);
296 dvbapi_client=cli;
297
298 struct s_auth *account;
299 int32_t ok = 0;
300 for (account = cfg.account; account; account=account->next) {
301 if ((ok = streq(cfg.dvbapi_usr, account->usr)))
302 break;
303 }
304 cs_auth_client(client, ok ? account : (struct s_auth *)(-1), "dvbapi");
305
306 dvbapi_read_priority();
307
308 openxcas_msg_t msg;
309 int32_t ret;
310 while ((ret = openxcas_get_message(&msg, 0)) >= 0) {
311 cs_sleepms(10);
312
313 if (ret) {
314 openxcas_stream_id = msg.stream_id;
315 openxcas_seq = msg.sequence;
316 struct stOpenXCAS_Data data;
317
318 switch(msg.cmd) {
319 case OPENXCAS_SELECT_CHANNEL:
320 cs_debug_mask(D_DVBAPI, LOG_PREFIX_MSG "OPENXCAS_SELECT_CHANNEL");
321
322 // parse channel info
323 struct stOpenXCASChannel chan;
324 memcpy(&chan, msg.buf, msg.buf_len);
325
326 cs_log(LOG_PREFIX "channel change: sid = %x, vpid = %x. apid = %x", chan.service_id, chan.v_pid, chan.a_pid);
327
328 openxcas_video_pid = chan.v_pid;
329 openxcas_audio_pid = chan.a_pid;
330 openxcas_data_pid = chan.d_pid;
331 break;
332 case OPENXCAS_START_PMT_ECM:
333 //FIXME: Apparently this is what the original MCA-oscam does
334 cs_debug_mask(D_DVBAPI, LOG_PREFIX_MSG "OPENXCAS_STOP_PMT_ECM");
335 memset(&demux, 0, sizeof(demux));
336 memset(&found, 0, sizeof(found));
337
338 cs_debug_mask(D_DVBAPI, LOG_PREFIX_MSG "OPENXCAS_START_PMT_ECM");
339
340 // parse pmt
341 cs_ddump_mask(D_DVBAPI, msg.buf + 2, msg.buf_len -2, LOG_PREFIX "capmt:");
342 // For some reason the mca sometimes sends duplicate ECMpids,
343 // we remove them here so dvbapi will not try them twice.
344 int new_len = mca_capmt_remove_duplicates(msg.buf + 2, msg.buf_len -2);
345 if(new_len < msg.buf_len - 2)
346 cs_ddump_mask(D_DVBAPI, msg.buf + 2, new_len, LOG_PREFIX "capmt (duplicates removed):");
347 int demux_id = dvbapi_parse_capmt(msg.buf + 2, new_len, -1, NULL);
348
349
350 unsigned char mask[12];
351 unsigned char comp[12];
352 memset(&mask, 0x00, sizeof(mask));
353 memset(&comp, 0x00, sizeof(comp));
354
355 mask[0] = 0xfe;
356 comp[0] = 0x80;
357
358 if (demux_id < 0){
359 cs_log(LOG_PREFIX "could not parse pmt");
360 break;
361 }
362
363 //if ((ret = openxcas_add_filter(msg.stream_id, OPENXCAS_FILTER_ECM, 0, 0xffff, openxcas_ecm_pid, mask, comp, (void *)mca_ecm_callback)) < 0)
364 DEMUXMATRIX demux_matrix;
365 mca_demux_convert(&demux[demux_id], &demux_matrix);
366 if ((ret = mca_write_flt(&demux_matrix, 0)) < 0)
367 cs_log(LOG_PREFIX "unable to add ecm filter");
368 else{
369 cs_debug_mask(D_DVBAPI, LOG_PREFIX "ecm filter added, pid = %x, caid = %x", openxcas_ecm_pid, 0);
370 cs_debug_mask(D_DVBAPI, LOG_PREFIX "ecm filter started");
371 }
372
373 //if (!openxcas_create_cipher_ex(msg.stream_id, openxcas_seq, 0, openxcas_ecm_pid, openxcas_video_pid, 0xffff, openxcas_audio_pid, 0xffff, 0xffff, 0xffff))
374 // cs_log(LOG_PREFIX "failed to create cipher ex");
375 //else
376 cs_debug_mask(D_DVBAPI, LOG_PREFIX "cipher created");
377 break;
378 case OPENXCAS_STOP_PMT_ECM:
379 cs_debug_mask(D_DVBAPI, LOG_PREFIX_MSG "OPENXCAS_STOP_PMT_ECM");
380 openxcas_stop_filter(msg.stream_id, OPENXCAS_FILTER_ECM);
381 openxcas_remove_filter(msg.stream_id, OPENXCAS_FILTER_ECM);
382 openxcas_stop_filter_ex(msg.stream_id, msg.sequence, openxcas_filter_idx);
383 openxcas_destory_cipher_ex(msg.stream_id, msg.sequence);
384 memset(&demux, 0, sizeof(demux));
385 memset(&found, 0, sizeof(found));
386 break;
387 case OPENXCAS_ECM_CALLBACK:
388 cs_debug_mask(D_DVBAPI, LOG_PREFIX_MSG "OPENXCAS_ECM_CALLBACK");
389 memcpy(&data, msg.buf, msg.buf_len);
390 if (!openxcas_busy)
391 //openxcas_filter_callback(msg.stream_id, msg.sequence, OPENXCAS_FILTER_ECM, &data);
392 mca_ecm_callback(msg.stream_id, msg.sequence, data.cipher_index, data.ca_system_id, (unsigned char*)&data.buf, data.len, data.pid);
393 break;
394 case OPENXCAS_PID_FILTER_CALLBACK:
395 cs_debug_mask(D_DVBAPI, LOG_PREFIX_MSG "OPENXCAS_PID_FILTER_CALLBACK");
396 memcpy(&data, msg.buf, msg.buf_len);
397 //openxcas_filter_callback_ex(msg.stream_id, msg.sequence, (struct stOpenXCAS_Data *)msg.buf);
398 mca_ex_callback(msg.stream_id, msg.sequence, data.cipher_index, data.pid, (unsigned char*)&data.buf, data.len);
399 break;
400 case OPENXCAS_QUIT:
401 cs_debug_mask(D_DVBAPI, LOG_PREFIX_MSG "OPENXCAS_QUIT");
402 mca_exit();
403 cs_log(LOG_PREFIX "exited");
404 return NULL;
405 break;
406 case OPENXCAS_UKNOWN_MSG:
407 default:
408 cs_debug_mask(D_DVBAPI, LOG_PREFIX_MSG "OPENXCAS_UKNOWN_MSG (%d)", msg.cmd);
409 //cs_ddump_mask(D_DVBAPI, &msg, sizeof(msg), "msg dump:");
410 break;
411 }
412 }
413 }
414 cs_log(LOG_PREFIX "invalid message");
415 return NULL;
416}
417
418void mca_send_dcw(struct s_client *client, ECM_REQUEST *er) {
419 cs_debug_mask(D_DVBAPI, LOG_PREFIX "send_dcw");
420
421 FILE *ecmtxt;
422 if ((ecmtxt = fopen(ECMINFO_FILE, "w"))) {
423 char tmp[25];
424 if(er->rc <= E_CACHEEX) {
425 fprintf(ecmtxt, "caid: 0x%04X\npid: 0x%04X\nprov: 0x%06X\n", er->caid, er->pid, (uint) er->prid);
426 fprintf(ecmtxt, "reader: %s\n", er->selected_reader->label);
427 if (is_cascading_reader(er->selected_reader))
428 fprintf(ecmtxt, "from: %s\n", er->selected_reader->device);
429 else
430 fprintf(ecmtxt, "from: local\n");
431 fprintf(ecmtxt, "protocol: %s\n", reader_get_type_desc(er->selected_reader, 1));
432 fprintf(ecmtxt, "hops: %d\n", er->selected_reader->currenthops);
433 fprintf(ecmtxt, "ecm time: %.3f\n", (float) client->cwlastresptime/1000);
434 fprintf(ecmtxt, "cw0: %s\n", cs_hexdump(1,demux[0].lastcw[0],8, tmp, sizeof(tmp)));
435 fprintf(ecmtxt, "cw1: %s\n", cs_hexdump(1,demux[0].lastcw[1],8, tmp, sizeof(tmp)));
436 fclose(ecmtxt);
437 ecmtxt = NULL;
438 } else {
439 fprintf(ecmtxt, "ECM information not found\n");
440 fclose(ecmtxt);
441 }
442 }
443
444 openxcas_busy = 0;
445
446 int32_t i;
447 for (i=0; i < MAX_DEMUX; i++) {
448
449 if (er->rc >= E_NOTFOUND && !found[i]) {
450 cs_debug_mask(D_DVBAPI, "cw not found");
451
452 if (demux[i].pidindex==-1)
453 dvbapi_try_next_caid(i);
454
455 openxcas_stop_filter(openxcas_stream_id, OPENXCAS_FILTER_ECM);
456 openxcas_remove_filter(openxcas_stream_id, OPENXCAS_FILTER_ECM);
457
458 unsigned char mask[12];
459 unsigned char comp[12];
460 memset(&mask, 0x00, sizeof(mask));
461 memset(&comp, 0x00, sizeof(comp));
462
463 mask[0] = 0xfe;
464 comp[0] = 0x80;
465
466 DEMUXMATRIX demux_matrix;
467 mca_demux_convert(&demux[0], &demux_matrix);
468 if (mca_write_flt(&demux_matrix, 0) < 0)
469 cs_log(LOG_PREFIX "unable to add ecm filter (0)");
470 else{
471 cs_debug_mask(D_DVBAPI, LOG_PREFIX "ecm filter added, pid = %x, caid = %x", openxcas_ecm_pid, 0);
472 cs_debug_mask(D_DVBAPI, LOG_PREFIX "ecm filter started");
473 }
474
475 return;
476 }
477 else{
478 found[i]=1;
479 }
480 }
481
482 unsigned char nullcw[8];
483 memset(nullcw, 0, 8);
484
485 int32_t n;
486 for (n=0;n<2;n++) {
487 if (memcmp(er->cw + (n * 8), demux[0].lastcw[n], 8) && memcmp(er->cw + (n * 8), nullcw, 8)) {
488 memcpy(demux[0].lastcw[n], er->cw + (n * 8), 8);
489 memcpy(openxcas_cw + (n * 8), er->cw + (n * 8), 8);
490 }
491 }
492
493 if (mca_set_key(openxcas_cw) < 0)
494 cs_log(LOG_PREFIX "set cw failed");
495 else
496 cs_ddump_mask(D_DVBAPI, openxcas_cw, 16, LOG_PREFIX "write cws to descrambler");
497}
498
499#endif
Note: See TracBrowser for help on using the repository browser.