diff -Naur a/Makefile b/Makefile --- a/Makefile 2014-06-10 23:31:37.000000000 +0300 +++ b/Makefile 2014-07-05 12:00:40.000000000 +0300 @@ -283,7 +283,8 @@ # CAPMT SRCS-${CONFIG_CAPMT} += \ - src/descrambler/capmt.c + src/descrambler/capmt.c \ + src/descrambler/ccw.c \ # FFdecsa ifneq ($(CONFIG_DVBCSA),yes) diff -Naur a/src/descrambler/capmt.c b/src/descrambler/capmt.c --- a/src/descrambler/capmt.c 2014-07-05 11:47:02.000000000 +0300 +++ b/src/descrambler/capmt.c 2014-07-05 12:23:11.000000000 +0300 @@ -1824,6 +1824,7 @@ capmt->capmt_port); td->td_nicename = strdup(buf); td->td_service = s; + td->dtype = 0; td->td_stop = capmt_service_destroy; td->td_caid_change = capmt_caid_change; LIST_INSERT_HEAD(&t->s_descramblers, td, td_service_link); diff -Naur a/src/descrambler/ccw.c b/src/descrambler/ccw.c --- a/src/descrambler/ccw.c 1970-01-01 03:00:00.000000000 +0300 +++ b/src/descrambler/ccw.c 2014-07-05 21:20:43.121814393 +0300 @@ -0,0 +1,542 @@ +/* + * tvheadend, CCW + * Copyright (C) 2012 + * + * This program 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 3 of the License, or + * (at your option) any later version. + * + * This program 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, see . + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "tvheadend.h" +#include "tcp.h" +#include "ccw.h" +#include "notify.h" +#include "atomic.h" +#include "dtable.h" +#include "subscriptions.h" +#include "service.h" +#include "input.h" +#include "input/mpegts/tsdemux.h" +#include "tvhcsa.h" +#include "input/mpegts/linuxdvb/linuxdvb_private.h" + +/** + * + */ +TAILQ_HEAD(ccw_queue, ccw); +LIST_HEAD(ccw_service_list, ccw_service); +static struct ccw_queue ccws; +static pthread_cond_t ccw_config_changed; + +/** + * + */ +typedef struct ccw_service { + th_descrambler_t; + + mpegts_service_t *ct_service; + + struct ccw *ct_ccw; + + LIST_ENTRY(ccw_service) ct_link; + + /** + * Status of the key(s) in ct_keys + */ + enum { + CT_UNKNOWN, + CT_RESOLVED, + CT_FORBIDDEN + } ct_keystate; + + tvhcsa_t cs_csa; + + /* buffer for keystruct */ + void *ct_keys; + + /* CSA */ + int ct_cluster_size; + uint8_t *ct_tsbcluster; + int ct_fill; + + uint8_t ccw_evenkey[8]; + uint8_t ccw_oddkey[8]; + +} ccw_service_t; + +/** + * + */ +typedef struct ccw { + pthread_cond_t ccw_cond; + + TAILQ_ENTRY(ccw) ccw_link; /* Linkage protected via global_lock */ + + struct ccw_service_list ccw_services; + + uint16_t ccw_caid; // CAID + uint16_t ccw_tid; // Transponder ID + uint16_t ccw_sid; // Channel ID + uint8_t ccw_confedkey[8]; // Key + char *ccw_comment; + char *ccw_id; + + int ccw_enabled; + int ccw_running; + int ccw_reconfigure; + +} ccw_t; + +/** + * global_lock is held + * s_stream_mutex is held + */ +static void +ccw_service_destroy(th_descrambler_t *td) +{ + tvhlog(LOG_INFO, "ccw", "Removing CCW key from service"); + + ccw_service_t *ct = (ccw_service_t *)td; + + LIST_REMOVE(td, td_service_link); + LIST_REMOVE(ct, ct_link); + + free_key_struct(ct->ct_keys); + free(ct->ct_tsbcluster); + + tvhcsa_destroy(&ct->cs_csa); + free(ct); +} + +/** + * + */ + +static int +ccw_descramble(th_descrambler_t *td, service_t *t, struct elementary_stream *st, + const uint8_t *tsb) +{ + ccw_service_t *ct = (ccw_service_t *)td; + int r, i; + unsigned char *vec[3]; + uint8_t *t0; + + tvhlog(LOG_DEBUG, "ccw", "ccw_descramble"); + + if(ct->ct_keystate == CT_FORBIDDEN) + return 1; + + if(ct->ct_keystate != CT_RESOLVED) + return -1; + + memcpy(ct->ct_tsbcluster + ct->ct_fill * 188, tsb, 188); + ct->ct_fill++; + + if(ct->ct_fill != ct->ct_cluster_size) + return 0; + + ct->ct_fill = 0; + + vec[0] = ct->ct_tsbcluster; + vec[1] = ct->ct_tsbcluster + ct->ct_cluster_size * 188; + vec[2] = NULL; + + while(1) { + t0 = vec[0]; + r = decrypt_packets(ct->ct_keys, vec); + if(r == 0) + break; + for(i = 0; i < r; i++) { + ts_recv_packet2((mpegts_service_t*)t, t0); + t0 += 188; + } + } + return 0; +} + +/** + * + */ +static inline elementary_stream_t * +ccw_find_stream_by_caid(service_t *t, int caid) +{ + elementary_stream_t *st; + caid_t *c; + + TAILQ_FOREACH(st, &t->s_components, es_link) { + LIST_FOREACH(c, &st->es_caids, link) { + if(c->caid == caid) + return st; + } + } + return NULL; +} + +/** + * Check if our CAID's matches, and if so, link + * + * global_lock is held + */ +void +ccw_service_start(service_t *t) +{ + ccw_t *ccw; + ccw_service_t *ct; + th_descrambler_t *td; + mpegts_service_t *ms = (mpegts_service_t*)t; + linuxdvb_frontend_t *lfe = (linuxdvb_frontend_t*)ms->s_dvb_active_input; + int adapter_num = lfe->lfe_adapter->la_dvb_number; + char buf[512]; + + lock_assert(&global_lock); + + extern const idclass_t mpegts_service_class; + if (!idnode_is_instance(&t->s_id, &mpegts_service_class)) + return; + + TAILQ_FOREACH(ccw, &ccws, ccw_link) { + if(ccw->ccw_caid == 0) + continue; + + if(ccw_find_stream_by_caid(t, ccw->ccw_caid) == NULL) + continue; + + if(ms->s_dvb_service_id != ccw->ccw_sid) + continue; + + if(ms->s_dvb_mux->mm_tsid != ccw->ccw_tid) + continue; + + tvhlog(LOG_INFO, "ccw","Starting ccw key for service \"%s\" on tuner %d", ms->s_dvb_svcname,adapter_num); + + /* create new ccw service */ + ct = calloc(1, sizeof(ccw_service_t)); + ct->ct_cluster_size = get_suggested_cluster_size(); + ct->ct_tsbcluster = malloc(ct->ct_cluster_size * 188); + + ct->ct_keys = get_key_struct(); + ct->ct_ccw = ccw; + ct->ct_service = ms; + + memcpy(ct->ccw_evenkey,ccw->ccw_confedkey,8); + memcpy(ct->ccw_oddkey,ccw->ccw_confedkey,8); + + set_even_control_word(ct->ct_keys, ct->ccw_evenkey); + set_odd_control_word(ct->ct_keys, ct->ccw_oddkey); + if(ct->ct_keystate != CT_RESOLVED) + tvhlog(LOG_INFO, "ccw", "Obtained key for service \"%s\"",ms->s_dvb_svcname); + + tvhlog(LOG_DEBUG, "ccw", + "Key for service \"%s\" " + "even: %02x.%02x.%02x.%02x.%02x.%02x.%02x.%02x" + " odd: %02x.%02x.%02x.%02x.%02x.%02x.%02x.%02x", + ms->s_dvb_svcname, + ct->ccw_evenkey[0], ct->ccw_evenkey[1], ct->ccw_evenkey[2], ct->ccw_evenkey[3], + ct->ccw_evenkey[4], ct->ccw_evenkey[5], ct->ccw_evenkey[6], ct->ccw_evenkey[7], + ct->ccw_oddkey[0], ct->ccw_oddkey[1], ct->ccw_oddkey[2], ct->ccw_oddkey[3], + ct->ccw_oddkey[4], ct->ccw_oddkey[5], ct->ccw_oddkey[6], ct->ccw_oddkey[7]); + ct->ct_keystate = CT_RESOLVED; + + td = (th_descrambler_t *)ct; + tvhcsa_init(td->td_csa = &ct->cs_csa); + snprintf(buf, sizeof(buf), "ccw-%i-%i", ccw->ccw_tid, ccw->ccw_sid); + td->td_nicename = strdup(buf); + td->td_service = t; + td->dtype = 1; + td->td_stop = ccw_service_destroy; + td->td_descramble = ccw_descramble; + LIST_INSERT_HEAD(&t->s_descramblers, td, td_service_link); + + LIST_INSERT_HEAD(&ccw->ccw_services, ct, ct_link); + } +} + +/** + * + */ +static void +ccw_destroy(ccw_t *ccw) +{ + lock_assert(&global_lock); + TAILQ_REMOVE(&ccws, ccw, ccw_link); + ccw->ccw_running = 0; + pthread_cond_signal(&ccw->ccw_cond); +} + +/** + * + */ +static ccw_t * +ccw_entry_find(const char *id, int create) +{ +// pthread_attr_t attr; +// pthread_t ptid; + char buf[20]; + ccw_t *ccw; + static int tally; + + if(id != NULL) { + TAILQ_FOREACH(ccw, &ccws, ccw_link) + if(!strcmp(ccw->ccw_id, id)) + return ccw; + } + if(create == 0) + return NULL; + + if(id == NULL) { + tally++; + snprintf(buf, sizeof(buf), "%d", tally); + id = buf; + } else { + tally = MAX(atoi(id), tally); + } + + ccw = calloc(1, sizeof(ccw_t)); + pthread_cond_init(&ccw->ccw_cond, NULL); + ccw->ccw_id = strdup(id); + ccw->ccw_running = 1; + + TAILQ_INSERT_TAIL(&ccws, ccw, ccw_link); + +// pthread_attr_init(&attr); +// pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED); +// pthread_create(&ptid, &attr, ccw_thread, ccw); +// pthread_attr_destroy(&attr); + + return ccw; +} + +/** + * + */ +static htsmsg_t * +ccw_record_build(ccw_t *ccw) +{ + htsmsg_t *e = htsmsg_create_map(); + char buf[100]; + + htsmsg_add_str(e, "id", ccw->ccw_id); + htsmsg_add_u32(e, "enabled", !!ccw->ccw_enabled); + + htsmsg_add_u32(e, "caid", ccw->ccw_caid); + htsmsg_add_u32(e, "tid", ccw->ccw_tid); + htsmsg_add_u32(e, "sid", ccw->ccw_sid); + + snprintf(buf, sizeof(buf), + "%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x", + ccw->ccw_confedkey[0], + ccw->ccw_confedkey[1], + ccw->ccw_confedkey[2], + ccw->ccw_confedkey[3], + ccw->ccw_confedkey[4], + ccw->ccw_confedkey[5], + ccw->ccw_confedkey[6], + ccw->ccw_confedkey[7]); + + htsmsg_add_str(e, "key", buf); + htsmsg_add_str(e, "comment", ccw->ccw_comment ?: ""); + + return e; +} + +/** + * + */ +static int +nibble(char c) +{ + switch(c) { + case '0' ... '9': + return c - '0'; + case 'a' ... 'f': + return c - 'a' + 10; + case 'A' ... 'F': + return c - 'A' + 10; + default: + return 0; + } +} + +/** + * + */ +static htsmsg_t * +ccw_entry_update(void *opaque, const char *id, htsmsg_t *values, int maycreate) +{ + ccw_t *ccw; + const char *s; + uint32_t u32; + uint8_t key[8]; + int u, l, i; + + if((ccw = ccw_entry_find(id, maycreate)) == NULL) + return NULL; + + lock_assert(&global_lock); + + if(!htsmsg_get_u32(values, "caid", &u32)) + ccw->ccw_caid = u32; + if(!htsmsg_get_u32(values, "tid", &u32)) + ccw->ccw_tid = u32; + if(!htsmsg_get_u32(values, "sid", &u32)) + ccw->ccw_sid = u32; + + if((s = htsmsg_get_str(values, "key")) != NULL) { + for(i = 0; i < 8; i++) { + while(*s != 0 && !isxdigit(*s)) s++; + if(*s == 0) + break; + u = nibble(*s++); + while(*s != 0 && !isxdigit(*s)) s++; + if(*s == 0) + break; + l = nibble(*s++); + key[i] = (u << 4) | l; + } + memcpy(ccw->ccw_confedkey, key, 8); + } + + if((s = htsmsg_get_str(values, "comment")) != NULL) { + free(ccw->ccw_comment); + ccw->ccw_comment = strdup(s); + } + + if(!htsmsg_get_u32(values, "enabled", &u32)) + ccw->ccw_enabled = u32; + + ccw->ccw_reconfigure = 1; + + pthread_cond_signal(&ccw->ccw_cond); + + pthread_cond_broadcast(&ccw_config_changed); + + return ccw_record_build(ccw); +} + +/** + * + */ +static int +ccw_entry_delete(void *opaque, const char *id) +{ + ccw_t *ccw; + + pthread_cond_broadcast(&ccw_config_changed); + + if((ccw = ccw_entry_find(id, 0)) == NULL) + return -1; + ccw_destroy(ccw); + return 0; +} + +/** + * + */ +static htsmsg_t * +ccw_entry_get_all(void *opaque) +{ + htsmsg_t *r = htsmsg_create_list(); + ccw_t *ccw; + + TAILQ_FOREACH(ccw, &ccws, ccw_link) + htsmsg_add_msg(r, NULL, ccw_record_build(ccw)); + + return r; +} + +/** + * + */ +static htsmsg_t * +ccw_entry_get(void *opaque, const char *id) +{ + ccw_t *ccw; + + + if((ccw = ccw_entry_find(id, 0)) == NULL) + return NULL; + return ccw_record_build(ccw); +} + +/** + * + */ +static htsmsg_t * +ccw_entry_create(void *opaque) +{ + pthread_cond_broadcast(&ccw_config_changed); + return ccw_record_build(ccw_entry_find(NULL, 1)); +} + +/** + * + */ +static const dtable_class_t ccw_dtc = { + .dtc_record_get = ccw_entry_get, + .dtc_record_get_all = ccw_entry_get_all, + .dtc_record_create = ccw_entry_create, + .dtc_record_update = ccw_entry_update, + .dtc_record_delete = ccw_entry_delete, + .dtc_read_access = ACCESS_ADMIN, + .dtc_write_access = ACCESS_ADMIN, + .dtc_mutex = &global_lock, +}; + +/** + * + */ +void +ccw_init(void) +{ + dtable_t *dt; + + TAILQ_INIT(&ccws); + + pthread_cond_init(&ccw_config_changed, NULL); + + dt = dtable_create(&ccw_dtc, "ccw", NULL); + dtable_load(dt); + +} + +/** + * + */ +void +ccw_done(void) +{ + ccw_t *ccw; + + dtable_delete("ccw"); + pthread_mutex_lock(&global_lock); + //pthread_mutex_lock(&ccw_mutex); + while ((ccw = TAILQ_FIRST(&ccws)) != NULL) + ccw_destroy(ccw); + //pthread_mutex_unlock(&ccw_mutex); + pthread_mutex_unlock(&global_lock); +} diff -Naur a/src/descrambler/ccw.h b/src/descrambler/ccw.h --- a/src/descrambler/ccw.h 1970-01-01 03:00:00.000000000 +0300 +++ b/src/descrambler/ccw.h 2014-07-05 12:00:26.000000000 +0300 @@ -0,0 +1,28 @@ +/* + * tvheadend, CCW + * Copyright (C) 2012 + * + * This program 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 3 of the License, or + * (at your option) any later version. + * + * This program 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, see . + */ + +#ifndef CCW_H_ +#define CCW_H_ + +void ccw_init(void); + +void ccw_done(void); + +void ccw_service_start(struct service *t); + +#endif /* CCW_H_ */ diff -Naur a/src/descrambler/cwc.c b/src/descrambler/cwc.c --- a/src/descrambler/cwc.c 2014-06-25 13:34:10.000000000 +0300 +++ b/src/descrambler/cwc.c 2014-07-05 12:24:53.000000000 +0300 @@ -1997,6 +1997,7 @@ snprintf(buf, sizeof(buf), "cwc-%s-%i", cwc->cwc_hostname, cwc->cwc_port); td->td_nicename = strdup(buf); td->td_service = t; + td->dtype = 0; td->td_stop = cwc_service_destroy; LIST_INSERT_HEAD(&t->s_descramblers, td, td_service_link); diff -Naur a/src/descrambler/descrambler.c b/src/descrambler/descrambler.c --- a/src/descrambler/descrambler.c 2014-06-28 23:02:56.000000000 +0300 +++ b/src/descrambler/descrambler.c 2014-07-05 21:22:18.201818591 +0300 @@ -19,6 +19,7 @@ #include "tvheadend.h" #include "descrambler.h" #include "cwc.h" +#include "ccw.h" #include "capmt.h" #include "ffdecsa/FFdecsa.h" #include "input.h" @@ -86,6 +87,7 @@ #endif #if ENABLE_CAPMT capmt_init(); + ccw_init(); #endif #if (ENABLE_CWC || ENABLE_CAPMT) && !ENABLE_DVBCSA ffdecsa_init(); @@ -97,6 +99,7 @@ { #if ENABLE_CAPMT capmt_done(); + ccw_done(); #endif #if ENABLE_CWC cwc_done(); @@ -118,6 +121,7 @@ #endif #if ENABLE_CAPMT capmt_service_start(t); + ccw_service_start(t); #endif if (t->s_descramble == NULL) { t->s_descramble = dr = calloc(1, sizeof(th_descrambler_runtime_t)); @@ -254,6 +258,8 @@ } if (td->td_keystate != DS_RESOLVED) continue; + if (td->dtype == 1) + continue; if (dr->dr_buf.sb_ptr > 0) { for (off = 0, size = dr->dr_buf.sb_ptr; off < size; off += 188) { tsb2 = dr->dr_buf.sb_data + off; diff -Naur a/src/descrambler.h b/src/descrambler.h --- a/src/descrambler.h 2014-06-19 01:57:26.000000000 +0300 +++ b/src/descrambler.h 2014-07-05 14:13:09.000000000 +0300 @@ -52,6 +52,11 @@ void (*td_stop) (struct th_descrambler *d); void (*td_caid_change)(struct th_descrambler *d); + int dtype; + + int (*td_descramble)(struct th_descrambler *d, struct service *t, + struct elementary_stream *st, const uint8_t *tsb); + } th_descrambler_t; typedef struct th_descrambler_runtime { diff -Naur a/src/input/mpegts/tsdemux.c b/src/input/mpegts/tsdemux.c --- a/src/input/mpegts/tsdemux.c 2014-06-13 13:15:46.000000000 +0300 +++ b/src/input/mpegts/tsdemux.c 2014-07-05 21:34:52.657851910 +0300 @@ -156,7 +156,8 @@ (mpegts_service_t *t, const uint8_t *tsb, int64_t *pcrp, int table) { elementary_stream_t *st; - int pid, r; + int pid, n, m, r; + th_descrambler_t *td; int error = 0; int64_t pcr = PTS_UNSET; @@ -198,6 +199,11 @@ pid = (tsb[1] & 0x1f) << 8 | tsb[2]; + if(pid==0x1FFF){ // ignore NULL stream + pthread_mutex_unlock(&t->s_stream_mutex); + return 0; + } + st = service_stream_find((service_t*)t, pid); /* Extract PCR */ @@ -224,6 +230,23 @@ t->s_scrambled_seen |= service_is_encrypted((service_t*)t); /* scrambled stream */ + n = m = 0; + + LIST_FOREACH(td, &t->s_descramblers, td_service_link) { + n++; + + if(td->dtype == 1) { + r = td->td_descramble(td, (service_t*)t, st, tsb); + if(r == 0) { + pthread_mutex_unlock(&t->s_stream_mutex); + return 1; + } + } + + if(r == 1) + m++; + } + r = descrambler_descramble((service_t *)t, st, tsb); if(r > 0) { pthread_mutex_unlock(&t->s_stream_mutex); diff -Naur a/src/webui/extjs.c b/src/webui/extjs.c --- a/src/webui/extjs.c 2014-06-19 01:57:26.000000000 +0300 +++ b/src/webui/extjs.c 2014-07-05 12:00:40.000000000 +0300 @@ -150,6 +150,7 @@ #endif #if ENABLE_CAPMT extjs_load(hq, "static/app/capmteditor.js"); + extjs_load(hq, "static/app/ccweditor.js"); #endif extjs_load(hq, "static/app/tvadapters.js"); extjs_load(hq, "static/app/idnode.js"); diff -Naur a/src/webui/static/app/ccweditor.js b/src/webui/static/app/ccweditor.js --- a/src/webui/static/app/ccweditor.js 1970-01-01 03:00:00.000000000 +0300 +++ b/src/webui/static/app/ccweditor.js 2014-07-05 12:00:26.000000000 +0300 @@ -0,0 +1,87 @@ +tvheadend.ccweditor = function() { + var fm = Ext.form; + + var enabledColumn = new Ext.grid.CheckColumn({ + header : "Enabled", + dataIndex : 'enabled', + width : 60 + }); + + function setMetaAttr(meta, record) { + var enabled = record.get('enabled'); + if (enabled == 1) { + meta.attr = 'style="color:green;"'; + } + else { + meta.attr = 'style="color:red;"'; + } + } + + var cm = new Ext.grid.ColumnModel({ + defaultSortable: true, + columns: [ enabledColumn, { + header: "CAID", + dataIndex: 'caid', + renderer: function(value, metadata, record, row, col, store) { + setMetaAttr(metadata, record); + return value; + }, + editor: new fm.TextField({allowBlank: false}) + }, { + header: "Mux ID", + dataIndex: 'tid', + renderer: function(value, metadata, record, row, col, store) { + setMetaAttr(metadata, record); + return value; + }, + editor: new fm.TextField({allowBlank: false}) + }, { + header: "SID", + dataIndex: 'sid', + renderer: function(value, metadata, record, row, col, store) { + setMetaAttr(metadata, record); + return value; + }, + editor: new fm.TextField({allowBlank: false}) + }, { + header: "Key", + dataIndex: 'key', + width: 200, + renderer: function(value, metadata, record, row, col, store) { + setMetaAttr(metadata, record); + return value; + }, + editor: new fm.TextField({allowBlank: false}) + }, { + header : "Comment", + dataIndex : 'comment', + width : 400, + renderer : function(value, metadata, record, row, col, store) { + setMetaAttr(metadata, record); + return value; + }, + editor : new fm.TextField() + } ]}); + + var rec = Ext.data.Record.create([ 'enabled','caid','tid','sid','key','comment' ]); + + store = new Ext.data.JsonStore({ + root: 'entries', + fields: rec, + url: "tablemgr", + autoLoad: true, + id: 'id', + baseParams: {table: 'ccw', op: "get"} + }); + + tvheadend.comet.on('ccwStatus', function(server) { + var rec = store.getById(server.id); + if(rec){ + rec.set('connected', server.connected); + } + }); + + return new tvheadend.tableEditor('CCW Keys', 'ccw', cm, rec, + [enabledColumn], store, + 'config_ccw.html', 'key'); +} diff -Naur a/src/webui/static/app/tvheadend.js b/src/webui/static/app/tvheadend.js --- a/src/webui/static/app/tvheadend.js 2014-06-10 23:31:37.000000000 +0300 +++ b/src/webui/static/app/tvheadend.js 2014-07-05 14:31:23.296729787 +0300 @@ -285,8 +285,10 @@ tabs2 = []; if (tvheadend.capabilities.indexOf('cwc') !== -1) tabs2.push(new tvheadend.cwceditor); - if (tvheadend.capabilities.indexOf('capmt') !== -1) + if (tvheadend.capabilities.indexOf('capmt') !== -1) { tabs2.push(new tvheadend.capmteditor); + tabs2.push(new tvheadend.ccweditor); + } if (tabs2.length > 0) { tvheadend.conf_csa = new Ext.TabPanel({ activeTab: 0,