Next Previous Contents

22. Example Configurations.

This section contains configurations which you may find useful.

22.1 Hauppauge PVR-250/350 hardware MPEG-2 encoder.

NOTE: THE FOLLOWING DOCUMENTATION IS PROVIDED AS-IS AND IS NOT GUARANTEED TO WORK WITH YOUR DISTRIBUTION. FOR IVTV DRIVER ASSISTANCE, SEE THE IVTV MAILING LIST. https://lists.sourceforge.net/lists/listinfo/ivtv-devel SEE THE IVTV FAQ IF YOU HAVE QUESTIONS OR ISSUES. http://ivtv.sourceforge.net/FAQ.html

These instructions work for Mandrake 9.1 on a backend machine which is hosting a single PVR-250 capture card.

Install the Mandrake kernel source. If you are using a different Mandrake kernel level (ie, not 2.4.21-0.16mdk as in the example below, then alter the urpmi command appropriately.)

$ uname -a
Linux pvr 2.4.21-0.16mdk #1 Fri Apr 11 06:51:54 CEST 2003 i686 unknown
unknown GNU/Linux

$ su
# urpmi kernel-source

NOTE: You do not need to recompile your kernel.

Download the IVTV driver from CVS:

$ cvs -d:pserver:anonymous@cvs.sourceforge.net:/cvsroot/ivtv login
<enter> as password
$ cvs -z3 -d:pserver:anonymous@cvs.sourceforge.net:/cvsroot/ivtv co ivtv

This should create an ivtv directory. Switch to it and perform the following commands:

$ cd ivtv/ivtv/utils
$ wget http://hauppauge.lightpath.net/software/pvr250/pvr250_17_21226.exe
$ su
# ./ivtvfwextract.pl pvr250_17_21226.exe
# exit

The ivtvfwextract program extracts the firmware required for the card. You may want to go to the Hauppauge website and download the latest Windows driver if the wget command fails.

Next, compile the driver:

$ cd ~/ivtv/ivtv/driver
$ make

Compile the test_ioctl program:

$ cd ../utils
$ make
$ su
# cp test_ioctl /usr/local/bin
# exit

NOTE: You may get warnings about i2c during the compile. Ignore them.

Add the following to /etc/modules.conf:

alias char-major-81     videodev
alias char-major-81-0   ivtv
alias char-major-61 lirc_i2c
options ivtv debug=1
options tuner type=2
options msp3400 once=1 simple=1
add below ivtv msp3400 saa7115 tuner
add above ivtv lirc_dev lirc_i2c

NOTE: You must specify the tuner type manually. See ~/ivtv/ivtv/driver/tuner.h for a listing of tuners. In the above example, tuner type=2 is a Phillips NTSC. Use an appropriate tuner type for your system and video standard. The debug=1 parameter on the ivtv line actually means less debugging output will be printed.

Next, copy the files that were compiled in the driver directory into the appropriate modules directory:

$ su
# make install
# depmod -a

Finally, load the ivtv driver:

# modprobe ivtv
# exit

Check that the card is being recognized on the PCI bus:

$ lspci -v
<snip>

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: <available only to root>

If you don't see your card on the PCI bus, make sure that it's been installed in a bus-master slot. For some motherboards, only the PCI slots closest to the AGP slot are bus-mastering.

Check that the ivtv driver has created a new video device:

$ ls -l /dev/v4l/vi*
crw-------    1 mythtv   sys       81, 224 Dec 31  1969 vbi0
crw-------    1 mythtv   sys       81,   0 Dec 31  1969 video0
crw-------    1 mythtv   sys       81,  32 Dec 31  1969 video32

In this case, the ivtv device is video0.

Go into setup/setup on the machine hosting the hardware MPEG-2 card. When you add a new capture card, ensure that you are using the video0 device.

NOTE: As of 2003-04-25 the ivtv driver does not support VBI, so closed-captioning is not available.

Leave the VBI device, audio device and audio sampling rate limit at the default values. Change the default input to an appropriate setting for your configuration. Change the card type to "Hardware MPEG Encoder Card" and press ENTER.

The remaining setup is just like a standard V4L card; define a video source if you have not already done so, and assign the video source to a video card input on the Input Connections screen.

Some people report issues with the ivtv module not being loaded when required by MythTV. To get around this, you can modprobe the ivtv driver before using it. The simplest technique is to add the modprobe command to /etc/rc.d/rc.local:

