#!/bin/sh
#
# setup dvb cards
#
# runlevels: geexbox, debug, install

echo "### Setting up DVB card ###"

# DVB frontends drivers are auto-loaded by main device drivers

# PCI DVB Devices
if grep -q 'Class 0400:.*109e:' /proc/pci; then
  # BT8x8 Card
  modprobe dvb-bt8xx >/dev/null 2>&1
  modprobe dst >/dev/null 2>&1
elif grep -q 'Class 0480:.*1131:' /proc/pci; then
  # SAA7134 Card
  modprobe saa7134-dvb >/dev/null 2>&1
  # SAA7146 Cards
  modprobe saa7146 >/dev/null 2>&1
  modprobe saa7146_vv >/dev/null 2>&1
  modprobe dvb-ttpci >/dev/null 2>&1
  modprobe budget >/dev/null 2>&1
  modprobe budget-ci >/dev/null 2>&1
  modprobe budget-av >/dev/null 2>&1
elif grep -q 'Class 0280:.*13d0:' /proc/pci; then
  # B2C2 Cards
  modprobe budget >/dev/null 2>&1
  modprobe b2c2-flexcop-pci >/dev/null 2>&1
  modprobe b2c2-flexcop >/dev/null 2>&1
elif grep -q 'Class 0480:.*14f1:88' /proc/pci; then
  # Conexant CX88 Card
  modprobe cx88-blackbird >/dev/null 2>&1
  modprobe cx88-dvb >/dev/null 2>&1
elif grep -q 'Class 0480:.*0432:' /proc/pci; then
  # SCM Pluto2 Card
  modprobe pluto2 >/dev/null 2>&1
fi

# ensure that DVB card has been discovered
if test -n "`dmesg | grep 'DVB: registering new adapter'`"; then
  echo -n "" > /var/dvbcard
fi

exit 0
