diff options
author | Tilman Keskinoz <arved@FreeBSD.org> | 2011-02-03 12:07:12 +0000 |
---|---|---|
committer | Tilman Keskinoz <arved@FreeBSD.org> | 2011-02-03 12:07:12 +0000 |
commit | 7e42ea2dd6e34212d80810a88f7b5ac1f7c71a58 (patch) | |
tree | cdd97ddd61de2d1eaccd66741f6a23fbda85850b /audio/madfufw/files | |
parent | 429b2b404d82cdbe01dfb9df1b598ba2f292f30a (diff) | |
download | ports-7e42ea2dd6e34212d80810a88f7b5ac1f7c71a58.tar.gz ports-7e42ea2dd6e34212d80810a88f7b5ac1f7c71a58.zip |
Add madufufw, Userland scripts to load the M-Audio firmware into supported
sound devices upon attachment.
PR: 148411
Submitted by: Aragon Gouveia
Feature safe: yes
Notes
Notes:
svn path=/head/; revision=268576
Diffstat (limited to 'audio/madfufw/files')
-rw-r--r-- | audio/madfufw/files/maudio-devd.conf.in | 13 | ||||
-rw-r--r-- | audio/madfufw/files/maudio.in | 98 | ||||
-rw-r--r-- | audio/madfufw/files/pkg-message.in | 11 |
3 files changed, 122 insertions, 0 deletions
diff --git a/audio/madfufw/files/maudio-devd.conf.in b/audio/madfufw/files/maudio-devd.conf.in new file mode 100644 index 000000000000..5940432f9a20 --- /dev/null +++ b/audio/madfufw/files/maudio-devd.conf.in @@ -0,0 +1,13 @@ +attach 100 { + match "device-name" "ugen[0-9]+\.[0-9]+"; + match "vendor" "0x0763"; + match "product" "0x280[34568]"; + action "%%PREFIX%%/etc/rc.d/maudio start $device-name $product"; +}; + +attach 100 { + match "device-name" "uaudio[0-9]+"; + match "vendor" "0x0763"; + match "product" "0x2006"; + action "/usr/local/etc/rc.d/maudio mixer $device-name"; +}; diff --git a/audio/madfufw/files/maudio.in b/audio/madfufw/files/maudio.in new file mode 100644 index 000000000000..b12a2b51e96c --- /dev/null +++ b/audio/madfufw/files/maudio.in @@ -0,0 +1,98 @@ +#!/bin/sh +# +# PROVIDE: maudio +# REQUIRE: LOGIN +# KEYWORD: nojail +# +# Add the following lines to /etc/rc.conf.local or /etc/rc.conf +# to enable this service: +# +# maudio_enable (bool): Set to NO by default. +# Set it to YES to enable maudio. +# Usage: +# maudio start [<device> <product id>] # load firmware to device with specified product ID + +# disable at boot time and prevent simultaneous runs +if [ -n "${_boot}" -o -f /var/run/maudio.pid ]; then + exit 0 +fi +trap "rm -f /var/run/maudio.pid" 1 2 10 13 14 15 EXIT +echo $$ >/var/run/maudio.pid + +. /etc/rc.subr + +name="maudio" +rcvar=`set_rcvar` +load_rc_config $name + +: ${maudio_enable="NO"} + +command="%%PREFIX%%/bin/dfu-util" +start_cmd="maudio_start" +firmware_dir="%%PREFIX%%/share/maudio" +required_modules="uhub/uaudio" +required_dirs=$firmware_dir +required_files=$command +extra_commands="mixer" +mixer_cmd="maudio_mixer" + +maudio_start() +{ + local firmware dev idVendor idProduct + + if [ -n "${1}" -a -n "${2}" ]; then + idProduct=${2} + dev=${1} + else + for dev in /dev/ugen*; do + dev=${dev#/dev/*} + eval $( /usr/sbin/usbconfig -d ${dev} dump_device_desc \ + |grep -E "idVendor = 0x0763|idProduct = 0x280[34568]" |tr -d " " ) + if [ -n "${idVendor}" -a -n "${idProduct}" ]; then + break; + fi + idVendor="" + idProduct="" + done + fi + + case "${idProduct}" in + 0x2803) + firmware=${firmware_dir}/ma003101.bin + ;; + 0x2804) + firmware=${firmware_dir}/ma004103.bin + ;; + 0x2805) + firmware=${firmware_dir}/ma005101.bin + ;; + 0x2806) + firmware=${firmware_dir}/ma006100.bin + ;; + 0x2808) + firmware=${firmware_dir}/ma008100.bin + ;; + *) + err 1 "Unknown product ID" + ;; + esac + + ${command} -R -t 64 -d 0x0763:${idProduct} -D ${firmware} 2>/dev/null 1>&2 + /usr/sbin/usbconfig -d ${dev} reset +} + +maudio_mixer() +{ + 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/' )" + if [ -r ${dev} ]; then + mixer -f ${dev} vol 100 pcm 100 + fi +} + +run_rc_command $* diff --git a/audio/madfufw/files/pkg-message.in b/audio/madfufw/files/pkg-message.in new file mode 100644 index 000000000000..de5cb8eb823b --- /dev/null +++ b/audio/madfufw/files/pkg-message.in @@ -0,0 +1,11 @@ +A devd(8) configuration has been installed at: +%%PREFIX%%/etc/devd/maudio-devd.conf. + +You must add 'maudio_enable="YES"' to rc.conf +and restart devd(8) for this port to work. + +Some devices (eg. Transit) may also require +sysctl modifications: + +hw.usb.uaudio.default_bits=16 +hw.usb.uaudio.default_rate=48000 |