From owner-freebsd-questions@FreeBSD.ORG Wed Jan 3 08:41:17 2007 Return-Path: X-Original-To: freebsd-questions@freebsd.org Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 3852F16A403 for ; Wed, 3 Jan 2007 08:41:17 +0000 (UTC) (envelope-from LukeD@pobox.com) Received: from proof.pobox.com (proof.pobox.com [207.106.133.28]) by mx1.freebsd.org (Postfix) with ESMTP id ECC3D13C459 for ; Wed, 3 Jan 2007 08:41:16 +0000 (UTC) (envelope-from LukeD@pobox.com) Received: from proof (localhost [127.0.0.1]) by proof.pobox.com (Postfix) with ESMTP id 1BC9224C31 for ; Wed, 3 Jan 2007 03:41:38 -0500 (EST) Received: from border.crystalsphere.multiverse (pool-71-112-198-61.sttlwa.dsl-w.verizon.net [71.112.198.61]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by proof.sasl.smtp.pobox.com (Postfix) with ESMTP id 3A485A1D29 for ; Wed, 3 Jan 2007 03:41:37 -0500 (EST) Date: Wed, 3 Jan 2007 00:41:11 -0800 (PST) From: Luke Dean X-X-Sender: lukas@border.crystalsphere.multiverse To: freebsd-questions@freebsd.org In-Reply-To: <448xgl1ndb.fsf@be-well.ilk.org> Message-ID: <20070103002651.I20975@border.crystalsphere.multiverse> References: <20061230224805.U7072@border.crystalsphere.multiverse> <448xgl1ndb.fsf@be-well.ilk.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Subject: Re: How to reset /dev/dsp ? X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: Luke Dean List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 03 Jan 2007 08:41:17 -0000 On Tue, 2 Jan 2007, Lowell Gilbert wrote: > Luke Dean writes: > >> I'm running FreeBSD 6.1. >> >> My sound device shows up like this in my dmesg: >> pcm0: port 0xd800-0xd8ff,0xdc00-0xdc3f mem >> 0xfc001000-0xfc0011ff,0xfc002000-0xfc0020ff irq 17 at device 31.5 on >> pci0 >> pcm0: primary codec not ready! >> pcm0: >> >> My sound driver is compiled into the kernel: >> device sound >> device snd_ich >> >> I've got a java application that I run through >> diablo-jdk-1.5.0.07.01_1 that uses sound. It's a game. Partway >> through the game, the sound stops working. The people who make the >> game have been aware of the problem for many months, but don't >> understand what to do about it. >> Okay, I can accept that. >> >> What I can't accept is that this java application breaks the sound in >> such a way that NOTHING can play sound anymore until I reboot the >> machine! >> >> If I attempt to play a movie with mplayer after the game has broken >> the sound, it says: >> [AO OSS] audio_setup: Can't open audio device /dev/dsp: No such file >> or directory >> >> However, the dsp device still exists in /dev: >> [0:/dev> ll dsp* >> crw-rw-rw- 1 root wheel - 0, 51 Dec 29 21:36 dsp0.0 >> crw-rw-rw- 1 root wheel - 0, 54 Dec 29 21:37 dsp0.1 >> crw-rw-rw- 1 root wheel - 0, 52 Dec 29 19:24 dspW0.0 >> crw-rw-rw- 1 root wheel - 0, 55 Dec 29 19:24 dspW0.1 >> crw-rw-rw- 1 root wheel - 0, 57 Dec 29 19:24 dspr0.1 >> >> The sndstat device doesn't show any problem, if I'm reading the output >> right: >> [0:/dev> cat /dev/sndstat >> FreeBSD Audio Driver (newpcm) >> Installed devices: >> pcm0: at io 0xfc001000, 0xfc002000 irq 17 bufsz >> 16384 (1p/1r/0v channels duplex default) >> >> Is there anything I can do short of rebooting the machine to get my >> sound working when this happens? I thought maybe there was something >> I could do with devd or devctl to reset the device, but I can't figure >> out how to do that. I'm not even sure how to "see" the problem except >> to attempt to play a sound. > > Well, it's hard to say, because the hardware could be misbehaving, in > which case the software may not know what's going on. It might be > interesting to see whether fstat(1) sees anything holding the dsp > devices. You could also try using vchans, which would (in theory) let > you access the hardware from another device node after the first one > hangs. fstat reveals that nothing is holding the dsp devices after the sound breaks. I read a bit about vchans, then set up a few with "sysctl hw.snd.pcm0.vchans=4". I had to reboot first, because once the sound locks up, attempting to adjust this sysctl produces a "device busy" error. This produced some new dsp devices in /dev. I ran the java app again, broke the sound, and found that all of the vchans produce the same "device busy" error when I use mplayer switches to specify which vchan to use. (I was using commands like "mplayer -ao oss:/dev/dsp0.1 blah.avi" to test this.) Whatever this java app is doing to break the sound breaks it for all device nodes. Thanks for the idea anyway. I learned something.