Difference between revisions of "User:Lwoggardner"

From MythTV Official Wiki
Jump to: navigation, search
Line 12: Line 12:
 
* [[MythMusic]]
 
* [[MythMusic]]
 
* [[MythGallery]]
 
* [[MythGallery]]
 
+
* [[MythVideo]]
  
  
Line 54: Line 54:
 
=== Software ===
 
=== Software ===
 
* MythBuntu 8.10 64bit
 
* MythBuntu 8.10 64bit
* [[http://synergy2.sourceforge.net/|Synergy]] to allow laptop to be the keyboard/mouse.
+
* [http://synergy2.sourceforge.net/ Synergy] to allow laptop to be the keyboard/mouse.
  
 
=== Configuration ===
 
=== Configuration ===
  
 +
* cx88_dvb in /etc/modules (needs to start early to load properly, not sure why)
  
* cx88_dvb in /etc/modules (needs to start early to load properly, not sure why)
 
* disabled GDM in favour of a [[Frontend Auto Login|simple mingetty startup]]
 
* user .xsession linked to /usr/share/mythbuntu/session.sh so we get the same xfce startup.
 
 
* autostart irexec to restart MythTV and switch xorg layout between the Projector and TV
 
* autostart irexec to restart MythTV and switch xorg layout between the Projector and TV
 +
==== Auto-start X Server ====
  
==== /etc/lircd/hardware.conf ====
+
* disabled GDM in /etc/X11/default-display-manager
Default chooser from mythbuntu did not find the usb device at /dev/usb/hiddev0, so need to edit this file explicitly.
+
* [[Frontend Auto Login|Simple mingetty startup]] with a tty definition and a startx script in the console
 +
* user .xsession linked to /usr/share/mythbuntu/session.sh so we get the same xfce startup.
 +
 
 +
=====/etc/event.d/tty7 =====
 
<pre>
 
<pre>
#Chosen Remote Control
+
# tty7 - mingetty for MythTv
REMOTE="DVICO_MCE"
+
#
REMOTE_MODULES=""
+
# This service maintains a mingetty on tty7 from the point the system is
REMOTE_DRIVER="dvico"
+
# started until it is shut down again.
REMOTE_DEVICE="/dev/usb/hiddev0"
+
 
REMOTE_LIRCD_CONF="/usr/share/lirc/dvico/lircd.conf.fusionHDTV"
+
start on runlevel 2
REMOTE_LIRCD_ARGS=""
+
 
 +
stop on runlevel 0
 +
stop on runlevel 1
 +
stop on runlevel 4
 +
stop on runlevel 5
 +
stop on runlevel 6
 +
 
 +
respawn
 +
exec /sbin/mingetty --autologin=<user>  tty7
 
</pre>
 
</pre>
  
 +
===== ~/.profile =====
 +
Appended to detect if we are on tty7, in which case we start-up X with an optional layout specified in ~/.mythrc
  
==== xorg.conf for PE8700, Samsung LCD. See also the tips for the [[NVidiaProprietaryDriver]] ====
+
Note that when X is stopped we automatically logout and respawn
 +
 
 +
<pre>
 +
start-frontend() {
 +
MYTHRC="$HOME/.mythrc"
 +
if [ -r $MYTHRC ] ; then
 +
  . $MYTHRC
 +
fi
 +
 
 +
LAYOUT_SPEC=
 +
[ ! -z "$LAYOUT" ] && LAYOUT_SPEC="-layout $LAYOUT"
 +
 
 +
startx --  $LAYOUT_SPEC -dpi 100 -logverbose 5
 +
logout
 +
}
 +
 
 +
tty | grep tty7 && start-frontend
 +
</pre>
 +
 
 +
===== xorg.conf =====
 +
For PE8700 Samsung LCD. See also the tips for the [[NVidiaProprietaryDriver]]
  
 
The FX5200 cards were the cause of my DVI problems on my projector. Apparently they freaks out a PCB component causing the EDID data to become corrupt.
 
The FX5200 cards were the cause of my DVI problems on my projector. Apparently they freaks out a PCB component causing the EDID data to become corrupt.
 
(the Gigabyte card lasted from Aug 2006 to Dec 2007. Fortunately the new nvidia driver allow you to use a CustomEDID to load the data from a file.
 
(the Gigabyte card lasted from Aug 2006 to Dec 2007. Fortunately the new nvidia driver allow you to use a CustomEDID to load the data from a file.
  
Option ExactModeTimingsDVI is important for the projector.
+
Option ExactModeTimingsDVI is also important for the projector.
  
 
Option "UseEDIDDpi" "false" or some equivalent control of DPI is important for the Samsung television otherwise you get really small fonts (fixed in 0.21)
 
Option "UseEDIDDpi" "false" or some equivalent control of DPI is important for the Samsung television otherwise you get really small fonts (fixed in 0.21)
Line 149: Line 181:
 
</pre>
 
</pre>
  
.asoundrc For ALSA digital audio out
+
==== LIRC Remote Control ====
<pre>
+
pcm.!default {
+
type plug
+
slave {
+
pcm "spdif"
+
rate 48000
+
format S16_LE
+
}
+
}
+
</pre>
+
  
/etc/inittab entry to auto login the mythtv user
+
Standard mythbuntu setup with a few tweaks.
<pre>
+
1:2345:respawn:/sbin/mingetty --autologin mythtv tty1
+
</pre>
+
  
 +
A mythbuntu xsession starts irexec before the window manager which is no good as we want to be able to logout of Xfce on a button press. We disable that with a non-empty ~/.noirexec file.
 +
We then use a desktop entry to start it.
  
.profile to start X from the auto login, also starts irexec.
+
=====/etc/lircd/hardware.conf =====
<pre>
+
PATH=$PATH:$HOME/bin
+
  
start-frontend() {
+
Default chooser from mythbuntu did not find the usb device at /dev/usb/hiddev0, so need to edit this file explicitly.
rm $HOME/.serverauth.*
+
irexec --daemon $HOME/.lircrc >> $HOME/irexec.log
+
  
MYTHRC="$HOME/.mythrc"
+
<pre>
if [ -r $MYTHRC ] ; then
+
#Chosen Remote Control
  . $MYTHRC
+
REMOTE="DVICO_MCE"
fi
+
REMOTE_MODULES=""
 
+
REMOTE_DRIVER="dvico"
LAYOUT_SPEC=
+
REMOTE_DEVICE="/dev/usb/hiddev0"
[ ! -z "$LAYOUT" ] && LAYOUT_SPEC="-layout $LAYOUT"
+
REMOTE_LIRCD_CONF="/usr/share/lirc/dvico/lircd.conf.fusionHDTV"
 
+
REMOTE_LIRCD_ARGS=""
startx --  $LAYOUT_SPEC -logverbose 5
+
</pre>
}
+
 
+
tty | grep tty1 && start-frontend
+
  
 +
===== ~/.config/autostart/irexec.desktop =====
  
 +
<pre>
 +
[Desktop Entry]
 +
Name=IrExec daemone
 +
Comment=A daemon for lirc
 +
GenericName=irexec daemon
 +
Exec=irexec -d
 +
Type=Application
 
</pre>
 
</pre>
  
.xsession To start Ratpoison, mythtv-setup and mythfrontend
+
===== ~/.lirc/irexec =====
 +
File is included into ~/.lircrc
 +
 
 
<pre>
 
<pre>
#Remove blue background... from TV-Out picture
+
## irexec
xvattr -a XV_COLORKEY -v 0
+
# Bounce this tty
ratpoison &
+
begin
echo $DISPLAY
+
    button = power_onoff
 
+
     prog  = irexec
if [ -r $HOME/.mythrc ] ; then
+
     config = /home/ggardner/bin/ir_mythtv.sh &
     . $HOME/.mythrc
+
end
     rm $HOME/.mythrc
+
fi
+
 
+
if [ ! -z "$MYTH_SETUP" ] ; then
+
  mythtv-setup
+
fi
+
mythfrontend  -l mfe.log  $MYTH_ARGS
+
  
 +
#Bounce the tty, use the Projector layout.
 +
begin
 +
    button = tv_onoff
 +
    prog  = irexec
 +
    config = /home/ggardner/bin/ir_mythtv.sh --layout Projector &
 +
end
 
</pre>
 
</pre>
  
.ratpoisonrc
+
===== ~/bin/ir_mythtv.sh =====
<pre>
+
Optionally specify a layout, kills mythfrontend and logs out of the window manager, triggering a restart.
#Make escape (default C-t) not clash with mythTV key bindings
+
escape C-r
+
#Banish the mouse cursor out of the way.
+
addhook switchwin banish
+
</pre>
+
  
ir_mythtv.sh script to restart MythTV via irexec.
 
 
<pre>
 
<pre>
 
#!/bin/bash
 
#!/bin/bash
Line 227: Line 244:
  
 
parseopts() {
 
parseopts() {
    MYTH_SETUP=
 
 
     LAYOUT=
 
     LAYOUT=
    MYTH_ARGS=
 
 
 
     while [ ! -z "$1" ]
 
     while [ ! -z "$1" ]
 
     do
 
     do
Line 236: Line 250:
 
             -l|--layout)
 
             -l|--layout)
 
                 LAYOUT="$2"
 
                 LAYOUT="$2"
 +
                log "Setting layout to $LAYOUT"
 
                 shift;;
 
                 shift;;
            -s|--setup)
 
                MYTH_SETUP="y"
 
                ;;
 
            -m|--mythargs)
 
                MYTH_ARGS="$2"
 
                shift
 
                ;;
 
 
 
             *) break ;;
 
             *) break ;;
 
         esac
 
         esac
Line 252: Line 259:
  
  
GETOPT=$(getopt -l "setup,layout:,mythargs:" -o "sl:m:" -- "$@")
+
GETOPT=$(getopt -l "layout:" -o "l:" -- "$@")
  
 
if [ $? -ne 0 ] ; then
 
if [ $? -ne 0 ] ; then
Line 260: Line 267:
 
eval parseopts $GETOPT
 
eval parseopts $GETOPT
  
OLDEST=$(pgrep -o -u $USER $(basename $0))
+
log "Restarting mythtv"
if [ $OLDEST -ne $$ ] ; then
+
  log "Process $OLDEST is still running, so I ($$) will abort"
+
  exit 1
+
fi
+
 
+
log "Restarting on tty1 $USER $(basename $0)"
+
  
 
cat - << EOF > $HOME/.mythrc
 
cat - << EOF > $HOME/.mythrc
 
LAYOUT=$LAYOUT
 
LAYOUT=$LAYOUT
MYTH_SETUP="$MYTH_SETUP"
 
MYTH_ARGS="$MYTH_ARGS"
 
 
EOF
 
EOF
  
pkill -u mythtv irexec
+
#Logout of our current session
 
+
pkill mythfrontend
pkill -t tty1 -u mythtv mythfrontend
+
xfce4-session-logout
sleep 2
+
pkill -t tty7
+
#Kill the login shell.
+
pkill -9 -t tty1 -u mythtv
+
  
 
</pre>
 
</pre>
Line 308: Line 303:
 
end
 
end
 
</pre>
 
</pre>
 +
 +
==== Sound ====
 +
 +
I use a set of ruby scripts so I can use lirc to switch between analog (TV speakers) and digital audio (AV receiver).
 +
 +
The remote's volup/down buttons are used to control the volume. In analog mode calls the amixer program, in digital/passthrough mode uses the serial port to change the volume directly on the receiver.
 +
 +
=====~/.asoundrc=====
 +
 +
ALC650 onboard sound.
 +
 +
Could probably do better 48/44kHz switching on the analog output between music and video but if that is important we just go digital passthrough and let the receiver do the work.
 +
 +
In myth config, you can see that default sound device is ALSA:myth-video, the passthrough device is ALSA:myth-passthru, and mythmusic uses ALSA:myth-music
 +
 +
<pre>
 +
#First line comment
 +
pcm.myth-music {
 +
  type plug
 +
  slave.pcm "hw:0,0,3"
 +
}
 +
 +
ctl.myth-music {
 +
  type hw
 +
  card 0
 +
}
 +
 +
pcm.myth-video {
 +
  type plug
 +
  slave.pcm "hw:0,0,3"
 +
}
 +
 +
ctl.myth-video {
 +
  type hw
 +
  card 0
 +
}
 +
 +
pcm.myth-passthru {
 +
  type copy
 +
  slave.pcm = "spdif"
 +
}
 +
 +
ctl.myth-passthru {
 +
  type hw
 +
  card 0
 +
}
 +
 +
</pre>
 +
 +
=== Mythbuntu 8.10 upgrades ===
 +
 +
==== Not yet tested/configured ====
 +
* HD playback
 +
* DVD rip/playback
  
 
=== 0.21-fixes ===
 
=== 0.21-fixes ===

Revision as of 07:27, 15 March 2009

I was keeping track of where I was at with Myth on my home wiki, but then figured I might as well share it here!

Major update in progress - split frontend/backend and using later versions of ubuntu/mythbuntu

My Setup

MythBuntu 8.10 with separated front-end/backend

  • Live TV/TV recording Free to air HD/SD (from Sydney, Australia)
  • Multi-rec
  • DTS/AC3 passthrough including 5,1 surround digital out
  • MythMusic
  • MythGallery
  • MythVideo


Backend

Hardware

  • 2 x 500GB HDDs
  • Intel S775 Core 2 Q6600 Quad-Core CPU
  • Gigabyte S775 GA-G33M-S2 Motherboard
  • 4GB RAM
  • DNTVLive LP Tuner
  • PCI Hauppauge Nova-T-500 MCE(OEM) Dual DVBT tuner

Software

Configuration

  • DVICO used device id 17de:a8a6 for two distinct devices requiring different drivers. Need to set "options cx88xx card=19" in /etc/modprobe.d to force use of Conexant reference drivers. Fortunately the Hauppauge tuner is a USB device so we can override the autodetection rather than patch the v4l dvb drivers to override it.

Frontend / Slave Backend

Hardware

  • AMD S754 Athlon 64 3700+
  • Gigabyte S754 GA-K8VM800M
  • 1GB Ram
  • 320GB Western Digital 7200rpm 8M Serial ATA HDD
  • Albatron FX5200LP 128M 8x Video Card with DVI output.
  • Gigabyte FX5200 128M 8x Video Card with DVI output.
  • DVICO FusionHDTV Hybrid Tuner
  • DVICO FusionRemote MCE
  • BenQ PE8700 DLP Projector
  • Samsung LCD Television
  • CambridgeAudio AV receiver

Software

  • MythBuntu 8.10 64bit
  • Synergy to allow laptop to be the keyboard/mouse.

Configuration

  • cx88_dvb in /etc/modules (needs to start early to load properly, not sure why)
  • autostart irexec to restart MythTV and switch xorg layout between the Projector and TV

Auto-start X Server

  • disabled GDM in /etc/X11/default-display-manager
  • Simple mingetty startup with a tty definition and a startx script in the console
  • user .xsession linked to /usr/share/mythbuntu/session.sh so we get the same xfce startup.
/etc/event.d/tty7
# tty7 - mingetty for MythTv
#
# This service maintains a mingetty on tty7 from the point the system is
# started until it is shut down again.

start on runlevel 2

stop on runlevel 0
stop on runlevel 1
stop on runlevel 4
stop on runlevel 5
stop on runlevel 6

respawn
exec /sbin/mingetty --autologin=<user>  tty7
~/.profile

Appended to detect if we are on tty7, in which case we start-up X with an optional layout specified in ~/.mythrc

Note that when X is stopped we automatically logout and respawn

start-frontend() {
MYTHRC="$HOME/.mythrc"
if [ -r $MYTHRC ] ; then
   . $MYTHRC
fi

LAYOUT_SPEC=
[ ! -z "$LAYOUT" ] && LAYOUT_SPEC="-layout $LAYOUT"

startx --  $LAYOUT_SPEC -dpi 100 -logverbose 5
logout
}

tty | grep tty7 && start-frontend
xorg.conf

For PE8700 Samsung LCD. See also the tips for the NVidiaProprietaryDriver

The FX5200 cards were the cause of my DVI problems on my projector. Apparently they freaks out a PCB component causing the EDID data to become corrupt. (the Gigabyte card lasted from Aug 2006 to Dec 2007. Fortunately the new nvidia driver allow you to use a CustomEDID to load the data from a file.

Option ExactModeTimingsDVI is also important for the projector.

Option "UseEDIDDpi" "false" or some equivalent control of DPI is important for the Samsung television otherwise you get really small fonts (fixed in 0.21)

There are two layouts, the default uses outputs via VGA to a Samsung LCD television, the second uses DVI to the PE8700 projector.

Section "ServerLayout"
    Identifier     "Main" # PC VGA output to Samsung LCD television
    Screen         0 "LCD[0]" 0 0
    Option         "Xinerama" "off"
EndSection

Section "ServerLayout"
    Identifier     "Projector"
    Screen         0 "Projector[0]" 0 0
    Option         "Xinerama" "off"
EndSection
 
Section "Module"
        Load    "glx"
EndSection

Section "Device"
    Identifier     "FX5200[0]"
    Driver         "nvidia"
    BusID          "PCI:1:0:0"
    Screen         0
    Option         "NvAGP" "3"
EndSection

Section "Screen"
    Identifier     "LCD[0]"
    Device         "FX5200[0]"
    Monitor        "AnyMonitor"
    DefaultDepth    24
    Option         "UseEDIDDpi" "FALSE" #Computed DPI values not so good for TV display
    Option         "UseDisplayDevice" "CRT" # VGA out
    SubSection     "Display"
        Depth       24
        Modes       "1360x768" "800x600"
    EndSubSection
EndSection

Section "Screen"
    Identifier     "Projector[0]"
    Device         "FX5200[0]"
    Monitor        "AnyMonitor"
    Option         "ConnectedMonitor" "DFP"
    Option         "UseDisplayDevice" "DFP" # DVI out
    Option         "CustomEDID" "DFP-0:/etc/X11/benq-c.bin"

    DefaultDepth    24
    SubSection     "Display"
        Depth       24
        Modes       "1280x720" "800x600"
    EndSubSection
EndSection

Section "Monitor"
    Identifier   "AnyMonitor"
    Option       "DPMS"
    Option       "ExactModeTimingsDVI" "true"
    Option       "RenderAccel" "true"
EndSection

LIRC Remote Control

Standard mythbuntu setup with a few tweaks.

A mythbuntu xsession starts irexec before the window manager which is no good as we want to be able to logout of Xfce on a button press. We disable that with a non-empty ~/.noirexec file. We then use a desktop entry to start it.

/etc/lircd/hardware.conf

Default chooser from mythbuntu did not find the usb device at /dev/usb/hiddev0, so need to edit this file explicitly.

#Chosen Remote Control
REMOTE="DVICO_MCE"
REMOTE_MODULES=""
REMOTE_DRIVER="dvico"
REMOTE_DEVICE="/dev/usb/hiddev0"
REMOTE_LIRCD_CONF="/usr/share/lirc/dvico/lircd.conf.fusionHDTV"
REMOTE_LIRCD_ARGS=""
~/.config/autostart/irexec.desktop
[Desktop Entry]
Name=IrExec daemone
Comment=A daemon for lirc
GenericName=irexec daemon
Exec=irexec -d
Type=Application
~/.lirc/irexec

File is included into ~/.lircrc

## irexec
# Bounce this tty
begin
    button = power_onoff
    prog   = irexec
    config = /home/ggardner/bin/ir_mythtv.sh &
end

#Bounce the tty, use the Projector layout.
begin
    button = tv_onoff
    prog   = irexec
    config = /home/ggardner/bin/ir_mythtv.sh --layout Projector &
end
~/bin/ir_mythtv.sh

Optionally specify a layout, kills mythfrontend and logs out of the window manager, triggering a restart.

#!/bin/bash

function log() {
   logger -t "mythtv" "$@"
}

parseopts() {
    LAYOUT=
    while [ ! -z "$1" ]
    do
        case "$1" in
            -l|--layout)
                LAYOUT="$2"
                log "Setting layout to $LAYOUT"
                shift;;
            *) break ;;
        esac
        shift
    done
}


