USB devices "wakeup" reset to "disabled" on every boot

Hi,

I was trying to set the ability of my USB Devices to wake my laptop from suspend.
I actually figured out how to do it (echo enabled > /sys/bus/usb/devices/3-2.1/power/wakeup, this device is my USB Hub). It worked nicely until I restared my laptop. I then checked the state of this device, and he goes from “enabled” to “disabled”. I’m not sure it’s because I did reboot, or because I unplugged my laptop…

How could I keep the state of my device persistent ?
Thanks for the help.

How to increase your chances of solving your issue:

Please provide Information:

you can add a script to the autostart that does it for you at each boot or you can define a udev-rule.

You can create a systemd service. For example,

Service file:

[mbb@mbb-laptop ~]$ cat /etc/systemd/system/wakeup-events.service 
[Unit]
Description=Disable wakeup events on startup

[Service]
Type=oneshot
ExecStart=/bin/bash /home/mbb/.bin/wakeup-events.sh

[Install]
WantedBy=multi-user.target

Script file:

[mbb@mbb-laptop ~]$ cat /home/mbb/.bin/wakeup-events.sh
#!/bin/bash
# Disable wakeup events
echo LANC > /proc/acpi/wakeup
echo EHC1 > /proc/acpi/wakeup
echo EHC2 > /proc/acpi/wakeup
echo " XHC" > /proc/acpi/wakeup

Then activate the service with sudo systemctl enable --now wakeup-events

Note that, if the state of wakeup events is already as you want in the session where you enable the service, you should omit --now, otherwise the script will revert the event states (for that session only).