Unplugging a currently playing USB audio (not MIDI) device results in a
big kernel oops.

When chip->shutdown is set, deactivate_urbs() doesn't do anything, but
that's the case where the URB unlinking is really needed.

And, in the shutdown case, the URBs must not be resubmitted. I'm not
really sure if reporting an xrun (like below) is a good idea; with the
changes below, aplay hangs (when draining?) after the device is unplugged.


Regards,
Clemens


--- usbaudio.c.orig     Tue Mar 11 22:14:48 2003
+++ usbaudio.c  Wed Mar 12 00:00:00 2003
@@ -545,6 +545,10 @@
                return;
        if (! subs->running) /* can be stopped during retire callback */
                return;
+       if (subs->stream->chip->shutdown) {
+               snd_pcm_stop(substream, SNDRV_PCM_STATE_XRUN);
+               return;
+       }
        if ((err = subs->ops.prepare(subs, substream->runtime, urb)) < 0 ||
            (err = usb_submit_urb(urb, GFP_ATOMIC)) < 0) {
                snd_printd(KERN_ERR "cannot submit urb (err = %d)\n", err);
@@ -570,6 +574,10 @@
                return;
        if (! subs->running) /* can be stopped during retire callback */
                return;
+       if (subs->stream->chip->shutdown) {
+               snd_pcm_stop(substream, SNDRV_PCM_STATE_XRUN);
+               return;
+       }
        if ((err = subs->ops.prepare_sync(subs, substream->runtime, urb))  < 0 ||
            (err = usb_submit_urb(urb, GFP_ATOMIC)) < 0) {
                snd_printd(KERN_ERR "cannot submit sync urb (err = %d)\n", err);
@@ -590,9 +598,6 @@
        int alive;

        subs->running = 0;
-
-       if (subs->stream->chip->shutdown) /* to be sure... */
-               return 0;

 #ifndef SND_USB_ASYNC_UNLINK
        if (in_interrupt())





-------------------------------------------------------
This SF.net email is sponsored by:Crypto Challenge is now open! 
Get cracking and register here for some mind boggling fun and 
the chance of winning an Apple iPod:
http://ads.sourceforge.net/cgi-bin/redirect.pl?thaw0031en
_______________________________________________
Alsa-devel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/alsa-devel

Reply via email to