Skip to contentSkip to conversation

snd-usb-audio hang when rmmoding after unplugging midisport1x1

DISCUSSION Mathieu Geli 4 participants 13 messages Mar 11, 2004 – Mar 23, 2004

lore
Share & tools
lore
#0 lore raw

Hello, I've got this 'big' problem for the hotplug feature:

I'm trying to plug/unplug the midisport1x1 from M-Audio. The plug works like a charm, hotplug does its job, load the firmware (fxload) and snd-usb-audio, if not inserted, is auto-loaded. But <hen I unplug the device, and I want to plug it again, the usb just hang, trying to rmmoding snd-usb-audio or anything else usb related will just hang.

I've disabled alsa in the kernel, installed instead alsa-driver-1.0.3rc2, and confiured it with intel8x0 (I'm on a dell inspiron 8200 laptop) , usb-audio and sequencer.

My kernel is a 2.6.3rc4, I'm using debian unstable.

the hid and uhci-hcd are modules, and autoloaded at boot via the "uhci-hcd" line in /etc/modules I've cleaned anything snd- related in the modules.conf and so far that works.

### dmesg gives ###

usb 2-1: USB disconnect, address 2
usb 2-1: new full speed USB device using address 3 usb 2-1: USB disconnect, address 3
usb 2-1: new full speed USB device using address 4 drivers/usb/core/usb.c: registered new driver snd-usb-audio

* ok the device has been plugged and works fine, led blinking *
* now let's unplug it *

drivers/usb/core/usb.c: deregistering driver snd-usb-audio
ALSA /home/mathieu/alsa-driver-1.0.3rc2/alsa-kernel/usb/usbmidi.c:148: urb status -104 ALSA /home/mathieu/alsa-driver-1.0.3rc2/alsa-kernel/usb/usbmidi.c:134: usb_submit_urb: -32

I've tryed to comment out, and do some silly modifications in this file, but doesn't have any effect. So I'm wondering if I'll see one day the hotpug for my new midi device wworking ... :/

If you guys have a solution, well... that'll be a good relief :)

Cheers,

Mathieu

PS: maybe an lsusb -v could as well help...

Bus 002 Device 004: ID 0763:1011 Midiman
Device Descriptor:
bLength 18
bDescriptorType 1
bcdUSB 1.00

  bDeviceClass            0 (Defined at Interface level)
  bDeviceSubClass         0 
  bDeviceProtocol         0 
  bMaxPacketSize0        64
  idVendor           0x0763 Midiman
  idProduct          0x1011 
  bcdDevice            1.21
  iManufacturer           0 
  iProduct                0 
  iSerial                 0 
  bNumConfigurations      1

Configuration Descriptor:
bLength 9
bDescriptorType 2
wTotalLength 39
bNumInterfaces 1
bConfigurationValue 1
iConfiguration 0
bmAttributes 0xa0
Remote Wakeup
MaxPower 0mA
Interface Descriptor:
bLength 9
bDescriptorType 4
bInterfaceNumber 0
bAlternateSetting 0
bNumEndpoints 3
bInterfaceClass 255 Vendor Specific Class
bInterfaceSubClass 0
bInterfaceProtocol 0
iInterface 0
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x81 EP 1 IN
bmAttributes 3
Transfer Type Interrupt
Synch Type None
Usage Type Data
wMaxPacketSize 0x0020 bytes 32 once
bInterval 1
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x82 EP 2 IN
bmAttributes 2
Transfer Type Bulk
Synch Type None
Usage Type Data
wMaxPacketSize 0x0020 bytes 32 once
bInterval 0
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x02 EP 2 OUT
bmAttributes 2
Transfer Type Bulk
Synch Type None
Usage Type Data
wMaxPacketSize 0x0020 bytes 32 once
bInterval 0

