giovedì 18 luglio 2013

Ubuntu 12.04, USB3 and Suspend

The only BIG problem I have on my Dell Vostro 3550 laptop with Ubuntu (I use only LTS version, so I'm still stuck with 12.04) is with USB3 ports.

By looking deeper to some details of the problem I've found that USB devices connected on USB3 does not work (they are not even detected) only after resuming from suspend.. and my laptop is always suspend and never shutdown!

I've googled around and found this interesting topic in askubuntu.com which, itself, links to this solution, regarding Asus K52 / Asus A52.

I adapt the suspend/resume script to my laptop as follows:

root@kimbamon:~# cat /etc/pm/sleep.d/20_dell_vostro_usb3_suspend
case "${1}" in
        hibernate|suspend)
              # Switch USB3 bus off
              echo -n "0000:0b:00.0" > /sys/bus/pci/drivers/xhci_hcd/unbind
        ;;
        resume|thaw)
              # Switch USB3 buses on
              echo -n "0000:0b:00.0" > /sys/bus/pci/drivers/xhci_hcd/bind
        ;;
esac

After editing the file with your favorite editor, don't forget  to make it executable

chmod +x /etc/pm/sleep.d/dell_vostro_usb3_suspend

As far as I test it, this solve my USB3 issue and now USB3 peripheral works even after resuming from suspend

Please note that, in case you need it, you can also run the script manually (as root, of course) to simulate a suspend/resume sequence and, thus, reset the USB3 bus