How to refresh or restart USB audio interface without unplugging the USB cable on Linux

This is not an Ardour problem, but maybe someone here can help.

I have an Mbox 2 USB audio interface and after I wake my computer from sleep, the input of the USB interface is not responding and appears as it has 100% signal.

Audacity screenshot:
2021-09-10_14-36-56

Pavucontrol screenshot:

I can’t get any real signal in using Ardour or any other software.
However I can still play audio, so output works but not input.

However, if I unplug and plug in again the USB cable, the input starts working normally again.

I recently installed Pipewire 0.3.34 but the issue persists.

OS: Ubuntu 20.04.3 LTS x86_64
Kernel: 5.4.0-81-lowlatency

Outpuf of dmesg after plugging in the USB device:

[lun sep  6 18:10:22 2021] usb 1-9: new full-speed USB device number 8 using xhci_hcd
[lun sep  6 18:10:22 2021] usb 1-9: config 1 interface 2 has no altsetting 1
[lun sep  6 18:10:22 2021] usb 1-9: config 1 interface 3 has no altsetting 1
[lun sep  6 18:10:22 2021] usb 1-9: config 1 interface 4 has no altsetting 1
[lun sep  6 18:10:22 2021] usb 1-9: config 1 interface 5 has no altsetting 1
[lun sep  6 18:10:22 2021] usb 1-9: New USB device found, idVendor=0dba, idProduct=3000, bcdDevice= 1.43
[lun sep  6 18:10:22 2021] usb 1-9: New USB device strings: Mfr=1, Product=2, SerialNumber=0
[lun sep  6 18:10:22 2021] usb 1-9: Product: Mbox 2 
[lun sep  6 18:10:22 2021] usb 1-9: Manufacturer: Digidesign
[lun sep  6 18:10:26 2021] usb 1-9: Digidesign Mbox 2: 24bit 48kHz

How can I debug this?
Which services could I restart to fix the issue?

My guess is that the mbox2 driver in the kernel does not correctly reinitialize the device.

Have you tried to restart pipewire? Ensure that the device is closed and re-opened again which may force a re-initialization.

check with

cd /tmp && wget https://community.ardour.org/files/adevices.sh && bash ./adevices.sh

(that will not modify your system; it lists all soundcards, their current settings and applications using them, etc).

Another thing to try is to unload/reload the snd_usb_audio kernel module.

Thanks @x42 !

Restarting PipeWire does not fix the issue, at least not when using:

systemctl --user restart pipewire.service pipewire-pulse.socket

I ran the ./adevices.sh script before and after computer sleep and it always outputs the same:

Card 1 (M2):
  * Playback Device 0 (USB Audio):
    - Subdevice 0 (hw:M2,0,0):
      closed

  * Recording Device 0 (USB Audio):
    - Subdevice 0 (hw:M2,0,0):
      closed

I was not able to unload the snd_usb_audio because of
modprobe: FATAL: Module snd_usb_audio is in use.

Maybe @zamaudio knows more about the issue?
According to this thread, he wrote the Linux drivers for the Mbox 2

To reset USB devices without unplugging/replugging them, you could use usbreset

1 Like

As Robin says this is likely a problem with the driver (kernel module), or possibly even related to the hardware/firmware of the sound card. Restarting higher level services is unlikely to help.

You should contact the driver developer to try to get the problem fixed (if it’s fixable on that side).

Meanwhile, as tentative workarounds, you may try to use “usbreset” as suggested by groundsquirrel. If that does not work you may try to unload and then reload the related kernel modules (e.g., snd-usb-audio, etc), or a combination of both things.

Even that is not guaranteed to work, though: the sound card hardware/firmware may be in a state which requires an actual power-cycle to get back to work properly. If that’s the case, your only option is to avoid your system to go into sleep mode. The fact that the card is not completely unresponding and it’s partly working is a good sign, though.

P.S.: in Debian and Ubuntu (and likely other distro as well), the “usbreset” command is included in the “usbutils” package (thus no need to build it yourself from sources). If it’s not already done, just install that package (e.g., apt install usbutils).

1 Like

Great responses, usbreset works!
The input is now working normally (not at 100%).

However, now I would have to turn off my speakers before running the command.
If I don’t, I get a loud noise, just like what happens when I plug/unplug the devise.
I don’t know what this sound is called or if it has a particular name.

This is a step in the right direction, I contacted the developer of the Mbox drivers, but no response yet.
I wanted to pay him (or someone else) to fix the issue of the drivers, if possible.