Documenting this mainly for my own benefit, on rare occasions my laptop will not go to sleep (suspend nor hibernate) on Linux (Ubuntu). I hate rebooting, but before I hadn’t dug deep enough to see what the issue was.
This happened again the other day, so I did not reboot, just kept it running on my way home from work. Later I needed to use my USB printer, but nothing happened, not even lsusb showed the device (All I saw were the built-in USB hubs and root device).
The following fixed my issue:
# reseting USB2 ports
for i in $(ls /sys/bus/pci/drivers/ehci_hcd/|grep :)
do echo $i >/sys/bus/pci/drivers/ehci_hcd/unbind
echo $i >/sys/bus/pci/drivers/ehci_hcd/bind
# reseting USB3 ports (if there none you'll get errors)
for i in $(ls /sys/bus/pci/drivers/xhci_hcd/|grep :)
do echo $i >/sys/bus/pci/drivers/xhci_hcd/unbind
echo $i >/sys/bus/pci/drivers/xhci_hcd/bind