Stop specific device from waking computer

Hello everyone, I’m looking to see if there’s a way to stop a specific device from waking the computer from a sleep state. I have a problematic device that will immediately wake the computer after being put to sleep. I’ve googled and googled and couldn’t find any answers. Does anyone know if this is even possible in Linux?

Welcome to the forum! :wave:

Please include the name of the device in the post so people don’t have to click an Amazon link for no reason.

Please see:

Just removed it, not trying to promote it. It’s a multimedia device but my question goes for any problematic USB device.

You can issue the name of the device to /proc/acpi/wakeup
Example of the file:

[mbb@mbb-laptop ~]$ cat /proc/acpi/wakeup 
Device  S-state   Status   Sysfs node
LANC      S0    *disabled  pci:0000:00:19.0
EHC1      S0    *disabled  pci:0000:00:1d.0
EHC2      S0    *disabled  pci:0000:00:1a.0
XHC       S0    *disabled  pci:0000:00:14.0
PCIB      S5    *disabled
RP02      S4    *disabled
ECF0      S4    *disabled
RP03      S4    *enabled   pci:0000:00:1c.2
RP04      S5    *enabled   pci:0000:00:1c.3
WNIC      S5    *disabled  pci:0000:03:00.0
RP06      S0    *disabled
NIC       S0    *disabled
RP07      S4    *disabled
RP08      S0    *disabled
HST1      S5    *disabled

Example of e script disabling wakeup events:

[mbb@mbb-laptop ~]$ cat .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

Example of a service triggering the script at startup:

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

Note 1: you should make sure the computer effectively enter sleep state and then wakes up by that specific device. Because if the computer doesn’t even enter sleep state, then there’s a different problem.

Note 2: if this is a device you connect/disconnect, maybe a udev rule upon connection would be more appropriate to run the script.

This worked like a charm!!! Thanks so much!

1 Like

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.