[mythtv-users] Install tips for RH9 and PVR250 owners for Myth

Jeff C tuner at hfx.eastlink.ca
Sat May 24 14:24:24 EDT 2003


I have spent the last two weeks banging about, in all my inexperience, 
working on getting the latest CVS of Myth working with my hardware, 
including a PVR 250 card on Red Hat 9.  I am happy to report that the other 
morning I was able to do a fresh install and have everything, including the 
remote, up and working in only a few hours.  I took notes during the 
process and due to a few requests I will share them with the list.

Fair warning - I can not guarantee these docs are 100% complete so if you 
notice something is missing, please let me know and I'll add it to the 
document - or even better if the FAQ mantainer thinks it is worthwhile, 
perhaps we could make this an appendix in there or something.  As well, I 
have to admit to not always knowing *WHY* you do a certain command and what 
is will do, I only know it worked.  If someone wants to add some comments 
on what is actually happening along the way, that is always nice for us 
newbies to understand.

So here goes:

HOW I SET UP MYTH ON REDHAT 9 WITH A PVR 250
Includes the PVR 250 drivers, Myth and lirc for the remote
------------------------------------------------------------------------------------
Jeff Campbell - tuner at hfx.eastlink.ca

First draft - May 24, 2003

1. MY HARDWARE

For reference, I am using the following hardware (your results may vary 
with other hardware):