# echo "/sbin/modprobe ivtv" >> /etc/rc.d/rc.local

NOTE: some people complain that their PVR-250/350 card is not capturing audio. The most likely source for this is that your system is not loading the correct msp3400.o file; ivtv uses a custom msp3400.c, and if the resulting module isn't loaded you will not get sound. Switch to your /lib/modules directory and rename the existing msp3400.o file, then copy the msp3400.o from the ivtv driver directory and re-run depmod. If that still doesn't work, then check the ivtv mailing list for more information. You may wish to perform an updatedb as root and then do a locate msp3400 to find all the msp3400.o.gz files that may be on your system. For example, Mandrake has a msp3400.o.gz in the 3rdparty subdirectory which will take precedence over the custom version created by ivtv. You can check if you have the correct msp3400 loaded by typing (as root): modinfo msp3400 | grep "parm: *standard". If you don't get a line that says: "parm: standard int", then you're not loading the correct msp3400.

Check to ensure that you're loading the correct msp3400 module.

 
# modinfo msp3400
filename:    /lib/modules/2.4.22-9mdk/kernel/drivers/media/video/msp3400.o

Check that the path is correct for your kernel version, and that the driver being loaded is in /media/video and not some other directory.

NOTE: Some people report "ghosting" issues with their PVR-250s, where there is a faint copy of whatever is on the screen appearing to the right of the image. If you have this issue, it's fairly obvious. This is a firmware issue, apparently. There are two ways around this:

  1. Run at 720x480 resolution
  2. Turn off DNR

To turn off DNR, add the following to your rc.local:

/path/to/ivtv/utils/test_ioctl --set-codec-params=dnr_mode=0,dnr_temporal=0

22.2 Hauppauge PVR-250 remote and MythTV's native LIRC support.

NOTE: THE FOLLOWING DOCUMENTATION IS PROVIDED AS-IS AND IS NOT GUARANTEED TO WORK WITH YOUR DISTRIBUTION. FOR LIRC DRIVER ASSISTANCE, SEE THE LIRC MAILING LIST. http://lists.sourceforge.net/lists/listinfo/lirc-list

These instructions work for Mandrake 9.2 on a frontend machine which is hosting a single PVR-250 capture card using MythTV's native LIRC support.

First, you need to ensure that you've installed the kernel source appropriate for the kernel that you're running. In this case, we're using kernel 2.4.22-9, so when installing the kernel-source ensure that you've got the correct version.

$ su
# uname -a
Linux frontend 2.4.22-9mdk #1 sam sep 13 06:54:11 CEST 2003 i686 unknown
unknown GNU/Linux
# rpm -qa|grep kernel-source
kernel-source-2.4.22-9mdk

If you've already installed LIRC from the Mandrake packages, it's going to be version 0.6.6, and that won't work. Uninstall it:

$ su
# urpme lirc lirc-remotes liblirc-devel
# rm -rf /dev/lirc*
# exit

Check to ensure that you don't have other versions of lirc modules and programs on your system:

$ su
# updatedb
# locate lirc_i2c|grep `uname -r`
/usr/src/linux-2.4.22-9mdk/3rdparty/lirc/lirc_i2c.c
/lib/modules/2.4.22-9mdk/kernel/3rdparty/lirc/lirc_i2c.o.gz

# locate lirc_dev|grep `uname -r`
/usr/src/linux-2.4.22-9mdk/3rdparty/lirc/lirc_dev.c
/usr/src/linux-2.4.22-9mdk/3rdparty/lirc/lirc_dev.h
/usr/src/linux-2.4.22-9mdk/include/linux/modules/lirc_dev.stamp
/usr/src/linux-2.4.22-9mdk/include/linux/modules/lirc_dev.ver
/lib/modules/2.4.22-9mdk/kernel/3rdparty/lirc/lirc_dev.o.gz

# locate irw|grep "/usr"
/usr/bin/irw
/usr/local/bin/irw
/usr/local/man/man1/irw.1

# locate lircd|grep "/usr"
/usr/src/linux-2.4.22-9mdk/3rdparty/lirc/lircd.conf.RM-050
/usr/share/man/man8/lircd.8.bz2
/usr/share/doc/lirc-0.6.6/html/lircd.html
/usr/sbin/lircd
/usr/local/sbin/lircd
/usr/local/man/man8/lircd.8