Bus 002 Device 001: ID 0000:0000
Device Descriptor:
bLength 18
bDescriptorType 1
bcdUSB 1.10

  bDeviceClass            9 Hub
  bDeviceSubClass         0 
  bDeviceProtocol         0 
  bMaxPacketSize0         8
  idVendor           0x0000 
  idProduct          0x0000 
  bcdDevice            2.06
  iManufacturer           3 
  iProduct                2 
  iSerial                 1 
  bNumConfigurations      1

Configuration Descriptor:
bLength 9
bDescriptorType 2
wTotalLength 25
bNumInterfaces 1
bConfigurationValue 1
iConfiguration 0
bmAttributes 0x40
Self Powered
MaxPower 0mA
Interface Descriptor:
bLength 9
bDescriptorType 4
bInterfaceNumber 0
bAlternateSetting 0
bNumEndpoints 1
bInterfaceClass 9 Hub
bInterfaceSubClass 0
bInterfaceProtocol 0
iInterface 0
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x81 EP 1 IN
bmAttributes 3
Transfer Type Interrupt
Synch Type None
Usage Type Data
wMaxPacketSize 0x0002 bytes 2 twice
bInterval 255

Bus 001 Device 002: ID 046d:c012 Logitech, Inc. Optical Mouse Device Descriptor:
bLength 18
bDescriptorType 1
bcdUSB 2.00

  bDeviceClass            0 (Defined at Interface level)
  bDeviceSubClass         0 
  bDeviceProtocol         0 
  bMaxPacketSize0         8
  idVendor           0x046d Logitech, Inc.
  idProduct          0xc012 Optical Mouse
  bcdDevice           13.20
  iManufacturer           1 
  iProduct                2 
  iSerial                 0 
  bNumConfigurations      1

Configuration Descriptor:
bLength 9
bDescriptorType 2
wTotalLength 34
bNumInterfaces 1
bConfigurationValue 1
iConfiguration 0
bmAttributes 0xa0
Remote Wakeup
MaxPower 98mA
Interface Descriptor:
bLength 9
bDescriptorType 4
bInterfaceNumber 0
bAlternateSetting 0
bNumEndpoints 1
bInterfaceClass 3 Human Interface Devices
bInterfaceSubClass 1 Boot Interface Subclass
bInterfaceProtocol 2 Mouse
iInterface 0
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x81 EP 1 IN
bmAttributes 3
Transfer Type Interrupt
Synch Type None
Usage Type Data
wMaxPacketSize 0x0004 bytes 4 three times
bInterval 10
HID Device Descriptor:
bLength 9
bDescriptorType 33
bcdHID 1.10
bCountryCode 0
bNumDescriptors 1
bDescriptorType 34 Report
wDescriptorLength 52

Bus 001 Device 001: ID 0000:0000
Device Descriptor:
bLength 18
bDescriptorType 1
bcdUSB 1.10

  bDeviceClass            9 Hub
  bDeviceSubClass         0 
  bDeviceProtocol         0 
  bMaxPacketSize0         8
  idVendor           0x0000 
  idProduct          0x0000 
  bcdDevice            2.06
  iManufacturer           3 
  iProduct                2 
  iSerial                 1 
  bNumConfigurations      1

Configuration Descriptor:
bLength 9
bDescriptorType 2
wTotalLength 25
bNumInterfaces 1
bConfigurationValue 1
iConfiguration 0
bmAttributes 0x40
Self Powered
MaxPower 0mA
Interface Descriptor:
bLength 9
bDescriptorType 4
bInterfaceNumber 0
bAlternateSetting 0
bNumEndpoints 1
bInterfaceClass 9 Hub
bInterfaceSubClass 0
bInterfaceProtocol 0
iInterface 0
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x81 EP 1 IN
bmAttributes 3
Transfer Type Interrupt
Synch Type None
Usage Type Data
wMaxPacketSize 0x0002 bytes 2 twice
bInterval 255

Something strange I just notice is, even if the device is inplugged (after rmmoding and bugging all usb) I can do:

$> sudo umount /proc/bus/usb
$> lsusb

