diff options
author | arved <arved@FreeBSD.org> | 2011-02-03 20:07:12 +0800 |
---|---|---|
committer | arved <arved@FreeBSD.org> | 2011-02-03 20:07:12 +0800 |
commit | 9a5a4b51f0d858be175fef8be566bbc0ff744bc5 (patch) | |
tree | 3c064012644057925094159cc6751dd10da44bca /audio | |
parent | d08365b7d1e5d2dea04ddb1f38619c277fa550cc (diff) | |
download | freebsd-ports-gnome-9a5a4b51f0d858be175fef8be566bbc0ff744bc5.tar.gz freebsd-ports-gnome-9a5a4b51f0d858be175fef8be566bbc0ff744bc5.tar.zst freebsd-ports-gnome-9a5a4b51f0d858be175fef8be566bbc0ff744bc5.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
Diffstat (limited to 'audio')
-rw-r--r-- | audio/Makefile | 1 | ||||
-rw-r--r-- | audio/madfufw/Makefile | 50 | ||||
-rw-r--r-- | audio/madfufw/distinfo | 2 | ||||
-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 | ||||
-rw-r--r-- | audio/madfufw/pkg-descr | 11 |
7 files changed, 186 insertions, 0 deletions
diff --git a/audio/Makefile b/audio/Makefile index e9f06ad47745..f5f94ee8d553 100644 --- a/audio/Makefile +++ b/audio/Makefile @@ -458,6 +458,7 @@ SUBDIR += lv2core SUBDIR += mac SUBDIR += mad + SUBDIR += madfufw SUBDIR += madman SUBDIR += madplay SUBDIR += malint diff --git a/audio/madfufw/Makefile b/audio/madfufw/Makefile new file mode 100644 index 000000000000..744c0fc7466d --- /dev/null +++ b/audio/madfufw/Makefile @@ -0,0 +1,50 @@ +# New ports collection makefile for: madfufw +# Date created: July 6, 2010 +# Whom: Aragon Gouveia <aragon@phat.za.net> +# +# $FreeBSD$ +# + +PORTNAME= madfufw +PORTVERSION= 1.0 +CATEGORIES= audio +MASTER_SITES= SF/usb-midi-fw/madfu-firmware/1.2/ +DISTNAME= madfuload-1.2 + +MAINTAINER= aragon@phat.za.net +COMMENT= M-Audio DFU Firmware for Transit, Ozone, Sonica, MobilePre + +RUN_DEPENDS= ${LOCALBASE}/bin/dfu-util:${PORTSDIR}/comms/dfu-util + +WRKSRC= ${WRKDIR}/madfuload-1.2 +PLIST_FILES= share/maudio/ma003101.bin \ + share/maudio/ma004103.bin \ + share/maudio/ma005101.bin \ + share/maudio/ma006100.bin \ + share/maudio/ma008100.bin \ + etc/devd/maudio-devd.conf +PLIST_DIRS= share/maudio +USE_RC_SUBR= maudio +SUB_FILES= maudio-devd.conf pkg-message +NO_BUILD= yes +NO_PACKAGE= redistribution of firmware files not permitted + +.include <bsd.port.pre.mk> + +.if ${OSVERSION} < 800064 +BROKEN= port requires FreeBSD 8.x +.endif + +do-install: + @${MKDIR} ${LOCALBASE}/share/maudio && \ + ${INSTALL_DATA} ${WRKSRC}/ma003101.bin ${WRKSRC}/ma004103.bin \ + ${WRKSRC}/ma005101.bin ${WRKSRC}/ma006100.bin \ + ${WRKSRC}/ma008100.bin ${LOCALBASE}/share/maudio + @${INSTALL_DATA} ${WRKDIR}/maudio-devd.conf ${LOCALBASE}/etc/devd + +post-install: + @${ECHO_MSG} "" + @${CAT} ${PKGMESSAGE} + @${ECHO_MSG} "" + +.include <bsd.port.post.mk> diff --git a/audio/madfufw/distinfo b/audio/madfufw/distinfo new file mode 100644 index 000000000000..e4409f72fa6c --- /dev/null +++ b/audio/madfufw/distinfo @@ -0,0 +1,2 @@ +SHA256 (madfuload-1.2.tar.gz) = 324d0a55f73c82ad48635a94a8d72277a2280030df6d036eafe3498c933dee6d +SIZE (madfuload-1.2.tar.gz) = 78506 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 diff --git a/audio/madfufw/pkg-descr b/audio/madfufw/pkg-descr new file mode 100644 index 000000000000..bbffeae97ced --- /dev/null +++ b/audio/madfufw/pkg-descr @@ -0,0 +1,11 @@ +Userland scaffolding to load M-Audio firmware into supported +sound devices upon attachment. Supported devices: + +* Sonica +* Ozone +* MobilePre USB (some newer models don't need this port) +* Transit + +Based upon the madfuload package. + +WWW: http://usb-midi-fw.sourceforge.net/ |