Skip to contentSkip to conversation

snd-usb-audio hangs modprobe if switching dv camera betw. webcam / usb mass storage mode

DISCUSSION thomas schorpp 1 participant 4 messages Jul 31, 2005 – Aug 1, 2005

lore
Share & tools
lore
#0 lore raw

hello,

this bug is in conjunction with the older
"usb disconnect hangs keyboard" bug on lkml.

module-init-tools / hotplug hangs with snd-usb-audio if i switch/remove usb camera as stated above, if a client like kmix is attached. (strange, since this device has no mixers here).

if its not unavoidable, pls fix soon, thx. vanilla kernel 2.6.12.0.

Jul 31 10:35:58 tom1 kernel: usb 1-2: USB disconnect, address 3

...
killall kmix
...

Jul 31 10:42:08 tom1 kernel: usb 1-2: new full speed USB device using
uhci_hcd and address 4
Jul 31 10:42:08 tom1 kernel:
/usr/src/spca5xx-20050701/drivers/usb/spca5xx.c: USB SPCA5XX camera
found. Aiptek DV3500 Mpeg4
Jul 31 10:42:08 tom1 kernel:
/usr/src/spca5xx-20050701/drivers/usb/spca5xx.c: [spca5xx_probe:8652]
Camera type JPEG
Jul 31 10:42:08 tom1 kernel: ALSA sound/usb/usbaudio.c:2570: 4:3:1: add

audio endpoint 0x86

y
tom

-------------------------------------------------------
SF.Net email is sponsored by: Discover Easy Linux Migration Strategies from IBM. Find simple to follow Roadmaps, straightforward articles, informative Webcasts and more! Get everything you need to get up to speed, fast. http://ads.osdn.com/?ad_id=7477&alloc_id=16492&op=click

#1 lore raw
Quoted 25 lines · thomas schorpp

hello,

this bug is in conjunction with the older
"usb disconnect hangs keyboard" bug on lkml.

module-init-tools / hotplug hangs with snd-usb-audio if i switch/remove usb camera as stated above, if a client like kmix is attached. (strange, since this device has no mixers here).

if its not unavoidable, pls fix soon, thx. vanilla kernel 2.6.12.0.

Jul 31 10:35:58 tom1 kernel: usb 1-2: USB disconnect, address 3

...
killall kmix
...

Jul 31 10:42:08 tom1 kernel: usb 1-2: new full speed USB device using
uhci_hcd and address 4
Jul 31 10:42:08 tom1 kernel:
/usr/src/spca5xx-20050701/drivers/usb/spca5xx.c: USB SPCA5XX camera
found. Aiptek DV3500 Mpeg4
Jul 31 10:42:08 tom1 kernel:
/usr/src/spca5xx-20050701/drivers/usb/spca5xx.c: [spca5xx_probe:8652]
Camera type JPEG
Jul 31 10:42:08 tom1 kernel: ALSA sound/usb/usbaudio.c:2570: 4:3:1: add
Quoted 5 lines

audio endpoint 0x86

y
tom

/*
* Frees the device.
*/
static void usX2Y_usb_disconnect(struct usb_device* device, void* ptr)

{
	if (ptr) {
		usX2Ydev_t* usX2Y = usX2Y((snd_card_t*)ptr);
		struct list_head* p;
		usX2Y->chip.shutdown = 1;
		usX2Y->chip_status = USX2Y_STAT_CHIP_HUP;
		usX2Y_unlinkSeq(&usX2Y->AS04);
		usb_kill_urb(usX2Y->In04urb);
		snd_card_disconnect((snd_card_t*)ptr); <--- err handler? (1)
		/* release the midi resources */
		list_for_each(p, &usX2Y->chip.midi_list) {
			snd_usbmidi_disconnect(p, &snd_usX2Y_usb_driver);
		}
		if (usX2Y->us428ctls_sharedmem)
			wake_up(&usX2Y->us428ctls_wait_queue_head);
		snd_card_free((snd_card_t*)ptr); <---- hang
	}
}

int snd_card_free(snd_card_t * card)

