X-Git-Url: https://git.cweiske.de/enigma2.git/blobdiff_plain/c942b1c829bf49d77dcdb2bfda776e6288c99828..1d07d67fdfcc5e3cedb9f5ce48998770264ab5c5:/lib/dvb/sec.cpp diff --git a/lib/dvb/sec.cpp b/lib/dvb/sec.cpp index 8b7b25db..ab5d6397 100644 --- a/lib/dvb/sec.cpp +++ b/lib/dvb/sec.cpp @@ -21,14 +21,14 @@ DEFINE_REF(eDVBSatelliteEquipmentControl); eDVBSatelliteEquipmentControl *eDVBSatelliteEquipmentControl::instance; eDVBSatelliteEquipmentControl::eDVBSatelliteEquipmentControl(eSmartPtrList &avail_frontends) - :m_lnbidx(-1), m_curSat(m_lnbs[0].m_satellites.end()), m_avail_frontends(avail_frontends) + :m_lnbidx(-1), m_curSat(m_lnbs[0].m_satellites.end()), m_avail_frontends(avail_frontends), m_rotorMoving(false) { if (!instance) instance = this; clear(); -#if 0 +#if 1 // ASTRA addLNB(); setLNBTunerMask(3); @@ -62,7 +62,7 @@ eDVBSatelliteEquipmentControl::eDVBSatelliteEquipmentControl(eSmartPtrList::iterator it(m_avail_frontends.begin()); - for (; it != m_avail_frontends.end(); ++it) - if ( !linked_to ) - { - found=true; - break; - } - else - --linked_to; - - if (found && it->m_inuse) + eDVBRegisteredFrontend *linked_fe = (eDVBRegisteredFrontend*) linked_to; + if (linked_fe->m_inuse) { int ocsw = -1, oucsw = -1, oToneburst = -1, oRotorPos = -1; - it->m_frontend->getData(0, ocsw); - it->m_frontend->getData(1, oucsw); - it->m_frontend->getData(2, oToneburst); - it->m_frontend->getData(6, oRotorPos); - + linked_fe->m_frontend->getData(0, ocsw); + linked_fe->m_frontend->getData(1, oucsw); + linked_fe->m_frontend->getData(2, oToneburst); + linked_fe->m_frontend->getData(6, oRotorPos); +#if 0 eDebug("compare csw %02x == lcsw %02x", csw, ocsw); if ( diseqc ) @@ -192,16 +183,16 @@ int eDVBSatelliteEquipmentControl::canTune(const eDVBFrontendParametersSatellite if ( rotor ) eDebug("compare pos %d == current pos %d", sat.orbital_position, oRotorPos); - +#endif if ( (csw != ocsw) || ( diseqc && (ucsw != oucsw || toneburst != oToneburst) ) || ( rotor && oRotorPos != sat.orbital_position ) ) { - eDebug("can not tune this transponder with linked tuner in use!!"); +// eDebug("can not tune this transponder with linked tuner in use!!"); ret=0; } - else - eDebug("OK .. can tune this transponder with linked tuner in use :)"); +// else +// eDebug("OK .. can tune this transponder with linked tuner in use :)"); } } } @@ -250,19 +241,10 @@ RESULT eDVBSatelliteEquipmentControl::prepare(iDVBFrontend &frontend, FRONTENDPA if (linked_to != -1) { - bool found=false; - eSmartPtrList::iterator it(m_avail_frontends.begin()); - for (; it != m_avail_frontends.end(); ++it) - if ( !linked_to ) - { - found=true; - break; - } - else - --linked_to; - if (found && it->m_inuse) + eDVBRegisteredFrontend *linked_fe = (eDVBRegisteredFrontend*) linked_to; + if (linked_fe->m_inuse) { - eDebug("[SEC] frontend is linked with another one and the other is in use.. so we dont do SEC!!"); + eDebug("[SEC] frontend is linked with another and the other one is in use.. so we dont do SEC!!"); linked=true; } } @@ -910,27 +892,20 @@ RESULT eDVBSatelliteEquipmentControl::setTunerLinked(int tu1, int tu2) if (tu1 == tu2) return -1; - eDVBFrontend *p1=NULL, *p2=NULL; - int tmp1=tu1, tmp2=tu2; + eDVBRegisteredFrontend *p1=NULL, *p2=NULL; - for (eSmartPtrList::iterator it(m_avail_frontends.begin()); it != m_avail_frontends.end(); ++it) + int cnt=0; + for (eSmartPtrList::iterator it(m_avail_frontends.begin()); it != m_avail_frontends.end(); ++it, ++cnt) { - if ( !tmp1 ) - p1 = it->m_frontend; - else - --tmp1; - if (!tmp2) - p2 = it->m_frontend; - else - --tmp2; + if (cnt == tu1) + p1 = *it; + else if (cnt == tu2) + p2 = *it; } if (p1 && p2) { - p1->setData(7, tu2); - p1->setTone(iDVBFrontend::toneOff); - p1->setVoltage(iDVBFrontend::voltageOff); - - p2->setData(7, tu1); + p1->m_frontend->setData(7, (int)p2); // this is evil.. + p2->m_frontend->setData(7, (int)p1); return 0; } return -1; @@ -938,5 +913,10 @@ RESULT eDVBSatelliteEquipmentControl::setTunerLinked(int tu1, int tu2) bool eDVBSatelliteEquipmentControl::isRotorMoving() { - return false; + return m_rotorMoving; +} + +void eDVBSatelliteEquipmentControl::setRotorMoving(bool b) +{ + m_rotorMoving=b; }