[mythtv-users] [OT] Simple script to initialize multiple PVRs

Jurgen Kramer gtm.kramer at inter.nl.net
Fri Jul 29 08:53:13 EDT 2005


With my limited programming skills a wrote a little script which
automatically sets the necessary ivtv parameters at bootup. I run this
script from rc.local.

BTW it currently only handles 150s (500s) and 250s and it is set for PAL
BTW2 enhancements / additions / simplifications are welcome!

Jurgen

-----------------< cut here >--------------------
#!/bin/sh
# pvrstart 1.1 29-July-05 - Jurgen Kramer
# Initialize all PVR cards
# Currently handles only 250 en 150s (500s)

modprobe ivtv

function InitPVR () {

echo "setting parameters for /dev/video$2.."

if [ "$1" = "250" ]; then

        ivtvctl -d /dev/video$2 -u 0xff                 # Set PAL
        ivtvctl -d /dev/video$2 -p 4                    # Set Input to
tuner
        ivtvctl -d /dev/video$2 -f width=720,height=576 # Set max PAL
res.
        ivtvctl -d /dev/video$2 -v input=3,output=1     #

elif [ "$1" = "150" ]; then

        ivtvctl -d /dev/video$2 -u 0xff                 # Set PAL
        ivtvctl -d /dev/video$2 -p 6                    # Set Input to
tuner
        ivtvctl -d /dev/video$2 -f width=720,height=576 # Set max PAL
res.
        ivtvctl -d /dev/video$2 -q 1                    # Enable sound

else

        echo "Unknown of unhandled PVR card PVR-$1!"

fi

}

# Init PVR cards

set `dmesg | grep "ivtv: Initialized WinTV PVR" | cut -d" " -f5,7`
nrcards=`dmesg | grep "ivtv: Initialized" | cut -d" " -f5,7 | wc -l`

echo "Found $nrcards PVR cards:"
num=0
while [ $num -lt $nrcards ]
do
        card=`echo $@ | cut -d" " -f1`
        cardno=`echo $@ | cut -d" " -f2`
        card=`echo $card | cut -d"," -f1`
        echo -n "Card $cardno is a PVR-$card, "
        cardno=`echo $cardno | cut -d"#" -f2`
        InitPVR $card $cardno
        shift
        shift
        num=`expr $num + 1`
done

echo "All done."

exit 0;
----------------------------< cut here >------------------------




More information about the mythtv-users mailing list