On Fri, 21 Apr 2023 17:16:59 +0200, Chris Down wrote:
Takashi Iwai writes:
Hrm, is "usb 3-7.1.4" really the USB audio device? The previous errors like "Unable to submit urb #2..." are certainly for USB audio, and those are with "usb 3-7.4".
There are two USB audio devices -- 3-7.1.4 is input, 3-7.4 is output.
% dmesg --notime | grep -e 'usb 3-7.4' -e 'usb 3-7.1.4' | grep Product: | sort | uniq usb 3-7.1.4: Product: USB2.0 Microphone usb 3-7.4: Product: USB Audio Device
Ah I see. Then those are two different sound cards?
The repeated call of usb_set_interface() might be avoided by the additional check like below. But it's still puzzling how it happens, because the only caller of endpoint_set_interface() you modified is snd_usb_endpoint_prepare(), and it's called only from snd_usb_pcm_prepare(). And, snd_usb_pcm_preapre() has the snd_usb_lock_shutdown() call, which does the check of the card->shutdown flag that should be set by the USB disconnection callback...
thanks,
Takashi
-- 8< -- --- a/sound/usb/endpoint.c +++ b/sound/usb/endpoint.c @@ -911,6 +911,9 @@ static int endpoint_set_interface(struct snd_usb_audio *chip,
if (ep->iface_ref->altset == altset) return 0; + /* already disconnected? */ + if (unlikely(atomic_read(&chip->shutdown))) + return -ENODEV;
usb_audio_dbg(chip, "Setting usb interface %d:%d for EP 0x%x\n", ep->iface, altset, ep->ep_num);