#!/bin/bash
# This script configures (and eventually unconfigures) any system hardware components.
# Configuration takes place before any other setup, unconfiguration is done at the end.

case "$1" in
  start)
    # Setup disk parameters. Currently set the UDMA 66 mode for the /dev/hda disk.
    # echo Setting disk parameters...
    # hdparm -q -d0 /dev/hda
    # hdparm -q -X66 /dev/hda
    # hdparm -q -d1 -c1 /dev/hda
    
    # Setup an irq for the parallel port.
#    echo Setting the parallel port irq to 7.
#    echo 7 >/proc/parport/0/irq
    
    # Init an ESS card and load sound support
    echo Initializing the PnP sound card
    /sbin/isapnp /etc/init.d/pnp.configfile
#    /sbin/insmod -f /lib/modules/current/misc/soundcore.o >/dev/null
#    /sbin/insmod -f /lib/modules/current/misc/sound.o >/dev/null
    /sbin/modprobe uart401
    /sbin/modprobe  sb io=0x220 irq=5 dma=1 dma16=-1 esstype=0
    /sbin/modprobe  mpu401 io=0x330
#    /sbin/insmod -f /lib/modules/current/misc/opl3.o >/dev/null
#    /sbin/modprobe  /lib/modules/current/kernel/drivers/sound/adlib_card.o io=0x388 >/dev/null
    /sbin/modprobe  v_midi
    
    ;;
  stop)
    # There is nothing to unconfigure now
    echo Removing support of soudn card
    /sbin/rmmod v_midi
#    /sbin/rmmod adlib_card
#    /sbin/rmmod opl3
    /sbin/rmmod mpu401
    /sbin/rmmod sb
    /sbin/rmmod uart401
#    /sbin/rmmod sound
 
    ;;
  *)
    echo "Usage: $0 {start|stop}"
    exit 1
    ;;
esac
exit 0
# end of hardware
