From mwm@mired.org  Tue Oct  3 01:23:35 2000
Return-Path: <mwm@mired.org>
Received: from guru.mired.org (okc-27-149-77.mmcable.com [24.27.149.77])
	by hub.freebsd.org (Postfix) with SMTP id 7995837B503
	for <FreeBSD-gnats-submit@freebsd.org>; Tue,  3 Oct 2000 01:23:34 -0700 (PDT)
Received: (qmail 3173 invoked by uid 100); 3 Oct 2000 08:23:28 -0000
Message-Id: <20001003082328.3172.qmail@guru.mired.org>
Date: 3 Oct 2000 08:23:28 -0000
From: mwm@mired.org
Reply-To: mwm@mired.org
To: FreeBSD-gnats-submit@freebsd.org
Subject: The mixer settings are lost on sysetm reboot.s
X-Send-Pr-Version: 3.2

>Number:         21722
>Category:       conf
>Synopsis:       The mixer settings are lost on sysetm reboot.s
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    freebsd-bugs
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Tue Oct 03 01:30:00 PDT 2000
>Closed-Date:    Sun Feb 17 02:41:54 PST 2002
>Last-Modified:  Sun Feb 17 02:43:20 PST 2002
>Originator:     Mike Meyer
>Release:        FreeBSD 5.0-CURRENT i386
>Organization:
Meyer Consulting
>Environment:

	A system with at least one sound card.

>Description:

	The system mixer settings - possibly carefully tuned by the user -
	are lost whenever the system goes through a hard shutdown.

>How-To-Repeat:

	Reboot your system so that the mixer settings are at the default
	values. Find a line input source that's not acceptable at those
	values, and adjust the mixer settings. Now reboot again, and notice
	that the values you had saved were gone.

>Fix:

The following patch (apply in /etc) adds an rc.conf knob to save the
mixer settings in /var/db on shutdown, and restore from those files on
restart.

And I forgot to test the "mixer numbers" case, but shutting down now
to do it would lose the PR entry, so...

--- rc	Tue Oct  3 03:14:55 2000
+++ /etc/rc	Tue Oct  3 03:10:50 2000
@@ -276,6 +276,19 @@
 	;;
 esac
 
+#
+# If we have saved mixer state and the user wants it restored, do it.
+#
+case ${mixer_devices} in
+[Nn][Oo] | '')
+	;;
+*)
+	for settings in /var/db/mixer*.settings; do
+		mixer -f `echo $settings | sed -e 's/.settings//' -e 's;/var/db;/dev;'` `cat $settings` >/dev/null
+	done
+	;;
+esac
+		
 # Remove X lock files, since they will prevent you from restarting X11
 # after a system crash.
 #
--- rc.shutdown	Tue Oct  3 03:14:55 2000
+++ /etc/rc.shutdown	Tue Oct  3 03:09:30 2000
@@ -43,6 +43,25 @@
 	;;
 esac
 
+# Save the mixer settings - if the user wants it.
+#
+case ${mixer_devices} in
+[Nn][Oo] | '')
+	;;
+[Yy][Ee][Ss])
+	echo "Saving mixer settings."
+	rm /var/db/mixer*.settings
+	/usr/sbin/mixer -s > /var/db/mixer.settings
+	;;
+*)
+	echo "Saving mixer settings."
+	rm /var/db/mixer*.settings
+	for dev in ${mixer_devices}; do
+		/usr/sbin/mixer -f /dev/mixer${dev} -s > /var/db/mixer${dev}.settings
+	done
+	;;
+esac
+
 # Check if /var/db/mounttab is clean.
 case $1 in
 reboot)
--- defaults/rc.conf	Fri Sep  1 08:37:25 2000
+++ /etc/defaults/rc.conf	Tue Oct  3 02:31:22 2000
@@ -298,6 +298,7 @@
 start_vinum=""		# set to YES to start vinum
 entropy_file="/var/db/entropy"
 			# Set to NO to disable caching entropy through reboots
+mixer_devices="NO"	# NO to disable saving, YES for /dev/mixer, or list of mixer numbers
 
 ##############################################################
 ### Define source_rc_confs, the mechanism used by /etc/rc.* ##



>Release-Note:
>Audit-Trail:

From: Salvo Bartolotta <bartequi@inwind.it>
To: mwm@mired.org
Cc: freebsd-gnats-submit@freebsd.org
Subject: Re: conf/21722: The mixer settings are lost on sysetm reboot.s
Date: Tue, 03 Oct 2000 12:22:07 GMT

 >>>>>>>>>>>>>>>>>> Original Message <<<<<<<<<<<<<<<<<<
 
 On 10/3/00, 9:23:28 AM, mwm@mired.org wrote regarding conf/21722: The
 mixer settings are lost on sysetm reboot.s:
 
 
 > >Number:         21722
 > >Category:       conf
 > >Synopsis:       The mixer settings are lost on sysetm reboot.s
 > >Confidential:   no
 > >Severity:       non-critical
 > >Priority:       medium
 > >Responsible:    freebsd-bugs
 > >State:          open
 > >Quarter:
 > >Keywords:
 > >Date-Required:
 > >Class:          sw-bug
 > >Submitter-Id:   current-users
 > >Arrival-Date:   Tue Oct 03 01:30:00 PDT 2000
 > >Closed-Date:
 > >Last-Modified:
 > >Originator:     Mike Meyer
 > >Release:        FreeBSD 5.0-CURRENT i386
 > >Organization:
 > Meyer Consulting
 > >Environment:
 
 >       A system with at least one sound card.
 
 > >Description:
 
 >       The system mixer settings - possibly carefully tuned by the user=
 
 -
 >       are lost whenever the system goes through a hard shutdown.
 
 > >How-To-Repeat:
 
 >       Reboot your system so that the mixer settings are at the default=
 
 >       values. Find a line input source that's not acceptable at those
 >       values, and adjust the mixer settings. Now reboot again, and
 notice
 >       that the values you had saved were gone.
 
 > >Fix:
 
 > The following patch (apply in /etc) adds an rc.conf knob to save the
 > mixer settings in /var/db on shutdown, and restore from those files on=
 
 > restart.
 
 > And I forgot to test the "mixer numbers" case, but shutting down now
 > to do it would lose the PR entry, so...
 
 > --- rc        Tue Oct  3 03:14:55 2000
 > +++ /etc/rc   Tue Oct  3 03:10:50 2000
 > @@ -276,6 +276,19 @@
 >       ;;
 >  esac
 
 > +#
 > +# If we have saved mixer state and the user wants it restored, do it.=
 
 > +#
 > +case ${mixer_devices} in
 > +[Nn][Oo] | '')
 > +     ;;
 > +*)
 > +     for settings in /var/db/mixer*.settings; do
 > +             mixer -f `echo $settings | sed -e 's/.settings//' -e
 's;/var/db;/dev;'` `cat $settings` >/dev/null
 > +     done
 > +     ;;
 > +esac
 > +
 >  # Remove X lock files, since they will prevent you from restarting
 X11
 >  # after a system crash.
 >  #
 > --- rc.shutdown       Tue Oct  3 03:14:55 2000
 > +++ /etc/rc.shutdown  Tue Oct  3 03:09:30 2000
 > @@ -43,6 +43,25 @@
 >       ;;
 >  esac
 
 > +# Save the mixer settings - if the user wants it.
 > +#
 > +case ${mixer_devices} in
 > +[Nn][Oo] | '')
 > +     ;;
 > +[Yy][Ee][Ss])
 > +     echo "Saving mixer settings."
 > +     rm /var/db/mixer*.settings
 > +     /usr/sbin/mixer -s > /var/db/mixer.settings
 > +     ;;
 > +*)
 > +     echo "Saving mixer settings."
 > +     rm /var/db/mixer*.settings
 > +     for dev in ${mixer_devices}; do
 > +             /usr/sbin/mixer -f /dev/mixer${dev} -s >
 /var/db/mixer${dev}.settings
 > +     done
 > +     ;;
 > +esac
 > +
 >  # Check if /var/db/mounttab is clean.
 >  case $1 in
 >  reboot)
 > --- defaults/rc.conf  Fri Sep  1 08:37:25 2000
 > +++ /etc/defaults/rc.conf     Tue Oct  3 02:31:22 2000
 > @@ -298,6 +298,7 @@
 >  start_vinum=3D""               # set to YES to start vinum
 >  entropy_file=3D"/var/db/entropy"
 >                       # Set to NO to disable caching entropy through
 reboots
 > +mixer_devices=3D"NO"   # NO to disable saving, YES for /dev/mixer, or=
 
 list of mixer numbers
 
 >  ##############################################################
 >  ### Define source_rc_confs, the mechanism used by /etc/rc.* ##
 
 
 
 Dear Mike Meyer,
 
 Under -STABLE, I had solved this "problem" at a user level as follows:
 
 
 <blockquote>
 
 #
 # $FreeBSD: src/share/skel/dot.login,v 1.11.2.2 1999/12/13 05:47:28
 # dcs Exp $
 #
 # .login - csh login script, read by login shell,
 #          after `.cshrc' at login.
 #
 # see also csh(1), environ(7).
 #
 
 <other user settings snipped>
 
 # Cdcontrol-related stuff
 setenv MUSIC_CD /dev/acd0c
 mixer dev vol 100 100 > /dev/null
 mixer dev igain 75 75 > /dev/null
 mixer dev ogain 75 75 > /dev/null
 mixer dev pcm 33 33 > /dev/null
 mixer dev cd 100 100 > /dev/null
 mixer dev mic 0 0 > /dev/null
 mixer dev speaker 0 0 > /dev/null
 mixer dev line 0 0 > /dev/null
 mixer dev bass 90 90 > /dev/null
 mixer dev treble 90 90 > /dev/null
 mixer dev synth  90 90 > /dev/null
 
 # I determined the above settings by trial and error.
 # Your mileage may vary.
 
 </blockquote>
 
 
 Whether I use cdcontrol (when working in CUI/CLI), or KDE cdplayer
 (when working in GUI), the settings are preserved.
 
 There is more than one way to do it(tm) :-)
 
 Best regards,
 Salvo
 
 
 
 
State-Changed-From-To: open->closed 
State-Changed-By: dwmalone 
State-Changed-When: Sun Feb 17 02:41:54 PST 2002 
State-Changed-Why:  
PR/35028 contains a port addressing this issue. 

http://www.FreeBSD.org/cgi/query-pr.cgi?pr=21722 
>Unformatted:
