X-Git-Url: https://git.cweiske.de/enigma2.git/blobdiff_plain/059f7f9c3ef10f29ac0c4f87c380854e1185e1e2..bf057ab3c120bf104f66dbaecd53edffffb0fb38:/lib/dvb_ci/dvbci.cpp diff --git a/lib/dvb_ci/dvbci.cpp b/lib/dvb_ci/dvbci.cpp index 315d2ae5..6fa8e2ec 100644 --- a/lib/dvb_ci/dvbci.cpp +++ b/lib/dvb_ci/dvbci.cpp @@ -1,16 +1,24 @@ #include +#include #include #include +#include #include #include #include +#include + +eDVBCIInterfaces *eDVBCIInterfaces::instance = 0; + eDVBCIInterfaces::eDVBCIInterfaces() { int num_ci = 0; - + + instance = this; + eDebug("scanning for common interfaces.."); while (1) @@ -37,6 +45,62 @@ eDVBCIInterfaces::~eDVBCIInterfaces() { } +eDVBCIInterfaces *eDVBCIInterfaces::getInstance() +{ + return instance; +} + +eDVBCISlot *eDVBCIInterfaces::getSlot(int slotid) +{ + for(eSmartPtrList::iterator i(m_slots.begin()); i != m_slots.end(); ++i) + if(i->getSlotID() == slotid) + return i; + + printf("FIXME: request for unknown slot\n"); + + return 0; +} + +int eDVBCIInterfaces::reset(int slotid) +{ + eDVBCISlot *slot; + + if( (slot = getSlot(slotid)) == 0 ) + return -1; + + return slot->reset(); +} + +int eDVBCIInterfaces::initialize(int slotid) +{ + eDVBCISlot *slot; + + if( (slot = getSlot(slotid)) == 0 ) + return -1; + + return slot->initialize(); +} + +int eDVBCIInterfaces::startMMI(int slotid) +{ + eDVBCISlot *slot; + + if( (slot = getSlot(slotid)) == 0 ) + return -1; + + return slot->startMMI(); +} + +int eDVBCIInterfaces::answerMMI(int slotid, int answer, char *value) +{ + eDVBCISlot *slot; + + if( (slot = getSlot(slotid)) == 0 ) + return -1; + + return slot->answerMMI(answer, value); +} + int eDVBCISlot::send(const unsigned char *data, size_t len) { int res; @@ -62,11 +126,12 @@ void eDVBCISlot::data(int what) state = stateRemoved; printf("ci removed\n"); notifier->setRequested(eSocketNotifier::Read); + //HACK + eDVBCI_UI::getInstance()->setState(0,0); } return; } - __u8 data[4096]; int r; r = ::read(fd, data, 4096); @@ -74,6 +139,10 @@ void eDVBCISlot::data(int what) if(state != stateInserted) { state = stateInserted; eDebug("ci inserted"); + + //HACK + eDVBCI_UI::getInstance()->setState(0,1); + /* enable PRI to detect removal or errors */ notifier->setRequested(eSocketNotifier::Read|eSocketNotifier::Priority|eSocketNotifier::Write); } @@ -102,11 +171,15 @@ eDVBCISlot::eDVBCISlot(eMainloop *context, int nr) { char filename[128]; + slotid = nr; + sprintf(filename, "/dev/ci%d", nr); fd = ::open(filename, O_RDWR | O_NONBLOCK); eDebug("eDVBCISlot has fd %d", fd); + + state = stateInserted; if (fd >= 0) { @@ -122,4 +195,36 @@ eDVBCISlot::~eDVBCISlot() { } +int eDVBCISlot::getSlotID() +{ + return slotid; +} + +int eDVBCISlot::reset() +{ + printf("edvbcislot: reset requested\n"); + + ioctl(fd, 0); + + return 0; +} + +int eDVBCISlot::initialize() +{ + printf("edvbcislot: initialize()\n"); + return 0; +} + +int eDVBCISlot::startMMI() +{ + printf("edvbcislot: startMMI()\n"); + return 0; +} + +int eDVBCISlot::answerMMI(int answer, char *value) +{ + printf("edvbcislot: answerMMI()\n"); + return 0; +} + eAutoInitP0 init_eDVBCIInterfaces(eAutoInitNumbers::dvb, "CI Slots");