+ case signalPowerdB: /* this will move into the driver */
+ {
+ uint16_t snr=0;
+ if (ioctl(m_fd, FE_READ_SNR, &snr) < 0 && errno != ERANGE)
+ eDebug("FE_READ_SNR failed (%m)");
+ if (!strcmp(m_description, "BCM4501 (internal)"))
+ {
+ unsigned int SDS_SNRE = snr << 16;
+
+ static float SNR_COEFF[6] = {
+ 100.0 / 4194304.0,
+ -7136.0 / 4194304.0,
+ 197418.0 / 4194304.0,
+ -2602183.0 / 4194304.0,
+ 20377212.0 / 4194304.0,
+ -37791203.0 / 4194304.0,
+ };
+
+ float fval1, fval2, snr_in_db;
+ int i;
+ fval1 = 12.44714 - (2.0 * log10(SDS_SNRE / 256.0));
+ fval2 = pow(10.0, fval1)-1;
+ fval1 = 10.0 * log10(fval2);
+
+ if (fval1 < 10.0)
+ {
+ fval2 = SNR_COEFF[0];
+ for (i=0; i<6; ++i)
+ {
+ fval2 *= fval1;
+ fval2 += SNR_COEFF[i];
+ }
+ fval1 = fval2;
+ }
+ snr_in_db = fval1;
+
+ return (int)(snr_in_db * 100.0);
+ }
+ else if (!strcmp(m_description, "Alps BSBE1 702A") || // some frontends with STV0299
+ !strcmp(m_description, "Alps -S") ||
+ !strcmp(m_description, "Philips -S") ||
+ !strcmp(m_description, "LG -S") )
+ {
+ float snr_in_db=(snr-39075)/1764.7;
+ return (int)(snr_in_db * 100.0);
+ }
+ else
+ eDebug("no SNR dB caluclation for frontendtype %s yet", m_description);
+ return 0x12345678;
+ }