Views:
1,732
Votes: 2
Tags:
suspend
19.10
Link:
🔍 See Original Answer on Ask Ubuntu ⧉ 🔗
URL:
https://askubuntu.com/q/1191112
Title:
Since 19.10 update, mouse movement wakes computer from sleep
ID:
/2019/11/23/Since-19.10-update_-mouse-movement-wakes-computer-from-sleep
Created:
November 23, 2019
Upload:
September 15, 2024
Layout: post
TOC:
false
Navigation: false
Copy to clipboard: false
Power off USB devices when suspending
My suspend/resume broke about a year ago. The solution for me was powering off the USB devices before going to sleep and powering them on with resume.
In the directory /lib/systemd/system-sleep
create this script:
#!/bin/bash
# Original script was using /bin/sh but shellcheck reporting warnings.
# NAME: custom-xhci_hcd
# PATH: /lib/systemd/system-sleep
# CALL: Called from SystemD automatically
# DESC: Suspend broken for USB3.0 as of Oct 25/2018 various kernels all at once
# DATE: Oct 28 2018.
# NOTE: From comment #61 at: https://bugs.launchpad.net/ubuntu/+source/linux/+bug/522998
TMPLIST=/tmp/xhci-dev-list
# Original script was: case "${1}" in hibernate|suspend)
case $1/$2 in
pre/*)
echo "$0: Going to $2..."
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
;;
post/*)
echo "$0: Waking up from $2..."
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
Mark the script executable with chmod a+x /lib/systemd/system-sleep/custom-xhci_hcd
Reboot.
Confirm script is working with journalctl -b-0 | grep custom-xhci_hcd
:
Nov 12 14:06:27 alien systemd-sleep[20174]: /lib/systemd/system-sleep/custom-xhci_hcd: Going to suspend...
Nov 12 17:22:19 alien systemd-sleep[20174]: /lib/systemd/system-sleep/custom-xhci_hcd: Waking up from suspend...
(... SNIP ...)
Nov 22 22:28:06 alien systemd-sleep[24432]: /lib/systemd/system-sleep/custom-xhci_hcd: Going to suspend...
Nov 23 08:16:15 alien systemd-sleep[24432]: /lib/systemd/system-sleep/custom-xhci_hcd: Waking up from suspend...