$> sudo mount /proc/bus/usb
$> lsusb
Bus 002 Device 004: ID 0763:1011 Midiman
Bus 002 Device 001: ID 0000:0000
Bus 001 Device 002: ID 046d:c012 Logitech, Inc. Optical Mouse Bus 001 Device 001: ID 0000:0000
$>

ok the usbfs is probably totally dead and shows the last working state... hey but my mouse is still working fine (in condition I don't unplug and replug it ^^ )

-------------------------------------------------------
This SF.Net email is sponsored by: IBM Linux Tutorials Free Linux tutorial presented by Daniel Robbins, President and CEO of GenToo technologies. Learn everything from fundamentals to system administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click

#1 lore raw
Quoted 6 lines · Mathieu Geli

I'm trying to plug/unplug the midisport1x1 from M-Audio. The plug works like a charm, hotplug does its job, load the firmware (fxload) and snd-usb-audio, if not inserted, is auto-loaded. But <hen I unplug the device, and I want to plug it again, the usb just hang, trying to rmmoding snd-usb-audio or anything else usb related will just hang.

There was a bug which has been fixed three days ago (after 1.0.3 came out). Either get the latest version from the CVS, or apply the patch below.

HTH
Clemens

Signature · 29 lines
--- alsa-kernel/usb/usbmidi.c	3 Mar 2004 11:35:15 -0000	1.24
+++ alsa-kernel/usb/usbmidi.c	8 Mar 2004 09:34:05 -0000	1.25
@@ -453,8 +453,16 @@
 	usbmidi_out_port_t* port = (usbmidi_out_port_t*)substream->runtime->private_data;

 	port->active = up;
-	if (up)
+	if (up) {
+		if (port->ep->umidi->chip->shutdown) {
+			/* gobble up remaining bytes to prevent wait in
+			 * snd_rawmidi_drain_output */
+			while (!snd_rawmidi_transmit_empty(substream))
+				snd_rawmidi_transmit_ack(substream, 1);
+			return;
+		}
 		tasklet_hi_schedule(&port->ep->tasklet);
+	}
 }

 static int snd_usbmidi_input_open(snd_rawmidi_substream_t* substream)




-------------------------------------------------------
This SF.Net email is sponsored by: IBM Linux Tutorials
Free Linux tutorial presented by Daniel Robbins, President and CEO of
GenToo technologies. Learn everything from fundamentals to system
administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click
#2 lore raw

Thanks for your reply,

ok, what I did, is first to apply your patch to my source tree (1.0.3rc2), clean, compile, install, and even reboot. That doesn't output anymore the two lines "urb status -104", and "usb_submit_urb: -32" but still hang after printing:
"drivers/usb/core/usb.c: deregistering driver snd-usb-audio"

So I have dl the CVS and reinstalled alsa-driver. That just have the same effect :/

Mathieu

-------------------------------------------------------
This SF.Net email is sponsored by: IBM Linux Tutorials Free Linux tutorial presented by Daniel Robbins, President and CEO of GenToo technologies. Learn everything from fundamentals to system administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click

#3 lore raw

sorry about my fuzzy observations, my bad, even with the last CVS I got those errors line when rmmoding snd-usb-audio, while the device is on. (I didn't redo the same actions than before) Is there any way to maybe unplug the device safely (usbfs point of view) ? I was guessing smtgh like a fxUNload programm.
There is obviously something from the midisport1x1 who bugs snd-usb-audio. Indepandently they works both fine :)

Maybe I've a easy view 'bout how the things are working, but I would expect from snd-usb-audio a timeout, after which he gives up, trying to communicate with the device if nothnig happens.

Cheers,

Mathieu

-------------------------------------------------------
This SF.Net email is sponsored by: IBM Linux Tutorials Free Linux tutorial presented by Daniel Robbins, President and CEO of GenToo technologies. Learn everything from fundamentals to system administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click

#4 lore raw

