DVB Front-End Signal Strength Inconsistency

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

 



Hi all,

Please find attached a patch which fixes a few of the front-end signal-strength functions.

The actual signal strength values returned by some front-ends are not consistent
with others, meaning that it makes it hard for applications to interpret this consistently,
this patch aims to correct this.

The patch was made against kernel sources 2.6.17.1 but should hopefully apply to the up-coming
2.6.18 too.


Regards
--
Bradley Kite.
diff -C 5 -r linux-2.6.17.1/drivers/media/dvb/frontends/cx22700.c linux-2.6.17.1-dvb-fixes/drivers/media/dvb/frontends/cx22700.c
*** linux-2.6.17.1/drivers/media/dvb/frontends/cx22700.c	2006-06-20 10:31:55.000000000 +0100
--- linux-2.6.17.1-dvb-fixes/drivers/media/dvb/frontends/cx22700.c	2006-08-02 13:54:19.000000000 +0100
***************
*** 299,308 ****
--- 299,309 ----
  	struct cx22700_state* state = fe->demodulator_priv;
  
  	u16 rs_ber = (cx22700_readreg (state, 0x0d) << 9)
  		   | (cx22700_readreg (state, 0x0e) << 1);
  	*signal_strength = ~rs_ber;
+         *signal_strength = (rs_ber << 8) | rs_ber;
  
  	return 0;
  }
  
  static int cx22700_read_snr(struct dvb_frontend* fe, u16* snr)
diff -C 5 -r linux-2.6.17.1/drivers/media/dvb/frontends/cx22702.c linux-2.6.17.1-dvb-fixes/drivers/media/dvb/frontends/cx22702.c
*** linux-2.6.17.1/drivers/media/dvb/frontends/cx22702.c	2006-06-20 10:31:55.000000000 +0100
--- linux-2.6.17.1-dvb-fixes/drivers/media/dvb/frontends/cx22702.c	2006-08-02 13:56:21.000000000 +0100
***************
*** 415,425 ****
  
  static int cx22702_read_signal_strength(struct dvb_frontend* fe, u16* signal_strength)
  {
  	struct cx22702_state* state = fe->demodulator_priv;
  
! 	*signal_strength = cx22702_readreg (state, 0x23);
  
  	return 0;
  }
  
  static int cx22702_read_snr(struct dvb_frontend* fe, u16* snr)
--- 415,427 ----
  
  static int cx22702_read_signal_strength(struct dvb_frontend* fe, u16* signal_strength)
  {
  	struct cx22702_state* state = fe->demodulator_priv;
  
!         u16 rs_ber = 0;
! 	rs_ber = cx22702_readreg (state, 0x23);
!         *signal_strength = (rs_ber << 8) | rs_ber;
  
  	return 0;
  }
  
  static int cx22702_read_snr(struct dvb_frontend* fe, u16* snr)
diff -C 5 -r linux-2.6.17.1/drivers/media/dvb/frontends/mt352.c linux-2.6.17.1-dvb-fixes/drivers/media/dvb/frontends/mt352.c
*** linux-2.6.17.1/drivers/media/dvb/frontends/mt352.c	2006-06-20 10:31:55.000000000 +0100
--- linux-2.6.17.1-dvb-fixes/drivers/media/dvb/frontends/mt352.c	2006-08-02 14:08:32.000000000 +0100
***************
*** 466,475 ****
--- 466,478 ----
  
  	/* align the 12 bit AGC gain with the most significant bits */
  	u16 signal = ((mt352_read_register(state, AGC_GAIN_1) & 0x0f) << 12) |
  		(mt352_read_register(state, AGC_GAIN_0) << 4);
  
+         /* make 16-bit */
+         signal = (signal << 8) | signal;
+ 
  	/* inverse of gain is signal strength */
  	*strength = ~signal;
  	return 0;
  }
  
_______________________________________________

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