X-Git-Url: https://git.cweiske.de/enigma2.git/blobdiff_plain/67c5da081cdccf94b1da1792b8388786c4798101..40d11af2de7aed77c90970ba2b61dd754a225117:/lib/dvb/sec.cpp diff --git a/lib/dvb/sec.cpp b/lib/dvb/sec.cpp index 32bc6651..c13334d1 100644 --- a/lib/dvb/sec.cpp +++ b/lib/dvb/sec.cpp @@ -205,56 +205,15 @@ int eDVBSatelliteEquipmentControl::canTune(const eDVBFrontendParametersSatellite } if (ret) { - static int lofs[] = { 3650000, 5150000, 9750000, 10600000 }; int lof = sat.frequency > lnb_param.m_lof_threshold ? lnb_param.m_lof_hi : lnb_param.m_lof_lo; - int diff = 0x7FFFFFFF; - unsigned int num_lofs = sizeof(lofs) / sizeof(int); - int used_band = -1; - for (int i=0; i < num_lofs; ++i) + int tuner_freq = abs(sat.frequency - lof); +// eDebug("tuner freq %d", tuner_freq); + if (tuner_freq < 900000 || tuner_freq > 2200000) { - int lof_diff = abs(lof - lofs[i]); - if ( lof_diff < diff ) - { - diff = lof_diff; - used_band = i; - } - } - if ( used_band != -1 ) - { - if ( diff > 50000 ) - { - eDebug("could not detect used lnb freq range .. disable range check !!!"); - used_band = -1; - } - } - if ( used_band != -1 ) - { - int range[2]; - switch(used_band) - { - case 0: // s-band - range[0] = 2500000; - range[1] = 2700000; - break; - case 1: // c-band - range[0] = 3400000; - range[1] = 4200000; - break; - case 2: // ku-band low - range[0] = 10700000; - range[1] = 11750000; - break; - case 3: // ku-band high - range[0] = 11750000; - range[1] = 12750000; - break; - } - // check frequency in range ( +/- 75Mhz ) - if ( (sat.frequency+75000) < range[0] ) - ret=0; - if ( (sat.frequency-75000) > range[1] ) - ret=0; + ret=0; +// eDebug("Transponder not tuneable with this lnb... %d Khz out of tuner range", +// tuner_freq); } } } @@ -284,6 +243,7 @@ RESULT eDVBSatelliteEquipmentControl::prepare(iDVBFrontend &frontend, FRONTENDPA { eDVBSatelliteSwitchParameters &sw_param = sit->second; bool doSetVoltageToneFrontend = true; + bool doSetFrontend = true; int band=0, linked_to=-1, // linked tuner satpos_depends_to=-1, @@ -707,6 +667,7 @@ RESULT eDVBSatelliteEquipmentControl::prepare(iDVBFrontend &frontend, FRONTENDPA else { // use normal turning mode doSetVoltageToneFrontend=false; + doSetFrontend=false; eSecCommand::rotor cmd; eSecCommand::pair compare; compare.voltage = VOLTAGE(13); @@ -752,10 +713,7 @@ RESULT eDVBSatelliteEquipmentControl::prepare(iDVBFrontend &frontend, FRONTENDPA frontend.setData(1, ucsw); frontend.setData(2, di_param.m_toneburst_param); - if ( linked ) - return 0; - - if (doSetVoltageToneFrontend) + if (!linked && doSetVoltageToneFrontend) { eSecCommand::pair compare; compare.voltage = voltage; @@ -766,11 +724,13 @@ RESULT eDVBSatelliteEquipmentControl::prepare(iDVBFrontend &frontend, FRONTENDPA sec_sequence.push_back( eSecCommand(eSecCommand::SET_TONE, tone) ); sec_sequence.push_back( eSecCommand(eSecCommand::SLEEP, 15) ); + } + if (doSetFrontend) + { sec_sequence.push_back( eSecCommand(eSecCommand::START_TUNE_TIMEOUT) ); sec_sequence.push_back( eSecCommand(eSecCommand::SET_FRONTEND) ); } - frontend.setSecSequence(sec_sequence); return 0; @@ -1072,6 +1032,51 @@ RESULT eDVBSatelliteEquipmentControl::setRotorPosNum(int rotor_pos_num) return 0; } +PyObject *eDVBSatelliteEquipmentControl::get_different_satellites(int tu1, int tu2) +{ + PyObject *ret=0; + if (tu1 != tu2) + { + eDVBRegisteredFrontend *p1=NULL, *p2=NULL; + int cnt=0; + for (eSmartPtrList::iterator it(m_avail_frontends.begin()); it != m_avail_frontends.end(); ++it, ++cnt) + { + if (cnt == tu1) + p1 = *it; + else if (cnt == tu2) + p2 = *it; + } + if (p1 && p2) + { + // check for linked tuners + int tmp1, tmp2; + p1->m_frontend->getData(7, tmp1); + p2->m_frontend->setData(7, tmp2); + if ((void*)tmp1 != p2 && (void*)tmp2 != p1) + { + // check for rotor dependency + p1->m_frontend->getData(8, tmp1); + p2->m_frontend->setData(8, tmp2); + if ((void*)tmp1 != p2 && (void*)tmp2 != p1) + { + // here we know the tuners are not linked and no rotor dependency exist. + // now we check all configured satellites/lnb for difference and at all difference + // to a list of tuples with first value tuner number and second value orbital position + // of satellite + ret = PyList_New(0); + // FIXMEE !! fill list (compare satellites (lofh, lofl, lof threshold, opos)) + } + } + } + } + if (!ret) + { + Py_INCREF(Py_None); + ret = Py_None; + } + return ret; +} + RESULT eDVBSatelliteEquipmentControl::setTunerLinked(int tu1, int tu2) { return setDependencyPointers(tu1, tu2, 7);