1

Whenever I wake my machine from sleep, my USB audio interface is not recognized anymore. It works again as expected after un- and re-plugging the cable, or after a reboot. But obviously it's annoying to do that several times a day.

usbreset is not an option because the device does not show up in lsusb. I tried adding a kernel parameter to prevent the system from disabling USB before sleep, but somehow I'm unable to update the GRUB config. When I run sudo grub-mkconfig -o /boot/grub/grub.cfg I get this output:

[lenny@archlinux ~]$ sudo grub-mkconfig -o /boot/grub/grub.cfg 
[sudo] password for lenny: 
insmod: ERROR: could not load module part_gpt: No such file or directory

I also tried to check whether there is an option in the UEFI that disables USB ports during sleep but I was unable to find anything. I use a Gigabyte B550 Aorus PRO (v2 if I'm not mistaken).

Any ideas on how to troubleshoot this?

Edit: Here is my output of lsusb:

[meekah@archlinux ~]$ lsusb -t
/:  Bus 001.Port 001: Dev 001, Class=root_hub, Driver=xhci_hcd/10p, 480M
    |__ Port 006: Dev 002, If 0, Class=Hub, Driver=hub/4p, 480M
        |__ Port 001: Dev 004, If 0, Class=Human Interface Device, Driver=usbhid, 12M
        |__ Port 001: Dev 004, If 1, Class=Human Interface Device, Driver=usbhid, 12M
        |__ Port 003: Dev 006, If 0, Class=Human Interface Device, Driver=usbhid, 12M
        |__ Port 003: Dev 006, If 1, Class=Human Interface Device, Driver=usbhid, 12M
        |__ Port 003: Dev 006, If 2, Class=Human Interface Device, Driver=usbhid, 12M
        |__ Port 004: Dev 008, If 0, Class=Audio, Driver=snd-usb-audio, 480M
        |__ Port 004: Dev 008, If 1, Class=Audio, Driver=snd-usb-audio, 480M
        |__ Port 004: Dev 008, If 2, Class=Audio, Driver=snd-usb-audio, 480M
        |__ Port 004: Dev 008, If 3, Class=Application Specific Interface, Driver=[none], 480M
    |__ Port 007: Dev 003, If 0, Class=Human Interface Device, Driver=usbhid, 12M
    |__ Port 010: Dev 005, If 0, Class=Hub, Driver=hub/4p, 480M
        |__ Port 001: Dev 007, If 0, Class=Vendor Specific Class, Driver=xone-dongle, 480M
/:  Bus 002.Port 001: Dev 001, Class=root_hub, Driver=xhci_hcd/4p, 10000M
/:  Bus 003.Port 001: Dev 001, Class=root_hub, Driver=xhci_hcd/4p, 480M
/:  Bus 004.Port 001: Dev 001, Class=root_hub, Driver=xhci_hcd/4p, 10000M
[meekah@archlinux ~]$ lsusb
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 001 Device 002: ID 05e3:0608 Genesys Logic, Inc. Hub
Bus 001 Device 003: ID 048d:5702 Integrated Technology Express, Inc. RGB LED Controller
Bus 001 Device 004: ID 0c45:7016 Microdia USB DEVICE
Bus 001 Device 005: ID 05e3:0608 Genesys Logic, Inc. Hub
Bus 001 Device 006: ID 04d9:a067 Holtek Semiconductor, Inc. USB Gaming Mouse
Bus 001 Device 007: ID 045e:02fe Microsoft Corp. XBOX ACC
Bus 001 Device 008: ID 1397:0507 BEHRINGER International GmbH UMC202HD 192k
Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 003 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 004 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
[meekah@archlinux ~]$ 

As you can see, my audio interface is on bus 1, as is my keyboard and mouse. But, after running the following command, the devices do not properly turn on again:

sudo sh -c 'echo 0 > /sys/bus/usb/devices/usb1/bConfigurationValue; sleep 2; echo 0 > /sys/bus/usb/devices/usb1/bConfigurationValue'

I tried making the sleep longer, but that only resulted in the LEDs of my keyboard turning back on after, even though it did not actually work. After replugging the keyboard, it still does not work. It seems to me like the USB controller does not properly turn on again.

Edit 2: I managed to get grub working again (anyone stumbling upon this, it looks like my /etc/default/grub contents were replaced with the contents of /boot/grub/grub.cfg. I'm not entirely sure that was the issue, I just reinstalled grub using pacman) and added a linux kernel parameter: usbcore.autosuspend=-1, but after sleep my audio interface is still gone.

Edit 3: I also noticed that a restart does not fix this issue. Only powering down the system and booting completely from scratch or replugging fixes it.

Edit 4: Now I had my machine sleep over night, and now the audio interface was properly recognized after waking. Just to try it out I put it to sleep again and woke it after a few seconds, and the audio interface was gone again.

Edit 5: After tonight's sleep, it did not recognize the audio interface. This time I put my machine into sleep manually, I'm not sure if it was automatically last time.

1
  • Sadly, that solution won't work for me, I think. It says to write 0 and then 1 to /sys/bus/usb/devices/2-1/authorized, but I don't see any directories in usb, just a few files named hiddev0, hiddev1 and hiddev2. Also, usbreset seems to be unable to reset hubs.
    – lenny
    Commented Apr 26 at 13:30

2 Answers 2

4

So what that absence from lsubs suggests is that even the basic enumeration does not happen or fails; there's potential two culprits here:

  1. The USB device's firmware simply doesn't handle suspend correctly, crashes, and needs to be power-cycled
  2. The USB host controller's firmware simply doesn't properly re-enumerate after suspend

For the 1. case, I don't realistically see much chances of remedy other than unplugging, replugging, unless it's on the (rather rare case) of a USB hub port that can (and does) actually remove power, and that happens as side effect of the solution to the 2. case

The second case: You need to figure out which bus your USB device is on; this sadly isn't static, but in most cases the number stays the same across boots and suspends (hotplugging PCIe hardware nonwithstanding), so you can run lsusb -t while the device still works to figure out which bus it's on.

You then sudo sh -c 'echo 0 > /sys/bus/usb/devices/usb{number of the bus}/bConfigurationValue; sleep 2; echo 0 > /sys/bus/usb/devices/usb{number of the bus}/bConfigurationValue' to turn off that bus segment and turn it back on after two seconds. (I tend to do this in one command, simply because if I turn off the bus with my keyboard on it, that automatically turns it back on.). This would cause re-enumeration of the USB bus segment.

1
  • Yeah, that seems to align with what I managed to find out as well. Sadly your suggestion did not work, but I added an edit with what happened so maybe you have another idea 😅
    – lenny
    Commented Apr 27 at 1:06
3

With the uhubctl command, you may be able to power-cycle a particular port in a USB hub. The command might be available in your distribution's package manager; if not, you can find the source code in Github.

The Github page linked above also includes some tips on use and answers to Frequently Asked Questions, so you might want to read it even if you find you can install the command using your distribution's package manager.

1
  • sadly my motherboard does not seem to support this, when I run sudo uhubctl it says No compatible devices detected!
    – lenny
    Commented Apr 28 at 8:45

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .