I meant to avoid my laptop waking immediately after suspend.
I managed to do so as shown here.
The contents of the script disable_devices_from_wakeup.sh
I am using is
#!/bin/bash
declare -a devices=(EHC1 EHC3 OHC1 OHC3)
for device in "${devices[@]}" ; do
sudo sh -c "echo $device > /proc/acpi/wakeup"
done
Now I wanted to make my changes permanent across bootings. So I setup a service as described here and here. The service put together is
$ cat /etc/systemd/system/wakeup_disable_devices.service
[Unit]
Description=Disable devices for wakeup, as a fix to prevent system from waking immediately after suspend
[Service]
ExecStart=/home/user1/Documents/soft-hard-ware/linux-ubuntu/disable_devices_from_wakeup.sh
#ExecStart=/bin/sh -c '/bin/echo EHC1 > /proc/acpi/wakeup'
Type=oneshot
RemainAfterExit=yes
[Install]
WantedBy=multi-user.target
But upon rebooting, the devices are still enabled for wakeup. The service is not running as (I guess) it should:
$ systemctl status wakeup_disable_devices.service
wakeup_disable_devices.service - Disable devices for wakeup, as a fix to prevent system from waking immediately after suspend
Loaded: loaded (/etc/systemd/system/wakeup_disable_devices.service; disabled; vendor preset: enabled)
Active: inactive (dead)
I am not sure how to proceed to make the changes permanent, and to have them automatically applied.
I don't know if the problem stems from the sudo
in my script, and/or else.
I also tried the service with the commented line instead, and it doesn't work either, since cat /proc/acpi/wakeup
still shows EHC1
as enabled
.
Related:
- https://askubuntu.com/questions/252743/how-do-i-prevent-mouse-movement-from-waking-up-a-suspended-computer
- https://askubuntu.com/questions/152403/how-do-i-make-changes-to-proc-acpi-wakeup-permanent
- Make changes to `/proc/acpi/wakeup` permanent
- https://answerbun.com/
- https://mitjafelicijan.com/disable-mouse-wake-from-suspend-with-systemd-service.html