Restart USB ports after a power overdraw (error -110). Unplug all devices prior to running script.
All USB ports
for port in $(lspci | grep USB | cut -d' ' -f1); do
echo -n "0000:${port}"| sudo tee /sys/bus/pci/drivers/xhci_hcd/unbind;
sleep 5;
echo -n "0000:${port}" | sudo tee /sys/bus/pci/drivers/xhci_hcd/bind;
sleep 5;
done
USB 3.1 Only
for port in $(lspci | grep xHCI | cut -d' ' -f1); do
echo -n "0000:${port}"| sudo tee /sys/bus/pci/drivers/xhci_hcd/unbind;
sleep 5;
echo -n "0000:${port}" | sudo tee /sys/bus/pci/drivers/xhci_hcd/bind;
sleep 5;
done
References:
[1] : https://gist.github.com/planetceres/917840478e1e4d45f8373667630e51a0
[2] : https://davidjb.com/blog/2012/06/restartreset-usb-in-ubuntu-12-04-without-rebooting/
[3] : https://ubuntuforums.org/showthread.php?t=1460790&p=9162799#post9162799