AMD Duron 1.1 Ghz Processor
ECS K7S5APRO Motherboard with SiS 735 chipset, onboard LAN
384MB of RAM (256MB saw regular swapping so I added more)
5400 RPM Maxtor 80GB HD (I'd prefer 7200 but 5400 is quiet)
Liteon 16X CD Burner
USB 3 button wheel mouse
NVidia GeForce2 MX 64MB TV Out (MSI Brand)
SBLive! PCI Soundcard
Hauppauge WinPVR 250 PCI MPEG encoder card w/remote

(Everything, except capture card auto detected by kernel)

Redhat 9 (RH9) ISOs for the operating system


2. OS INSTALLATION

Fresh install of RH9 utilising the custom installation option.  I included 
all the development options for both shell and X based development, and 
definitely kernel development, as well as MySQL (which Myth requries) and 
Samba (for transferring files back and forth with Windows machines).

I looked at each section in detail and selected utilities I needed but 
ensure all major library packages were always included.  MySQL is not 
checked by default when you select databases so please make sure you go in 
and ensure it is checked.


3. RHN UPDATES TO KERNEL, SOURCE AND UTILITIES

On first reboot after install I did my basic config then ran the RH Network 
updater and updated all the identified components, including the kernel and 
source (as of this writing the latest RHN kernel is 2.4.20-13.9).

Reboot to load the new kernel.


4. SETTING UP THE KERNEL SOURCE
  (You will likely need to be root to do most of this)

Once the system was updated and rebooted I logged in and:

	cd /usr/src

Made a symbolic link for /usr/src/linux to the current kernel source

	ln -s /usr/src/linux-2.4 linux

Then I went to to /usr/src/linux and cleaned some things up

	cd /usr/src/linux

Required after new kernel sources are installed

	make mrproper

Then edit the "Makefile" and remove the phrase "custom" after the end of 
the kernel name (otherwise it will complain of kernel source mismatches 
later when you compile different kernel dependent drivers etc).

Next copy your kernel config from your /boot directory to the 
/usr/src/linux as ".config"

	cp /boot/config-2.4.20-13.9 /usr/src/linux/.config

Now you want to run the following in /usr/src/linux:

	make oldconfig ; make depend

You DO NOT need to run make install here.


5. GET AND BUILD THE LATEST CVS OF IVTV, THE DRIVER FOR THE PVR250 CARD

Next cd back to your home directory and using the docs at 
http://ivtv.sf.net checkout the latest source code for the IVTV drivers for 
the PVR 250 card.

	cd ~
	INSERT CVS instructions here (see their web site)
	You might get an End of File error message if the site is busy, just try 
again ever few minutes

Now you want to go in and build the IVTV driver

	cd ivtv/ivtv/driver

	(per the docs for the ivtv driver)
Copy the videodev2.h header file from the ivtv utils directory

	cp ../utils/videodev2.h .

Build the driver

	make

Install the driver if it built properly (some warnings are normal as the 
driver is still in alpha)

	make install

Before you go any further, go to www.hauppauge.com and download the latest 
driver set from their site for the PVR250, it's a windows .exe file, you 
want to put it in ~/ivtv/ivtv/utils

Go in to ivtv/ivtv/utils and run the firmware extractor program:

	cd ../utils/
	./ivtvextract.pl NAMEOFHAUPPAGEDOWNLOAD

	(This will extract the latest firmware and install it where the IVTV 
driver needs it)

While you are over here, make the test utilities in here too:

	make

You also want to uncompress the frequencies module and follow the docs in 
there to install the frequencies tables you will need to use the ptune.pl 
script to set a TV channel for your testing.  Read the IVTV FAQ in detail.

Go back to the driver directory

	cd ../driver/

Follow the instructions from the IVTV FAQ at http://ivtv.sf.net to modprobe 
and insmod the modules (these will load the different modules in to memory 
that the IVTV driver utilizes).  NOTE: there is a regularly occuring 
problem with people not having any sound because they do this "modprobe 
msp3400", which is what the docs currently say.  This will actually load 
the msp3400 module that comes with your RH distribution, not the one you 
just built.  Instead you want to replace the line they suggest with this one:

	insmod ./msp3400.o

	This will load the module you just built from the current directory.

(FYI if you are getting "modprobe command not found or insmod command not 
found" you can find the in /sbin/modprobe and /sbin/insmod.  Alternatively, 
when you su to root, us "su -" which will make sure you inherit roots PATH 
statement which includes /sbin/ and saves you some typing)

Check dmesg to see if the ivtv drivers loaded normally.  You may also want 
to check /var/log/messages for any odd messages.

The IVTV FAQ has suggested formatting for adding the driver load statements 
to /etc/modules.conf and I highly recommend that you do that.

Here is what mine looks like (note my card has a Temic tuner, which is 
type=8, whereas the FAQ says type=2 for the Philips tuner.  Apparently mine 
is almost 100% compatible with the Philips so 2 might be fine, but just in 
case, be aware their are other tuner types in case type=2 does not work for 
you).

Oh, and I added the mpg_buffers=30 part to my load statement as I was 
getting buffer overflow problems and this seemed to fix it, thanks to some 
feedback on the ivtv mailing list.

(from /etc/modules.conf)
# Start IVTV
alias char-major-81 videodev
alias char-major-81-0 ivtv
options ivtv debug=0 mpg_buffers=30
options tuner type=8
options msp3400 once=1 simple=1
add below ivtv msp3400 saa7115 tuner
#IVTV End

So at this point you have compiled and installed the driver, told 
/etc/modules.conf to load it when it is needed, and manually loaded it and 
checked the error messages to make sure it worked.  There is more detail in 
the IVTV FAQ on doing some initial config and testing work - spend the time 
to read that and do those things to ensure you are capturing video and 
audio.  I will mention that the FAQ does not clearly state that you need to 
set you input to -p 4 to see TV so go in the utils directory and do that:

	cd ~/ivtv/ivtv/utils

Do the initial test stuff from the IVTV FAQ

	./test_ioctl -u0x3000
	(I believe this is NTSC?)

	./test_ioctl -p 4
	Sets the input to the TV tuner (input 4)

Now you can do the test they recommend:

	cat /dev/video0 > sample.mpg

Let it run for a few seconds and then cancel it.  You should have a file of 
a few 100K or maybe over a megabyte depending on how long you ran 
it.  Don't worry about the file for now, we'll confirm it is ok once we 
install MPlayer to play MPEG files.  If the file size is zero take another 
look at dmesg and /var/log/messages and see if the driver complained of 
anything.  I have also had the problem where I had it complain that 
/dev/video0 didn't exist but I corrected that by a reboot...


6. GET AND INSTALL THE LATEST NVIDIA DRIVERS

Go to the NVidia website and download the latest NVidia driver.

Edit your /etc/inittab and change your default run level from 5 to 3 - the 
new entry will look like this:

(from /etc/inittab)
id:3:initdefault:

This will ensure when you reboot your system it will come up in console 
mode, which is required to install the NVidia driver.

Reboot and login to the console as root.

In the directory when you downloaded the driver do this:

	sh Nvidia-driver-name

Then step through the well documented screens that NVidia provides and you 
should see that everything is cool when you are done.  It may complain that 
it couldn't find the driver on their FTP site for your kernel (the brand 
new one you just installed) so it will attempt to build you one (which it 
should be able to do because you have set up your sources properly).

