X-Git-Url: https://git.cweiske.de/enigma2.git/blobdiff_plain/ecd8882f14e3ad6ebfc27be40dc71d110fe278c1..0c42f02950fa650dc395981cf4469f633498033a:/lib/dvb/frontend.cpp diff --git a/lib/dvb/frontend.cpp b/lib/dvb/frontend.cpp index 5f28a829..9f19ada1 100644 --- a/lib/dvb/frontend.cpp +++ b/lib/dvb/frontend.cpp @@ -371,9 +371,42 @@ RESULT eDVBFrontendParameters::getHash(unsigned long &hash) const } case iDVBFrontend::feCable: hash = 0xFFFF0000; + hash |= (cable.frequency/1000)&0xFFFF; return 0; case iDVBFrontend::feTerrestrial: hash = 0xEEEE0000; + hash |= (terrestrial.frequency/1000)&0xFFFF; + return 0; + default: + return -1; + } +} + +RESULT eDVBFrontendParameters::calcLockTimeout(unsigned int &timeout) const +{ + switch (m_type) + { + case iDVBFrontend::feSatellite: + { + /* high symbol rate transponders tune faster, due to + requiring less zigzag and giving more symbols faster. + + 5s are definitely not enough on really low SR when + zigzag has to find the exact frequency first. + */ + if (sat.symbol_rate > 20000000) + timeout = 5000; + else if (sat.symbol_rate > 10000000) + timeout = 10000; + else + timeout = 20000; + return 0; + } + case iDVBFrontend::feCable: + timeout = 5000; + return 0; + case iDVBFrontend::feTerrestrial: + timeout = 5000; return 0; default: return -1; @@ -836,7 +869,11 @@ void fillDictWithSatelliteData(ePyObject dict, const FRONTENDPARAMETERS &parm, e void fillDictWithCableData(ePyObject dict, const FRONTENDPARAMETERS &parm) { const char *tmp=0; +#if HAVE_DVB_API_VERSION < 3 + PutToDict(dict, "frequency", parm_frequency); +#else PutToDict(dict, "frequency", parm_frequency/1000); +#endif PutToDict(dict, "symbol_rate", parm_u_qam_symbol_rate); switch(parm_u_qam_fec_inner) { @@ -1317,9 +1354,11 @@ void eDVBFrontend::tuneLoop() // called by m_tuneTimer ++m_sec_sequence.current(); break; case eSecCommand::START_TUNE_TIMEOUT: - m_timeout->start(5000, 1); // 5 sec timeout. TODO: symbolrate dependent + { + m_timeout->start(m_sec_sequence.current()->timeout, 1); ++m_sec_sequence.current(); break; + } case eSecCommand::SET_TIMEOUT: m_timeoutCount = m_sec_sequence.current()++->val; eDebug("[SEC] set timeout %d", m_timeoutCount); @@ -1441,7 +1480,7 @@ void eDVBFrontend::tuneLoop() // called by m_tuneTimer break; case eSecCommand::UPDATE_CURRENT_ROTORPARAMS: setRotorData(m_data[NEW_ROTOR_POS], m_data[NEW_ROTOR_CMD]); - eDebug("[SEC] update current rotorparams %d %04x %d", m_timeoutCount, m_data[ROTOR_CMD], m_data[ROTOR_POS]); + eDebug("[SEC] update current rotorparams %d %04lx %ld", m_timeoutCount, m_data[ROTOR_CMD], m_data[ROTOR_POS]); ++m_sec_sequence.current(); break; case eSecCommand::SET_ROTOR_DISEQC_RETRYS: @@ -1522,7 +1561,7 @@ RESULT eDVBFrontend::getFrontendType(int &t) return 0; } -RESULT eDVBFrontend::prepare_sat(const eDVBFrontendParametersSatellite &feparm) +RESULT eDVBFrontend::prepare_sat(const eDVBFrontendParametersSatellite &feparm, unsigned int tunetimeout) { int res; if (!m_sec) @@ -1530,7 +1569,7 @@ RESULT eDVBFrontend::prepare_sat(const eDVBFrontendParametersSatellite &feparm) eWarning("no SEC module active!"); return -ENOENT; } - res = m_sec->prepare(*this, parm, feparm, 1 << m_slotid); + res = m_sec->prepare(*this, parm, feparm, 1 << m_slotid, tunetimeout); if (!res) { eDebug("prepare_sat System %d Freq %d Pol %d SR %d INV %d FEC %d orbpos %d", @@ -1636,7 +1675,11 @@ RESULT eDVBFrontend::prepare_sat(const eDVBFrontendParametersSatellite &feparm) RESULT eDVBFrontend::prepare_cable(const eDVBFrontendParametersCable &feparm) { +#if HAVE_DVB_API_VERSION < 3 + parm_frequency = feparm.frequency; +#else parm_frequency = feparm.frequency * 1000; +#endif parm_u_qam_symbol_rate = feparm.symbol_rate; switch (feparm.modulation) { @@ -1861,6 +1904,7 @@ RESULT eDVBFrontend::prepare_terrestrial(const eDVBFrontendParametersTerrestrial RESULT eDVBFrontend::tune(const iDVBFrontendParameters &where) { + unsigned int timeout = 5000; eDebug("(%d)tune", m_dvbid); m_timeout->stop(); @@ -1883,6 +1927,8 @@ RESULT eDVBFrontend::tune(const iDVBFrontendParameters &where) m_sn->stop(); m_sec_sequence.clear(); + where.calcLockTimeout(timeout); + switch (m_type) { case feSatellite: @@ -1895,7 +1941,7 @@ RESULT eDVBFrontend::tune(const iDVBFrontendParameters &where) goto tune_error; } m_sec->setRotorMoving(false); - res=prepare_sat(feparm); + res=prepare_sat(feparm, timeout); if (res) goto tune_error; @@ -1913,7 +1959,7 @@ RESULT eDVBFrontend::tune(const iDVBFrontendParameters &where) if (res) goto tune_error; - m_sec_sequence.push_back( eSecCommand(eSecCommand::START_TUNE_TIMEOUT) ); + m_sec_sequence.push_back( eSecCommand(eSecCommand::START_TUNE_TIMEOUT, timeout) ); m_sec_sequence.push_back( eSecCommand(eSecCommand::SET_FRONTEND) ); break; } @@ -1933,7 +1979,7 @@ RESULT eDVBFrontend::tune(const iDVBFrontendParameters &where) std::string enable_5V; char configStr[255]; snprintf(configStr, 255, "config.Nims.%d.terrestrial_5V", m_slotid); - m_sec_sequence.push_back( eSecCommand(eSecCommand::START_TUNE_TIMEOUT) ); + m_sec_sequence.push_back( eSecCommand(eSecCommand::START_TUNE_TIMEOUT, timeout) ); ePythonConfigQuery::getConfigValue(configStr, enable_5V); if (enable_5V == "True") m_sec_sequence.push_back( eSecCommand(eSecCommand::SET_VOLTAGE, iDVBFrontend::voltage13) );