Snd-bt87x (alsa bt878 driver)

From LinuxTVWiki
Revision as of 22:52, 30 March 2009 by Martin.res (talk | contribs)
Jump to navigation Jump to search

Preamble

The rumor is that snd-bt87x is the ALSA driver that replaces the legacy btaudio. If you have arrived on this page, chances are your snd-bt87x-based device did not work out of the box. Hopefully, this page will assist you. If it does please return the favor by creating a page for your card.

Given the rapid development in the Linux kernel and v4l project, module options, driver features and functionality may change. The instructions below are very general to accommodate as many distros and kernel versions as possible. Therefore, it is incumbent upon you to know how to do a few things and how your distro implements them.

Required Skills

Figuring out if the card will work will require some familiarity with kernel options and permanently storing them, working on the command line in root (or sudo), and perusing dmesg to find the debugging data for snd-bt87x.

Rough instructions to enable snd-bt87x audio

When setting up the driver, find and delete any defaults that may be present that would make getting the sound to work a challenge. For example, in Debian/Ubuntu, there is a mapping stanza in /etc/modprobe.d/aliases that maps bttv devices to -2. Research suggests the -2 has special meaning in ALSA. It is interpreted as, take the next device number available after any other device. In order to keep track of which sound device is the first, second, etc., it is advised to comment out stanzas with the -2 designation and define card0 (your primary sound card), card1 (probably your tv card), with "index=" kernel options for each driver.


1: Pre-installation & Hardware Notes

If your card has internal connectors to send audio to an open plug on your sound card, then plug them in and note the name of the connector. (usually Aux) If it does not, you will need a patch cord running from the back of the tv card to your sound card's capture port.

If your primary volume is not down low, then turn your audio waaaay down before inserting your card. Successfully installing/configuring snd-bt87x, may lead to TV sound with the volume on 11. (See Spinal Tap for the "It goes to 11" reference) You are warned.

Before inserting the card in an available slot, you need to make snd-bt87x load by default when the system boots. This can vary depending on your distro. For Debian, I add snd-bt87x to /etc/modules in order to force loading. Don't reboot yet.

2: Enable all debug options for the bttv, snd-bt87x, and bt878.

In Debian, that is accomplished by adding a text file to /etc/modprobe.d/. If you have already inserted the card, add the kernel options to your system anyway. You need to be sure your primary sound card is given an index=0 kernel option and the snd-bt87x is given an index value of 1 (or greater) and has the load_all option. ex. options snd-bt87x index=1 id=bttv load_all appears in my /etc/modprobe.d/bttv file. The id= option is helpful to name your cards. Sound rate options may need to be set.

3: Post Installation Testing

After booting, open a terminal and type "dmesg | grep bt" (no quotes) That will give you all of the output related to the tv card. Your kernel should have no problems finding the card and giving it device nodes. At minimum, /dev/video0 should be created. If dmesg does not at least detect the card, then chances are good the card does not have the bare minimum to function at all under Linux. Despite the ubiquity of bttv-based cards, it is still possible that your card is not supported.

Check to see what devices have been made available for alsa a couple of ways. Note, this doesn't mean the device works with all of the features advertised from the Windows world. It just means that ALSA/Linux detects the device. (Welcome to the fascinating world of device driver hacking!) In the console, arecord -l should show at least one capture interface. Depending on the amount of support, amixer -c 1 should give a list of some controls from the snd-bt87x device. The "-c 1" option is the index number set in the kernel options. You can also check /proc/asound for the device names you set with the kernel options in pre-configuration.

4: Reinstall Module bttv to get the sound work

With ubuntu 8.04 and a Pinnacle TV-Card with BT878 there where no sound, but the tuner works. To solve this Problem is to reinstall the module bttv. Open a terminal as root and type:

 rmmod bt878
 rmmod tuner
 rmmod bttv
 modprobe tuner
 modprobe bt878
 modprobe bttv

You can also write a Start-script in /etc/init.d and set a symlink to /etc/rc2.d/@S51bttv:

 #!/bin/sh -e
 # 
 # init script for reload bttv module
 
 case "$1" in
   start)
     rmmod bt878
     rmmod tuner
     rmmod bttv
     modprobe tuner
     modprobe bt878
     modprobe bttv
     ;;
   stop)
     ;;
   *)
     echo "Usage: /etc/init.d/bttv {start|stop"
     exit 1
     ;;
 esac
 
 exit 0 

Post Installation Configuration

To see if audio actually works in some fashion, it is probably the case that capture will need to be enabled in alsamixer for the plug you connected your card's audio. In a terminal, type alsamixer and press F4. Move the cursor to the device that may be capturing the audio and press the space bar. If capture and output are working, then sound should come out quietly at first when you return to the main mixer gui and turn up the capture volume. If your card is really well supported, stereo audio may be available and you may even be able to use arecord to capture audio directly from the device.

Play with the the master volume and capture volumes to get things right for you. Then remove the debug options you enabled at the beginning.

Note from page's inaugural author: this page needs better organization and clarification. Please contribute!