All of lore.kernel.org
 help / color / mirror / Atom feed
* [Patch] Correct Signal Strength values for STB0899
@ 2010-09-08 14:15 Newsy Paper
  2010-09-08 17:47 ` [linux-dvb] " Goga777
  0 siblings, 1 reply; 5+ messages in thread
From: Newsy Paper @ 2010-09-08 14:15 UTC (permalink / raw)
  To: linux-media, linux-dvb

[-- Attachment #1: Type: text/plain, Size: 368 bytes --]

Hi,

first of all I have to say that this patch is not from me.
It's from rotor-0.1.4mh-v1.2.tar.gz
Thx to the author of that patch and the modified rotor Plugin. I think he's a friend of Mike Booth

I think it should be included into s2-liplianin.
With this patch all dvb-s and dvb-s2 signal strength values are scaled correctly.

kind regards


Newsy


[-- Attachment #2: STB0899_signal_strength_v3patch --]
[-- Type: application/octet-stream, Size: 2430 bytes --]

--- /common/Programms/ver2/src/s2-liplianin/linux/drivers/media/dvb/frontends/stb0899_drv.c	2009-12-31 17:15:38.115203347 +0300
+++ ./linux/drivers/media/dvb/frontends/stb0899_drv.c	2010-01-14 22:17:22.671634551 +0300
@@ -980,6 +980,16 @@
 
 				*strength = stb0899_table_lookup(stb0899_dvbsrf_tab, ARRAY_SIZE(stb0899_dvbsrf_tab) - 1, val);
 				*strength += 750;
+                
+                const int MIN_STRENGTH_DVBS = 0;
+                const int MAX_STRENGTH_DVBS = 680;
+                if (*strength < MIN_STRENGTH_DVBS)     
+                    *strength = 0;
+                else if(*strength > MAX_STRENGTH_DVBS) 
+                    *strength = 0xFFFF;
+                else
+			        *strength = (*strength - MIN_STRENGTH_DVBS) * 0xFFFF / (MAX_STRENGTH_DVBS - MIN_STRENGTH_DVBS); 
+
 				dprintk(state->verbose, FE_DEBUG, 1, "AGCIQVALUE = 0x%02x, C = %d * 0.1 dBm",
 					val & 0xff, *strength);
 			}
@@ -992,6 +1002,7 @@
 
 			*strength = stb0899_table_lookup(stb0899_dvbs2rf_tab, ARRAY_SIZE(stb0899_dvbs2rf_tab) - 1, val);
 			*strength += 750;
+			*strength = *strength << 4;
 			dprintk(state->verbose, FE_DEBUG, 1, "IF_AGC_GAIN = 0x%04x, C = %d * 0.1 dBm",
 				val & 0x3fff, *strength);
 		}
@@ -1024,6 +1035,16 @@
 				val = MAKEWORD16(buf[0], buf[1]);
 
 				*snr = stb0899_table_lookup(stb0899_cn_tab, ARRAY_SIZE(stb0899_cn_tab) - 1, val);
+
+                const int MIN_SNR_DVBS = 0;
+                const int MAX_SNR_DVBS = 200;
+                if (*snr < MIN_SNR_DVBS)     
+                    *snr = 0;
+                else if(*snr > MAX_SNR_DVBS) 
+                    *snr = 0xFFFF;
+                else
+			        *snr = (*snr - MIN_SNR_DVBS) * 0xFFFF / (MAX_SNR_DVBS - MIN_SNR_DVBS); 
+
 				dprintk(state->verbose, FE_DEBUG, 1, "NIR = 0x%02x%02x = %u, C/N = %d * 0.1 dBm\n",
 					buf[0], buf[1], val, *snr);
 			}
@@ -1048,6 +1069,16 @@
 				val = (quantn - estn) / 10;
 			}
 			*snr = val;
+
+            const int MIN_SNR_DVBS2 = 10;
+            const int MAX_SNR_DVBS2 = 70;
+            if (*snr < MIN_SNR_DVBS2)     
+                *snr = 0;
+            else if(*snr > MAX_SNR_DVBS2) 
+                *snr = 0xFFFF;
+            else
+			    *snr = (*snr - MIN_SNR_DVBS2) * 0xFFFF / (MAX_SNR_DVBS2 - MIN_SNR_DVBS2); 
+
 			dprintk(state->verbose, FE_DEBUG, 1, "Es/N0 quant = %d (%d) estimate = %u (%d), C/N = %d * 0.1 dBm",
 				quant, quantn, est, estn, val);
 		}

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2010-09-08 21:44 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-09-08 14:15 [Patch] Correct Signal Strength values for STB0899 Newsy Paper
2010-09-08 17:47 ` [linux-dvb] " Goga777
2010-09-08 17:51   ` Newsy Paper
2010-09-08 18:18     ` Goga777
2010-09-08 21:33     ` Mike Booth

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.