[ale] TV tuner card problem (long cut and paste reply)

Preston Boyington PBoyington at polyengineering.com
Tue May 11 11:21:48 EDT 2004


ChangingLINKS.com wrote:
: I have been soooo spoiled by Suse 8.1-9.0 that my current
: problems amplified.
: 
: I thought that Hauppauge TV cards were compatible with Linux,
: so I bought one.
: A WinTV-250 PVR. To my surprise, it was not automatically
: detected. I manually
: added it using Yast2, but it still didn't work.

this may help also:

<!-- saved from url=(0058)http://pvrhw.goldfish.org/tiki-page.php?pageName=rh9pvr250 -->

Step-by-step guide to building a MythTV box under Red Hat Linux 9 w/ATrpms

11. Get and install capture card driver

		For WinTV PVR-250/350/Freestyle capture card users-

Disclaimer! The ivtv driver for the WinTV PVR-250/350/Freestyle capture cards is still considered beta, though it does work quite well. Driver development isn't entirely stable just yet, and thus parts of this section may become obsolete over time. Please be aware that TV-Out is not yet supported in the ivtv rpms.

Install the ivtv driver:

# apt-get install ivtv-kmdl-$KERNEL
# apt-get install ivtv

This has been broken down into two lines, due to apt flat-out not cooperating when it comes to dependency resolution (multiple kmdl's will satisfy the deps of ivtv, but it seems to like to install something other than the one we want, unless we install the one we want first).

Due to unresolved licensing issues, the necessary firmware files are no longer included in the ivtv rpms. You'll have to download the Windows drivers from Hauppauge and manually extract the firmware images. At this time, you can do so by following these steps (check Hauppauge's site if the download fails, there may be a newer version):

# wget http://hauppauge.lightpath.net/software/pvr250/pvr250_17_21226.exe
# /usr/lib/ivtv/ivtvfwextract.pl pvr250_17_21226.exe

Now, edit /etc/modules.conf to add ivtv-specific configuration info, making sure to place it at the top (and note that those are back-ticks in there, NOT single-quotes; very important distinction):

