[PATCH] stv0297 signal strength and SNR fix

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello.

The attached patch adds better shifting and masking of SNR and signal
strength to stv0297 frontend. This makes the frontend report more
reasonable strength and SNR values to user space.

I tested the patch only with my Cablestar 2 so mileage with other cards
may vary. Please test and let me know if there is an improvement for
other cards as well.


Signed-off-by: Antti Seppälä <ajhseppa@xxxxxxxxxxxxxx>


--- v4l-dvb-orig/linux/drivers/media/dvb/frontends/stv0297.c	2007-02-14 10:23:45.000000000 +0200
+++ v4l-dvb-cs2/linux/drivers/media/dvb/frontends/stv0297.c	2007-02-14 10:21:54.000000000 +0200
@@ -356,7 +356,7 @@
 	u8 STRENGTH[2];
 
 	stv0297_readregs(state, 0x41, STRENGTH, 2);
-	*strength = (STRENGTH[1] & 0x03) << 8 | STRENGTH[0];
+	*strength = ~(((STRENGTH[1] & 0x03) << 14) | (STRENGTH[0] << 6) | (STRENGTH[0] & 0x3F));
 
 	return 0;
 }
@@ -367,7 +367,7 @@
 	u8 SNR[2];
 
 	stv0297_readregs(state, 0x07, SNR, 2);
-	*snr = SNR[1] << 8 | SNR[0];
+	*snr = ~(((SNR[1] & 0x3F) << 10) | (SNR[0] << 2) | (SNR[0] & 0x3));
 
 	return 0;
 }
_______________________________________________
linux-dvb mailing list
linux-dvb@xxxxxxxxxxx
http://www.linuxtv.org/cgi-bin/mailman/listinfo/linux-dvb

[Index of Archives]     [Linux Media]     [Video 4 Linux]     [Asterisk]     [Samba]     [Xorg]     [Xfree86]     [Linux USB]

  Powered by Linux