[linux-dvb] FE_GET_FRONTEND returns wrong frequency for TwinHan DST cards

Tom Hughes tom at compton.nu
Mon Sep 12 20:27:55 CEST 2005


The FE_GET_FRONTEND ioctl seems to return the wrong frequency
for TwinHan DST cards - looking at the code in dst_get_tuna shows
that it only looks at two bytes while fills in three when setting
the frequency for DVB-T and DVB-C cards.

In addition it doesn't multiply the extracted value by 1000 to
match the division by 1000 that dst_set_freq does when setting
the frequency.

All this seems to match up with the resut being off by a factor
of 256000 on my DVB-T card.

The attached patch corrects both issues and seems to resolve the
problem on my system.

Tom

-- 
Tom Hughes (tom at compton.nu)
http://www.compton.nu/
-------------- next part --------------
Index: linux/drivers/media/dvb/bt8xx/dst.c
===================================================================
RCS file: /cvs/linuxtv/dvb-kernel/linux/drivers/media/dvb/bt8xx/dst.c,v
retrieving revision 1.39
diff -u -u -r1.39 dst.c
--- linux/drivers/media/dvb/bt8xx/dst.c	10 Sep 2005 16:20:12 -0000	1.39
+++ linux/drivers/media/dvb/bt8xx/dst.c	12 Sep 2005 18:21:59 -0000
@@ -1093,7 +1093,13 @@
 	}
 	if (state->rx_tuna[2] == 0 && state->rx_tuna[3] == 0)
 		return 0;
-	state->decode_freq = ((state->rx_tuna[2] & 0x7f) << 8) + state->rx_tuna[3];
+        
+	if (state->dst_type == DST_TYPE_IS_SAT) {
+		state->decode_freq = ((state->rx_tuna[2] & 0x7f) << 8) + state->rx_tuna[3];
+	} else {
+		state->decode_freq = ((state->rx_tuna[2] & 0x7f) << 16) + (state->rx_tuna[3] << 8) + state->rx_tuna[4];
+	}
+	state->decode_freq = state->decode_freq * 1000;
 	state->decode_lock = 1;
 	state->diseq_flags |= HAS_LOCK;
 


More information about the linux-dvb mailing list