Linux Media Controller development
 help / color / mirror / Atom feed
From: Newsy Paper <newspaperman_germany@yahoo.com>
To: linux-media@vger.kernel.org, linux-dvb@linuxtv.org
Subject: [Patch] Correct Signal Strength values for STB0899
Date: Wed, 8 Sep 2010 14:15:54 +0000 (GMT)	[thread overview]
Message-ID: <670866.16644.qm@web29505.mail.ird.yahoo.com> (raw)

[-- 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);
 		}

             reply	other threads:[~2010-09-08 14:22 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-09-08 14:15 Newsy Paper [this message]
2010-09-08 17:47 ` [linux-dvb] [Patch] Correct Signal Strength values for STB0899 Goga777
2010-09-08 17:51   ` Newsy Paper
2010-09-08 18:18     ` Goga777
2010-09-08 21:33     ` Mike Booth

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=670866.16644.qm@web29505.mail.ird.yahoo.com \
    --to=newspaperman_germany@yahoo.com \
    --cc=linux-dvb@linuxtv.org \
    --cc=linux-media@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox