[PC-BSD Commits] r20085 - in pcbsd/current/overlays/desktop-overlay: etc usr/local/share/pcbsd/scripts

svn at pcbsd.org svn at pcbsd.org
Tue Oct 30 09:01:50 PDT 2012


Author: kris
Date: 2012-10-30 16:01:50 +0000 (Tue, 30 Oct 2012)
New Revision: 20085

Modified:
   pcbsd/current/overlays/desktop-overlay/etc/devd.conf
   pcbsd/current/overlays/desktop-overlay/usr/local/share/pcbsd/scripts/sound-dev-changed.sh
Log:

Add new patch for sound-dev-changed to fix setting device when we dont need to

Submitted by: NV	


Modified: pcbsd/current/overlays/desktop-overlay/etc/devd.conf
===================================================================
--- pcbsd/current/overlays/desktop-overlay/etc/devd.conf	2012-10-30 15:35:51 UTC (rev 20084)
+++ pcbsd/current/overlays/desktop-overlay/etc/devd.conf	2012-10-30 16:01:50 UTC (rev 20085)
@@ -269,7 +269,7 @@
         match "subsystem"       "CDEV";
         match "type"            "CREATE";
 	match "cdev"            "mixer[0-9]+";
-	action "/usr/local/share/pcbsd/scripts/sound-dev-changed.sh add";
+	action "/usr/local/share/pcbsd/scripts/sound-dev-changed.sh add $cdev";
 };
 
 notify 15 {
@@ -277,7 +277,7 @@
         match "subsystem"       "CDEV";
         match "type"            "DESTROY";
 	match "cdev"            "mixer[0-9]+";
-	action "/usr/local/share/pcbsd/scripts/sound-dev-changed.sh del";
+	action "/usr/local/share/pcbsd/scripts/sound-dev-changed.sh del $cdev";
 };
 
 notify 5 {

Modified: pcbsd/current/overlays/desktop-overlay/usr/local/share/pcbsd/scripts/sound-dev-changed.sh
===================================================================
--- pcbsd/current/overlays/desktop-overlay/usr/local/share/pcbsd/scripts/sound-dev-changed.sh	2012-10-30 15:35:51 UTC (rev 20084)
+++ pcbsd/current/overlays/desktop-overlay/usr/local/share/pcbsd/scripts/sound-dev-changed.sh	2012-10-30 16:01:50 UTC (rev 20085)
@@ -2,6 +2,7 @@
 
 # Action can be add / del
 action=$1
+cdev=$2
 
 regen_ossconf()
 {
@@ -15,6 +16,7 @@
 PCM=`egrep -o 'pcm[0-9]+' /dev/sndstat | egrep -o '[0-9]+'`
 OSSCONF=`cat <<EOF
 # pcm-oss plugin configuration
+# generated by ${0}
 
 pcm.oss {
         type oss
@@ -68,10 +70,17 @@
       return
    fi
 
-   # Get the last pcm device so we can make it the default
-   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
+   mixerNum=`echo ${cdev} | egrep -o '[0-9]+'`
+
+   # Can new dev play?
+   cat /dev/sndstat | grep pcm${mixerNum} | grep -q play
+   if [ $? -ne 0 ] ; then
+      return
+   fi
+
+   # make new device the default one
+   sysctl hw.snd.default_unit=$mixerNum
+
 }
 
 # Update device based upon action



More information about the Commits mailing list