{
	struct snd_shutdown_f_ops *s_f_ops;

	if (card == NULL)
		return -EINVAL;
	write_lock(&snd_card_rwlock);
	snd_cards[card->number] = NULL;
	write_unlock(&snd_card_rwlock);
#ifdef CONFIG_PM
	wake_up(&card->power_sleep);
#ifdef CONFIG_SND_GENERIC_PM
	if (card->pm_dev) {
		snd_generic_device_unregister(card->pm_dev); <--- not working here
		card->pm_dev = NULL;
	}

#endif
#endif

	/* wait, until all devices are ready for the free operation */
	wait_event(card->shutdown_sleep, card->files == NULL); <--- hang

(1)

	/* notify all devices that we are disconnected */
	err = snd_device_disconnect_all(card);
	if (err < 0)
		snd_printk(KERN_ERR "not all devices for card %i can be

disconnected\n", card->number); <-- not handled?

	return 0;	
}

-------------------------------------------------------
SF.Net email is sponsored by: Discover Easy Linux Migration Strategies from IBM. Find simple to follow Roadmaps, straightforward articles, informative Webcasts and more! Get everything you need to get up to speed, fast. http://ads.osdn.com/?ad_id=7477&alloc_id=16492&op=click

#2 lore raw
Quoted 34 lines · thomas schorpp
Quoted 25 lines · thomas schorpp

hello,

this bug is in conjunction with the older
"usb disconnect hangs keyboard" bug on lkml.

module-init-tools / hotplug hangs with snd-usb-audio if i switch/remove usb camera as stated above, if a client like kmix is attached. (strange, since this device has no mixers here).

if its not unavoidable, pls fix soon, thx. vanilla kernel 2.6.12.0.

Jul 31 10:35:58 tom1 kernel: usb 1-2: USB disconnect, address 3

...
killall kmix
...

Jul 31 10:42:08 tom1 kernel: usb 1-2: new full speed USB device using
uhci_hcd and address 4
Jul 31 10:42:08 tom1 kernel:
/usr/src/spca5xx-20050701/drivers/usb/spca5xx.c: USB SPCA5XX camera
found. Aiptek DV3500 Mpeg4
Jul 31 10:42:08 tom1 kernel:
/usr/src/spca5xx-20050701/drivers/usb/spca5xx.c: [spca5xx_probe:8652]
Camera type JPEG
Jul 31 10:42:08 tom1 kernel: ALSA sound/usb/usbaudio.c:2570: 4:3:1: add
Quoted 5 lines

audio endpoint 0x86

y
tom

Quoted 8 lines

/*
* Frees the device.
*/
static void usX2Y_usb_disconnect(struct usb_device* device, void* ptr)

{
	if (ptr) {
		usX2Ydev_t* usX2Y = usX2Y((snd_card_t*)ptr);
		struct list_head* p;

xxx check busy here and return "-EIBUSY" xxx ?

Quoted 16 lines
		usX2Y->chip.shutdown = 1;
		usX2Y->chip_status = USX2Y_STAT_CHIP_HUP;
		usX2Y_unlinkSeq(&usX2Y->AS04);
		usb_kill_urb(usX2Y->In04urb);
		snd_card_disconnect((snd_card_t*)ptr); <--- err handler? (1)
		/* release the midi resources */
		list_for_each(p, &usX2Y->chip.midi_list) {
			snd_usbmidi_disconnect(p, &snd_usX2Y_usb_driver);
		}
		if (usX2Y->us428ctls_sharedmem)
			wake_up(&usX2Y->us428ctls_wait_queue_head);
		snd_card_free((snd_card_t*)ptr); <---- hang
	}
}
Quoted 3 lines
	/* wait, until all devices are ready for the free operation */
	wait_event(card->shutdown_sleep, card->files == NULL); <--- hang

PEOPLE, i know its common unix behaviour not to remove busy drivers with files open,
but You cant just hang the whole usb-system and modprobe then with an infinite signal wait.

the driver *must not* enter the disconnection it must signal modprobe / hotplug to print a "busy" message and return.

y
tom

-------------------------------------------------------
SF.Net email is sponsored by: Discover Easy Linux Migration Strategies from IBM. Find simple to follow Roadmaps, straightforward articles, informative Webcasts and more! Get everything you need to get up to speed, fast. http://ads.osdn.com/?ad_id=7477&alloc_id=16492&op=click

#3 lore raw
Quoted 7 lines · thomas schorpp
Quoted 5 lines · thomas schorpp
Quoted 2 lines · thomas schorpp

hello,

Quoted 7 lines
Quoted 7 lines
Quoted 7 lines

this bug is in conjunction with the older
"usb disconnect hangs keyboard" bug on lkml.

module-init-tools / hotplug hangs with snd-usb-audio if i switch/remove usb camera as stated above, if a client like kmix is attached. (strange, since this device has no mixers here).

sorry wrong driver, done this:

Aug  1 13:11:18 tom1 kernel: usb 1-2: USB disconnect, address 22
Aug  1 13:11:18 tom1 kernel: ALSA sound/usb/usbaudio.c:3275:
snd_usb_audio_disconnect
Aug  1 13:11:18 tom1 kernel: ALSA sound/usb/usbaudio.c:3284: 1
Aug  1 13:11:18 tom1 kernel: ALSA sound/usb/usbaudio.c:3289: 2
Aug  1 13:11:18 tom1 kernel: ALSA sound/usb/usbaudio.c:3296: free

... kill kmix ...

Aug  1 13:12:51 tom1 kernel: ALSA sound/usb/usbaudio.c:3301: freed
Aug  1 13:12:52 tom1 kernel: usb 1-2: new full speed USB device using
uhci_hcd and address 23
Aug  1 13:12:52 tom1 kernel: scsi9 : SCSI emulation for USB Mass Storage

devices

static void snd_usb_audio_disconnect(struct usb_device *dev, void *ptr)

{
	snd_usb_audio_t *chip;
	snd_card_t *card;
	struct list_head *p;

	if (ptr == (void *)-1L)
		return;
	
	snd_printk(KERN_ERR "snd_usb_audio_disconnect\n");

	chip = ptr;
	card = chip->card;
	down(&register_mutex);
	chip->shutdown = 1;
	chip->num_interfaces--;
	if (chip->num_interfaces <= 0) {
		snd_card_disconnect(card);
	snd_printk(KERN_ERR "1\n");
		/* release the pcm resources */
		list_for_each(p, &chip->pcm_list) {
			snd_usb_stream_disconnect(p, &usb_audio_driver);
		}
	snd_printk(KERN_ERR "2\n");
		/* release the midi resources */
		list_for_each(p, &chip->midi_list) {
			snd_usbmidi_disconnect(p, &usb_audio_driver);
		}
		usb_chip[chip->index] = NULL;
		up(&register_mutex);
	snd_printk(KERN_ERR "free\n");
		snd_card_free(card); <----- HANGS HERE
	} else {
		up(&register_mutex);
	}
	snd_printk(KERN_ERR "freed\n");

-------------------------------------------------------
SF.Net email is sponsored by: Discover Easy Linux Migration Strategies from IBM. Find simple to follow Roadmaps, straightforward articles, informative Webcasts and more! Get everything you need to get up to speed, fast. http://ads.osdn.com/?ad_id=7477&alloc_id=16492&op=click