[dapper apm-upgrade] Sound gone with update 2006-06-17

Patrick Drechsler patrick at pdrechsler.de
Sat Jul 8 01:00:22 UTC 2006


Hi,

using Dapper I do not have sound output anymore on my laptop.

I'm using a dual-boot laptop. Hardware is OK (sound works with
WinXP).

I have already reported this problem in the following thread a
few weeks back:

<URL:http://thread.gmane.org/gmane.linux.ubuntu.user/82725/focus=83252>


Here comes the hardware info:

IBM Thinkpad R40 with...
,----[ patrick at trurl:~$ lspci ]
| 0000:00:00.0 Host bridge: Intel Corporation 82855PM Processor to I/O Controller (rev 03)
| 0000:00:01.0 PCI bridge: Intel Corporation 82855PM Processor to AGP Controller (rev 03)
| 0000:00:1d.0 USB Controller: Intel Corporation 82801DB/DBL/DBM (ICH4/ICH4-L/ICH4-M) USB UHCI Controller #1 (rev 01)
| 0000:00:1d.1 USB Controller: Intel Corporation 82801DB/DBL/DBM (ICH4/ICH4-L/ICH4-M) USB UHCI Controller #2 (rev 01)
| 0000:00:1d.2 USB Controller: Intel Corporation 82801DB/DBL/DBM (ICH4/ICH4-L/ICH4-M) USB UHCI Controller #3 (rev 01)
| 0000:00:1d.7 USB Controller: Intel Corporation 82801DB/DBM (ICH4/ICH4-M) USB2 EHCI Controller (rev 01)
| 0000:00:1e.0 PCI bridge: Intel Corporation 82801 Mobile PCI Bridge (rev 81)
| 0000:00:1f.0 ISA bridge: Intel Corporation 82801DBM (ICH4-M) LPC Interface Bridge (rev 01)
| 0000:00:1f.1 IDE interface: Intel Corporation 82801DBM (ICH4-M) IDE Controller (rev 01)
| 0000:00:1f.3 SMBus: Intel Corporation 82801DB/DBL/DBM (ICH4/ICH4-L/ICH4-M) SMBus Controller (rev 01)
| 0000:00:1f.5 Multimedia audio controller: Intel Corporation 82801DB/DBL/DBM (ICH4/ICH4-L/ICH4-M) AC'97 Audio Controller (rev 01)
| 0000:00:1f.6 Modem: Intel Corporation 82801DB/DBL/DBM (ICH4/ICH4-L/ICH4-M) AC'97 Modem Controller (rev 01)
| 0000:01:00.0 VGA compatible controller: ATI Technologies Inc Radeon Mobility M7 LW [Radeon Mobility 7500]
| 0000:02:00.0 CardBus bridge: Texas Instruments PCI1510 PC card Cardbus Controller
| 0000:02:02.0 Ethernet controller: Atheros Communications, Inc. AR5211 802.11ab NIC (rev 01)
| 0000:02:07.0 FireWire (IEEE 1394): Texas Instruments TSB43AB21 IEEE-1394a-2000 Controller (PHY/Link)
| 0000:02:08.0 Ethernet controller: Intel Corporation 82801DB PRO/100 VE (MOB) Ethernet Controller (rev 81)
`----

Looking through my old backups in the /etc directory I noticed
that there where a few changes made. I do not have the skill to
analyze them.

Changes seem have to have been made in acpi/apm scripts.

Before the update:

,----[ patrick at trurl:~$ find skripte/backup/tmp/etc -iname alsa ]
| skripte/backup/tmp/etc/default/alsa
| skripte/backup/tmp/etc/init.d/alsa
| skripte/backup/tmp/etc/alsa
| skripte/backup/tmp/etc/apm/scripts.d/alsa
`----

After the update:

,----[ patrick at trurl:~$ sudo find /etc -iname alsa ]
| /etc/default/alsa
| /etc/apm/scripts.d/alsa
`----

The diff between my /etc/apm/scripts.d/alsa file before and after
the upgrade is posted below. The comment section at the beginning
of the new version states that modules are loaded
differently. How do I accomplish to adapt this correctly (so it
keeps on working with future upgrades)?

Please do not hesitate to contact me for further details.

TIA

Patrick

PS: I have upgraded from Hoary to Breezy to Dapper successfully
without a new installation using "apt-get dist-upgrade". Besides
loosing sound this has worked fairly well.  


--8<------------------------schnipp------------------------->8---
*** /home/patrick/skripte/backup/tmp/etc/apm/scripts.d/alsa	2005-03-25 22:08:25.000000000 +0000
--- /etc/apm/scripts.d/alsa	2006-04-06 08:14:52.000000000 +0100
***************
*** 1,9 ****
  #!/bin/sh
  #
! # apmd proxy script for ALSA
  
! case "$1,$2" in
! 	suspend,*) /etc/init.d/alsa suspend ;;
! 	resume,suspend) /etc/init.d/alsa resume ;;
! esac
  
--- 1,209 ----
  #!/bin/sh
  #
! # alsa-base control script
! #
! ### BEGIN INIT INFO
! # Required-Start:
! # Required-Stop:
! # Default-Start:
! # Default-Stop:
! # Short-Description: Script to unload and load ALSA modules
! ### END INIT INFO
! #
! # At one time this script loaded and unloaded ALSA driver modules on
! # bootup and shutdown.  This feature has since been removed.  To load
! # modules on bootup use the hotplug or the discover package or add
! # the names of the modules that should be loaded to /etc/modules.
! #
! # At one time this script restored and stored mixer levels on
! # bootup and shutdown.  This feature has since been moved to the
! # alsa-utils initscript.
! #
! # There is no longer any need to run this script on bootup or shutdown.
! # It must remain in /etc/init.d/ for now, though, because certain
! # other scripts expect to find it there.
  
! set -e
! 
! # Exit if alsa-base package is not installed
! [ -f /usr/share/alsa-base/alsa.default ] || exit 0
! 
! MYNAME=/etc/apm/scripts.d/alsa
! PATH=/sbin:/usr/sbin:/bin:/usr/bin
! 
! # Default values of variables in /etc/default/alsa
! force_unload_modules_before_suspend=""
! 
! [ -f /etc/default/alsa ] && . /etc/default/alsa
  
+ # $* MESSAGE
+ warn() { echo "${MYNAME}: Warning: $* " >&2 ; }
+ 
+ echo_procs_using_sound()
+ {
+ 	echo $( \
+ 		lsof +D /dev -F rt \
+ 		| awk '/^p/ {pid=$1} /^t/ {type=$1} /^r0x(74|e)..$/ && type == "tCHR" {print pid}' \
+ 		| cut -c 2- \
+ 		| uniq \
+ 	)
+ }
+ 
+ # $* [PID]...
+ echo_with_command_names()
+ {
+ 	[ "$1" ] || return 0
+ 	echo $( \
+ 		ps --no-headers -o "%p %c" "$@" \
+ 		| sed -e 's/\([0-9][0-9]*\) \(.*\)/\1(\2)/' \
+ 	)
+ }
+ 
+ kill_procs_using_sound()
+ {
+ 	procs_using_sound="$(echo_procs_using_sound)"
+ 	if [ "$procs_using_sound" ] ; then
+ 		echo -n "Terminating processes:"
+ 		for attempt in 1 2 3 4 ; do
+ 			echo -n " ${procs_using_sound}"
+ 			kill $procs_using_sound || :
+ 			sleep 1
+ 			procs_using_sound="$(echo_procs_using_sound)"
+ 			[ "$procs_using_sound" ] || break
+ 		done
+ 		# Either no more procs using sound or attempts ran out
+ 		if [ "$procs_using_sound" ] ; then
+ 			echo -n " (with SIGKILL:) ${procs_using_sound}"
+ 			kill -9 $procs_using_sound || :
+ 			sleep 1
+ 		fi
+ 		procs_using_sound="$(echo_procs_using_sound)"
+ 		if [ "$procs_using_sound" ] ; then
+ 			echo " (failed: processes still using sound devices: $(echo_with_command_names $procs_using_sound))."
+ 			return 1
+ 		fi
+ 		echo "."
+ 	fi
+ 	return 0
+ }
+ 
+ # $* MODULE-NAME [MODULE-NAME]... | "all"
+ unload_modules()
+ {
+ 	procs_using_sound="$(echo_procs_using_sound)"
+ 	if [ "$procs_using_sound" ] ; then
+ 		warn "Processes using sound devices: $(echo_with_command_names $procs_using_sound)."
+ 	fi
+ 	[ -d /var/run/alsa ] || mkdir -p /var/run/alsa
+ 	:> /var/run/alsa/modules-removed
+ 	echo -n "Unloading ALSA sound driver modules:"
+ 	[ -d /proc/asound ] || { echo " (none loaded)." ; return 0 ; }
+ 	echo_snd_modules_loaded()
+ 	{
+ 		lsmod \
+ 		| sed -n -e 's/^\(snd[-_][^[:space:]]*\)[[:space:]].*/\1/p' \
+ 		| sed -e 's/_/-/g'
+ 	}
+ 	for FSMBS in $* ; do
+ 		MODULES_TO_REMOVE=""
+ 		SND_MODULES_LOADED="$(echo_snd_modules_loaded)"
+ 		case "$FSMBS" in
+ 		  all)
+ 			MODULES_TO_REMOVE="$SND_MODULES_LOADED"
+ 			;;
+ 		  snd_*|snd-*)
+ 			FSMBS="$(echo "$FSMBS" | sed -e 's/_/-/g')"
+ 			for M in $SND_MODULES_LOADED ; do
+ 				if [ "$FSMBS" = "$M" ] ; then
+ 					MODULES_TO_REMOVE="$FSMBS"
+ 					break
+ 				fi
+ 			done
+ 			;;
+ 		esac
+ 		[ "$MODULES_TO_REMOVE" ] || continue
+ 		echo "$MODULES_TO_REMOVE" >> /var/run/alsa/modules-removed
+ 		for M in $MODULES_TO_REMOVE ; do
+ 			echo -n " ${M}"
+ 			modprobe -r "$M" >/dev/null 2>&1 || :
+ 		done
+ 	done
+ 	if [ -f /var/run/alsa/modules-removed ] ; then
+ 		MODULES_STILL_LOADED="$(echo_snd_modules_loaded | grep -F -f /var/run/alsa/modules-removed)"
+ 		MODULES_STILL_LOADED="$(echo $MODULES_STILL_LOADED)"
+ 	else
+ 		MODULES_STILL_LOADED=""
+ 	fi
+ 	if [ "$MODULES_STILL_LOADED" ] ; then
+ 		echo " (failed: modules still loaded: ${MODULES_STILL_LOADED})."
+ 		return 1
+ 	else
+ 		echo "."
+ 		return 0
+ 	fi
+ }
+ 
+ # $* MODULE-NAME [MODULE-NAME]... | "all"
+ force_unload_modules()
+ {
+ 	kill_procs_using_sound || :
+ 	unload_modules "$@" || return 1
+ 	return 0
+ }
+ 
+ load_unloaded_modules()
+ {
+ 	LUM_RETURNSTATUS=0
+ 	MODULES_TO_LOAD=""
+ 	[ -d /var/run/alsa ] || mkdir -p /var/run/alsa
+ 	echo -n "Loading ALSA sound driver modules:"
+ 	[ -f /var/run/alsa/modules-removed ] && MODULES_TO_LOAD="$(echo $(cat /var/run/alsa/modules-removed))"
+ 	[ "$MODULES_TO_LOAD" ] || { echo " (none to reload)." ; return $LUM_RETURNSTATUS ; }
+ 	echo -n " $MODULES_TO_LOAD"
+ 	for MDL in $MODULES_TO_LOAD ; do
+ 		modprobe $MDL || LUM_RETURNSTATUS=1
+ 	done
+ 	case "$LUM_RETURNSTATUS" in
+ 	  0) echo "." ;;
+ 	  *) echo " (failed)." ;;
+ 	esac
+ 	return $LUM_RETURNSTATUS
+ }
+ 
+ case "$1" in
+   unload)
+ 	unload_modules all || exit $?
+ 	;;
+   reload)
+ 	EXITSTATUS=0
+ 	unload_modules all || EXITSTATUS=1
+ 	load_unloaded_modules || EXITSTATUS=1
+ 	exit $EXITSTATUS
+ 	;;
+   force-unload)
+ 	force_unload_modules all || exit $?
+ 	;;
+   force-reload)
+ 	EXITSTATUS=0
+ 	force_unload_modules all || EXITSTATUS=1
+ 	load_unloaded_modules || EXITSTATUS=1
+ 	exit $EXITSTATUS
+ 	;;
+   suspend)
+ 	case "$force_unload_modules_before_suspend" in
+ 	  ""|false) : ;;
+ 	  all|true) force_unload_modules all || exit $? ;;
+ 	  *) force_unload_modules $force_unload_modules_before_suspend || exit $? ;;
+ 	esac
+ 	;;
+   resume)
+ 	case "$force_unload_modules_before_suspend" in
+ 	  ""|false) : ;;
+ 	  *) load_unloaded_modules || exit $? ;;
+ 	esac
+ 	;;
+   *)
+ 	echo "Usage: $MYNAME {unload|reload|force-unload|force-reload|suspend|resume}" >&2
+ 	exit 3
+ 	;;
+ esac
--8<------------------------schnapp------------------------->8---

-- 
"Physics is like sex. Sure, it may give some practical results, but
that's not why we do it." --Richard Feynman






More information about the ubuntu-users mailing list