#!/bin/sh
#
# setup the tvout
#
# runlevels: geexbox, debug, install, configure


test -f /etc/tvout || exit 1

# it's probably not a good idea to mix X.org and TVOut
test -f /var/use_xorg && exit 1

echo "### Setting up TV-Out ###"

. /etc/tvout

atitvout $TVOUT_STANDARD auto >/dev/null 2>&1
test "`atitvout active 2>/dev/null | sed -n 's/TV.*/TV/p'`" = "TV" && echo "" > /var/tvout

# nvidia and s3 cards cannot detect tv devices, and disable vga when enabled.
if [ $TVOUT_ENABLE = yes ]; then
    nvtv $NVTV_ON >/dev/null 2>&1
    s3switch -q tv $TVOUT_STANDARD >/dev/null 2>&1
    i810tvout $I810_TVON >/dev/null 2>&1
    echo "" > /var/tvout
fi

exit 0