I've the same symptom. Even with kernel 2.6.4 and the patch provided by Clemens. I own a Midisport 4x4. So it seems not to be model specific.
Initialzing is fine. But unplugin/replugin will request a reboot with sysrq intervention. First I've had enabled the USB 2.0 features on my motherboard with the same effect. But with the disadvantage not _receiving_ any MIDI messages. Sending was quite fine. So I switched to USB 1.1 in the BIOS and receiving was been although possible.

Regards, Hartmut

-------------------------------------------------------
This SF.Net email is sponsored by: IBM Linux Tutorials Free Linux tutorial presented by Daniel Robbins, President and CEO of GenToo technologies. Learn everything from fundamentals to system administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click

#5 lore raw
In reply to Mathieu Geli
Quoted 5 lines · Mathieu Geli

ok, what I did, is first to apply your patch to my source tree (1.0.3rc2), clean, compile, install, and even reboot. That doesn't output anymore the two lines "urb status -104", and "usb_submit_urb: -32" but still hang after printing:
"drivers/usb/core/usb.c: deregistering driver snd-usb-audio"

It seems to work fine on my 2.4.25 kernel.

Can you unload the snd-usb-audio module? If not, please apply the patch below to see whether the driver or the USB core is the culprit.

Regards,
Clemens

Signature · 27 lines
--- alsa-kernel/usb/usbaudio.c	8 Mar 2004 09:29:51 -0000	1.87
+++ alsa-kernel/usb/usbaudio.c	12 Mar 2004 12:05:22 -0000
@@ -2928,6 +2928,7 @@
 		return;

 	chip = snd_magic_cast(snd_usb_audio_t, ptr, return);
+	snd_printk(KERN_INFO "snd_usb_audio_disconnect called, refcount = %d\n", chip->num_interfaces);
 	card = chip->card;
 	down(&register_mutex);
 	chip->shutdown = 1;
@@ -2947,6 +2948,7 @@
 	} else {
 		up(&register_mutex);
 	}
+	snd_printk(KERN_INFO "snd_usb_audio_disconnect finished!\n");
 }

 /*




-------------------------------------------------------
This SF.Net email is sponsored by: IBM Linux Tutorials
Free Linux tutorial presented by Daniel Robbins, President and CEO of
GenToo technologies. Learn everything from fundamentals to system
administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click
#6 lore raw

Re: snd-usb-audio and midisport1x1 little hack fixes hotplug pb

Ok, I applied your second patch, and get this dmesg output:

drivers/usb/core/usb.c: deregistering driver snd-usb-audio
ALSA /home/mathieu/alsa-driver/usb/usbaudio.c:2944: snd_usb_audio_disconnect called, refcount = 1 ALSA /home/mathieu/alsa-driver/usb/usbaudio.c:2944: snd_usb_audio_disconnect called, refcount = 0 ALSA /home/mathieu/alsa-driver/alsa-kernel/usb/usbmidi.c:148: urb status -104 ALSA /home/mathieu/alsa-driver/alsa-kernel/usb/usbmidi.c:134: usb_submit_urb: -32

At this point the usb was down not responding anymore, like in the past.

what I did next, is put double each interesting lines printk, what I get is, that the rmmod of the driver was hanging on the midi ressources cleaning stuff. Hum, first reflex: I just comment out those 3 lines =) and guess what.. that works fine now. I tried to plug/unplug several times my mouse, the midisport, and everything works fine, so... I don't really know what was the bug's reason, but as long as that works I'm happy ;-)
Probably Takashi Iwai who seems to has coded it should once have a look to understand the 'why' question.

Cheers,

Mathieu
--

Here is finally the modifications I applied:

usb/usbmidi.c +9 -1
@@ -453,8 +453,16 @@
 	usbmidi_out_port_t* port = (usbmidi_out_port_t*)substream->runtime->private_data;
 
 	port->active = up;
-	if (up)
+	if (up) {
+		if (port->ep->umidi->chip->shutdown) {
+			/* gobble up remaining bytes to prevent wait in
+			 * snd_rawmidi_drain_output */
+			while (!snd_rawmidi_transmit_empty(substream))
+				snd_rawmidi_transmit_ack(substream, 1);
+			return;
+		}
 		tasklet_hi_schedule(&port->ep->tasklet);