When it is all set and happy, you now need to update your 
/etc/X11/XF86Config file so that it uses the new driver instead of the old 
one.  I am going to post mine in here - I make no claims as to its 
appropriateness in terms of being tweaked but I can tell you that my TV out 
works fine and my X display at 1024x768 works great and plays back video 
fine.  So, here is mine:

(/etc/X11/XFree86Config)
-- CUT HERE --

# Specify which keyboard LEDs can be user-controlled (eg, with xset(1))
#       Option  "Xleds"         "1 2 3"
# To disable the XKEYBOARD extension, uncomment XkbDisable.
#       Option  "XkbDisable"
# To customise the XKB settings to suit your keyboard, modify the
# lines below (which are the defaults).  For example, for a non-U.S.
# keyboard, you will probably want to use:
#       Option  "XkbModel"      "pc102"
# If you have a US Microsoft Natural keyboard, you can use:
#       Option  "XkbModel"      "microsoft"
#
# Then to change the language, change the Layout setting.
# For example, a german layout can be obtained with:
#       Option  "XkbLayout"     "de"
# or:
#       Option  "XkbLayout"     "de"
#       Option  "XkbVariant"    "nodeadkeys"
#
# If you'd like to switch the positions of your capslock and
# control keys, use:
#       Option  "XkbOptions"    "ctrl:swapcaps"
# Or if you just want both to be control, use:
#       Option  "XkbOptions"    "ctrl:nocaps"
#
         Identifier  "Keyboard0"
         Driver      "keyboard"
         Option      "XkbRules" "xfree86"
         Option      "XkbModel" "pc105"
         Option      "XkbLayout" "us"
EndSection

Section "InputDevice"
         Identifier  "Mouse0"
         Driver      "mouse"
         Option      "Protocol" "IMPS/2"
         Option      "Device" "/dev/input/mice"
         Option      "ZAxisMapping" "4 5"
         Option      "Emulate3Buttons" "no"
EndSection

Section "InputDevice"

# If the normal CorePointer mouse is not a USB mouse then
# this input device can be used in AlwaysCore mode to let you
# also use USB mice at the same time.
         Identifier  "DevInputMice"
         Driver      "mouse"
         Option      "Protocol" "IMPS/2"
         Option      "Device" "/dev/input/mice"
         Option      "ZAxisMapping" "4 5"
         Option      "Emulate3Buttons" "no"
EndSection

Section "Monitor"
         Identifier   "Monitor0"
         VendorName   "Monitor Vendor"
         ModelName    "Avitron"
         DisplaySize  280        210
         HorizSync    30.0 - 70.0
         VertRefresh  50.0 - 160.0
#       Option      "dpms"
EndSection

Section "Device"
     Identifier  "VideoCard0"
     VendorName  "nvidia"
     Driver   "nvidia"
     # update this with the PCI id of your card.  Consult the output
     # of the 'lspci' command.
     BusID       "PCI:1:0:0"
     BoardName   "NVIDIA GeForce 2 MX (MSI)"
     VideoRAM    65536
     Option      "RenderAccel" "1"
# TV Out Related Stuff
     Option "TwinView"
     Option "SecondMonitorHorizSync"     "30-50"
     Option "SecondMonitorVertRefresh"   "60"
     Option "MetaModes" "800x600, 800x600; 640x480, 640x480;"
#    Option "MetaModes" "640x480, 640x480;"
     Option "TVStandard" "NTSC-M"
EndSection

#Section "Device"
#       Identifier  "Videocard0"
#       Driver      "nvidia"
#       VendorName  "Videocard vendor"
#       BoardName   "NVIDIA GeForce 2 MX (generic)"
#       VideoRam    65536
#       Option      "RenderAccel" "1"
#EndSection

Section "Screen"
         Identifier "Screen0"
         Device     "Videocard0"
         Monitor    "Monitor0"
         DefaultDepth     24
         SubSection "Display"
                 Depth     24
                 Modes    "1024x768" "800x600" "640x480"
         EndSubSection
