+ snr_in_db = fval1;
+ }
+#if HAVE_DVB_API_VERSION >= 3
+ else
+ {
+ float fval1 = SDS_SNRE / 268435456.0,
+ fval2, fval3, fval4;
+
+ if (parm_u_qpsk_fec_inner <= FEC_S2_QPSK_9_10) // DVB-S2 QPSK
+ {
+ fval2 = 6.76;
+ fval3 = 4.35;
+ }
+ else // 8PSK
+ {
+ fval1 *= 0.5;
+ fval2 = 8.06;
+ fval3 = 6.18;
+ }
+ fval4 = -10.0 * log10(fval1);
+ fval1 = fval4;
+ for (int i=0; i < 5; ++i)
+ fval1 = fval4 - fval2 * log10(1.0+pow(10.0, (fval3-fval1)/fval2));
+ snr_in_db = fval1;
+ }
+#endif
+ sat_max = 1750;
+ ret = (int)(snr_in_db * 100);
+ }
+ else if (strstr(m_description, "Alps BSBE1 C01A") ||
+ !strcmp(m_description, "Alps -S(STV0288)"))
+ {
+ if (snr == 0)
+ ret = 0;
+ else if (snr == 0xFFFF) // i think this should not happen
+ ret = 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}
+ };
+ int add=strchr(m_description, '.') ? 0xA250 : 0xA100;
+ long regval = 0xFFFF - ((snr / 3) + add), // 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]))
+ {
+ while((Imax-Imin)>1)
+ {
+ i=(Imax+Imin)/2;
+ if(INRANGE(CN_lookup[Imin][REGVAL],regval,CN_lookup[i][REGVAL]))
+ Imax = i;
+ else
+ Imin = i;
+ }
+ ret = (((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;
+ }
+ else
+ ret = 100;