#include <lib/base/ebase.h>
#include <lib/base/eerror.h>
+#include <lib/base/nconfig.h> // access to python config
#include <lib/dvb/pmt.h>
#include <lib/dvb_ci/dvbci.h>
#include <lib/dvb_ci/dvbci_session.h>
if(i->getSlotID() == slotid)
return i;
- printf("FIXME: request for unknown slot\n");
+ eDebug("FIXME: request for unknown slot");
return 0;
}
+int eDVBCIInterfaces::getSlotState(int slotid)
+{
+ eDVBCISlot *slot;
+
+ if( (slot = getSlot(slotid)) == 0 )
+ return eDVBCISlot::stateInvalid;
+
+ return slot->getState();
+}
+
int eDVBCIInterfaces::reset(int slotid)
{
eDVBCISlot *slot;
}
}
+static bool canDescrambleMultipleServices(int slotid)
+{
+ char configStr[255];
+ snprintf(configStr, 255, "config.ci.%d.canDescrambleMultipleServices", slotid);
+ std::string str;
+ ePythonConfigQuery::getConfigValue(configStr, str);
+ if ( str == "auto" )
+ {
+ std::string appname = eDVBCI_UI::getInstance()->getAppName(slotid);
+ if (appname.find("AlphaCrypt") != std::string::npos)
+ return true;
+ }
+ else if (str == "yes")
+ return true;
+ return false;
+}
+
void eDVBCIInterfaces::recheckPMTHandlers()
{
// eDebug("recheckPMTHAndlers()");
{
for (eSmartPtrList<eDVBCISlot>::iterator ci_it(m_slots.begin()); ci_it != m_slots.end(); ++ci_it)
{
- if (ci_it->getState() == eDVBCISlot::stateInvalid)
- ci_it->reset();
-
bool useThis=false;
eDVBCICAManagerSession *ca_manager = ci_it->getCAManager();
if (ca_manager)
{
if ( tmp->cislot )
{
- bool canHandleMultipleServices=false;
eServiceReferenceDVB ref2;
tmp->pmthandler->getServiceReference(ref2);
eDVBChannelID s1, s2;
{
ref.getChannelID(s1);
ref2.getChannelID(s2);
- // FIXME .. build a "ci can handle multiple services" config entry
- // Yes / No / Auto
- if ( eDVBCI_UI::getInstance()->getAppName(ci_it->getSlotID()) == "AlphaCrypt" )
- {
- canHandleMultipleServices = true;
- eDebug("Alphacrypt can handle multiple services");
- }
}
- if (ref == ref2 || (s1 == s2 && canHandleMultipleServices) )
+ if (ref == ref2 || (s1 == s2 && canDescrambleMultipleServices(ci_it->getSlotID())))
{
it->cislot = tmp->cislot;
++it->cislot->use_count;
bool sameServiceExist=false;
for (PMTHandlerList::iterator i=m_pmt_handlers.begin(); i != m_pmt_handlers.end(); ++i)
{
- eServiceReferenceDVB ref;
- i->pmthandler->getServiceReference(ref);
- if ( ref == service_to_remove )
+ if (i->cislot)
{
- sameServiceExist=true;
- break;
+ eServiceReferenceDVB ref;
+ i->pmthandler->getServiceReference(ref);
+ if ( ref == service_to_remove )
+ {
+ sameServiceExist=true;
+ break;
+ }
}
}
{
int res=0;
//int i;
- //printf("< ");
+ //eDebugNoNewLine("< ");
//for(i=0;i<len;i++)
- // printf("%02x ",data[i]);
- //printf("\n");
+ // eDebugNoNewLine("%02x ",data[i]);
+ //eDebug("");
if (sendqueue.empty())
res = ::write(fd, data, len);
void eDVBCISlot::data(int what)
{
- if (state == stateInvalid)
- return;
if(what == eSocketNotifier::Priority) {
if(state != stateRemoved) {
state = stateRemoved;
- printf("ci removed\n");
+ eDebug("ci removed");
while(sendqueue.size())
{
delete [] sendqueue.top().data;
return;
}
+ if (state == stateInvalid)
+ reset();
+
if(state != stateInserted) {
eDebug("ci inserted");
state = stateInserted;
r = ::read(fd, data, 4096);
if(r > 0) {
// int i;
-// printf("> ");
+// eDebugNoNewLine("> ");
// for(i=0;i<r;i++)
-// printf("%02x ",data[i]);
-// printf("\n");
+// eDebugNoNewLine("%02x ",data[i]);
+// eDebug("");
eDVBCISession::receiveData(this, data, r);
eDVBCISession::pollAll();
return;
int eDVBCISlot::reset()
{
- printf("edvbcislot: reset requested\n");
+ eDebug("edvbcislot: reset requested");
if (state == stateInvalid)
{
int eDVBCISlot::startMMI()
{
- printf("edvbcislot: startMMI()\n");
+ eDebug("edvbcislot: startMMI()");
if(application_manager)
application_manager->startMMI();
int eDVBCISlot::stopMMI()
{
- printf("edvbcislot: stopMMI()\n");
+ eDebug("edvbcislot: stopMMI()");
if(mmi_session)
mmi_session->stopMMI();
int eDVBCISlot::answerText(int answer)
{
- printf("edvbcislot: answerText(%d)\n", answer);
+ eDebug("edvbcislot: answerText(%d)", answer);
if(mmi_session)
mmi_session->answerText(answer);
int eDVBCISlot::answerEnq(char *value)
{
- printf("edvbcislot: answerENQ(%s)\n", value);
+ eDebug("edvbcislot: answerENQ(%s)", value);
if(mmi_session)
mmi_session->answerEnq(value);
int eDVBCISlot::cancelEnq()
{
- printf("edvbcislot: cancelENQ\n");
+ eDebug("edvbcislot: cancelENQ");
if(mmi_session)
mmi_session->cancelEnq();
int eDVBCISlot::enableTS(int enable, int tuner)
{
-// printf("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n");
-// printf("eDVBCISlot::enableTS(%d %d)\n", enable, tuner);
+// eDebug("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
+// eDebug("eDVBCISlot::enableTS(%d %d)", enable, tuner);
FILE *input0, *input1, *ci;
if((input0 = fopen("/proc/stb/tsmux/input0", "wb")) == NULL) {
- printf("cannot open /proc/stb/tsmux/input0\n");
+ eDebug("cannot open /proc/stb/tsmux/input0");
return 0;
}
if((input1 = fopen("/proc/stb/tsmux/input1", "wb")) == NULL) {
- printf("cannot open /proc/stb/tsmux/input1\n");
+ eDebug("cannot open /proc/stb/tsmux/input1");
return 0;
}
if((ci = fopen("/proc/stb/tsmux/input2", "wb")) == NULL) {
- printf("cannot open /proc/stb/tsmux/input2\n");
+ eDebug("cannot open /proc/stb/tsmux/input2");
return 0;
}