----Insert the following text at the top /etc/modules.conf----
# For ivtv
path[toplevel]=/lib/modules/`uname -r`/drivers/media/video
# For bttv and saa7134
path[toplevel]=/lib/modules/`uname -r`/v4l2
# default path
path[toplevel]=/lib/modules/`uname -r`
# ivtv modules setup
alias char-major-81 videodev
alias char-major-81-0 ivtv
options ivtv debug=1
options tuner type=2
options msp3400 once=1 simple=1
add below ivtv msp3400 saa7115 tuner
----Cut above here (don't include this line)----

NOTE: There was some confusion about whether that last line should be "add below..." or "add above...", but the ivtv developer now states that the proper way is indeed "add below..." for this section, and a separate line to specify when lirc should load (covered in the lirc section).

Now try loading up the driver:

# /sbin/modprobe ivtv

Check that the card is being properly recognized:

$ /sbin/lspci -v

The lspci output should return something like this within the output:

00:0c.0 Multimedia video controller: Internext Compression Inc iTVC15 MPEG-2
Encoder (rev 01)
Subsystem: Hauppauge computer works Inc.: Unknown device 4801
Flags: bus master, medium devsel, latency 32, IRQ 11
Memory at d0000000 (32-bit, prefetchable) [size=64M]
Capabilities:

Also check that your video device exists:

$ ll /dev/video0
crw-------    1 mythtv   root       81,   0 Jun 06  2003 /dev/video0

Make a note of what your video device has been set up as (device /dev/video0 in this case), as you will need to inform MythTV of this fact later on. We'll take care of loading ivtv at startup a bit later on. You can determine exactly what device ivtv is configured on by looking in /var/log/dmesg. For example, you should see something like this:

# cat /var/log/dmesg |grep ivtv
ivtv: Found an iTVC16 based chip
tuner: probing ivtv i2c driver #0 i2c adapter [id=0x10005]
saa7114.c: starting probe for adapter ivtv i2c driver #0 (0x10005)
ivtv: Encoder revision: 0x02040008
ivtv: Registered v4l2 device, minor 0   <---This is the specific entry we're interested in
ivtv: Registered v4l2 device, minor 32
ivtv: Registered v4l2 device, minor 224

Now you need to set some aspects of the capture card. In this case, we're going to make sure the card is set up for tuner input, using the NTSC (US) video standard, and full NTSC resolution (720x480). The next four lines 1) set NTSC as the video standard, 2) select the tuner for input, and 3) set the full NTSC resolution of 720x480 (you can set a lower rez if you really want, but I say use the best! But then I have an HDTV...) and 4) specify the sound input and output channels. NOTE: The ivtv docs say that './test_ioctl -p 0' should set the tuner for input, but yours may vary (mine did, it is '-p 4'). Keep trying with different -p values, doing a test capture after each change until you get the right one. You may or may not have to do the same for the 4th line.

# /usr/lib/ivtv/test_ioctl -u 0x3000
# /usr/lib/ivtv/test_ioctl -p 4
# /usr/lib/ivtv/test_ioctl -f width=720,height=480
# /usr/lib/ivtv/test_ioctl -v input=3,output=1

And by popular demand, here is the PAL version:

# /usr/lib/ivtv/test_ioctl -u 0xff
# /usr/lib/ivtv/test_ioctl -p 4
# /usr/lib/ivtv/test_ioctl -f width=720,height=576
# /usr/lib/ivtv/test_ioctl -v input=3,output=1

MythTV has the ability to control some of these functions, so be sure to set similar values when we get to the MythTV setup portion. Now hook up your cable or antenna to the WinTV PVR-250's tuner input if you haven't already done so, and we'll try to capture some video... Press Ctrl-C to stop the video capture.

# cat /dev/video0 > /tmp/test_capture.mpg
(ctrl-c to stop capture)

Use that copy of mplayer you installed a bit ago to view the capture. If you get something that looks and sounds intelligible, then congrats, you've got ivtv set up!

If you get the following error:

cat: /dev/video0: Input/output error

Run the following commands to reload the driver:

# /sbin/rmmod ivtv
# /sbin/modprobe ivtv

Now try the capture again.

If you don't have any sound, it is possible that the correct msp3400 module didn't get loaded for one reason or another. To remedy that situation, follow these steps:

# /sbin/rmmod ivtv
# cd /lib/modules/$KERNEL/kernel/drivers/media/video
# mv msp3400.o msp3044.o.orig

Then reload the driver yet again, and try the video capture one more time:

# /sbin/depmod -a
# /sbin/modprobe ivtv
# cat /dev/video0 > /tmp/test_capture.mpg

Some people have run into issues with the PVR-250 generating a slight inverse ghosted image off to the right of the main picture, myself included. The recommended fix, which appears to be working for me, is to set the DNR mode to 0 (mine was initially set to 3), like this:

# /usr/lib/ivtv/test_ioctl -c dnr_mode=0

Also make sure that the values for DNR temporal and spatial filters are set to 0, for best results:

# /usr/lib/ivtv/test_ioctl -c dnr_temporal=0
# /usr/lib/ivtv/test_ioctl -c dnr_spatial=0

You can verify all the settings for your card, see possible inputs, video standards, etc., with this command:

# /usr/lib/ivtv/test_ioctl -a

NOTE: While MythTV has been able to control ivtv capture resolution for some time now, as of version 0.12, MythTV can also control the capture bit rate, so scripts adjusting bit rate are no longer necessary.

				For PVR-x50 users only:

With the kernel module installed, we need to put the correct config file for lirc and the grey Hauppauge remote in place, which is provided by the ivtv folks. Say yes if prompted about overwriting an existing file.

# cp /usr/share/doc/ivtv-0.12/lircd-g.conf /etc/lircd.conf

Users with the older black Hauppauge remote, you'll need to go this route (there's some variation in the config files, because the two different remotes have different buttons):

# cp /usr/share/doc/ivtv-0.12/lircd.conf /etc/lircd.conf

Now we add a bit to ivtv's setup in /etc/modules.conf to load the lirc modules. Find this line of the ivtv module config:

add below ivtv msp3400 saa7115 tuner

And add this line below it:

add above ivtv lirc_dev lirc_i2c

Then add one line near the top of /etc/modules.conf, but after this section:

# For ivtv
path[toplevel]=/lib/modules/`uname -r`/drivers/media/video
# For bttv and saa7134
path[toplevel]=/lib/modules/`uname -r`/v4l2
# default path
path[toplevel]=/lib/modules/`uname -r`

that reads:

alias char-major-61 lirc_i2c

To get started with lirc right now, we'll just modprobe...

# /sbin/depmod -a
# /sbin/modprobe lirc_dev
# /sbin/modprobe lirc_i2c

If everything is still going like it should, let's set up lircd (the lirc receiver daemon) to start at boot time:

# /sbin/chkconfig lircd on

And go ahead and fire it up right now...

# /sbin/service lircd start

If you get one or two [OK]'s, then proceed to testing the remote (one is for lircd, one is for lircmd; you only really need lircd). If not, check /var/log/lircd to see if you can figure out what went wrong. To begin testing, fire up the irw tool:

$ /usr/bin/irw

You should get some output corresponding to the buttons you pressed. Hit ctrl-C to stop irw.

The next step is to set up a file to convert the input from lircd into something sensible that lirc's irxevent utility can send to MythTV, so your remote actually does something useful once we have MythTV working. This sample is for the grey Hauppauge remote. Create the necessary file like so (be wary of long comment lines):

