case "${1}" in hibernate|suspend)
echo -n '' > $TMPLIST
for i in `ls /sys/bus/pci/drivers/xhci_hcd/ | egrep '[0-9a-z]+\:[0-9a-z]+\:.*$'`; do
# Unbind xhci_hcd for first device XXXX:XX:XX.X:
echo -n "$i" | tee /sys/bus/pci/drivers/xhci_hcd/unbind
echo "$i" >> $TMPLIST
done
;; resume|thaw)
for i in `cat $TMPLIST`; do
# Bind xhci_hcd for first device XXXX:XX:XX.X:
echo -n "$i" | tee /sys/bus/pci/drivers/xhci_hcd/bind
done
rm $TMPLIST
;;
esac
I didn't need to create the /etc/pm/sleep.d/05_xhci file as suggested by @Gabou, nor did I need to do anything with /etc/modprobe.d/blacklist-xhci_hcd.conf or /etc/pm/config.d/unload_module, as suggested by @Martin. In fact, these three files don't exist on my machine.
For other laptops that have ehci_hcd devices which cause suspend problems, I think this script will work by simply replacing xhci_hcd with ehci_hcd, although this isn't directly relevant to this bug report.
This works even with two usb devices plugged into the ports when I suspend and then resume -- the devices work and don't need to be plugged in or out.
I have a Lenovo Thinkpad W510, and the following works flawlessly for me:
1) As root/sudo, create /etc/pm/ sleep.d/ 20_custom- xhci_hcd with the following contents:
#!/bin/sh sleep.d/ 20_custom- xhci_hcd" . /tmp/xhci- dev-list
# File: "/etc/pm/
TMPLIST=
case "${1}" in
hibernate| suspend) pci/drivers/ xhci_hcd/ | egrep '[0-9a- z]+\:[0- 9a-z]+\ :.*$'`; do pci/drivers/ xhci_hcd/ unbind
resume| thaw) pci/drivers/ xhci_hcd/ bind
echo -n '' > $TMPLIST
for i in `ls /sys/bus/
# Unbind xhci_hcd for first device XXXX:XX:XX.X:
echo -n "$i" | tee /sys/bus/
echo "$i" >> $TMPLIST
done
;;
for i in `cat $TMPLIST`; do
# Bind xhci_hcd for first device XXXX:XX:XX.X:
echo -n "$i" | tee /sys/bus/
done
rm $TMPLIST
;;
esac
2) sudo chmod 755 /etc/pm/ sleep.d/ 20_custom- xhci_hcd
I didn't need to create the /etc/pm/ sleep.d/ 05_xhci file as suggested by @Gabou, nor did I need to do anything with /etc/modprobe. d/blacklist- xhci_hcd. conf or /etc/pm/ config. d/unload_ module, as suggested by @Martin. In fact, these three files don't exist on my machine.
For other laptops that have ehci_hcd devices which cause suspend problems, I think this script will work by simply replacing xhci_hcd with ehci_hcd, although this isn't directly relevant to this bug report.
This works even with two usb devices plugged into the ports when I suspend and then resume -- the devices work and don't need to be plugged in or out.