PureOS wakes up after a few seconds of suspend


#1

I have had the issue recently that when I suspend the Librem 15v3 (either by pressing the suspend button in the taskbar or by closing the lid), it will automatically wake up after 2 to 5 seconds without any keyboard or mouse click. Worse, sometimes it would freeze and I would have to reboot to be able to use the laptop again.

After some research on the internet, the root cause seems to be some components waking up the laptop.
cat /proc/acpi/wakeup
showed that XHCI device was enabled.
Disabling it with
echo XHCI | sudo tee /proc/acpi/wakeup
solved the automatic wake up and potential freezing issues.

Where I am stuck is that after rebooting the laptop, the XHCI device is enabled again. So I have to disable it manually through the command line above after every reboot.

Can someone explain the steps to disable a device permanently?

Thanks in advance


#2

I found the solution in these 2 posts:

https://bbs.archlinux.org/viewtopic.php?pid=1575617#p1575617

https://www.reddit.com/r/archlinux/comments/3zxg65/how_to_permanently_change_procacpiwakeup_or/

I created a file disable-USB-wakeup.service in /etc/systemd/system containing

[Unit]
Description=Disable USB wakeup triggers in /proc/acpi/wakeup

[Service]
Type=oneshot
ExecStart=/bin/sh -c “echo XHCI > /proc/acpi/wakeup”
RemainAfterExit=yes

[Install]
WantedBy=multi-user.target

Then I did

sudo systemctl daemon-reload

Then

sudo systemctl start disable-USB-wakeup.service

Checked on it with

systemctl status disable-USB-wakeup.service

Then enabled it so it starts after boot with

sudo systemctl enable disable-USB-wakeup.service


#3

Just check on power optimisation quite a few people had trouble with it.