How I fixed xHCI host controller not responding, assume dead

Problem:

In Linux, my USB 3.0 hub randomly kept resetting and only recovered after a reboot: All USB devices were offline until I manually rebooted the system. This is the dmesg output:

[ 3685.684555] xhci_hcd 0000:04:00.0: Abort failed to stop command ring: -110
[ 3685.716572] xhci_hcd 0000:04:00.0: Host halt failed, -110
[ 3685.716575] xhci_hcd 0000:04:00.0: xHCI host controller not responding, assume dead
[ 3685.716620] xhci_hcd 0000:04:00.0: HC died; cleaning up
[ 3685.716653] xhci_hcd 0000:04:00.0: Timeout while waiting for setup device command
[ 3685.716820] usb 3-2: USB disconnect, device number 3
[ 3685.716942] usb 4-2: USB disconnect, device number 2
[ 3685.716944] usb 4-2.4: USB disconnect, device number 3
[ 3686.268612] usb 3-2.3: device not accepting address 29, error -22
[ 3686.268694] usb 3-2.3: USB disconnect, device number 29
[ 3686.269109] usb 3-2.4: USB disconnect, device number 4
[ 3686.269114] usb 3-2.4.1: USB disconnect, device number 5
[ 3686.345109] usb 3-2.4.2: USB disconnect, device number 9
[ 3686.573230] usb 3-2.4.3: USB disconnect, device number 7
[ 3686.701272] usb 3-2.4.4: USB disconnect, device number 8

Solution:

I discovered the solution (which basically restarts the xHCI USB device) on the ArchLinux forums:

echo -n "0000:04:00.0" > /sys/bus/pci/drivers/xhci_hcd/unbind
echo -n "0000:04:00.0" > /sys/bus/pci/drivers/xhci_hcd/bind

You need to insert your device ID which you can find in the dmesg output (0000:04:00.0 in my case) and run the code as root.