GETOPT=$(getopt -l "layout:" -o "l:" -- "$@")

if [ $? -ne 0 ] ; then
    exit 1
fi

eval parseopts $GETOPT

log "Restarting mythtv"

cat - << EOF > $HOME/.mythrc
LAYOUT=$LAYOUT
EOF

#Logout of our current session
pkill mythfrontend
xfce4-session-logout

the .lircrc file (buttons as per the DVICO remote, which I think are now standard in the lirc distribution)

## irexec
# Bounce this tty
begin
    button = power_onoff
    prog   = irexec
    config = /home/mythtv/bin/ir_mythtv.sh &
end

#Run myth-setup before running mythfrontend
begin
    button = cpf
    prog   = irexec
    config = /home/mythtv/bin/ir_mythtv.sh --setup &
end

#Bounce the tty, use the Projector layout.
begin
    button = tv_onoff
    prog   = irexec
    config = /home/mythtv/bin/ir_mythtv.sh --layout Projector &
end

Sound

I use a set of ruby scripts so I can use lirc to switch between analog (TV speakers) and digital audio (AV receiver).

The remote's volup/down buttons are used to control the volume. In analog mode calls the amixer program, in digital/passthrough mode uses the serial port to change the volume directly on the receiver.

~/.asoundrc

ALC650 onboard sound.

Could probably do better 48/44kHz switching on the analog output between music and video but if that is important we just go digital passthrough and let the receiver do the work.

In myth config, you can see that default sound device is ALSA:myth-video, the passthrough device is ALSA:myth-passthru, and mythmusic uses ALSA:myth-music

#First line comment
pcm.myth-music {
  type plug
  slave.pcm "hw:0,0,3"
}

ctl.myth-music {
  type hw
  card 0
}

pcm.myth-video {
  type plug
  slave.pcm "hw:0,0,3"
}

ctl.myth-video {
  type hw
  card 0
}

pcm.myth-passthru {
  type copy
  slave.pcm = "spdif"
}

ctl.myth-passthru {
  type hw
  card 0
}

Mythbuntu 8.10 upgrades

Not yet tested/configured

  • HD playback
  • DVD rip/playback

0.21-fixes

upgrade smooth

0.20-fixes

0.19.x fixes info

  • MythTV 0.19.x fixes branch (had to move /usr/lib/libdts_pic.a to /usr/lib/libdts.a to compile)
  • Xine external DVD/video player
  • XvMC ( with Bob de-interlacing for HD channels. Have to manually turn it off for SD stuff).