X-Git-Url: https://git.cweiske.de/enigma2.git/blobdiff_plain/361b1eb4e6dce1fb2ecc8f9389b5d7cfa07cf54d..c746e07fe32dd9cd95c5bddba437d9f2daf69fcf:/lib/dvb/frontend.cpp diff --git a/lib/dvb/frontend.cpp b/lib/dvb/frontend.cpp index 02297243..79c9ad0b 100644 --- a/lib/dvb/frontend.cpp +++ b/lib/dvb/frontend.cpp @@ -559,7 +559,6 @@ int eDVBFrontend::closeFrontend(bool force) m_fd=-1; else eWarning("couldnt close frontend %d", m_dvbid); - m_data[CSW] = m_data[UCSW] = m_data[TONEBURST] = -1; } #if HAVE_DVB_API_VERSION < 3 if (m_secfd >= 0) @@ -657,6 +656,8 @@ void eDVBFrontend::timeout() } } +#define INRANGE(X,Y,Z) (((X<=Y) && (Y<=Z))||((Z<=Y) && (Y<=X)) ? 1 : 0) + int eDVBFrontend::readFrontendData(int type) { switch(type) @@ -713,6 +714,49 @@ int eDVBFrontend::readFrontendData(int type) return (int)(snr_in_db * 100.0); } + else if (strstr(m_description, "Alps BSBE1 C01A") || + !strcmp(m_description, "Alps -S(STV0288)")) + { + if (snr == 0) + return 0; + else if (snr == 0xFFFF) // i think this should not happen + return 100*100; + else + { + enum { REALVAL, REGVAL }; + const long CN_lookup[31][2] = { + {20,8900}, {25,8680}, {30,8420}, {35,8217}, {40,7897}, + {50,7333}, {60,6747}, {70,6162}, {80,5580}, {90,5029}, + {100,4529}, {110,4080}, {120,3685}, {130,3316}, {140,2982}, + {150,2688}, {160,2418}, {170,2188}, {180,1982}, {190,1802}, + {200,1663}, {210,1520}, {220,1400}, {230,1295}, {240,1201}, + {250,1123}, {260,1058}, {270,1004}, {280,957}, {290,920}, + {300,890} + }; + long regval = 0xFFFF - ((snr / 3) + 0xA100), // revert some dvb api calulations to get the real register value + Imin=0, + Imax=30, + i; + if(INRANGE(CN_lookup[Imin][REGVAL],regval,CN_lookup[Imax][REGVAL])) + { + long val; + while((Imax-Imin)>1) + { + i=(Imax+Imin)/2; + if(INRANGE(CN_lookup[Imin][REGVAL],regval,CN_lookup[i][REGVAL])) + Imax = i; + else + Imin = i; + } + return (((regval - CN_lookup[Imin][REGVAL]) + * (CN_lookup[Imax][REALVAL] - CN_lookup[Imin][REALVAL]) + / (CN_lookup[Imax][REGVAL] - CN_lookup[Imin][REGVAL])) + + CN_lookup[Imin][REALVAL]) * 10; + } + return 100; + } + return 0; + } else if (!strcmp(m_description, "Alps BSBE1 702A") || // some frontends with STV0299 !strcmp(m_description, "Alps -S") || !strcmp(m_description, "Philips -S") || @@ -1519,6 +1563,20 @@ void eDVBFrontend::tuneLoop() // called by m_tuneTimer else ++m_sec_sequence.current(); break; + case eSecCommand::INVALIDATE_CURRENT_SWITCHPARMS: + eDebug("[SEC] invalidate current switch params"); + sec_fe_data[CSW] = -1; + sec_fe_data[UCSW] = -1; + sec_fe_data[TONEBURST] = -1; + ++m_sec_sequence.current(); + break; + case eSecCommand::UPDATE_CURRENT_SWITCHPARMS: + sec_fe_data[CSW] = sec_fe_data[NEW_CSW]; + sec_fe_data[UCSW] = sec_fe_data[NEW_UCSW]; + sec_fe_data[TONEBURST] = sec_fe_data[NEW_TONEBURST]; + eDebug("[SEC] update current switch params"); + ++m_sec_sequence.current(); + break; case eSecCommand::INVALIDATE_CURRENT_ROTORPARMS: eDebug("[SEC] invalidate current rotorparams"); sec_fe_data[ROTOR_CMD] = -1;