- Published on
Prevent Spurious Wakeup from Suspend
- Authors
- Name
- Martin Andrews
- @mdda123
Check whether USB events might be causing the wakeup
If EHC1
, EHC1
or XHC
(USB3) are shown as enabled, then it's possible that a USB device might be the culprit :
grep enabled /proc/acpi/wakeup
#PXSX S4 *enabled pci:0000:03:00.0
#EHC1 S4 *enabled pci:0000:00:1d.0
#EHC2 S4 *enabled pci:0000:00:1a.0
#XHC S4 *enabled pci:0000:00:14.0
#PWRB S3 *enabled platform:PNP0C0C:00
One can disable specific device-types using the following script :
# parse wakeup and disable wakeup for ARPT(wifi) and XHC1(usb)
cat /proc/acpi/wakeup | tail -n +2 | awk ‘{print $1,$3}’ | while read ss st;
do
if [ $ss = “ARPT” ] || [ $ss = “XHC1” ]; then
if [ $st = “*enabled” ]; then
echo $ss > /proc/acpi/wakeup
fi
fi
However, this is a blunt tool if a single USB device is causing the problem.
Track down the mouse...
First, get an idea of which strings/devices you should be searching for :
cat /sys/bus/usb/devices/*/product
Now, specify that you need the 'mouse' device id:
grep -i "mouse" /sys/bus/usb/devices/*/product
#/sys/bus/usb/devices/3-12/product:2.4G Keyboard Mouse
Use the device id found to disable the power wakeup (just once) :
echo "disabled" > /sys/bus/usb/devices/3-12/power/wakeup
Test the resume-from-suspend cycle is no longer triggered by the mouse...
Make the change permanent...
Shout-out : The following comes from reading all the advice on this page.
Put the one-liner above in a (probably new) file /etc/rc.d/rc.local
with a bash
invocation :
#!/bin/bash
echo "disabled" > /sys/bus/usb/devices/3-12/power/wakeup
And then make it executable, and usable by systemd
:
chmod +x /etc/rc.d/rc.local
restorecon -v /etc/rc.d/rc.local
systemctl enable rc-local.service
systemctl start rc-local.service
Check that the rc-local.service
does exist (though it appears to be defined internally, rather than through a .service
file like many other services) :
systemctl status rc-local.service
All done.