patch for bktr(4): don't reset tuner on open/close

Jacob Meuser jakemsr at
Sat Apr 23 22:29:43 PDT 2005

On Sat, Apr 23, 2005 at 09:42:34PM -0700, Julian Elischer wrote:
> Jacob Meuser wrote:
> >the following is a patch that is in OpenBSD's bktr.
> >
> >the idea is to not reset the tuner device on open(2) and close(2).
> >
> >effects:
> >  - don't need to hold /dev/tuner open to get audio.
> >  - selected channelset won't get clobbered on open/close.  IMO, the
> >    current behaviour here is idiotic.  the channelset has nothing to
> >    do with the hardware.  it is internally used by the driver.  also,
> >    this is IMO a much cleaner fix to the problems with V4L programs
> >    not tuning properly because they never set the channelset.  now
> >    the correct channelset can be set at bootup with something like
> >    bsdbktrtvtune or whatever, instead of rebuilding the kernel with
> >    the default channelset hardcoded into the driver.
> >
> >BTW, I haven't tested this on FreeBSD at all.  it might need some
> >tweaking.  the diff is also set up so that BKTR_NO_OPEN_RESET must
> >be defined to enable it.  ultimately, I think this should be the
> >default behaviour.
> >
> can you comment on what you mean by "V4L programs"?
> (since we don't have V4L on freeBSD (as such))

mplayer, xawtv, etc.  I guess what I meant was programs that were
originally for V4L and then ported (with some pieces missing).

the bktr interface is not very intuitive, and it's pretty easy, IMO,
to understand why some projects that were ported from V4L to bktr
don't do things quite right.

probably the most common issue is with tuning via TVTUNER_SETFREQ.
on the surface this looks like VIDIOCSFREQ or VIDIOC_S_FREQUENCY.
however, bktr uses it's internal channelset to calculate carrier
offset, etc.  this does not happen in the linux bttv driver.
as a result, programs like mplayer and xawtv never set the
channelset.  for mplayer, allowing a user to choose the channelset
(because remember, as it is now, the channelset gets reset to the
default everytime the tuner is opened) would require another option.
xawtv has a menu box for selecting the channelset.  however, the
action of changing the channelset doesn't do anything but update
the list pointer.  the less intrusive fix would be to add
TVTUNER_SETTYPE before each TVTUNER_SETFREQ.  otherwise a new
action would have to be added to xawtv (which I have patches for.
but of course, they are for xawtv-3.x, which is now obsolete ...).

also, there is (was) no documentation for bktr ioctls.  some was
recently added to the OpenBSD bktr manpage.  your meteor(4) explains
some of the METEOR_ ioctls, but it seems there are differences and
some of the stuff it talks about was apparently never implemented
in bktr(4)?

<jakemsr at>

More information about the freebsd-multimedia mailing list