aboutsummaryrefslogtreecommitdiff
path: root/audio
diff options
context:
space:
mode:
authorChris Rees <crees@FreeBSD.org>2012-01-30 19:32:30 +0000
committerChris Rees <crees@FreeBSD.org>2012-01-30 19:32:30 +0000
commit0b20c4909db00671383265ffbb51032f7caef7d1 (patch)
tree02a4bcc58d51e6da0cdec6f9a8b5caae3e33f8ee /audio
parent7cdfadbd71c7812701caed9454df58676343ff7e (diff)
downloadports-0b20c4909db00671383265ffbb51032f7caef7d1.tar.gz
ports-0b20c4909db00671383265ffbb51032f7caef7d1.zip
Notes
Diffstat (limited to 'audio')
-rw-r--r--audio/madfufw/Makefile1
-rw-r--r--audio/madfufw/files/maudio-devd.conf.in27
-rw-r--r--audio/madfufw/files/maudio.in86
-rw-r--r--audio/madfufw/files/pkg-message.in5
4 files changed, 105 insertions, 14 deletions
diff --git a/audio/madfufw/Makefile b/audio/madfufw/Makefile
index 744c0fc7466d..a8be7a28e1c0 100644
--- a/audio/madfufw/Makefile
+++ b/audio/madfufw/Makefile
@@ -7,6 +7,7 @@
PORTNAME= madfufw
PORTVERSION= 1.0
+PORTREVISION= 1
CATEGORIES= audio
MASTER_SITES= SF/usb-midi-fw/madfu-firmware/1.2/
DISTNAME= madfuload-1.2
diff --git a/audio/madfufw/files/maudio-devd.conf.in b/audio/madfufw/files/maudio-devd.conf.in
index 5940432f9a20..6beddb039b78 100644
--- a/audio/madfufw/files/maudio-devd.conf.in
+++ b/audio/madfufw/files/maudio-devd.conf.in
@@ -1,13 +1,32 @@
-attach 100 {
- match "device-name" "ugen[0-9]+\.[0-9]+";
+notify 100 {
+ match "system" "USB";
+ match "subsystem" "DEVICE";
+ match "type" "ATTACH";
match "vendor" "0x0763";
match "product" "0x280[34568]";
- action "%%PREFIX%%/etc/rc.d/maudio start $device-name $product";
+ action "%%PREFIX%%/etc/rc.d/maudio start $cdev $product";
+};
+
+attach 100 {
+ match "device-name" "pcm[0-9]+";
+ action "%%PREFIX%%/etc/rc.d/maudio attach $device-name $bus";
};
attach 100 {
match "device-name" "uaudio[0-9]+";
match "vendor" "0x0763";
match "product" "0x2006";
- action "/usr/local/etc/rc.d/maudio mixer $device-name";
+ action "%%PREFIX%%/etc/rc.d/maudio attach $device-name";
+};
+
+detach 100 {
+ match "device-name" "pcm[0-9]+";
+ action "%%PREFIX%%/etc/rc.d/maudio detach $device-name $bus";
+};
+
+detach 100 {
+ match "device-name" "uaudio[0-9]+";
+ match "vendor" "0x0763";
+ match "product" "0x2006";
+ action "%%PREFIX%%/etc/rc.d/maudio detach $device-name";
};
diff --git a/audio/madfufw/files/maudio.in b/audio/madfufw/files/maudio.in
index e60c6c971ee9..dc1c8bfbc745 100644
--- a/audio/madfufw/files/maudio.in
+++ b/audio/madfufw/files/maudio.in
@@ -26,20 +26,25 @@ rcvar=maudio_enable
load_rc_config $name
: ${maudio_enable="NO"}
+: ${maudio_default="NO"}
command="%%PREFIX%%/bin/dfu-util"
start_cmd="maudio_start"
firmware_dir="%%PREFIX%%/share/maudio"
+temp_dir="/tmp/.maudio"
required_modules="uhub/uaudio"
required_dirs=$firmware_dir
required_files=$command
-extra_commands="mixer"
-mixer_cmd="maudio_mixer"
+extra_commands="attach detach"
+attach_cmd="maudio_attach"
+detach_cmd="maudio_detach"
maudio_start()
{
local firmware dev idVendor idProduct
+ mkdir -p ${temp_dir} && touch ${temp_dir}/state
+
if [ -n "${1}" -a -n "${2}" ]; then
idProduct=${2}
dev=${1}
@@ -81,18 +86,79 @@ maudio_start()
/usr/sbin/usbconfig -d ${dev} reset
}
-maudio_mixer()
+maudio_init()
{
- local dev
-
- if [ -z "${1}" ]; then
- err 1 "No device specified"
- fi
-
- dev="/dev/mixer$( echo ${1} |sed -E 's/^[a-z]+([0-9]+)$/\1/' )"
+ local unit dev
+ unit=${1#pcm*}
+ test -n "${unit}" || return 1
+ dev="/dev/mixer${unit}"
if [ -r ${dev} ]; then
mixer -f ${dev} vol 100 pcm 100
+ if checkyesno maudio_default; then
+ sysctl -w hw.snd.default_unit=${unit}
+ fi
fi
}
+maudio_attach()
+{
+ local bus pcmdev pcmdevs
+
+ . ${temp_dir}/state
+
+ case "${1}" in
+ pcm*)
+ eval "bus=\$maudio_${2}"
+ if [ "${bus}" = "1" ]; then
+ maudio_init ${1}
+ fi
+ pcmdevs="${pcmdevs:+${pcmdevs} }${1}"
+ echo "pcmdevs=\"${pcmdevs}\"" >${temp_dir}/state
+ for pcmdev in ${pcmdevs}; do
+ echo "pcmbus_${1}=${2}" >>${temp_dir}/state
+ done
+ grep "^maudio_" >>${temp_dir}/state
+ ;;
+ uaudio*)
+ for pcmdev in ${pcmdevs}; do
+ eval "bus=\$pcmbus_${pcmdev}"
+ if [ "${bus}" = "${1}" ]; then
+ maudio_init ${pcmdev}
+ break
+ fi
+ done
+ echo "maudio_${1}=1" >>${temp_dir}/state
+ ;;
+ *)
+ err 1 "Unknown device specified"
+ ;;
+ esac
+}
+
+maudio_detach()
+{
+ local pcmdev pcmdevs pcmdevs_new
+
+ . ${temp_dir}/state
+
+ case "${1}" in
+ pcm*)
+ for pcmdev in ${pcmdevs}; do
+ if [ "${pcmdev}" = "${1}" ]; then
+ continue
+ fi
+ pcmdevs_new="${pcmdevs_new:+${pcmdevs_new} }${1}"
+ done
+ pcmdevs="${pcmdevs_new}"
+ sed -i "" -e "/^pcmdevs=/ s/=.*$/=\"${pcmdevs}\"/" -e "/^pcmbus_${1}=/ d" ${temp_dir}/state
+ ;;
+ uaudio*)
+ sed -i "" "/^maudio_${1}=/ d" ${temp_dir}/state
+ ;;
+ *)
+ err 1 "Unknown device specified"
+ ;;
+ esac
+}
+
run_rc_command $*
diff --git a/audio/madfufw/files/pkg-message.in b/audio/madfufw/files/pkg-message.in
index de5cb8eb823b..99b653e045e0 100644
--- a/audio/madfufw/files/pkg-message.in
+++ b/audio/madfufw/files/pkg-message.in
@@ -4,6 +4,11 @@ A devd(8) configuration has been installed at:
You must add 'maudio_enable="YES"' to rc.conf
and restart devd(8) for this port to work.
+You can optionally add 'maudio_default="YES"'
+to rc.conf if you'd like M-Audio devices to
+be setup as the default sound device upon
+detection.
+
Some devices (eg. Transit) may also require
sysctl modifications: