Hello, I have an Creative Audigy 2 NX USB soundcard and other USB devices like a mouse and a keyboard plugged into my laptop. So, naturally, I like having hotplug installed on my box. But... Whenever I shutdown my box I get this: /usr/bin/alsactl:save state:1061:no soundcards found I assume it's directly related to hotplugging. It doesn't matter in what runlevels I put alsasound and hotplug, hotplug stops first when shutting down. I think when hotplug shuts down it removes all my sound modules and the other usb modules. Afterwards ALSA tries to shutdown but before it wants to save the mixer values. But hotplug has already removed the device and ALSA can't find the sound state. I tried, really, every possible runlevel mixing: alsasound in boot, hotplug in boot alsasound in boot, hotplug in default and so on.... But it doesn't matter how I put them, hotplug always shuts down first. I could put all the snd* and usb modules in /etc/hotplug/blacklist I guess, but that would be totally wrong, because I installed hotplug to handle usb hotplug devices :) So, I hope I expressed my dilemma properly :) I hope someone smarter than me finds a solution :) Laters Sebastian Reproducible: Always Steps to Reproduce: 1. Get an USB soundcard 2. Install alsasound and hotplug in some runlevel 3. Reboot 4. Shut down your box Actual Results: Sound states are not saved Expected Results: Sound states are saved Portage 2.0.50-r9 (default-x86-2004.0, gcc-3.3.3, glibc-2.3.3.20040420-r0, 2.6.7-gentoo-r11) ================================================================= System uname: 2.6.7-gentoo-r11 i686 Intel(R) Pentium(R) M processor 1400MHz Gentoo Base System version 1.4.16 Autoconf: sys-devel/autoconf-2.59-r3 Automake: sys-devel/automake-1.8.3 ACCEPT_KEYWORDS="x86" AUTOCLEAN="yes" CFLAGS="-O3 -march=pentium3 -mmmx -msse -msse2 -mfpmath=sse -fomit-frame-pointer -pipe" CHOST="i686-pc-linux-gnu" COMPILER="gcc3" CONFIG_PROTECT="/etc /usr/X11R6/lib/X11/xkb /usr/kde/2/share/config /usr/kde/3/share/config /usr/lib/mozilla/defaults/pref /usr/share/config /usr/share/texmf/dvipdfm/config/ /usr/share/texmf/dvips/config/ /usr/share/texmf/tex/generic/config/ /usr/share/texmf/tex/platex/config/ /usr/share/texmf/xdvi/ /var/qmail/control"CONFIG_PROTECT_MASK="/etc/gconf /etc/terminfo /etc/env.d" CXXFLAGS="-O3 -march=pentium3 -mmmx -msse -msse2 -mfpmath=sse -fomit-frame-pointer -pipe" DISTDIR="/usr/portage/distfiles" FEATURES="autoaddcvs ccache sandbox" GENTOO_MIRRORS="ftp://mirrors.sec.informatik.tu-darmstadt.de/gentoo/ http://mirrors.sec.informatik.tu-darmstadt.de/gentoo/ http://128.213.5.34/gentoo/ http://gentoo.mirror.sdv.fr" MAKEOPTS="-j2" PKGDIR="/usr/portage/packages" PORTAGE_TMPDIR="/var/tmp" PORTDIR="/usr/portage" PORTDIR_OVERLAY="/usr/local/portage" SYNC="rsync://rsync.gentoo.org/gentoo-portage" USE="berkdb gdbm mmx ncurses nls pam perl pwdb python readline sse ssl tcpd x86 zlib"
does putting a 'use hotplug' in the depend() section of the alsasound ebuild cause it to work properly for you?
Hello! No, that doesn't help. I tried what you suggested but still hotplug shuts down before alsa. Greetings Sebastian
Sebastian, I presume you already tried this but just to be sure there are no other hidden dependencies. If you manually do a '/etc/init.d/alsasound stop' before the shutdown I works gracefully stops and saves settings? Are you using sys-apps/sysvinit or any other init process?
Hello Frank! I tried what you said. I removed /etc/asound.state before doing this. After shutting down alsasound /etc/asound.state was there again. So the state of the devices was saved. But something went wrong while alsasound tried to unload the modules. Maybe hotplug just reinserted them instantly. And I never played with sys-apps/sysvinit. Here's what I did: sk@blood sk $ su - Password: blood root # rm /etc/asound.state blood root # /etc/init.d/alsasound status * status: started blood root # /etc/init.d/hotplug status * status: started blood root # /etc/init.d/alsasound stop * WARNING: you are stopping a boot service. * Unloading ALSA... * Storing ALSA Mixer Levels * Unloading modules [ !! ] [ ok ]blood root # cat /etc/asound.state state.NX { control.1 { comment.access 'read write' comment.type BOOLEAN iface MIXER name 'Speaker Playback Switch' value true } control.2 { comment.access 'read write' comment.type INTEGER comment.range '0 - 207' iface MIXER name 'Speaker Playback Volume' value.0 207 value.1 207 } control.3 { comment.access 'read write' comment.type BOOLEAN iface MIXER name 'Speaker Playback Switch' index 1 value true } control.4 { comment.access 'read write' comment.type INTEGER comment.range '0 - 231' iface MIXER name 'Speaker Playback Volume' index 1 value.0 207 value.1 207 } control.5 { comment.access 'read write' comment.type BOOLEAN iface MIXER name 'Speaker Playback Switch' index 2 value true } control.6 { comment.access 'read write' comment.type INTEGER comment.range '0 - 183' iface MIXER name 'Speaker Playback Volume' index 2 value.0 183 value.1 183 value.2 183 value.3 183 value.4 183 value.5 159 value.6 159 value.7 159 } control.7 { comment.access 'read write' comment.type BOOLEAN iface MIXER name 'Speaker Playback Switch' index 3 value true } control.8 { comment.access 'read write' comment.type ENUMERATED comment.item.0 Mixer comment.item.1 Mixer iface MIXER name 'Headphone Playback Source' value Mixer } control.9 { comment.access 'read write' comment.type BOOLEAN iface MIXER name 'Headphone Playback Switch' value true } control.10 { comment.access 'read write' comment.type ENUMERATED comment.item.0 Mixer comment.item.1 PCM comment.item.2 'Input 2' iface MIXER name 'Digital In Playback Source' value Mixer } control.11 { comment.access 'read write' comment.type BOOLEAN iface MIXER name 'Digital In Playback Switch' value true } control.12 { comment.access 'read write' comment.type INTEGER comment.range '0 - 46' iface MIXER name 'PCM Capture Volume' value 46 } control.13 { comment.access 'read write' comment.type INTEGER comment.range '0 - 46' iface MIXER name 'PCM Capture Volume' index 1 value 46 } control.14 { comment.access 'read write' comment.type INTEGER comment.range '0 - 46' iface MIXER name 'PCM Capture Volume' index 2 value 46 } control.15 { comment.access 'read write' comment.type ENUMERATED comment.item.0 'Input 0' comment.item.1 'Input 1' comment.item.2 Mixer iface MIXER name 'PCM Capture Source' value 'Input 0' } } blood root # lsmod Module Size Used by radeon 120356 2 snd_usb_audio 64288 1 snd_rawmidi 17344 1 snd_usb_audio snd_pcm 81224 1 snd_usb_audio snd_page_alloc 8584 1 snd_pcm snd_timer 20356 1 snd_pcm snd 39928 6 snd_usb_audio,snd_rawmidi,snd_pcm,snd_timer soundcore 7200 1 snd ehci_hcd 24772 0 uhci_hcd 27856 0 usbhid 21888 0 usbcore 94432 6 snd_usb_audio,ehci_hcd,uhci_hcd,usbhid evdev 6976 1 8139too 19712 0 crc32 3840 1 8139too When I do a '/etc/init.d/hotplug stop' every modules gets unloaded. So naturally snd-modules, too. What about compiling drivers into the kernel instead compiling them as modules? Would hotplug then be out of work? Does hotplug just load and unload modules while it detects hardware devices being plugged into or out of the computer? Or is that just one thing hotplug can do? Does hotplug call alsasound when it detects a sounddevice inserted into the computer? Thanks for your help! Sebastian
Uups, forgot something: blood root # emerge -s sysvinit Searching... [ Results for search key : sysvinit ] [ Applications found : 1 ] * sys-apps/sysvinit Latest version available: 2.83-r1 Latest version installed: [ Not Installed ] Size of downloaded files: 88 kB Homepage: http://freshmeat.net/projects/sysvinit/ Description: System initialization stuff License: GPL-2 blood root # I hope this isn't wrong :) I never bothered with init scripts. But I think sysvinit gets emerged with baselayout: blood root # emerge -s baselayout Searching... [ Results for search key : baselayout ] [ Applications found : 2 ] * sys-apps/baselayout Latest version available: 1.9.4-r3 Latest version installed: 1.9.4-r3 Size of downloaded files: 197 kB Homepage: http://www.gentoo.org/ Description: Base layout for Gentoo Linux (incl. initscripts and sysvinit) License: GPL-2 * sys-apps/baselayout-lite [ Masked ] Latest version available: 1.0_pre1 Latest version installed: [ Not Installed ] Size of downloaded files: 2 kB Homepage: http://www.gentoo.org/proj/en/base/embedded/ Description: Baselayout for embedded systems License: GPL-2 blood root # Laters Sebastian
hotplug loads modules for the devices it detects when it starts. Additionally, when something is added or removed from the system, it adds or removes the module. The problem here is that alsasound loads its own modules based on what is in your modules.conf file, BUT hotplug sets up usb on most systems... The "right way" to do this would be to have alsasound start after hotplug and stop before hotplug... which the 'use hotplug' should accomplish... Please show me what happens when you do '/etc/init.d/hotplug restart' and '/etc/init.d/alsasound restart'
Hello Jeremy, this happens: blood root # /etc/init.d/alsasound status * status: started blood root # /etc/init.d/hotplug status * status: started blood root # /etc/init.d/hotplug restart * WARNING: you are stopping a boot service. * Stopping input hotplugging... [ ok ] * Stopping pci hotplugging... [ ok ] * Stopping usb hotplugging... [ ok ] * Starting input hotplugging... [ ok ] * Starting pci hotplugging... [ ok ] * Starting usb hotplugging... [ ok ]blood root # /etc/init.d/alsasound restart * WARNING: you are stopping a boot service. * Unloading ALSA... * Storing ALSA Mixer Levels * Unloading modules [ ok ] * Loading ALSA drivers... * Loading: snd_usb_audio * Running card-dependent scripts * Restoring Mixer Levels [ ok ]blood root # Looks good I think. But after restarting hotplug the soundcard is muted. Alsasound doesn't know that hotplug has removed and reinserted the soundcards drivers. So alsasound doesn't know that the device was muted because of this. When alsasound restarts, it first saves the muted state, the reinits the card in this muted state. That sounds totally logical to me, but it's not what people want I guess. What about non-usb soundcards? This never happened to me with a non-usb soundcard. Even when its driver was compiled as a module. Greetings Sebastian
Right. I know why the sound is muting, etc... the thing is, adding the 'use hotplug' to your alsasound's depend() should have forced alsasound to restart with hotplug... ie: $ hotplug restart alsaound stops hotplug stops hotplug starts alsasound starts Please attach your modified alsasound init script so I can check it out...
Created attachment 36277 [details] alsasound init script
Ok, thanks... I'll look into this later... for now, I recommend emerging 'aumix' and adding it to your 'default' run level... that way your sound will be saved/restored on boot/halt.
Hi, just for the memory of this bug: I just noticed similar problems for hotplug/alsasound with a pci soundcard. So there should be a dependence in both of them. See Bug #51998 Is there something new in this problem? Nikolaus
ok... I modified the alsasound script to actually run after hotplug rather than before. This makes it a bit cleaner, IMO. Please emerge sync and try the new script. Reopen if you still have issues.