From owner-freebsd-bugs@FreeBSD.ORG Mon Apr 26 14:50:19 2004 Return-Path: Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 2D75A16A4D3 for ; Mon, 26 Apr 2004 14:50:19 -0700 (PDT) Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id 1764143D2F for ; Mon, 26 Apr 2004 14:50:12 -0700 (PDT) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) i3QLoBcT076139 for ; Mon, 26 Apr 2004 14:50:11 -0700 (PDT) (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.12.11/8.12.11/Submit) id i3QLoBIB076134; Mon, 26 Apr 2004 14:50:11 -0700 (PDT) (envelope-from gnats) Resent-Date: Mon, 26 Apr 2004 14:50:11 -0700 (PDT) Resent-Message-Id: <200404262150.i3QLoBIB076134@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-bugs@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, "Josh Elsasser" Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 9040716A4CE for ; Mon, 26 Apr 2004 14:49:53 -0700 (PDT) Received: from mail.vineyard.net (k1.vineyard.net [204.17.195.90]) by mx1.FreeBSD.org (Postfix) with ESMTP id F000443D46 for ; Mon, 26 Apr 2004 14:49:52 -0700 (PDT) (envelope-from jre@vineyard.net) Received: from localhost (loopback [127.0.0.1]) by mail.vineyard.net (Postfix) with ESMTP id 39351A0CA5 for ; Mon, 26 Apr 2004 17:49:51 -0400 (EDT) Received: from mail.vineyard.net ([127.0.0.1]) by localhost (king1.vineyard.net [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 16120-07 for ; Mon, 26 Apr 2004 17:49:51 -0400 (EDT) Received: from jade.elsasser.org (loopback [127.0.0.1]) by mail.vineyard.net (Postfix) with ESMTP id A7C029755B for ; Mon, 26 Apr 2004 17:49:50 -0400 (EDT) Received: from jade.elsasser.org (localhost [127.0.0.1]) by jade.elsasser.org (Postfix) with ESMTP id 4E1ADAE for ; Mon, 26 Apr 2004 17:49:49 -0400 (EDT) Message-Id: <1083016189.0@jade.elsasser.org> Date: Mon, 26 Apr 2004 17:49:49 -0400 From: "Josh Elsasser" To: "FreeBSD gnats submit" X-Send-Pr-Version: gtk-send-pr 0.3.3 Subject: kern/66006: [PATCH] bktr driver may not tune correctly X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 26 Apr 2004 21:50:19 -0000 >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: