Installing MythTV on Fedora VGA&composite

From MythTV Official Wiki
Revision as of 23:44, 7 May 2008 by Dillwead (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Incomplete.png Incomplete, needs to be expanded. Please help to fill the gaps or discuss the issue on the talk page

This "How-To" guide is for instruction on getting both VGA and composite working on a Fedora Core 6 MythTV box with a remote control button. One display at a time, but both work.

Introduction

This guide is based after installing with Jarod Wilson's how to guide which you can find here.

I stopped with Jarod's install instructions at the rebuilding of the ram-disk. If you have gotten that far, you should have a box that once worked with VGA and currently works with the composite out. This document covers how to get both to work and how to get the PVR-350 remote to switch between the two.

How to VGA and Composite with a PVR-350 on FC6

- Create a second user account to run X with. In my case, I'm using "mythtv" and "mythtv-composite". You could use the system config tool to set up the users

# system-config-users

- Create a symbolic link to your mythfrontend binary, in the same directory, called mythfrontend-composite. This unique name allows the script to know if both copies are running.

# ln -s /usr/bin/mythfrontend /usr/bin/mythfrontend-composite

- Make changes to X. Fist backup your current xorg.conf

# cp /etc/X11/xorg.conf /etc/X11/xorg.conf.orginal

Now use the system config tools to get your VGA display going again.

# system-config-display

Then add a separate "ServerLayout" section in your Xorg.conf file, for the PVR card. Its name is referenced in the video select script. Below is an example that uses "NTSCLayout" for the layout identifier.

from my /etc/X11/xorg.conf I have this addition

Script.png /etc/X11/xorg.conf

# Xorg configuration created by system-config-display

Section "ServerLayout"
	Identifier     "single head configuration"
	Screen      0  "Screen0" 0 0
	InputDevice    "Keyboard0" "CoreKeyboard"
EndSection

Section "InputDevice"
	Identifier  "Keyboard0"
	Driver      "kbd"
	Option	    "XkbModel" "pc105"
	Option	    "XkbLayout" "us"
EndSection

Section "Monitor"
	Identifier   "Monitor0"
	ModelName    "Monitor 1024x768"
 ### Comment all HorizSync and VertSync values to use DDC:
	HorizSync    31.5 - 57.0
	VertRefresh  50.0 - 70.0
	Option	    "dpms"
EndSection

Section "Device"
	Identifier  "Videocard0"
	Driver      "r128"
EndSection

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

# Added for TV out options with MythTV

Section "ServerLayout"
       Identifier     "NTSCLayout"
       Screen      1  "ScreenNTSC" 0 0
       InputDevice    "Keyboard0" "CoreKeyboard"
EndSection


Section "Files"

# RgbPath is the location of the RGB database.  Note, this is the name of the
# file minus the extension (like ".txt" or ".db").  There is normally
# no need to change the default.
# Multiple FontPath entries are allowed (they are concatenated together)
# By default, Red Hat 6.0 and later now use a font server independent of
# the X server to render fonts.
        RgbPath      "/usr/X11R6/lib/X11/rgb"
        FontPath     "unix/:7100"
EndSection

Section "Module"
        Load  "dbe"
        Load  "extmod"
        Load  "fbdevhw"
        Load  "glx"
        Load  "record"
        Load  "freetype"
        Load  "type1"
EndSection

Section "Monitor"
        Identifier  "NTSC Monitor"
        HorizSync  30-68
        VertRefresh 50-120
        Mode "720x480"
          # D: 34.563 MHz, H: 37.244 kHz, V: 73.897 Hz
          DotClock 34.564
          HTimings 720 752 840 928
          VTimings 480 484 488 504
          Flags    "-HSync" "-VSync"
        EndMode
EndSection

Section "Device"
        Identifier  "Hauppauge PVR 350 iTVC15 Framebuffer"
        Driver      "ivtvdev"

        ### change fb1 to whatever your card grabbed
        Option      "fbdev" "/dev/fb0"
	  Option      "ivtv" "/dev/fb0"

        ### change the BusID to whatever is reported by lspci,
        ### converted from hex to decimal
        BusID "PCI:2:0:0" # lspci says 02:00.0
        ### More examples
        #BusID "PCI:0:10:0" # lspci says 00:0a.0
        #BusID "PCI:1:14:0" # lspci says 01:0e.0
        #BusID "PCI:0:5:1" # lspci says 00:05.1
EndSection

Section "Screen"
        Identifier  "ScreenNTSC"
        Device      "Hauppauge PVR 350 iTVC15 Framebuffer"
        Monitor     "NTSC Monitor"
        DefaultDepth 24
        DefaultFbbpp 32
        Subsection "Display"
          Depth 24
          FbBpp 32
          Modes "720x480"
        EndSubsection
EndSection

Section "DRI"
        Group        0
        Mode         0666
EndSection

Once you have appended this look it over and make sure there aren't conflict's or missing sections. Specifically look closely at keyboard and mouse configs. The rest should be unique enough to avoid problems. Also be careful with items like system-config-display, it will often blows away your modified file.

- Download and install wmctrl

# yum -y install wmctrl

- setup the video select script by creating /usr/local/bin/start-script and modifying it to your needs. Here is my current script.

Script.png /usr/local/bin/start-script

#!/bin/sh

vt=8
prog=mythfrontend-composite
disp=':1.0'
disp_short=':1'
user=mythtv-composite
note=upstairs
dev=/dev/dsp
args='-layout NTSCLayout -dpi 100'
vscan='0'
hscan='0'
yscan='0'
guioffsetx='34'
guiheight='464'
guiwidth='658'
painter='qt'
debug='/dev/pts/1'

echo "start-script" > $debug

if [ "$1" != '-composite' ] ; then
# normal operation 
   vt=7
   prog=mythfrontend
   disp=':0.0'
   disp_short=':0'
   user=mythtv
   note=downstairs
   dev=ALSA:default
   args=''
   vscan='3'
   hscan='6'
   yscan='13'
   guioffsetx='0'
   guiheight='0'
   guiwidth='0'
   painter='qt'
fi

# start X if not already running
gotx=`ps h -C X | grep " $disp_short "`
echo "gotx is next" $args > $debug
echo ${gotx}X > $debug
if [ "${gotx}X" = 'X' ] ; then
   echo "no X so startx --" $disp_short $args "vt is" $vt > $debug
   echo -n 1 > /var/run/console/$user
   su -c -l - $user "startx -- $disp_short $args &"
   chvt $vt
   sleep 2
else
   echo "X is running so vt" $vt > /dev/pts/2
   # it's already running, so just switch the VT
   chvt $vt
fi

echo "just switched X over" > $debug

## start mythfrontend, or make it the topmost app
#pid=`/sbin/pidof $prog`
#export DISPLAY=$disp
#export XAUTHORITY="/home/$user/.Xauthority"
#if [ "${pid}X" = 'X' ] ; then
#   echo "Starting frontend for $note TV"
#   su -c -l - $user "exec gnome-terminal -e '$prog' &"
#else
#   # make it topmost
#   wmctrl -a $prog
#fi

# update the DB
#echo \
#"update settings set data='$guioffsetx' where value='GuiOffsetX';" \
#"update settings set data='$guiheight' where value='GuiHeight';" \
#"update settings set data='$guiwidth' where value='GuiWidth';" \
#"update settings set data='$painter' where value='ThemePainter';" \
#"update settings set data='$dev' where value='AudioOutputDevice';" \
#| mysql --password=mythtv -u mythtv mythconverg

I've commented out the Myth stuff for now. Once you get X switching correctly, then you can add the Myth sections. when you are working on the Myth stuff, modify the script to make any additional DB changes.

- Get irexec working and automatic, by editing /etc/rc.d/rc.local. I added this line to the bottom

/usr/sbin/lircd --device=/dev/lirc0 --output=/dev/lircd
/usr/bin/irexec /home/mythtv/.mythtv/lircrc &

You should check that the lirc0 and lircd are correct. Don't forget to disable lirc from the services.

# chkconfig --level 2345 lircd off

Now it's probably best to reboot to make sure it will start correctly. To confirm the irexec is started do the following command.

# ps -A | grep irexec

- Now you need to add to your lirc file so that irw commands irexec to execute the script. Edit ~/.mythtv/lircrc so that it contains this

begin
prog = irexec
button = Red
repeat = 3
config = start-script -composite
end

begin
prog = irexec
button = Blue
repeat = 3
config = start-script
end

Troubleshooting

To be determined

Credits

The original install of FC6 was from Jarod Wilson The original video select script came from Dan Wilga