X-Git-Url: https://git.cweiske.de/enigma2.git/blobdiff_plain/095b5e84fb25bab4505fc568c1e33e6d1fc6c876..2e0f9fcac9ee3a504c1eee49e98e150f524b3113:/lib/dvb_ci/dvbci.cpp diff --git a/lib/dvb_ci/dvbci.cpp b/lib/dvb_ci/dvbci.cpp index 72dfd388..bbea1211 100644 --- a/lib/dvb_ci/dvbci.cpp +++ b/lib/dvb_ci/dvbci.cpp @@ -1,7 +1,9 @@ #include +#include #include #include +#include #include #include @@ -9,10 +11,14 @@ #include +eDVBCIInterfaces *eDVBCIInterfaces::instance = 0; + eDVBCIInterfaces::eDVBCIInterfaces() { int num_ci = 0; - + + instance = this; + eDebug("scanning for common interfaces.."); while (1) @@ -39,6 +45,32 @@ 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; + + return 0; +} + +int eDVBCIInterfaces::reset(int slotid) +{ + eDVBCISlot *slot; + + if( (slot = getSlot(slotid)) == 0 ) { + printf("FIXME: request for unknown slot\n"); + return 0; + } + + return slot->reset(); +} + int eDVBCISlot::send(const unsigned char *data, size_t len) { int res; @@ -70,7 +102,6 @@ void eDVBCISlot::data(int what) return; } - __u8 data[4096]; int r; r = ::read(fd, data, 4096); @@ -110,11 +141,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) { @@ -130,4 +165,18 @@ eDVBCISlot::~eDVBCISlot() { } +int eDVBCISlot::getSlotID() +{ + return slotid; +} + +int eDVBCISlot::reset() +{ + printf("edvbcislot: reset requested\n"); + + ioctl(fd, 0); + + return 0; +} + eAutoInitP0 init_eDVBCIInterfaces(eAutoInitNumbers::dvb, "CI Slots");