# locate irxevent|grep "/usr"
/usr/share/man/man1/irxevent.1.bz2
/usr/share/doc/lirc-0.6.6/html/irxevent.html
/usr/share/doc/lirc-0.6.6/irxevent.keys
/usr/bin/irxevent
/usr/local/bin/irxevent
/usr/local/man/man1/irxevent.1
As you can see, there were a number of different versions of lirc already installed on this system. They must be removed. We don't care about the source code or the man pages, only the executables and the kernel modules.
$ su
# rm -rf /lib/modules/2.4.22-9mdk/kernel/3rdparty/lirc
# rm -rf /usr/sbin/lircd /usr/local/sbin/lircd
# rm -rf /usr/bin/irxevent /usr/local/bin/irxevent
# rm -rf /usr/bin/irw /usr/local/bin/irw

Download the lirc-0.7.0pre2 tarball:

$ wget http://lirc.sourceforge.net/software/snapshots/lirc-0.7.0pre2.tar.bz2
$ tar -xjf lirc-0.7.0pre2.tar.bz2

Mandrake now includes i2c version 2.8.0 which changes the semantics of some low-level calls. You will need to patch LIRC in order for it to work correctly. Download the patch and install:

$ cd lirc-0.7.0pre2
$ wget http://delvare.free.fr/i2c/other/lirc-CVS-i2c-2.8.0.patch
$ patch -p1 < lirc-CVS-i2c-2.8.0.patch

Next, run the LIRC setup program:

$ ./setup.sh

Select "1" (Driver configuration), then scroll down to "5" (TV Card), press ENTER, then scroll down to "f" (Hauppauge TV card) and press ENTER again. Once back at the main menu, press "3" for Save and run configure.

If your build environment is ready, LIRC will create a Makefile for you. Switch to root and compile:

$ su
# make
# make install

As a part of the make install process, LIRC will create the appropriate device for you in /dev. Check to make sure:

$ ls -l /dev/lirc*
crw-r--r--    1 root     root      61,   0 Sep 18 15:36 /dev/lirc
srw-rw-rw-    1 root     root            0 Sep 18 15:38 /dev/lircd=

Your modules.conf file should have already been modified if you've followed the instructions above for installing the PVR-250. modprobe the lirc_i2c driver, run the lircd program and then check your /var/log/messages and /var/log/lircd files.

$ su
# modprobe lirc_i2c
# lsmod
Module                  Size  Used by    Not tainted
lirc_i2c                5124   0
lirc_dev               10096   1  [lirc_i2c]
...
# lircd
# tail /var/log/messages
Sep 18 15:38:26 frontend kernel: lirc_i2c: chip found @ 0x18 (Hauppauge IR)
Sep 18 15:38:26 frontend kernel: lirc_dev: lirc_register_plugin:sample_rate:
10
...
# tail /var/log/lircd
Sep 18 15:24:52 frontend lircd 0.7.0pre2: lircd(hauppauge) ready

To check that your remote is working correctly, run the irw program and start pressing buttons. If nothing is happening, you must begin troubleshooting. Things to check:

If none of the above works, and irw still isn't showing keypresses, then you will need to ask your question on the LIRC list.

Assuming that irw is showing keypresses, you can continue: To enable native LIRC support within MythTV, you will need to modify your settings.pro file and recompile. Your settings.pro should look like this:

# Native lirc support
CONFIG += using_lirc
EXTRA_LIBS += -llirc_client

Recompile and install:

$ make distclean; make
$ su
# make install

If you're not using native LIRC support, ensure that the button names that come up with irw match the ones in the .lircrc file in your home directory. Note that if you are not using native LIRC support, the .lircrc file is in your home directory and has a "." as the first character.

Since we're using native LIRC support within MythTV, copy the configfiles/hauppauge-lircrc-nativelirc file into your .mythtv/ directory and call it lircrc. It has a slightly different format than what you would use if you were using irxevent. Also note that it is in your .mythtv directory and does not have a "." in the filename.

$ cp configfiles/hauppauge-lircrc-nativelirc ~/.mythtv/lircrc

Add the commands to load the LIRC device drivers and start lircd to your rc.local:

$ su
# echo "modprobe lirc_i2c" >> /etc/rc.d/rc.local
# echo "/usr/local/sbin/lircd" >> /etc/rc.d/rc.local
# exit

You should now have native LIRC support within MythTV.

22.3 Logical Volume Manager (LVM).

LVM greatly increases the flexibility you have in managing your storage than traditional physical partitions. This section will provide some brief notes on how to use LVM to create storage space for your video files and how to add additional disk space in the future. There's lots more that can be done with LVM, so check the LVM HOWTO http://tldp.org/HOWTO/lvm-HOWTO/ document for details.

