diff options
| author | Ronny Strutz <ronny.strutz@multimedia-labs.de> | 2005-11-18 01:23:10 +0000 |
|---|---|---|
| committer | Ronny Strutz <ronny.strutz@multimedia-labs.de> | 2005-11-18 01:23:10 +0000 |
| commit | ed8f9a4e13e4d4eafbc26048d7b70d3aaa8d1399 (patch) | |
| tree | 73c89260bdb010dc88bdba06faaba5a4a65b9791 /lib/dvb_ci/dvbci.cpp | |
| parent | 69a98765d29216757566baf7924abe63012f5f0d (diff) | |
| download | enigma2-ed8f9a4e13e4d4eafbc26048d7b70d3aaa8d1399.tar.gz enigma2-ed8f9a4e13e4d4eafbc26048d7b70d3aaa8d1399.zip | |
add stuff to find a slot and call stuff from there
Diffstat (limited to 'lib/dvb_ci/dvbci.cpp')
| -rw-r--r-- | lib/dvb_ci/dvbci.cpp | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/lib/dvb_ci/dvbci.cpp b/lib/dvb_ci/dvbci.cpp index 014d51a5..bbea1211 100644 --- a/lib/dvb_ci/dvbci.cpp +++ b/lib/dvb_ci/dvbci.cpp @@ -1,7 +1,9 @@ #include <fcntl.h> +#include <sys/ioctl.h> #include <lib/base/init.h> #include <lib/base/init_num.h> +#include <lib/base/ebase.h> #include <lib/base/eerror.h> #include <lib/dvb_ci/dvbci.h> @@ -9,10 +11,14 @@ #include <lib/dvb_ci/dvbci_ui.h> +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<eDVBCISlot>::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; @@ -109,6 +141,8 @@ eDVBCISlot::eDVBCISlot(eMainloop *context, int nr) { char filename[128]; + slotid = nr; + sprintf(filename, "/dev/ci%d", nr); fd = ::open(filename, O_RDWR | O_NONBLOCK); @@ -131,4 +165,18 @@ eDVBCISlot::~eDVBCISlot() { } +int eDVBCISlot::getSlotID() +{ + return slotid; +} + +int eDVBCISlot::reset() +{ + printf("edvbcislot: reset requested\n"); + + ioctl(fd, 0); + + return 0; +} + eAutoInitP0<eDVBCIInterfaces> init_eDVBCIInterfaces(eAutoInitNumbers::dvb, "CI Slots"); |