+	}
 }
 
 static int snd_usbmidi_input_open(snd_rawmidi_substream_t* substream)
usb/usbaudio.c +3 -3
@@ -2939,9 +2939,9 @@
                        snd_usb_stream_disconnect(p, &usb_audio_driver);
                }
                /* release the midi resources */
-               list_for_each(p, &chip->midi_list) {
-                       snd_usbmidi_disconnect(p, &usb_audio_driver);
-               }
+               /* list_for_each(p, &chip->midi_list) { */
+               /* snd_usbmidi_disconnect(p, &usb_audio_driver); */
+               /* } */
                up(&register_mutex);
                snd_card_free_in_thread(card);
        } else {

-------------------------------------------------------
This SF.Net email is sponsored by: IBM Linux Tutorials Free Linux tutorial presented by Daniel Robbins, President and CEO of GenToo technologies. Learn everything from fundamentals to system administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click

#7 lore raw

Re: snd-usb-audio and midisport1x1 little hack fixes hotplug pb

Salut Mathieu,

that fixes the issue with the 4x4 as well.

Let's see what Takashi is thinking about to comment his code. ;-)

Regards, Hartmut

-------------------------------------------------------
This SF.Net email is sponsored by: IBM Linux Tutorials Free Linux tutorial presented by Daniel Robbins, President and CEO of GenToo technologies. Learn everything from fundamentals to system administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click

#8 lore raw

Re: snd-usb-audio and midisport1x1 little hack fixes hotplug pb

In reply to Mathieu Geli

At Sat, 13 Mar 2004 04:32:34 +0100,

Quoted 8 lines · Mathieu Geli

Ok, I applied your second patch, and get this dmesg output:

drivers/usb/core/usb.c: deregistering driver snd-usb-audio
ALSA /home/mathieu/alsa-driver/usb/usbaudio.c:2944: snd_usb_audio_disconnect called, refcount = 1 ALSA /home/mathieu/alsa-driver/usb/usbaudio.c:2944: snd_usb_audio_disconnect called, refcount = 0 ALSA /home/mathieu/alsa-driver/alsa-kernel/usb/usbmidi.c:148: urb status -104 ALSA /home/mathieu/alsa-driver/alsa-kernel/usb/usbmidi.c:134: usb_submit_urb: -32

this means that the urbs are still active. i'm not sure whether these messages appear after or before calling snd_usbmidi_disconnect(), though.

Quoted 10 lines

At this point the usb was down not responding anymore, like in the past.

what I did next, is put double each interesting lines printk, what I get is, that the rmmod of the driver was hanging on the midi ressources cleaning stuff.
Hum, first reflex: I just comment out those 3 lines =) and guess what.. that works fine now. I tried to plug/unplug several times my mouse, the midisport, and everything
works fine, so... I don't really know what was the bug's reason, but as long as that works I'm happy ;-)

i also don't know yet why disconnect() call hangs up. could you check at which point it happens by adding printk()'s in snd_usbmidi_disconnect()?

the resource release can work even without disconnect() call, since the clean up will be done later also by the workqueue when all devices are closed properly. the disconnect function should shut up possible hardware features immediately.

Takashi

-------------------------------------------------------
This SF.Net email is sponsored by: IBM Linux Tutorials Free Linux tutorial presented by Daniel Robbins, President and CEO of GenToo technologies. Learn everything from fundamentals to system administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click

#9 lore raw

Re: snd-usb-audio and midisport1x1 little hack fixes hotplug pb

In reply to Mathieu Geli
Quoted 5 lines · Mathieu Geli

Ok, I applied your second patch, and get this dmesg output:

drivers/usb/core/usb.c: deregistering driver snd-usb-audio
ALSA /home/mathieu/alsa-driver/usb/usbaudio.c:2944: snd_usb_audio_disconnect called, refcount = 1 ALSA /home/mathieu/alsa-driver/usb/usbaudio.c:2944: snd_usb_audio_disconnect called, refcount = 0

