Date: Thu, 14 Feb 2002 14:57:34 +0100 From: Rahul Siddharthan <rsidd@online.fr> To: multimedia@freebsd.org Subject: Detaching a PCM device (USB audio) Message-ID: <20020214135734.GA5060@lpt.ens.fr>
next in thread | raw e-mail | index | archive | help
I was trying to use the USB audio driver at http://www.mars.sphere.ne.jp/navi/uaudio/ and, basically, it's very prone to panicking the system. If I insert/remove it 2 or 3 times, a panic is almost guaranteed. It seems to me that the problem was in unregistering the PCM device: if I had used a mixer program at any point, when I pulled out the plug I'd get a kernel message "mixer: device busy" -- even if there was no mixer program currently running at that point. (a) I don't understand that message, (b) it seems to me that when you pull out a USB audio device, the corresponding pcm device should be unregistered, no matter what -- it doesn't exist any more. But when you reinsert it, if it was originally pcm1, it becomes pcm2 (because pcm1 never got unregistered) and so on. Now if I try using pcm1 as my audio device I get a guaranteed panic, but I get panics even if I use pcm2, the new device, as the audio device. I tried fixing the ua_detach function to forcibly unregister it on detaching. It works reasonably well -- now as long as I'm not actually playing audio, I can remove and attach the device any number of times, there's no "mixer busy" nonsense and no panics (yet). My ugly patch (I don't know the "correct" way to do it...) is at http://rsidd.free.fr/uaudio_pcm.c.diff But I still get a panic if I pull out the USB device while audio output is actually going on. It seems to me this may be because some audio output happens in the small timeframe after I pull out the device and before it gets properly "unregistered". Also, if I have a mixer program running, I pull out the USB device and reinsert it without closing the mixer program, then I try to use the old mixer again, I get a panic. (I can use a new mixer program without problems, and I can also close the old mixer program after the reinsertion as long as I don't touch the controls.) I suppose this is because the old mixer program is trying to control something that no longer exists.. Does anyone have any ideas? I'd very much like some help with this. I've written to the maintainer separately. Rahul To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-multimedia" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20020214135734.GA5060>