X-Git-Url: https://git.cweiske.de/enigma2.git/blobdiff_plain/a2a9746211af69c5f0c5090468fd656fb71e4b4a..60fb5b95387fb30902240b92deed145720fa867a:/lib/dvb/sec.cpp diff --git a/lib/dvb/sec.cpp b/lib/dvb/sec.cpp index 3f9ec90a..4842945c 100644 --- a/lib/dvb/sec.cpp +++ b/lib/dvb/sec.cpp @@ -21,13 +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 1 // ASTRA addLNB(); setLNBTunerMask(3); @@ -45,12 +46,12 @@ eDVBSatelliteEquipmentControl::eDVBSatelliteEquipmentControl(eSmartPtrList= eDVBSatelliteDiseqcParameters::V1_0) { + diseqc=true; if ( di_param.m_committed_cmd < eDVBSatelliteDiseqcParameters::SENDNO ) { csw = 0xF0 | (csw << 2); @@ -103,6 +150,7 @@ int eDVBSatelliteEquipmentControl::canTune(const eDVBFrontendParametersSatellite if ( di_param.m_diseqc_mode == eDVBSatelliteDiseqcParameters::V1_2 ) // ROTOR { + rotor=true; if ( curRotorPos == sat.orbital_position ) ret=20; else @@ -128,23 +176,33 @@ int eDVBSatelliteEquipmentControl::canTune(const eDVBFrontendParametersSatellite if (found && it->m_inuse) { - int lastcsw = -1, - lastucsw = -1, - lastToneburst = -1, - curRotorPos = -1; - it->m_frontend->getData(0, lastcsw); - it->m_frontend->getData(1, lastucsw); - it->m_frontend->getData(2, lastToneburst); - it->m_frontend->getData(6, curRotorPos); - - if (csw != lastcsw || ucsw != lastucsw || - toneburst != lastToneburst || curRotorPos != sat.orbital_position ) + 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); +#if 0 + eDebug("compare csw %02x == lcsw %02x", + csw, ocsw); + if ( diseqc ) + eDebug("compare ucsw %02x == lucsw %02x\ncompare toneburst %02x == oToneburst %02x", + ucsw, oucsw, toneburst, oToneburst); + 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 :)"); } } } @@ -207,7 +265,6 @@ RESULT eDVBSatelliteEquipmentControl::prepare(iDVBFrontend &frontend, FRONTENDPA { eDebug("[SEC] frontend is linked with another one and the other is in use.. so we dont do SEC!!"); linked=true; - continue; } } @@ -296,7 +353,10 @@ RESULT eDVBSatelliteEquipmentControl::prepare(iDVBFrontend &frontend, FRONTENDPA { send_diseqc = changed_csw; if ( send_diseqc && di_param.m_use_fast && (csw & 0xF0) && (lastcsw & 0xF0) && ((csw / 4) == (lastcsw / 4)) ) + { + frontend.setData(0, csw); // needed for linked tuner handling send_diseqc = false; + } } if ( send_diseqc || changed_burst ) @@ -317,7 +377,6 @@ RESULT eDVBSatelliteEquipmentControl::prepare(iDVBFrontend &frontend, FRONTENDPA { sec_sequence.push_back( eSecCommand(eSecCommand::SEND_TONEBURST, di_param.m_toneburst_param) ); sec_sequence.push_back( eSecCommand(eSecCommand::SLEEP, 50) ); - frontend.setData(2, di_param.m_toneburst_param); } if ( send_diseqc ) @@ -380,6 +439,7 @@ RESULT eDVBSatelliteEquipmentControl::prepare(iDVBFrontend &frontend, FRONTENDPA frontend.setData(0, csw); frontend.setData(1, ucsw); + frontend.setData(2, di_param.m_toneburst_param); } } @@ -401,7 +461,7 @@ RESULT eDVBSatelliteEquipmentControl::prepare(iDVBFrontend &frontend, FRONTENDPA RotorCmd=sw_param.m_rotorPosNum; else // we must calc gotoxx cmd { - eDebug("Entry for %d,%d° not in Rotor Table found... i try gotoXX°", sat.orbital_position / 10, sat.orbital_position % 10 ); + eDebug("Entry for %d,%d? not in Rotor Table found... i try gotoXX?", sat.orbital_position / 10, sat.orbital_position % 10 ); useGotoXX = true; int satDir = sat.orbital_position < 0 ? @@ -535,8 +595,16 @@ RESULT eDVBSatelliteEquipmentControl::prepare(iDVBFrontend &frontend, FRONTENDPA sec_sequence.push_back( eSecCommand(eSecCommand::GOTO, -4) ); // running loop start ///////////////////// sec_sequence.push_back( eSecCommand(eSecCommand::UPDATE_CURRENT_ROTORPARAMS) ); - frontend.setData(3, RotorCmd); - frontend.setData(4, sat.orbital_position); + if ( linked ) + { + frontend.setData(5, RotorCmd); + frontend.setData(6, sat.orbital_position); + } + else + { + frontend.setData(3, RotorCmd); + frontend.setData(4, sat.orbital_position); + } } else eFatal("rotor turning without inputpowermeasure not implemented yet"); @@ -546,6 +614,9 @@ RESULT eDVBSatelliteEquipmentControl::prepare(iDVBFrontend &frontend, FRONTENDPA else frontend.setData(0, band); // store band as csw .. needed for linked tuner handling + if ( linked ) + return 0; + eSecCommand::pair compare; compare.voltage = voltage; compare.steps = +3; @@ -865,3 +936,13 @@ RESULT eDVBSatelliteEquipmentControl::setTunerLinked(int tu1, int tu2) } return -1; } + +bool eDVBSatelliteEquipmentControl::isRotorMoving() +{ + return m_rotorMoving; +} + +void eDVBSatelliteEquipmentControl::setRotorMoving(bool b) +{ + m_rotorMoving=b; +}