Two calls to disconnect? Strange.

Quoted 2 lines

ALSA /home/mathieu/alsa-driver/alsa-kernel/usb/usbmidi.c:148: urb status -104 ALSA /home/mathieu/alsa-driver/alsa-kernel/usb/usbmidi.c:134: usb_submit_urb: -32

The driver tries to resubmit the URB although the device is being shut down. I don't think this causes the hang, but the patch below (already in CVS) fixes this. (-104 is -ECONNRESET which shouldn't occur when unlinking synchronously.)

Apparently, snd_usb_audio_disconnect hangs before returning. Please try to insert printk's in snd_usbmidi_disconnect as Takashi suggestes.

Regards,
Clemens

Signature · 39 lines
diff -u -r1.25 -r1.26
--- alsa-kernel/usb/usbmidi.c	8 Mar 2004 09:34:05 -0000	1.25
+++ alsa-kernel/usb/usbmidi.c	16 Mar 2004 16:36:05 -0000	1.26
@@ -143,8 +143,9 @@
 	if (status == -ENOENT)
 		return status; /* killed */
 	if (status == -EILSEQ ||
+	    status == -ECONNRESET ||
 	    status == -ETIMEDOUT)
-		return -ENODEV; /* device removed */
+		return -ENODEV; /* device removed/shutdown */
 	snd_printk(KERN_ERR "urb status %d\n", status);
 	return 0; /* continue */
 }
@@ -706,7 +707,6 @@
 	int i;

 	umidi = list_entry(p, snd_usb_midi_t, list);
-	usb_driver_release_interface(driver, umidi->iface);
 	for (i = 0; i < MIDI_MAX_ENDPOINTS; ++i) {
 		snd_usb_midi_endpoint_t* ep = &umidi->endpoints[i];
 		if (ep->out && ep->out->urb)
@@ -714,6 +714,7 @@
 		if (ep->in && ep->in->urb)
 			usb_unlink_urb(ep->in->urb);
 	}
+	usb_driver_release_interface(driver, umidi->iface);
 }

 static void snd_usbmidi_rawmidi_free(snd_rawmidi_t* rmidi)




-------------------------------------------------------
This SF.Net email is sponsored by: IBM Linux Tutorials
Free Linux tutorial presented by Daniel Robbins, President and CEO of
GenToo technologies. Learn everything from fundamentals to system
administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click
#10 lore raw

Re: snd-usb-audio and midisport1x1 little hack fixes hotplug pb

Quoted 3 lines · Clemens Ladisch

Apparently, snd_usb_audio_disconnect hangs before returning. Please try to insert printk's in snd_usbmidi_disconnect as Takashi suggestes.

I removed the quick hack from Mathieu and inserted snd_printk's in snd_usbmidi_disconnect.

The new function:

void snd_usbmidi_disconnect(struct list_head* p, struct usb_driver *driver)

{
        snd_usb_midi_t* umidi;
        int i;

        umidi = list_entry(p, snd_usb_midi_t, list);
        snd_printk(KERN_INFO "after list_entry\n");
//      usb_driver_release_interface(driver, umidi->iface);
        for (i = 0; i < MIDI_MAX_ENDPOINTS; ++i) {
        snd_printk(KERN_INFO "in for with i=%d\n",i);

                snd_usb_midi_endpoint_t* ep = &umidi->endpoints[i];
                if (ep->out && ep->out->urb)
                        usb_unlink_urb(ep->out->urb);
                        snd_printk(KERN_INFO "usb_unlink_urb out\n");

                if (ep->in && ep->in->urb)
                        usb_unlink_urb(ep->in->urb);
                        snd_printk(KERN_INFO "usb_unlink_urb in\n");

        }
        usb_driver_release_interface(driver, umidi->iface);
        snd_printk(KERN_INFO "after usb_driver_release_interface\n");
}

The output from dmesg I got:

