From 40929bedeb3ac67d8f8205cb0009562d13e05d0a Mon Sep 17 00:00:00 2001 From: Andreas Monzner Date: Tue, 21 Feb 2006 20:52:20 +0000 Subject: [PATCH] add frequency possibility test to detect the correct lnb (for example on tunerA a C-Band LNB is used and on tunerB a ku-Band but for both tuners the same satellites are configured) --- lib/dvb/sec.cpp | 54 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) diff --git a/lib/dvb/sec.cpp b/lib/dvb/sec.cpp index aa00062a..47240043 100644 --- a/lib/dvb/sec.cpp +++ b/lib/dvb/sec.cpp @@ -209,6 +209,60 @@ int eDVBSatelliteEquipmentControl::canTune(const eDVBFrontendParametersSatellite // else // eDebug("OK .. can tune this transponder satpos is correct :)"); } + 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 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 ( +/- 50Mhz ) + if ( (sat.frequency+75000) < range[0] ) + ret=0; + if ( (sat.frequency-75000) > range[1] ) + ret=0; + } + } } } } -- 2.30.2