EndSection

#Section "DRI"
#       Group        0
#       Mode         0666
#EndSection

-- CUT HERE --

There is lots of info out there on making NVidia cards work under linux - 
please consult it if you want to performance tune your system or if you are 
having problems.  I don't know much about it, I can only tell you what 
worked for me with my hardware.

Once the driver and config file are in place, reboot the machine and you 
will be at the console again.  Login as root and run:

	startx

You should seen some screen resolution changes and maybe a few characters 
flash by, and then the NVidia logo.  Or you may also get an error message 
from XWindows.  I think you will get the NVidia logo and then be able to 
login to X but if you don't, read the X server error messages in detail and 
diagnose it.  That is outside the scope of what I can help you with 
;).  Use Google.

If X starts up normally, then you can go back in to /etc/inittab and set 
your run level back to 5 so that you will get an X login the next time you 
reboot.


7. GET AND INSTALL MPLAYER

Ok, now we have the card drivers for the capture card installed and working 
(we believe), and the video card driver installed and working.  Let's 
install a movie player and try out our sample.mpg capture.

Download the tar file for MPlayer, you can find it via http://www.freshmeat.net

Uncompress and untar it.

In the Mplayer directory, run:

	./configure ; make ; make install

Copy the mplayer example configuration file from ../etc/example.conf to 
/usr/local/etc/mplayer/mplayer.conf

Read the file and tune it to your liking and erase the last line in the file.

Look at your test capture and be amazed that everything is working so far

	mplayer /path/to/sample.mpg


8. INSTALL APT TO MAKE YOUR LIFE EASIER (AND GET XMLTV FOR YOU)

Go here and download the apt setup files:

http://atrpms.physik.fu-berlin.de/dist/rh9/

You want:
atrpms-9-0_1at.noarch.rpm (from the atrpms dir)
libapt-pkg-0.5.5cnc5-0_24.90at.i386.rpm (from the apt dir)
apt-0.5.5cnc5-0_24.90at.i386.rpm  (from the apt dir)

To install them you want to become root and go to the directory you 
downloaded them to and run:

rpm -Uhv atrpms-9-0_1at.noarch.rpm
rpm -Uhv libapt-pkg-0.5.5cnc5-0_24.90at.i386.rpm
rpm -Uhv apt-0.5.5cnc5-0_24.90at.i386.rpm

This will install apt and allow you to grab a few things you will need 
later on.

Now that apt is successfully installed, you want to tell it to update its 
rpm lists:

apt-get update

Then you want to tell it to go and fetch XMLTV and its dependencies for 
you, making your life much easier:

apt-get install xmltv

Follow the prompts to install XMLTV

No need to do anything with XMLTV, Myth will work with it for you.


9. DOWNLOAD AND INSTALL LAME FOR MP3 PLAYBACK

Go to http://www.freshmeat.net and locate LAME and download the tarball

Decompress it, and read the docs on installing it - it is very 
straightforward.  I didn't even write anything down for it so I'm guessing 
it is your basic ./configure ; make ; make install - done as root - but you 
can read the docs to be sure.


10. USE APT TO GET AND INSTALL A FEW OTHER REQUIRED PACKAGES

apt-get install qt-MySQL
(MySQL interfacing stuff for QT)

apt-get install qt-devel
Development libraries for QT required to compile Myth


11. SET YOUR PATH TO INCLUDE QT

This is a very important and often missed step that screws up people before 
they go to install Myth.  As root, and in the window you intend to use to 
compile Myth, execute this command

	export QTDIR=/usr/lib/qt-3.1

I can not over emphasize the importance of the above line...

Use "set | grep QT" to ensure it appears in your environment variable output.

You also want to add the QT directory to your path - the Myth installation 
documentation http://www.mythtv.org covers this as well.  Make sure you go 
through their install docs in detail for Myth - I'm not going to repeat it all.


12. CHECK OUT THE MYTH CVS THEN BUILD IT - READ THEIR DETAILED FAQ

Using the instructions at http://www.mythtv.org you can checkout the CVS of 
Myth (which is the only place the PVR 250 is currently supported) and the 
follow their instructions on configuring and building Myth.  If you 
followed my document this far you should have all the necessary libraries 
and other depencies installed and working, and your QT stuff set up 
properly (if Myth won't compile, problems with your QTDIR or path including 
QT are the most likely culprits).

