What follows are my experiences only. I do not claim to be an expert but in the hopes that someone else may not have to have the troubles I did I post the following;
I added a fourth tuner to my system. I had a PVR-150 and a PVR-500 (Dual-Tuner). My new tuner is an ATI TV-Wonder PCI. The ATI TV-Wonder PCI has been a challenge for me to get working.
The video and audio streams from the tuner are two separate PCI devices in the ATI TV-Wonder PCI (and most other bt878 cards) we will need to configure the devices separately for MythTV to access them. We shall discuss the video first and then the audio second.
VIDEO
The video configuration is fairly simple compared to the audio. The bttv driver is native and installed with the KnoppMyth kernel. The only thing we must do is setup the options file. We must do this due to the tuner parameters often are guessed wrong on boot. In my case the OS thinks I am running a PAL tuner when I have an NTSC.
All commands must be run as root!
From a bash shell prompt;
Code:
su
dmesg | grep bttv.*tuner
It responds;
bttv0: using tuner=19Using
http://www.tldp.org/HOWTO/BTTV/modprobe.html as a look-up table I see NTSC should be 2 not 19.
Determine your card number;
Code:
dmesg | grep bttv.*card
It responded;
bttv0: detected: ATI TV Wonder [card=63], PCI subsystem ID is 1002:0001
bttv0: using: ATI TV-Wonder [card=63,autodetected]In my case it was 63… Write this down we will need it later. If you want to make sure it is correct you can check
http://www.linuxtv.org/v4lwiki/index.php/Cardlist.BTTV and see. In my case it was. From what I have read the card detection usually works…. The tuner detection often is wrong.
We have to edit the bttv config file. I must have spent hours scouring the board where everyone said just modify the bttv file. If you looked you know what I mean… I finally came across a post by Xsecrets in the thread at
http://mysettopbox.tv/phpBB2/viewtopic.php?t=8158 that made a big light bulb go on in my head. Thanks!!!
We must determine which bttv file to edit;
Code:
nano /etc/modprobe.d/KnoppMyth
Look for the line;
include /etc/mythtv/modules/bttv
include /etc/mythtv/modules/bttv0
include /etc/mythtv/modules/bttv1
include /etc/mythtv/modules/bttv2
include /etc/mythtv/modules/bttv3Exit nano (<Ctrl – X>)
You should only have one of these files listed. In my case it was bttv1. If you edit any of the other files they will not process.
Now here we edit the config file;
Code:
nano /etc/mythtv/modules/bttv1
(Be sure to edit the correct file as discussed above)
Add the following;
options bttv card=63 tuner=2You need to use the correct numbers for your card as we determined above. This is the correct line for an ATI TV-Wonder PCI with an NTSC tuner.
Exit nano (<Ctrl – X>, Yes to save changes and overwrite /etc/mythtv/modules/bttv1)
Now we test it out.
Code:
rmmod bttv
modprobe bttv
tail /var/log/syslog
It should report;
Aug 2 00:35:52 mythtv kernel: tuner 0-0060: chip found @ 0xc0 (bt878 #0 [sw])
Aug 2 00:35:52 mythtv kernel: bttv0: using tuner=2
Aug 2 00:35:52 mythtv kernel: tuner 0-0060: type set to 2 (Philips NTSC (FI1236,FM1236 and compatibles))
Aug 2 00:35:52 mythtv kernel: bttv0: i2c: checking for MSP34xx @ 0x80... found
Aug 2 00:35:52 mythtv kernel: bttv0: i2c: checking for TDA9875 @ 0xb0... not found
Aug 2 00:35:52 mythtv kernel: bttv0: i2c: checking for TDA7432 @ 0x8a... not found
Aug 2 00:35:52 mythtv kernel: bttv0: i2c: checking for TDA9887 @ 0x86... not found
Aug 2 00:35:52 mythtv kernel: bttv0: registered device video0
Aug 2 00:35:52 mythtv kernel: bttv0: registered device vbi0
Aug 2 00:35:53 mythtv kernel: bttv0: PLL: 28636363 => 35468950 .. okNote: If you have had a lot of system log activity it may not show because it would be deeper in the log.
Just to be sure reboot and then,
Code:
dmesg | grep bttv
It should output something like;
bttv: driver version 0.9.16 loaded
bttv: using 8 buffers with 2080k (520 pages) each for capture
bttv: Bt8xx card found (0).
bttv0: Bt878 (rev 2) at 0000:01:08.0, irq: 18, latency: 32, mmio: 0xe0000000
bttv0: detected: ATI TV Wonder [card=63], PCI subsystem ID is 1002:0001
bttv0: using: ATI TV-Wonder [card=63,insmod option]
bttv0: gpio: en=00000000, out=00000000 in=00ffffff [init]
bttv0: using tuner=2
bttv0: i2c: checking for MSP34xx @ 0x80... found
bttv0: i2c: checking for TDA9875 @ 0xb0... not found
bttv0: i2c: checking for TDA7432 @ 0x8a... not found
bttv0: i2c: checking for TDA9887 @ 0x86... not found
bttv0: registered device video0
bttv0: registered device vbi0
bttv0: PLL: 28636363 => 35468950 .. ok
bttv0: PLL can sleep, using XTAL (28636363).It worked… Note the device
video0 and
vbi0. Your numbers may be different. Once you get the audio working you will need to setup the video for linux V4L sotware card in the backend setup. You will need these two numbers then.
AUDIO
These instructions should work with any bt787 based audio device with a MSP34xx chipset (
http://www.linuxtv.org/v4lwiki/index.php/Btaudio). How do you know if you have this chipset?
From a bash shell prompt;
Code:
dmesg | grep bttv.*MSP34
If you have the chipset you should see something like;
bttv0: i2c: checking for MSP34xx @ 0x80... foundThere are two options for audio output on the ATI TV-Wonder PCI. You can use the bt878 ALSA driver or the btaudio OSS driver. In KnoppMyth R5C7 btaudio is no longer part of the default compiled kernel but the source code is provided. It may have been this way in previous KnoppMyth kernel revisions but this is my first run-in with it. The default KnoppMyth driver for the bt878 audio chipset is to use the bt878 ALSA driver (Driver is at: /lib/modules/2.6.15-chw-2/kernel/drivers/media/dvb/bt8xx/bt878.ko Source is at: /usr/src/kernel-source-2.6.15-chw-2/drivers/media/dvb/bt8xx/bt878.c in R5C7). This works great if you are using the line out on the tuner card to the line in on a sound card but for my MythTV usage btaudio is a better driver choice for two reasons, first btaudio’s ability to place data on the PCI bus using DMA creating a dsp device allows for one less digital to analogue and back to digital audio conversion (using an external cable), second I do not need an audio cable or sound card input available for each tuner card in my chassis. This may seem trivial for one card but when you have multiple tuners the sound cards add up quick.
So how do we disable bt878, compile btaudio, install bt878 and verify it all worked?
Just so people don’t think I am reinventing the wheel I have tried the following with no success;
In the MythTV wiki (as of 2006/08/01 -
http://www.mythtv.org/wiki/index.php/Btaudio) it talk about using btaudio by initializing it on boot. There is an assumption that btaudio is part of the kernel. For MythTV this is no longer the case.
In the KnoppMyth wiki (as of 2006/08/01 -
http://wiki.knoppmyth.net/index.php?page=BTTV+BTAudio) it talks about downloading the source and make file. For me I got as far as the make command when it dumped a verification error and would go no further…. I am not sure if the kernel version causes an issue or what the root cause is. It may be possible to play with the make file and get it to work but my level of expertise in caused me to look elsewhere. All commands should be run as root.
Step One: disable bt878
Using concepts from the KnoppMyth wiki post above;
From a bash shell prompt;
Code:
su root
Now type your root password.
Open the modules instantiation file
Code:
nano /etc/modules
Comment out the bt878 line. It should look like…
#bt878Exit nano (<Ctrl – X>, Yes to save changes and overwrite /etc/modules)
Now blacklist bt878 so hotplug will not load it
Code:
nano /etc/hotplug/blacklist
Scroll to the last line of the file and add
bt878Exit nano (<Ctrl – X>, Yes to save changes and overwrite /etc/hotplug/blacklist)
Step Two: Compile btaudio
The btaudio default location for the source and documentation are;
/usr/src/kernel-source-2.6.15-chw-2/sound/oss/btaudio.c
/usr/src/kernel-source-2.6.15-chw-2/Documentation/sound/oss/btaudio
From a bash shell prompt;
Code:
cd /usr/src/kernel-source-2.6.15-chw-2/
make menuconfig
A text based gui will pop up
Scroll down to “Device Drivers” <Enter>
Scroll down to “Sound” <Enter>
Scroll down to “Open Sound System” <Enter>
Scroll down to “Open Sound System (DEPRECATED)” <Space Bar>
Scroll down to “Obsolete OSS drivers (NEW)” <Space Bar>
Scroll down to “BT878 audio dma (NEW)” <Space Bar>
You should see it go
-from: < > BT878 audio dma (NEW)
-to: <M> BT878 audio dma
Press <Esc> four times.
It now asks “Do you wish to save your new kernel configuration?”
Select “Yes”You should be back at a bash shell prompt.
Now we compile…
Code:
make modules
One of the last few lines you should see should be;
LD [M] sound/oss/btaudio.koStep Three: Install btaudio
There are two ways to do this….
The quick way is to use the make modules_install command. The downside is it will reload a lot of other thing but it will verify dependencies…. I prefer to make things easy as possible but I will provide directions for both methods…
As a sidenote btaudio does depend on soundcore.ko but for now it is already there in R5C7… should this change in the future it would need to be added.
If you want the easiest way (Preferred method for me)
Code:
make modules_install
If you are concerned with a make modules_install command
Code:
mkdir /lib/modules/2.6.15-chw-2/kernel/sound/oss
cp /usr/src/kernel-source-2.6.15-chw-2/sound/oss/btaudio.ko /lib/modules/2.6.15-chw-2/kernel/sound/oss/btaudio.ko
depmod -a
Now we have to add it to the list of modules to load at boot
Open the modules instantiation file
Code:
nano /etc/modules
Below where we commented out the bt878 line add btaudio. It should look like…
#bt878
btaudioExit nano (<Ctrl – X>, Yes to save changes and overwrite /etc/modules)
I know some will say “But we could just have done this earlier”, but for the process and to understand the flow I structured it this way…
Now we have to load the “Options” for the driver. We could stick it in another file (Say the video configuration file) or we could make an audio specific one… I am going to describe how to make an audio specific one… you can see what is going on and modify to your liking.
Here we tell it to load the config file;
Code:
nano /etc/modprobe.d/KnoppMyth
Add to the last line;
include /etc/mythtv/modules/btaudio
Exit nano (<Ctrl – X>, Yes to save changes and overwrite /etc/modprobe.d/KnoppMyth)
Now here we make the config file;
Code:
touch /etc/mythtv/modules/btaudio
Now here we edit the config file;
Code:
nano /etc/mythtv/modules/btaudio
You should see a blank file.
Add the following;
options btaudio dsp1=1 digital=1 analog=0 rate=32000Exit nano (<Ctrl – X>, Yes to save changes and overwrite /etc/mythtv/modules/btaudio)
Note: dsp=X Where X is will determine the dsp device number assigned…. Modify if needed.
If you want to play around there are more parameters (as shown below) you can play with but the above options line works for me.
parm: latency:pci latency timer (int)
parm: rate:int
parm: analog:int
parm: digital:int
parm: irq_debug:int
parm: debug:int
parm: mixer:int
parm: dsp2:int
parm: dsp1:int
Step Four: Verify it all worked
Unload the bt878 module
Code:
rmmod bt878
Load the btaudio module
Code:
modprobe btaudio
Check the logs to make sure it all worked…
Code:
cat /var/log/syslog | grep btaudio
You should see something like….
Aug 2 05:03:17 mythtv kernel: btaudio: driver version 0.7 loaded [digital]
Aug 2 05:03:17 mythtv kernel: btaudio: Bt878 (rev 2) at 01:08.1, irq: 18, latency: 32, mmio: 0xe0001000
Aug 2 05:03:17 mythtv kernel: btaudio: using card config "default"
Aug 2 05:03:17 mythtv kernel: btaudio: registered device dsp1 [digital]Reboot
Get back to a shell and run
Code:
dmesg | grep btaudio
You should see something like;
btaudio: driver version 0.7 loaded [digital]
btaudio: Bt878 (rev 2) at 01:08.1, irq: 18, latency: 32, mmio: 0xe0001000
btaudio: using card config "default"
btaudio: registered device dsp1 [digital]
Now you can configure the video for linux V4L Software setting for audio in the backend setup. Use the dsp device you set in the options file. In my case it is
dsp1.
It is important to note that you should not have any output device attached to the tuner line-out but rather your soundcard line-out/speakers. The card will be initialized with the backend and audio will immediately start from the tuner line-out. If you are using your sound card you will never even know it is there.
-Steve