$ cat > ~/.lircrc
#----Begin ~/.lircrc contents----
# May 19, 2003 - Jeff Campbell - rev .1
# Oct 01, 2003 - Minor revisions - rev .2
#
# .lircrc key bindings
#
# Suggested remote key bindings for MythTV Version .8 and up
#
# This is for the newer, light grey remote with red/yellow/blue/green keys
# that comes with the Hauppauge WinPVR 250 and 350(?) cards
#
# This file is case sensitive - so keep that in mind.

# Channel Up
begin
prog = irxevent
button = CH+
repeat = 3
config = Key Up CurrentWindow
end

# Channel Down
begin
prog = irxevent
button = CH-
repeat = 3
config = Key Down CurrentWindow
end

# OK/Select
begin
prog = irxevent
button = OK
repeat = 3
config = Key space CurrentWindow
end

# Play key for selecting recordings
begin
prog = irxevent
button = PLAY
repeat = 3
config = Key space CurrentWindow
end

# Record key for identifying recordings in EPG
begin
prog = irxevent
button = RECORD
repeat = 3
config = Key space CurrentWindow
end

# Pause playback
begin
prog = irxevent
button = MUTE
config = Key P CurrentWindow
end

begin
prog = irxevent
button = PAUSE
config = Key P CurrentWindow
end

# Escape/Exit/Back
begin
prog = irxevent
button = BACK/EXIT
config = Key Escape CurrentWindow
end

# Also "Power off" key
begin
prog = irxevent
button = OFF
config = Key Escape CurrentWindow
end

# Also "Stop" for movie playback
begin
prog = irxevent
button = STOP
config = Key Escape CurrentWindow
end

# Also "RED", for instinct ;)
begin
prog = irxevent
button = RED
config = Key Escape CurrentWindow
end

# BLANK on VCR key for deleting recordings from playback screen
begin
prog = irxevent
button = BLANK
config = Key D CurrentWindow
end

# Turns on 'Browse' mode to allow scrolling OSD data while staying on current channel (use arrows)
# Use any ESC key to exit browse mode
begin
prog = irxevent
button = GREEN
config = Key O CurrentWindow
end

# Blue to record a show seen in browseable OSD
begin
prog = irxevent
button = BLUE
config = Key R CurrentWindow
end

# Displays EPG when watching Live TV
begin
prog = irxevent
button = MENU
config = Key M CurrentWindow
end

# Yellow to select and change to the highlighted channel from active EPG (because OK records)
begin
prog = irxevent
button = YELLOW
config = Key M CurrentWindow
end

# Toggles Full Screen Mode
begin
prog = irxevent
button = FULL
config = Key F CurrentWindow
end

# Fast forward (default in Myth is 10 minute segment)
begin
prog = irxevent
button = SKIP
config = Key Page_DownCurrentWindow
end

# Rewind (default in Myth is 10 minute segment)
begin
prog = irxevent
button = REPLAY
config = Key Page_UpCurrentWindow
end

# Scroll Down
begin
prog = irxevent
button = VOL-
repeat = 3
config = Key Left CurrentWindow
end

# Scroll Up
begin
prog = irxevent
button = VOL+
repeat = 3
config = Key Right CurrentWindow
end

# Rewind (default in Myth is 30 seconds)
begin
prog = irxevent
button = REW
repeat = 3
config = Key Left CurrentWindow
end

# Fast Forward (default in Myth is 30 seconds)
begin
prog = irxevent
button = FFW
repeat = 3
config = Key Right CurrentWindow
end

# Bring up OSD (this will auto-fade after a few seconds unlike GREEN which reqs ESC to exit)
begin
prog = irxevent
button = GO
config = Key I CurrentWindow
end

# Numeric key definitions
begin
prog = irxevent
button = 0
config = Key 0 CurrentWindow
end

begin
prog = irxevent
button = 1
config = Key 1 CurrentWindow
end

begin
prog = irxevent
button = 2
config = Key 2 CurrentWindow
end

begin
prog = irxevent
button = 3
config = Key 3 CurrentWindow
end

begin
prog = irxevent
button = 4
config = Key 4 CurrentWindow
end

begin
prog = irxevent
button = 5
config = Key 5 CurrentWindow
end

begin
prog = irxevent
button = 6
config = Key 6 CurrentWindow
end

begin
prog = irxevent
button = 7
config = Key 7 CurrentWindow
end

begin
prog = irxevent
button = 8
config = Key 8 CurrentWindow
end

begin
prog = irxevent
button = 9
config = Key 9 CurrentWindow
end
(now hit Control-D to end input)

This .lircrc file is originally courtesy of this link (slightly modified), where you can find some of the same information & some different information from that provided in this doc (though now a bit out-dated):

http://www.gossamer-threads.com/perl/mailarc/gforum.cgi?post=63078#63078



More information about the Ale mailing list