You are not logged in.

#1 2021-02-03 13:11:38

raphaelabb
Member
From: France
Registered: 2021-02-03
Posts: 31

[SOLVED] Suspend_Wakeup /proc/acpi/wakeup file

Hello,

One of the issues I encountered while installing Arch was to get the suspend mode work. It would not stay in suspend mode and would wake up immediately. It turned out it was the USB devices that would prevent the system from staying suspended.
I easily found information about the issue and solved it, but I don't fully understand what I did.

The solution was to change the XHC line to *disabled in the /proc/acpi/wakeup file. And since the change won't stay after a reboot, I created a no_usb_wakeup.service file in /etc/systemd/system/ with these contents and enable the service:

[Unit]
Description=no_usb_wakeup

[Service]
ExecStart=/bin/bash -c "echo XHC >> /proc/acpi/wakeup"

[Install]
WantedBy=multi-user.target

It does the job well, but it seems like tinkering to me.
What creates this /proc/acpi/wakeup file?
And is there a way to definitely disable XHC wakeup, instead of creating a service?

Last edited by raphaelabb (2021-02-05 15:51:36)

Offline

#2 2021-02-03 18:34:29

Ropid
Member
Registered: 2015-03-09
Posts: 1,069

Re: [SOLVED] Suspend_Wakeup /proc/acpi/wakeup file

This isn't an unusual problem. I had this with different PC motherboards. I also had this problem on Windows 7 and 8, not just Linux. I had to hunt down a check box somewhere in the Windows device manager to make the mouse not wake the PC.

It seems for many people their motherboard has a setting for the problem in the UEFI/BIOS menus. The setting controls if USB devices can wake the PC out of suspend or not. This didn't work for me so I ended up with the same solution as you. My systemd service looks like this if you are interested:

# /etc/systemd/system/disable-usb-wakeup.service
[Unit]
Description=Disable USB controllers in /proc/acpi/wakeup

[Service]
Type=oneshot
ExecStart=bash -c '\
    while read -r device _ status _; do \
        [[ $device == +([EX]HC*|USB*|PS2*) && $status == "*enabled" ]] && \
            echo $device > /proc/acpi/wakeup; \
    done < /proc/acpi/wakeup; \
    true \
'

[Install]
WantedBy=multi-user.target

The bash script in there reads through all /proc/acpi/wakeup lines and looks for names "EHC*", "XHC*", "USB*", "PS2*" that are 'enabled'. I got the "EHC" name from an old motherboard, the "PS2" name is from using a PS/2 keyboard, and the "USB" name came from a laptop.

There's also a different way to disable things through files named "wakeup" in /sys. Here's an example about that from my old motherboard where I used a file in /etc/tmpfiles.d/ to deal with the problem:

$ cat /etc/tmpfiles.d/acpi-wakeup.conf~ 
#Type  Path  Mode  UID  GID  Age  Argument
w /sys/bus/usb/devices/usb1/power/wakeup - - - - disabled
w /sys/bus/usb/devices/usb2/power/wakeup - - - - disabled
w /sys/bus/usb/devices/usb3/power/wakeup - - - - disabled
w /sys/bus/usb/devices/usb4/power/wakeup - - - - disabled
w /sys/bus/usb/devices/usb5/power/wakeup - - - - disabled
w /sys/bus/usb/devices/usb6/power/wakeup - - - - disabled

I had to do this with tmpfiles.d on that old motherboard because the file /proc/acpi/wakeup had several entries with the exact same name. Writing into /proc/acpi/wakeup then only disabled one of the devices. You couldn't change the other ones. That's why I had to hunt down the wakeup entries in /sys instead.

Offline

#3 2021-02-04 10:20:43

raphaelabb
Member
From: France
Registered: 2021-02-03
Posts: 31

Re: [SOLVED] Suspend_Wakeup /proc/acpi/wakeup file

I checked my UEFI, everything related to devices wakeup is on disabled.

Thanks for the /etc/tmpfiles.d/acpi-wakeup.conf tip. I won' t go messing inside /sys though, as long as my no_usb_wakeup.service works, but it may be useful to those who'd need to disable wakeup on several devices.

Offline

Board footer

Powered by FluxBB