#!/bin/sh
#
# /etc/hotplug/usb/alsasound
#
# Sets up newly plugged in USB audio/MIDI devices.
#

case "$PRODUCT" in
0x1604/*) module="snd-usb-usx2y";;
*)        module="snd-usb-audio";;
esac

add_alsa () {
    # check alsa is already running
    if [ ! -d /proc/asound ]; then
	# start alsasound script, so that static devices are properly loaded
	echo "Starting ALSA..."
	/etc/init.d/alsasound start >/dev/null 2>&1
    fi
    /sbin/modprobe $module
}

remove_alsa () {
    /sbin/modprobe -r $module
}

case "$ACTION" in
add)
  add_alsa
  ;;
remove)
  remove_alsa
  ;;
esac

exit 0
