Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 26 Apr 2004 17:49:49 -0400
From:      "Josh Elsasser" <jre@vineyard.net>
To:        "FreeBSD gnats submit" <FreeBSD-gnats-submit@FreeBSD.org>
Subject:   kern/66006: [PATCH] bktr driver may not tune correctly
Message-ID:  <1083016189.0@jade.elsasser.org>
Resent-Message-ID: <200404262150.i3QLoBIB076134@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         66006
>Category:       kern
>Synopsis:       [PATCH] bktr driver may not tune correctly
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Mon Apr 26 14:50:11 PDT 2004
>Closed-Date:
>Last-Modified:
>Originator:     Josh Elsasser
>Release:        FreeBSD 5.2-CURRENT i386
>Organization:
>Environment:


System: FreeBSD 5.2-CURRENT #15: Mon Apr 26 13:49:58 EDT 2004
    joshe@jade.elsasser.org:/usr/local/obj/usr/src/sys/JADE



>Description:


The bktr TV-tuner card driver contains a bug when a program tunes a
frequency with a TVTUNER_SETFREQ ioctl without first setting the tuner
type with a TVTUNER_SETTYPE ioctl.  If the default tuner type is a PAL
frequency set such as CHNLSET_WEUROPE and the video format is NTSC or
vice versa, the card will be tuned to the wrong frequency.

The driver uses the current channel set to determine "the offset from
the base signal where the video, color, audio and NICAM signals are".
It appears to have been written with the assumption that a
TVTUNER_SETTYPE will always be issued, but this is not necessary if
one wishes to bypass the driver's build-in (and somewhat incomplete)
frequency sets and tune a frequency directly with TVTUNER_SETFREQ.

This simple patch uses the current input format set with the BT848SFMT
ioctl to determine if a NTSC or PAL offset should be used.  I am not
entirely sure that it is correct for every possible input format, but
it is at least as correct as the driver is now.


>How-To-Repeat:


For NTSC, build the bktr driver with DEFAULT_CHNLSET=CHNLSET_WEUROPE
(which is the default), or CHNLSET_WEUROPE=CHNLSET_NABCST for PAL.
Then use xawtv/motv or mplayer (not fxtv) and observe that it is not
tuning correctly.


>Fix:


--- bktr-kernel-patch begins here ---
--- sys/dev/bktr/bktr_tuner.c.orig	Mon Dec 15 22:28:39 2003
+++ sys/dev/bktr/bktr_tuner.c	Mon Apr 26 16:03:57 2004
@@ -698,7 +698,7 @@
 #undef TBL_CHNL
 
 
-#define TBL_IF	freqTable[ bktr->tuner.chnlset ].ptr[ 1 ]
+#define TBL_IF	(bktr->format_params == BT848_IFORM_F_NTSCJ || bktr->format_params == BT848_IFORM_F_NTSCM ? nabcst[1] : weurope[1])
 
 
 /* Initialise the tuner structures in the bktr_softc */
--- bktr-kernel-patch ends here ---



>Release-Note:
>Audit-Trail:
>Unformatted:



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?1083016189.0>