Make sure your kernel configuration includes LVM support or that it's available as a module. Today, most vendors include this by default. You'll also want to ensure that you have a copy of the LVM utilities; check your distribution, or get the latest versions from http://www.sistina.com/products_lvm.htm and build them manually.

Check that the vgscan program is being run at some point during your boot sequence - most distributions do this by default. Look for a message during boot up that looks like this: vgscan -- reading all physical volumes (this may take a while...)

LVM uses a few concepts you should be familiar with before starting.

The following example assumes that you want to create a LVM partition from a chunk of space in /dev/hda5, using a reiserfs filesystem and mounted on /var/video. You later decide to extend this filesystem by adding a new disk: /dev/hdb.

You need to create at least one LVM partition for a physical volume. Use fdisk or your favorite partition editor to set the type to LVM (0x8e). If you're using an entire disk, create one big partition rather than using the device itself. e.g. use /dev/hdb1 not /dev/hdb.

# fdisk /dev/hda .... create partition 5, save partition table and reboot if you have to

Create the LVM physical volume from the partitions (repeat if you have multiple partitions to use):

# pvcreate /dev/hda5
Create a LVM volume group out of this physical volume called "VGforMyth" that is allocated in chunks that are a multiple of 64MB
# vgcreate --name VGforMyth -s 64m /dev/hda5
Create a logical volume of 20GB called "video" and then create the reiserfs filesystem and mount it:
# lvcreate --name video --size 20G VGforMyth
# mkreiserfs /dev/VGforMyth/video
# mount /dev/VGforMyth/video /var/video
Now create a 5GB volume for mythmusic files if you like:
# lvcreate --name music --size 5G VGforMyth
# mkreiserfs /dev/VGforMyth/music
# mount /dev/VGforMyth/music /var/music
Display the volume group status: # vgdisplay -v

Now, lets suppose you want to add a 60GB hard disk to the system as hdb and allocate 50GB of it to video storage.

First, create a single partition /dev/hdb1 covering the whole disk and make it type 0x8e using your partition editor.

# fdisk /dev/hdb .... create partition, set type, save and reboot if it says you have to

Create the new LVM physical volume:

# pvcreate /dev/hdb1

Add the new physical volume to the volume group:

# vgextend VGforMyth /dev/hdb1

NOTE: You may get errors at this point stating that there are no physical volumes available for adding to the LV, even though you know for a fact that there are. You may need to specify the physical volume in the /dev/ide/host/bus/target/lun/etc format.

Once you've completed one of the following two procedures, use df to check that you've got more space.

ReiserFS

Make the logical volume used for video bigger:

# lvextend --size +50G /dev/VGforMyth/video

Unmount, resize and remount the filesystem. Technically, you don't need to unmount and remount the ReiserFS.

# umount /var/video
# resize_reiserfs /dev/VGforMyth/video
# mount /dev/VGforMyth/video /var/video

ext2 or ext3

LVM comes with a program called e2fsadm.

Unmount, resize and remount the filesystem. The filesystem must be unmounted during this procedure.

# umount /var/video
# e2fsadm --size +50G /dev/VGforMyth/video
# mount /dev/VGforMyth/video /var/video

22.4 Advanced Partition Formatting.

MythTV creates large files. The partitions that your distribution sets up for you may not be optimized for large files. Using LVM in conjunction with the following techniques can be quite useful.

Ext3

With Ext3, your biggest gain is that in case of a crash and reboot you don't have to wait very long for your partition to be remounted. With Ext2, the fsck may take a long time to run on multi-gigabyte partitions.

When formatting the partition, the following command line should be better than the default. This example assumes that /dev/hdb1 has already been created using fdisk. If you're using LVM, /dev/hdb1 may be something like /dev/VGforMyth/video.

# mkfs.ext3 -T largefile4 -m 0 /dev/hdb1

The "-T largefile4" option creates one inode per 4 megabytes. The "-m 0" (zero, not "oh") parameter sets the amount of spaced reserved for root to zero. By default, this is 5%, which on a multi-gigabyte drive is a lot of reserved space.

You may also modify some aspects of a filesystem such as the reserved block percentage after it has been created using the tune2fs program:

# tune2fs -m 0 /dev/hdb1

You can check on your filesystem using the dumpe2fs program. See the man page for details.


Next Previous Contents