Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 29 Jan 2012 16:30:13 GMT
From:      Aragon Gouveia <aragon@phat.za.net>
To:        freebsd-ports-bugs@FreeBSD.org
Subject:   Re: ports/164605: [patch] audio/madfufw upgrade
Message-ID:  <201201291630.q0TGUDVc035056@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help
The following reply was made to PR ports/164605; it has been noted by GNATS.

From: Aragon Gouveia <aragon@phat.za.net>
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: ports/164605: [patch] audio/madfufw upgrade
Date: Sun, 29 Jan 2012 18:26:24 +0200

 This is a multi-part message in MIME format.
 --------------030903090309070900020208
 Content-Type: text/plain; charset=ISO-8859-1; format=flowed
 Content-Transfer-Encoding: 7bit
 
 Looks like the patch got swallowed somewhere...
 
 Attached here instead.
 
 --------------030903090309070900020208
 Content-Type: text/plain;
  name="madfufw.txt"
 Content-Transfer-Encoding: 7bit
 Content-Disposition: attachment;
  filename="madfufw.txt"
 
 diff -uNr madfufw/Makefile madfufw.new/Makefile
 --- madfufw/Makefile	2011-02-03 14:07:11.000000000 +0200
 +++ madfufw.new/Makefile	2012-01-29 15:45:00.000000000 +0200
 @@ -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 -uNr madfufw/files/maudio-devd.conf.in madfufw.new/files/maudio-devd.conf.in
 --- madfufw/files/maudio-devd.conf.in	2011-02-03 14:07:12.000000000 +0200
 +++ madfufw.new/files/maudio-devd.conf.in	2012-01-29 15:41:00.000000000 +0200
 @@ -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 -uNr madfufw/files/maudio.in madfufw.new/files/maudio.in
 --- madfufw/files/maudio.in	2012-01-14 10:55:24.000000000 +0200
 +++ madfufw.new/files/maudio.in	2012-01-29 18:14:29.000000000 +0200
 @@ -22,24 +22,29 @@
  . /etc/rc.subr
  
  name="maudio"
 -rcvar=maudio_enable
 +rcvar=`set_rcvar`
  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,82 @@
  	/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*}
 +	warn "init ${1} ${unit}"
 +	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
 +	cat ${temp_dir}/state > /tmp/maudio.$$
 +}
 +
 +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
 +	cat ${temp_dir}/state > /tmp/maudio.$$
 +}
 +
  run_rc_command $*
 diff -uNr madfufw/files/pkg-message.in madfufw.new/files/pkg-message.in
 --- madfufw/files/pkg-message.in	2011-02-03 14:07:12.000000000 +0200
 +++ madfufw.new/files/pkg-message.in	2012-01-29 15:44:46.000000000 +0200
 @@ -4,6 +4,11 @@
  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:
  
 
 --------------030903090309070900020208--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201201291630.q0TGUDVc035056>