ohci_hcd 0000:00:02.0: urb e2e2b4c0 path 2.4 ep1in 5e160000 cc 5 --> status -110 hub 1-2:1.0: port 4, status 100, change 1, 12 Mb/s
usb 1-2.4: USB disconnect, address 5
usb 1-2.4: usb_disable_device nuking all URBs
usb 1-2.4: unregistering interface 1-2.4:1.0
ALSA sound/usb/usbaudio.c:2924: snd_usb_audio_disconnect called, refcount = 1 ALSA sound/usb/usbmidi.c:710: after list_entry
ALSA sound/usb/usbmidi.c:714: in for with i=0
usb 1-2.4: hcd_unlink_urb e2e2b640 fail -22
ALSA sound/usb/usbmidi.c:719: usb_unlink_urb out
usb 1-2.4: hcd_unlink_urb e2e2b4c0 fail -22
ALSA sound/usb/usbmidi.c:723: usb_unlink_urb in
ALSA sound/usb/usbmidi.c:714: in for with i=1
usb 1-2.4: hcd_unlink_urb e2e2b3c0 fail -22
ALSA sound/usb/usbmidi.c:719: usb_unlink_urb out
ALSA sound/usb/usbmidi.c:723: usb_unlink_urb in
ALSA sound/usb/usbaudio.c:2924: snd_usb_audio_disconnect called, refcount = 0

Remember this is the output for a 4x4. (If this matters)

Kindly regards, Hartmut

-------------------------------------------------------
This SF.Net email is sponsored by: IBM Linux Tutorials Free Linux tutorial presented by Daniel Robbins, President and CEO of GenToo technologies. Learn everything from fundamentals to system administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click

#11 lore raw

Re: snd-usb-audio and midisport1x1 little hack fixes hotplug pb

Quoted 8 lines · Hartmut Geissbauer

I removed the quick hack from Mathieu and inserted snd_printk's in snd_usbmidi_disconnect.

The new function:
...

                if (ep->out && ep->out->urb)
                        usb_unlink_urb(ep->out->urb);
                        snd_printk(KERN_INFO "usb_unlink_urb out\n");

Please note that this is C, not Python. :-)

Quoted 6 lines

The output from dmesg I got:

ohci_hcd 0000:00:02.0: urb e2e2b4c0 path 2.4 ep1in 5e160000 cc 5 --> status -110 hub 1-2:1.0: port 4, status 100, change 1, 12 Mb/s
usb 1-2.4: USB disconnect, address 5
usb 1-2.4: usb_disable_device nuking all URBs

It seems we don't need to unlink the URBs as the kernel does this for us, but it doesn't hurt.

Quoted 3 lines

...
ALSA sound/usb/usbmidi.c:723: usb_unlink_urb in
ALSA sound/usb/usbaudio.c:2924: snd_usb_audio_disconnect called, refcount = 0

Apparently, snd_usb_audio_disconnect is called recursively, caused by the call to usb_driver_release_interface, and then deadlocks.

The USB core will release all interfaces automatically, so we don't need this call. Please remove the usb_driver_release_interface line.

HTH
Clemens

-------------------------------------------------------
This SF.Net email is sponsored by: IBM Linux Tutorials Free Linux tutorial presented by Daniel Robbins, President and CEO of GenToo technologies. Learn everything from fundamentals to system administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click

#12 lore raw

Re: [fixed] snd-usb-audio and midisport1x1 little hack fixes hotplug pb

Quoted 5 lines

Apparently, snd_usb_audio_disconnect is called recursively, caused by the call to usb_driver_release_interface, and then deadlocks.

The USB core will release all interfaces automatically, so we don't need this call. Please remove the usb_driver_release_interface line.

Sorry, in case of your're awaiting any response. It works.

Regards, Hartmut

-------------------------------------------------------
This SF.Net email is sponsored by: IBM Linux Tutorials Free Linux tutorial presented by Daniel Robbins, President and CEO of GenToo technologies. Learn everything from fundamentals to system administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click