[PC-BSD Commits] r19922 - pcbsd/branches/9.1/overlays/desktop-overlay/usr/local/share/pcbsd/scripts

svn at pcbsd.org svn at pcbsd.org
Thu Oct 25 06:32:48 PDT 2012


Author: kris
Date: 2012-10-25 13:32:48 +0000 (Thu, 25 Oct 2012)
New Revision: 19922

Modified:
   pcbsd/branches/9.1/overlays/desktop-overlay/usr/local/share/pcbsd/scripts/sound-dev-changed.sh
Log:

MFC fix for setting default playback audio device



Modified: pcbsd/branches/9.1/overlays/desktop-overlay/usr/local/share/pcbsd/scripts/sound-dev-changed.sh
===================================================================
--- pcbsd/branches/9.1/overlays/desktop-overlay/usr/local/share/pcbsd/scripts/sound-dev-changed.sh	2012-10-25 13:31:41 UTC (rev 19921)
+++ pcbsd/branches/9.1/overlays/desktop-overlay/usr/local/share/pcbsd/scripts/sound-dev-changed.sh	2012-10-25 13:32:48 UTC (rev 19922)
@@ -5,9 +5,15 @@
 
 regen_ossconf()
 {
+PCM_OSS_CONF_DIR=/compat/linux/etc/alsa/pcm/
+PCM_OSS_CONF=${PCM_OSS_CONF_DIR}pcm-oss.conf
 
+if [ ! -d $PCM_OSS_CONF_DIR ]; then
+  return
+fi
+
 PCM=`egrep -o 'pcm[0-9]+' /dev/sndstat | egrep -o '[0-9]+'`
-cat > /tmp/pcm-oss.conf <<EOF
+OSSCONF=`cat <<EOF
 # pcm-oss plugin configuration
 
 pcm.oss {
@@ -25,16 +31,19 @@
                 description "Open Sound System"
         }
 }
+EOF`
 
-EOF
+for NUM in $PCM; do
+  UNIT_DESC=`sysctl -in dev.pcm.${NUM}.%desc`
+  
+  OSSCONF_UNITS=${OSSCONF_UNITS}`cat <<EOF
 
-for NUM in $PCM; do
-  cat >> /tmp/pcm-oss.conf <<EOF
+ 
 pcm.oss${NUM} {
 	type oss
 	device /dev/dsp${NUM}
 	hint {
-		description "Open Sound System Unit ${NUM}"
+		description "oss${NUM}: ${UNIT_DESC}"
 	}
 }
 
@@ -42,20 +51,19 @@
 	type oss
 	device /dev/mixer${NUM}
 	hint {
-		description "Open Sound System Unit ${NUM}"
+		description "oss${NUM}: ${UNIT_DESC}"
 	}
 }
+EOF`
+done
 
-EOF
-
-done
-mv /tmp/pcm-oss.conf /compat/linux/etc/alsa/pcm/pcm-oss.conf
+echo "${OSSCONF}${OSSCONF_UNITS}" > $PCM_OSS_CONF
 }
 
 set_new_dev()
 {
    # Get the last pcm device so we can make it the default
-   newDev=`cat /dev/sndstat | egrep -o 'pcm[0-9]+' | tail -n 1`
+   newDev=`cat /dev/sndstat | grep play | egrep -o 'pcm[0-9]+' | tail -n 1`
    dNum=`echo $newDev | sed 's|pcm||g'`
    sysctl hw.snd.default_unit=$dNum
 }



More information about the Commits mailing list