[mythtv-users] Close to functional, few problems

Matt Collins matt at clues.com
Fri Dec 12 10:22:12 EST 2003


Thought this might be of help to you, as my myth system
is redhat based - I compile stuff from source and loathe
rpm so its not THAT redhatty though, and I dont run gdm
or kde or anything for myth as its only a celeron 500 with
128mb of ram.

Anyhow. For your permission problems on redhat, run the
backend and frontend as mythtv. You can do this by putting
config files in /etc/init.d/ that have the following
properties; you probably dont need the test_ioctl stuff
and so forth, but I try to get my PVR card set to a pretty
decent set BEFORE running mythtv - the card doesnt seem
to like ever being asked to sample 'invalid' data, and
better safe than sorry.

Note the comment lines at the top, chkconfig and description.
These enable you to type 'chkconfig -add mythfrontend' and
'chkconfig mythfrontend on' to start autobooting.

To avoid spamming the list I've snipped the start, stop and
case sections but they're pretty much identical to other
scripts - anacron is a nice short one to model on. Just replace
references to 'anacron' with your myth binaries.

To avoid getting errors on the device files update 
/etc/security/console.perms to set them to your mythtv user
and group.

Once you've done this running mythtv with 'use PVR350 output'
checked and /dev/video16 as the device should work fine; if you
see xv errors then its still trying to software render and you've
messed up a config error.

I'm using the .twmrc from the myth config files dir in mythtv's
home dir. This works well for me, and avoids the overhead and
weirdness of running a full desktop environment for what is never
going to be an interactive user.

I'm pretty sure they have some supplied init.d scripts too that 
doubtless will be more graceful than these; I just rolled my own
on the basis that I like to understand whats going on.

Hope its some help,

Matt ;)

Snips from files:
/etc/security/console.perms
<console>  0660 <sound>      0660 mythtv.mythtv
<console>  0660 <fb>         0600 mythtv.mythtv
<console>  0660 <v4l>        0660 mythtv.mythtv

/etc/init.d/mythbackend
#!/bin/sh
# Startup script for $prog
#
# chkconfig: 345 90 10 
# description: Provides infrared remote control keypresses to subscribed clients.
#
# Source function library.
. /etc/rc.d/init.d/functions

prog="mythbackend"

[ -f /usr/local/bin/$prog ] || exit 0


start() {
    echo -n $"Starting $prog: " 
    echo 1024 > /proc/sys/dev/rtc/max-user-freq
    /sbin/modprobe ivtv
    /usr/local/bin/test_ioctl -d -p 4 >/dev/null 2>&1
    dev="/dev/video0"
    /usr/local/bin/test_ioctl -d $dev -u 0xff >/dev/null 2>&1
    /usr/local/bin/test_ioctl -d $dev -f width=720 -u 0xff >/dev/null 2>&1
    /usr/local/bin/test_ioctl -d $dev -f height=576 >/dev/null 2>&1
    /usr/local/bin/test_ioctl -d $dev --set-codec-params=framerate=1 >/dev/null 2>&1
    /usr/local/bin/channel.pl bbc1
    daemon -5 --user mythtv /usr/local/bin/$prog -d -l /var/log/mythbackend
    RETVAL=$?
    [ $RETVAL -eq 0 ] && touch /var/lock/subsys/$prog
    echo
    return $RETVAL
}

...


/etc/init.d/mythfrontend
#!/bin/sh
# Startup script for $prog
#
# chkconfig: 345 95 5 
# description: Front end user interface to the Myth PVR
#
# Source function library.
. /etc/rc.d/init.d/functions

prog="mythfrontend"

[ -f /usr/local/bin/$prog ] || exit 0


start() {
    echo -n $"Starting $prog: " 
    /sbin/modprobe saa7127 
    /sbin/modprobe ivtv-fb
   
    DISPLAY=:0.0
    export DISPLAY
    if test "x`pidof X`" == x; then 
        /usr/X11R6/bin/X &
        sleep 4
    fi
    if test "x`pidof twm`" == x; then 
        su -s /bin/bash - mythtv -c "/usr/X11R6/bin/twm" &
    fi

    nice -n -5 su -s /bin/bash - mythtv -c "/usr/local/bin/$prog -l /var/log/mythfrontend" &
    RETVAL=$?
    [ $RETVAL -eq 0 ] && touch /var/lock/subsys/$prog
    echo
    return $RETVAL
}

stop() {
    for prog in mythfrontend twm X ; do
        if test "x`pidof $prog`" != x; then
                echo -n $"Stopping $prog: "
                killproc $prog
                echo
        fi
    done
    rmmod saa7127
    rmmod ivtv-fb
    rm -f /var/lock/subsys/$prog
    return 0
}


More information about the mythtv-users mailing list