Once you have the source, follow their instructions on compiling and then 
setting it up.  I will warn you now, on a 1.1Ghz system Myth takes a while 
to compile (I think near 30 minutes) so don't be surprised.


13. SET UP YOUR FANCY SCHMANCY REMOTE FOR USE WITH MYTH (LIRC)

Don't bother doing this unless everything up to this point is working - ie 
you have video and audio operating properly, you have myth up and running, 
changing channels, your guide is up to date and so on.  If all that is cool 
then lets make your remote work.  These instructions are for the newer 
light grey remote that has the yellow/red/green/blue extra buttons.  If you 
have the older remote, your results may vary and the config files I suggest 
won't be appropriate.

Again you are going to need CVS, as only the latest version of lirc 
supports the remotes for the PVR cards.

You can get the details of how to check out the lirc CVS from the lirc 
website : http://www.lirc.org

Follow their instructions for compiling and installing it (again, it is 
very straightfoward and it walks you through the configuration set in a 
menu format where you select the WinPVR card as the source of the 
remote).  You will have to insmod the approrprite modules by hand and check 
dmesg and /var/log/messages for errors.  As you can see from the notes 
below, you insmod the lirc_dev file first then the lirc_i2c module.  Once 
you have them loaded by hand you can add them to your /etc/modules.conf 
file so they load automatically.  Here is my complete /etc/modules.conf 
entry for ivtv/lirc:

# Start IVTV
alias char-major-81 videodev
alias char-major-81-0 ivtv
options ivtv debug=0 mpg_buffers=30
options tuner type=8
options msp3400 once=1 simple=1
add below ivtv msp3400 saa7115 tuner lirc_dev lirc_i2c
#IVTV End


Once lirc is compiled and installed you want to put the right lircd.conf 
file in place for your remote.  This is provided by the IVTV team and can 
be found in the ~/ivtv/ivtv/utils directory.

	copy ~/ivtv/ivtv/utils/lircd-g.conf /etc/lircd.conf
	Copy the remote config to /etc where lircd looks by default

Ok now you can fire up lircd which will start a log in /var/log/lircd for 
any messages.

Once that is running you can start up irw from within the tools directory 
of your lirc source tree.  irw will display the keys you press back to 
stdout so you can see them.  If irw starts and immediately exits you back 
to the prompt, look at the error messages - something is wrong.  Otherwise 
it will just sit there and spit back the buttons you press and you will be 
all excited because it is reading your remote.

Ok now you are going to need a .lircrc file in the homedirectory of the 
user you intend to run Myth as.  I spent a bit of time creating a detailed 
and commented config file for the PVR 250 remote and I will include it 
below for you to cut/paste and modify as you see fit.  When the "irxevent" 
program starts it looks for this file.  Put it in your homedir as .lircrc 
and then in another window (leave irw running as it will continue to track 
key presses) fire up irxevent (which reports nothing, but that is normal, 
it will just sit there watching for key presses and translating them in to 
commands in Myth for you).

Once you do all this, you can start Myth in another window and your remote 
should allow you to navigate through the system.

Before I paste in the file I'll note that there are a few things you will 
likely want to do.  Putting lircd somewhere so it starts automatically, 
disabling your screen saver so it doesnt blank out Myth on you, and 
possibly downloading the NVTV project stuff from sourceforce so you can 
have more control over your TV.  (BTW your TV out should just work if you 
connect an SVideo cable to the port on your card, are running my config 
file, and have the TV turned on at boot).

Well, that brings my document to an end for now, here is that lircrc file 
and I hope you enjoy your Myth machine as much as I enjoy mine.

-- CUT HERE --
# May 19, 2003 - JAC - rev .1
#
# .lircrc key bindings
#
# Suggested remote key bindings for MythTV Version .8
#
# 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 
urrent 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
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_Up CurrentWindow
end

# Rewind (default in Muth is 10 minute segment)
begin
     prog = irxevent
     button = REPLAY
     config = Key Page_Down CurrentWindow
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

-- CUT HERE --

Well, that's all I can offer for now.  I hope you found this document useful.

-Jeff




More information about the mythtv-users mailing list