aboutsummaryrefslogtreecommitdiff
path: root/lib/dvb_ci
diff options
context:
space:
mode:
authorFelix Domke <tmbinc@elitedvb.net>2009-03-02 17:17:08 +0100
committerFelix Domke <tmbinc@elitedvb.net>2009-03-02 17:17:08 +0100
commitfe12fe9e0ab3a4f9751b67c0aa3751d5864784ba (patch)
treedafa963f9f5a99bc2a322e77a24e0683b0676d3c /lib/dvb_ci
parente63586af0f2e8acf5a0972ae1993c039edcd901e (diff)
parent23d87e80ac74cea3df87ac89cef734509341fa98 (diff)
downloadenigma2-fe12fe9e0ab3a4f9751b67c0aa3751d5864784ba.tar.gz
enigma2-fe12fe9e0ab3a4f9751b67c0aa3751d5864784ba.zip
Merge branch 'master' of /home/tmbinc/enigma2-git
Diffstat (limited to 'lib/dvb_ci')
-rw-r--r--lib/dvb_ci/dvbci.cpp53
-rw-r--r--lib/dvb_ci/dvbci.h2
2 files changed, 44 insertions, 11 deletions
diff --git a/lib/dvb_ci/dvbci.cpp b/lib/dvb_ci/dvbci.cpp
index d088075c..c34ea0c0 100644
--- a/lib/dvb_ci/dvbci.cpp
+++ b/lib/dvb_ci/dvbci.cpp
@@ -18,7 +18,7 @@
#include <dvbsi++/ca_program_map_section.h>
-#undef CIDEBUG
+//#define CIDEBUG 1
#ifdef CIDEBUG
#define eDebugCI(x...) eDebug(x)
@@ -268,23 +268,34 @@ void eDVBCIInterfaces::recheckPMTHandlers()
eDVBCISlot *tmp = it->cislot;
eDVBServicePMTHandler *pmthandler = it->pmthandler;
eDVBServicePMTHandler::program p;
+ bool first_plugged_cis_exist = false;
pmthandler->getServiceReference(ref);
pmthandler->getService(service);
eDebugCI("recheck %p %s", pmthandler, ref.toString().c_str());
+ for (eSmartPtrList<eDVBCISlot>::iterator ci_it(m_slots.begin()); ci_it != m_slots.end(); ++ci_it)
+ if (ci_it->first_plugged && ci_it->getCAManager())
+ {
+ eDebug("Slot %d first plugged", ci_it->getSlotID());
+ ci_it->first_plugged = false;
+ first_plugged_cis_exist = true;
+ }
// check if this pmt handler has already assigned CI(s) .. and this CI(s) are already running
- while(tmp)
+ if (!first_plugged_cis_exist)
{
- if (!tmp->running_services.empty())
- break;
- tmp=tmp->linked_next;
- }
- if (tmp) // we dont like to change tsmux for running services
- {
- eDebugCI("already assigned and running CI!\n");
- continue;
+ while(tmp)
+ {
+ if (!tmp->running_services.empty())
+ break;
+ tmp=tmp->linked_next;
+ }
+ if (tmp) // we dont like to change tsmux for running services
+ {
+ eDebugCI("already assigned and running CI!\n");
+ continue;
+ }
}
if (!pmthandler->getProgramInfo(p))
@@ -887,6 +898,23 @@ RESULT eDVBCIInterfaces::setDescrambleRules(int slotid, SWIG_PYOBJECT(ePyObject)
return 0;
}
+PyObject *eDVBCIInterfaces::readCICaIds(int slotid)
+{
+ eDVBCISlot *slot = getSlot(slotid);
+ if (!slot)
+ {
+ char tmp[255];
+ snprintf(tmp, 255, "eDVBCIInterfaces::readCICaIds try to get CAIds for CI Slot %d... but just %d slots are available", slotid, m_slots.size());
+ PyErr_SetString(PyExc_StandardError, tmp);
+ return 0;
+ }
+ int idx=0;
+ ePyObject list = PyList_New(slot->possible_caids.size());
+ for (caidSet::iterator it = slot->possible_caids.begin(); it != slot->possible_caids.end(); ++it)
+ PyList_SET_ITEM(list, idx++, PyLong_FromLong(*it));
+ return list;
+}
+
int eDVBCISlot::send(const unsigned char *data, size_t len)
{
int res=0;
@@ -912,6 +940,7 @@ int eDVBCISlot::send(const unsigned char *data, size_t len)
void eDVBCISlot::data(int what)
{
+ eDebugCI("CISlot %d what %d\n", getSlotID(), what);
if(what == eSocketNotifier::Priority) {
if(state != stateRemoved) {
state = stateRemoved;
@@ -981,6 +1010,7 @@ eDVBCISlot::eDVBCISlot(eMainloop *context, int nr)
use_count = 0;
linked_next = 0;
user_mapped = false;
+ first_plugged = true;
slotid = nr;
@@ -992,7 +1022,7 @@ eDVBCISlot::eDVBCISlot(eMainloop *context, int nr)
fd = ::open(filename, O_RDWR | O_NONBLOCK);
- eDebug("CI Slot %d has fd %d", getSlotID(), fd);
+ eDebugCI("CI Slot %d has fd %d", getSlotID(), fd);
state = stateInvalid;
if (fd >= 0)
@@ -1007,6 +1037,7 @@ eDVBCISlot::eDVBCISlot(eMainloop *context, int nr)
eDVBCISlot::~eDVBCISlot()
{
+ eDVBCISession::deleteSessions(this);
}
void eDVBCISlot::setAppManager( eDVBCIApplicationManagerSession *session )
diff --git a/lib/dvb_ci/dvbci.h b/lib/dvb_ci/dvbci.h
index c06ae7e3..c11a1203 100644
--- a/lib/dvb_ci/dvbci.h
+++ b/lib/dvb_ci/dvbci.h
@@ -65,6 +65,7 @@ class eDVBCISlot: public iObject, public Object
int current_tuner;
bool user_mapped;
void data(int);
+ bool first_plugged;
public:
enum {stateRemoved, stateInserted, stateInvalid, stateResetted};
eDVBCISlot(eMainloop *context, int nr);
@@ -152,6 +153,7 @@ public:
int getNumOfSlots() { return m_slots.size(); }
PyObject *getDescrambleRules(int slotid);
RESULT setDescrambleRules(int slotid, SWIG_PYOBJECT(ePyObject) );
+ PyObject *readCICaIds(int slotid);
};
#endif